public ActionResult Edit_DataUser(Edit_UserMaster EA) { try { DataSet ds = _objCM.Edit_DataUser(EA); List<CommanMaster> Master = new List<CommanMaster>(); List<CommanUserMaster> Caption = new List<CommanUserMaster>(); if (ds.Tables[0].Rows.Count > 0) { ViewBag.fname = ds.Tables[0]; foreach (System.Data.DataRow dr in ViewBag.fname.Rows) { Master.Add(new CommanMaster { xmaster = @dr["xmaster"].ToString(), xname = @dr["xname"].ToString(), Corporate = @dr["Corporate"].ToString(), drpCaption = @dr["drpCaption"].ToString(), xlink = @dr["xlink"].ToString(), xcross = @dr["xcross"].ToString(), xcross1 = @dr["xcross1"].ToString(), xcross2 = @dr["xcross2"].ToString(), xcross3 = @dr["xcross3"].ToString(), xcross4 = @dr["xcross4"].ToString(), xreference1 = @dr["xreference1"].ToString(), xreference2 = @dr["xreference2"].ToString(), xreference3 = @dr["xreference3"].ToString(), xreference4 = @dr["xreference4"].ToString(), xreference5 = @dr["xreference5"].ToString(), xreference6 = @dr["xreference6"].ToString(), xdetail = @dr["xdetail"].ToString(), ENTRYCONTROL = @dr["ENTRYCONTROL"].ToString(), SEGMENT = @dr["SEGMENT"].ToString(), MultiSelect1 = @dr["MultiSelect1"].ToString(), MultiSelect2 = @dr["MultiSelect2"].ToString(), MultiSelect3 = @dr["MultiSelect3"].ToString(), MultiSelect4 = @dr["MultiSelect4"].ToString(), MultiSelect5 = @dr["MultiSelect5"].ToString() }); } } var result = Master; if (ds.Tables[1].Rows.Count > 0) { ViewBag.Caption = ds.Tables[1]; foreach (System.Data.DataRow dr in ViewBag.Caption.Rows) { Caption.Add(new CommanUserMaster { USrno = @dr["Srno"].ToString(), Uxmaster = @dr["Xmaster"].ToString(), Uxcode = @dr["Xcode"].ToString(), Uxname = @dr["Xname"].ToString(), UIsActive = @dr["Isactive"].ToString(), URemark = @dr["Remark"].ToString(), Uxlink = @dr["Xlink"].ToString(), Uxcross = @dr["Xcross"].ToString(), Uxcross1 = @dr["Xcross1"].ToString(), Uxcross2 = @dr["Xcross2"].ToString(), Uxcross3 = @dr["Xcross3"].ToString(), Uxcross4 = @dr["Xcross4"].ToString(), Uxreference1 = @dr["Xreference1"].ToString(), Uxreference2 = @dr["Xreference2"].ToString(), Uxreference3 = @dr["Xreference3"].ToString(), Uxreference4 = @dr["Xreference4"].ToString(), Uxreference5 = @dr["Xreference5"].ToString(), Uxreference6 = @dr["Xreference6"].ToString(), Uxdetail = @dr["Xdetail"].ToString(), UAttribute1 = @dr["Attribute1"].ToString(), UAttribute2 = @dr["Attribute2"].ToString(), UAttribute3 = @dr["Attribute3"].ToString(), UAttribute4 = @dr["Attribute4"].ToString(), UAttribute5 = @dr["Attribute5"].ToString(), UAttribute6 = @dr["Attribute6"].ToString(), UAttribute7 = @dr["Attribute7"].ToString(), UAttribute8 = @dr["Attribute8"].ToString(), UAttribute9 = @dr["Attribute9"].ToString(), UAttribute10 = @dr["Attribute10"].ToString(), //UUserId = @dr["Userid"].ToString(), //UCreatedBy = @dr["CreatedBy"].ToString(), //UEntryDatetime = @dr["EntryDatetime"].ToString(), //UEditedBy = @dr["EditedBy"].ToString(), //UEditDatetime = @dr["EditDatetime"].ToString(), //UCorpcentreBy = @dr["CorpcentreBy"].ToString(), //// UUnitCorpBy = @dr["UnitCorpBy "].ToString(), //// UTerminalBy = @dr["TerminalBy"].ToString(), //UBranchBy = @dr["BranchBy"].ToString(), URating1 = @dr["Rating1"].ToString(), URating2 = @dr["Rating2"].ToString(), URating3 = @dr["Rating3"].ToString(), UDate1 = @dr["Date1"].ToString(), UDate2 = @dr["Date2"].ToString(), UDate3 = @dr["Date3"].ToString(), UEmail1 = @dr["Email1"].ToString(), UEmail2 = @dr["Email2"].ToString(), UEmail3 = @dr["Email3"].ToString(), UAmount = @dr["Amount"].ToString(), UAmount2 = @dr["Amount2"].ToString(), UAmount3 = @dr["Amount3"].ToString(), UTime1 = @dr["Time1"].ToString(), UTime2 = @dr["Time2"].ToString(), UHtml = @dr["Html"].ToString(), UUpload = @dr["Upload"].ToString(), UTextArea = @dr["Textarea"].ToString(), UMultiSelect1 = @dr["Multiselect1"].ToString(), UMultiSelect2 = @dr["Multiselect2"].ToString(), UMultiSelect3 = @dr["Multiselect3"].ToString(), UMultiSelect4 = @dr["Multiselect4"].ToString(), UMultiSelect5 = @dr["Multiselect5"].ToString(), }); } } var Data = Caption; return Json(new { AMaster = result, AUserMasterData = Data }, JsonRequestBehavior.AllowGet); } catch (Exception) { throw; } }
public DataSet Edit_DataUser(Edit_UserMaster EA) { try { _cn.Open(); SqlCommand _cmd = new SqlCommand("sp_Edit_Usermaster", _cn); _cmd.CommandType = CommandType.StoredProcedure; _cmd.Parameters.AddWithValue("@tablename", EA.tablename); _cmd.Parameters.AddWithValue("@Corporate", EA.Corporate); _cmd.Parameters.AddWithValue("@unit", EA.unit); _cmd.Parameters.AddWithValue("@Formcode", EA.Formcode); _cmd.Parameters.AddWithValue("@Formtabcode", EA.Formtabcode); _cmd.Parameters.AddWithValue("@Xmaster", EA.Xmaster); _cmd.Parameters.AddWithValue("@Type", EA.Type); _cmd.Parameters.AddWithValue("@SrNo", EA.SrNo); _cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter _adp = new SqlDataAdapter(_cmd); DataSet _ds = new DataSet(); _adp.Fill(_ds); _adp.Dispose(); _cmd.Dispose(); return _ds; } catch (Exception) { throw; } finally { _cn.Close(); _cn.Dispose(); } }