protected void lstCaseTypes_SelectedIndexChanged(object sender, EventArgs e) { if (lstOrganization.SelectedIndex == -1) { lblStatusMessage.Text = "Please Select Organization First"; programmaticModalPopup.Show(); return; } foreach (GridViewRow row in grdOrgUnits.Rows) { CheckBox cbSelect = (CheckBox)row.Cells[0].FindControl("chkSelect"); cbSelect.Checked = false; } try { List <ATTSectionCaseType> lstSecCaseType = BLLSectionCaseType.GetSectionCaseType(int.Parse(lstOrganization.SelectedValue), int.Parse(lstCaseTypes.SelectedValue), null, null); ATTSectionCaseType attSC = new ATTSectionCaseType(); foreach (GridViewRow row in grdOrgUnits.Rows) { CheckBox cbSelect = (CheckBox)row.Cells[0].FindControl("chkSelect"); attSC = lstSecCaseType.Find(delegate(ATTSectionCaseType att) { return(att.UnitID == int.Parse(row.Cells[1].Text.ToString())); }); if (attSC != null) { cbSelect.Checked = true; row.Cells[3].Text = "U"; } } } catch (Exception ex) { lblStatusMessage.Text = ex.Message; programmaticModalPopup.Show(); } }
public static List <ATTSectionCaseType> GetSecCaseType(int orgID, int caseTypeID) { List <ATTSectionCaseType> SectionCaseTypeLST = new List <ATTSectionCaseType>(); try { foreach (DataRow row in DLLSectionCaseType.GetSecCaseType(orgID, caseTypeID).Rows) { ATTSectionCaseType objSectionCaseType = new ATTSectionCaseType(); objSectionCaseType.OrgID = int.Parse(row["ORG_ID"].ToString()); objSectionCaseType.UnitID = int.Parse(row["UNIT_ID"].ToString()); objSectionCaseType.UnitName = row["UNIT_NAME"].ToString(); objSectionCaseType.CaseTypeID = int.Parse(row["CASE_TYPE_ID"].ToString()); objSectionCaseType.FromDate = row["FROM_DATE"].ToString(); SectionCaseTypeLST.Add(objSectionCaseType); } return(SectionCaseTypeLST); } catch (Exception ex) { throw ex; } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (lstOrganization.SelectedIndex == -1) { lblStatusMessage.Text = "Please Select Organization First"; programmaticModalPopup.Show(); return; } if (lstCaseTypes.SelectedIndex == -1) { lblStatusMessage.Text = "Please Select Case Type First"; programmaticModalPopup.Show(); return; } if (grdOrgUnits.Rows.Count < 0) { lblStatusMessage.Text = "This Organization hasn't case Types..Choose next Org."; programmaticModalPopup.Show(); return; } if (txtFromDate_RQD.Text == "____/__/__") { lblStatusMessage.Text = "Please Enter from Date First"; programmaticModalPopup.Show(); return; } List <ATTSectionCaseType> SecCaseTypeList = new List <ATTSectionCaseType>(); foreach (GridViewRow row in grdOrgUnits.Rows) { CheckBox cbSelect = (CheckBox)row.Cells[0].FindControl("chkSelect"); if (cbSelect.Checked == true && row.Cells[3].Text == "") { ATTSectionCaseType attSCT = new ATTSectionCaseType(); attSCT.OrgID = orgID; attSCT.CaseTypeID = int.Parse(lstCaseTypes.SelectedValue); attSCT.UnitID = int.Parse(row.Cells[1].Text.ToString()); attSCT.FromDate = txtFromDate_RQD.Text.Trim(); attSCT.EntryBy = strUser; attSCT.Action = "A"; SecCaseTypeList.Add(attSCT); } else if (cbSelect.Checked == false && row.Cells[3].Text == "U") { ATTSectionCaseType attSCT = new ATTSectionCaseType(); attSCT.OrgID = orgID; attSCT.CaseTypeID = int.Parse(lstCaseTypes.SelectedValue); attSCT.UnitID = int.Parse(row.Cells[1].Text.ToString()); attSCT.FromDate = txtFromDate_RQD.Text.Trim(); attSCT.EntryBy = strUser; attSCT.Action = "E"; SecCaseTypeList.Add(attSCT); } } if (BLLSectionCaseType.SaveSectionCaseType(SecCaseTypeList)) { ClearControls(); lblStatusMessage.Text = "Successfully Saved"; programmaticModalPopup.Show(); } }