public static List <ATTOrgDecisionType> GetOrgDecisionType(int orgID, int?decTypeID, string active, string loadAll, int defaultFlag) { List <ATTOrgDecisionType> OrgDecTypeList = new List <ATTOrgDecisionType>(); try { foreach (DataRow row in DLLOrgDecisionType.GetOrgDecisionType(orgID, decTypeID, active, loadAll).Rows) { ATTOrgDecisionType objOrgDecType = new ATTOrgDecisionType( int.Parse(row["ORG_ID"].ToString()), int.Parse(row["DEC_TYPE_ID"].ToString()), row["ACTIVE"].ToString()); OrgDecTypeList.Add(objOrgDecType); } if (defaultFlag > 0) { ; } //OrgDecTypeList.Insert(0, new ATTOrgDecisionType(0, "छान्नुहोस", "")); return(OrgDecTypeList); } catch (Exception ex) { throw ex; } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (txtDecisionTypeName_RQD.Text == "") { lblStatusMessage.Text = "निर्नयको किसिम लेख्नुस"; programmaticModalPopup.Show(); return; } ATTDecisionType objDecisionType = new ATTDecisionType(int.Parse(this.hdnDecTypeID.Value), this.txtDecisionTypeName_RQD.Text.Trim(), "Y"); objDecisionType.EntryBy = strUser; foreach (GridViewRow row in grdOrganization.Rows) { ATTOrgDecisionType attODT = new ATTOrgDecisionType(); CheckBox cbSelect = (CheckBox)(row.Cells[0].FindControl("chkSelect")); string active = ""; string action = ""; if (cbSelect.Checked == true && row.Cells[3].Text == "") { active = "Y"; action = "A"; } else if (cbSelect.Checked == true && row.Cells[3].Text == "N") { active = "Y"; action = "E"; } else if (cbSelect.Checked == false && row.Cells[3].Text == "Y") { active = "N"; action = "E"; } else { continue; } attODT = new ATTOrgDecisionType(int.Parse(row.Cells[1].Text), int.Parse(this.hdnDecTypeID.Value), active); attODT.Action = action; attODT.EntryBy = strUser; objDecisionType.LstOrgDecisionType.Add(attODT); } try { List <ATTDecisionType> DecisionTypeList = (List <ATTDecisionType>)Session["DecisionType"]; BLLDecisionType.SaveDecisionType(objDecisionType); if (this.lstDecisionType.SelectedIndex != -1) { DecisionTypeList[this.lstDecisionType.SelectedIndex].DecisionTypeID = objDecisionType.DecisionTypeID; DecisionTypeList[this.lstDecisionType.SelectedIndex].DecisionTypeName = objDecisionType.DecisionTypeName; DecisionTypeList[this.lstDecisionType.SelectedIndex].Active = objDecisionType.Active; } else { DecisionTypeList.Add(objDecisionType); } this.lblStatusMessage.Text = "Successfully Saved."; this.programmaticModalPopup.Show(); this.lstDecisionType.DataSource = DecisionTypeList; this.lstDecisionType.DataBind(); ClearControls(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }