public static void SaveUser(Tbl_ClientMaster obj, HttpPostedFileBase doc) { string filepath = System.Configuration.ConfigurationManager.AppSettings["SaveFilePath"]; using (GSTDB db = new GSTDB()) { obj.DOJ = DateTime.Now; db.Tbl_ClientMaster.Add(obj); db.SaveChanges(); if (doc != null && doc.ContentLength > 0) { var fileName = Path.GetFileName(doc.FileName); doc.SaveAs(Path.Combine(filepath, DateTime.Now.ToString("ddMMyyyy_" + obj.ClientID + ".jpg"))); } Tbl_LoginMaster loginObj = new Tbl_LoginMaster(); loginObj.Email = obj.Mail1; loginObj.UserName = (string.IsNullOrEmpty(obj.Mail1) ? obj.Mob1 : obj.Mail1); loginObj.Password = "******"; loginObj.IsClient = true; loginObj.CilientID = obj.ClientID; db.Tbl_LoginMaster.Add(loginObj); db.SaveChanges(); } }
public static void SaveReport(Tbl_ReportMaster reportobj, LineItem list) { try { List <LineItemListClass> lineList = new List <LineItemListClass>(); int rowcount = list.cgst.Length; for (int i = 0; i < rowcount; i++) { LineItemListClass Lineobj = new LineItemListClass() { itemname = list.itemname[i], hsn = list.hsn[i], uom = list.uom[i], qty = list.qty[i], rpu = list.rpu[i], tvalue = list.tvalue[i], rate = list.rate[i], igst = list.igst[i], sgst = list.sgst[i], cgst = list.cgst[i], utgst = list.utgst[i], total = list.total[i], cess = list.cess[i], }; lineList.Add(Lineobj); } reportobj.ItemInfo = Newtonsoft.Json.JsonConvert.SerializeObject(lineList); using (GSTDB db = new GSTDB()) { db.Tbl_ReportMaster.Add(reportobj); db.SaveChanges(); } } catch (Exception ex) { } }