public static List <ATTOrganisationBenchType> GetOrganisationBenchType(int?OrgID, int?BenchTypeID, string active) { List <ATTOrganisationBenchType> OrganisationBenchTypeLST = new List <ATTOrganisationBenchType>(); try { foreach (DataRow row in DLLOrganisationBenchType.GetOrganisationBenchType(OrgID, BenchTypeID, active).Rows) { ATTOrganisationBenchType objOrganisationBenchType = new ATTOrganisationBenchType(); objOrganisationBenchType.OrganisationID = int.Parse(row["ORG_ID"].ToString()); objOrganisationBenchType.OrganisationName = row["ORG_NAME"].ToString(); objOrganisationBenchType.BenchTypeID = int.Parse(row["BENCH_TYPE_ID"].ToString()); objOrganisationBenchType.BenchTypeName = row["BENCH_TYPE_NAME"].ToString(); objOrganisationBenchType.Active = row["ACTIVE"].ToString(); OrganisationBenchTypeLST.Add(objOrganisationBenchType); } //if (defaultFlag > 0) //{ // ATTOrganisationBenchType obj = new ATTOrganisationBenchType(); // obj.BenchTypeID = 0; // obj.BenchTypeName = "छान्नुहोस"; // OrganisationBenchTypeLST.Insert(0, obj); //} return(OrganisationBenchTypeLST); } catch (Exception ex) { throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { List <ATTOrganisationBenchType> OrgBenchTypeLST = new List <ATTOrganisationBenchType>(); foreach (GridViewRow row in grdOrganisation.Rows) { CheckBox chk = (CheckBox)row.Cells[0].FindControl("chkOrganisation"); string active = row.Cells[3].Text; string action = ""; string actv = ""; bool AddEdit = false; if (chk.Checked) { if (active == "") { action = "A"; actv = "Y"; AddEdit = true; } if (active == "N") { action = "E"; actv = "Y"; AddEdit = true; } } else if (!chk.Checked) { if (active == "Y") { action = "E"; actv = "N"; AddEdit = true; } } if (AddEdit) { ATTOrganisationBenchType orgBenchType = new ATTOrganisationBenchType(); orgBenchType.OrganisationID = int.Parse(row.Cells[1].Text); orgBenchType.BenchTypeID = int.Parse(lstBenchType.SelectedValue); orgBenchType.Active = actv; orgBenchType.Action = action; orgBenchType.EntryBy = entryBy; OrgBenchTypeLST.Add(orgBenchType); } } if (OrgBenchTypeLST.Count > 0) { if (BLLOrganisationBenchType.SaveOrganisationBenchType(OrgBenchTypeLST)) { LoadBenchTypes(); foreach (GridViewRow row in grdOrganisation.Rows) { ((CheckBox)row.Cells[0].FindControl("chkOrganisation")).Checked = false; row.Cells[3].Text = ""; } lblStatusMessage.Text = "Data Saved Successfully </br>"; this.programmaticModalPopup.Show(); } else { lblStatusMessage.Text = "Could not Save Data </br>"; this.programmaticModalPopup.Show(); } } }