protected void SaveAttachments(Int32 actRuleID) { if (gvAttachments.Rows.Count > 0) { if ((Session["FileDetail"].ToString() != "")) { string[] Records = Session["FileDetail"].ToString().Split('#'); byte[] fileContent; FileStream fs; BinaryReader br; for (int i = 0; i < Records.Length; i++) { string[] arrRecords = Records[i].Split(','); fs = new FileStream(arrRecords[2], FileMode.Open, FileAccess.Read); br = new BinaryReader(fs); fileContent = br.ReadBytes((int)fs.Length); br.Close(); fs.Close(); Econnect.EEMS.ActRulesAttachments objAttachment = new Econnect.EEMS.ActRulesAttachments(); objAttachment.ActRuleID = actRuleID; objAttachment.FileName = arrRecords[0].ToString(); objAttachment.FileFormat = arrRecords[3].ToString(); objAttachment.FileContent = fileContent; context.ActRuleAttachments.Add(objAttachment); context.SaveChanges(); } } } }
null
if(Session["FileDetail"] != null && Session["FileDetail"].ToString() != "")){...}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)