protected void grdOrgDesignation_SelectedIndexChanged(object sender, EventArgs e) { if (this.grdOrgDesignation.SelectedIndex > -1) { this.ddlDesignation_Rqd.Enabled = false; this.ddlOrganization_Rqd.Enabled = false; List <ATTOrganizationDesignation> OrgDesignationList = (List <ATTOrganizationDesignation>)Session["OrganizationDesignation"]; this.ddlOrganization_Rqd.SelectedValue = OrgDesignationList[this.grdOrgDesignation.SelectedIndex].OrgID.ToString(); this.ddlDesignation_Rqd.SelectedValue = OrgDesignationList[this.grdOrgDesignation.SelectedIndex].DesID.ToString(); this.txtTotalSeats_Rqd.Text = OrgDesignationList[this.grdOrgDesignation.SelectedIndex].TotalSeats.ToString(); this.ddlSewa_Rqd.SelectedValue = OrgDesignationList[this.grdOrgDesignation.SelectedIndex].SewaID.ToString(); this.ddlSewa_Rqd_SelectedIndexChanged(sender, e); this.ddlSamuha_Rqd.SelectedValue = OrgDesignationList[this.grdOrgDesignation.SelectedIndex].SamuhaID.ToString(); this.ddlSamuha_Rqd_SelectedIndexChanged(sender, e); this.ddlUpaSamuha_Rqd.Text = OrgDesignationList[this.grdOrgDesignation.SelectedIndex].UpaSamuhaID.ToString(); this.ddlDesignationLevel_Rqd.SelectedValue = OrgDesignationList[this.grdOrgDesignation.SelectedIndex].DesgLevelID.ToString(); this.txtCreatedDate_DT.Text = OrgDesignationList[this.grdOrgDesignation.SelectedIndex].CreatedDate.ToString(); this.btnCreatePost.Text = "Update Post"; this.grdOrgDesignation.SelectedRow.Focus(); this.grdDesPost.DataSource = ""; this.grdDesPost.DataBind(); List <ATTPost> PostList = BLLPost.GetOrgDesgPost(int.Parse(this.ddlOrganization_Rqd.SelectedValue.ToString()), int.Parse(this.ddlDesignation_Rqd.SelectedValue.ToString()), this.txtCreatedDate_DT.Text.Trim()); Session["PostTbl"] = PostList; this.grdDesPost.DataSource = PostList; this.grdDesPost.DataBind(); } }
protected void ddlOrg_Rqd_SelectedIndexChanged(object sender, EventArgs e) { this.ddlAvailablePost_Rqd.DataSource = ""; this.ddlAvailablePost_Rqd.Items.Clear(); this.ddlAvailablePost_Rqd.DataBind(); this.ddlAvailablePost_Rqd.Enabled = false; this.ddlPost_Rqd.DataSource = ""; this.ddlPost_Rqd.Items.Clear(); Session["OrgAvailableDesgPost"] = ""; List <ATTPost> DispOrgAvailableDesgPost = new List <ATTPost>(); try { if (this.ddlOrg_Rqd.SelectedIndex > 0) { List <ATTPost> OrgAvailableDesgPost = BLLPost.GetOrgAvailableDesgPost(int.Parse(this.ddlOrg_Rqd.SelectedValue.ToString()), null, "CO", null); Session["OrgAvailableDesgPost"] = OrgAvailableDesgPost; int intDesID = 0; foreach (ATTPost lstPost in OrgAvailableDesgPost) { if (intDesID != lstPost.DesID) { DispOrgAvailableDesgPost.Add(lstPost); } intDesID = lstPost.DesID; } if (DispOrgAvailableDesgPost.Count > 0) { this.ddlPost_Rqd.DataSource = DispOrgAvailableDesgPost; this.ddlPost_Rqd.DataTextField = "DESNAME"; this.ddlPost_Rqd.DataValueField = "DESID"; this.ddlPost_Rqd.Items.Add(new ListItem("--- छान्नुहोस ---", "0")); } } this.ddlPost_Rqd.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
void LoadPost() { try { List <ATTPost> lstPost; lstPost = BLLPost.GetPost(null); lstPost.Insert(0, new ATTPost(0, "Select Post")); Session["Post"] = lstPost; this.ddlPost.DataSource = lstPost; this.ddlPost.DataTextField = "PostName"; //ATTPost this.ddlPost.DataValueField = "PostID"; this.ddlPost.SelectedIndex = 0; this.ddlPost.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
void GetPost() { try { List <ATTPost> PostList = BLLPost.GetPost(null); Session["Post"] = PostList; lstPost.DataSource = PostList; lstPost.DataTextField = "PostName"; lstPost.DataValueField = "PostID"; lstPost.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); return; } }
protected void btnSubmit_Click(object sender, EventArgs e) { List <ATTPost> PostList = (List <ATTPost>)Session["Post"]; int PostID; if (lstPost.SelectedIndex == -1) { PostID = 0; } else { PostID = int.Parse(lstPost.SelectedValue.ToString()); } try { ATTPost ObjAtt = new ATTPost(PostID, txtPostName_Rqd.Text.Trim()); foreach (GridViewRow row in grdPostLevel.Rows) { if (row.Cells[3].Text.Trim() != " ") { ATTPostLevel attPL = new ATTPostLevel(int.Parse(row.Cells[0].Text.ToString()), int.Parse(row.Cells[1].Text.ToString()), row.Cells[2].Text.Trim(), row.Cells[3].Text.Trim()); ObjAtt.LstPostLevel.Add(attPL); } } ObjectValidation OV = BLLPost.Validate(ObjAtt); if (OV.IsValid == false) { lblStatusMessage.Text = OV.ErrorMessage; this.programmaticModalPopup.Show(); return; } for (int i = 0; i < lstPost.Items.Count; i++) { if (lstPost.SelectedIndex != i) { if (PostList[i].PostName.ToLower() == txtPostName_Rqd.Text.Trim().ToLower()) { this.lblStatusMessage.Text = "Post Name Already Exists"; this.programmaticModalPopup.Show(); return; } } } BLLPost.SavePost(ObjAtt); if (lstPost.SelectedIndex > -1) { PostList[lstPost.SelectedIndex].PostID = ObjAtt.PostID; PostList[lstPost.SelectedIndex].PostName = ObjAtt.PostName; PostList[lstPost.SelectedIndex].LstPostLevel.Clear(); foreach (GridViewRow row in grdPostLevel.Rows) { if (row.Cells[3].Text.Trim() != "D") { ATTPostLevel attPL = new ATTPostLevel(int.Parse(row.Cells[0].Text.ToString()), int.Parse(row.Cells[1].Text.ToString()), row.Cells[2].Text, ""); PostList[lstPost.SelectedIndex].LstPostLevel.Add(attPL); } } } else { PostList.Add(ObjAtt); } lstPost.DataSource = PostList; lstPost.DataTextField = "PostName"; lstPost.DataValueField = "PostID"; lstPost.DataBind(); ClearControls(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); return; } }
protected void btnSave_Click(object sender, EventArgs e) { List <ATTOrganizationDesignation> OrgDesignationList = (List <ATTOrganizationDesignation>)Session["OrganizationDesignation"]; ATTOrganizationDesignation objOrgDesignation = new ATTOrganizationDesignation(); ATTPost objPost = new ATTPost(); int intDesignationID = 0; int intOrganizationID = 0; int intTotalSeats = 0; int intSewaID = 0; int intSamuhaID = 0; int intUpaSamuhaID = 0; int intDesgLevelID = 0; string strUser = ((ATTUserLogin)Session["Login_User_Detail"]).UserName; if (this.ddlDesignation_Rqd.SelectedIndex > 0) { intDesignationID = int.Parse(this.ddlDesignation_Rqd.SelectedValue.ToString()); } if (this.ddlOrganization_Rqd.SelectedIndex > 0) { intOrganizationID = int.Parse(this.ddlOrganization_Rqd.SelectedValue.ToString()); } if (this.ddlSewa_Rqd.SelectedIndex > 0) { intSewaID = int.Parse(this.ddlSewa_Rqd.SelectedValue.ToString()); } if (this.ddlSamuha_Rqd.SelectedIndex > 0) { intSamuhaID = int.Parse(this.ddlSamuha_Rqd.SelectedValue.ToString()); } if (this.ddlUpaSamuha_Rqd.SelectedIndex > 0) { intUpaSamuhaID = int.Parse(this.ddlUpaSamuha_Rqd.SelectedValue.ToString()); } if (this.ddlDesignationLevel_Rqd.SelectedIndex > 0) { intDesgLevelID = int.Parse(this.ddlDesignationLevel_Rqd.SelectedValue.ToString()); } foreach (GridViewRow row in this.grdDesPost.Rows) { CheckBox chkDelete = (CheckBox)(row.Cells[8].FindControl("chkPostSelect")); if (!chkDelete.Checked) { intTotalSeats += 1; } } if (this.grdDesPost.Rows.Count == 0) { this.lblStatusMessage.Text = "Enter The Total Quantity And Click Create Post (or) Update Post."; this.programmaticModalPopup.Show(); return; } try { objOrgDesignation = new ATTOrganizationDesignation(intOrganizationID, intDesignationID, intTotalSeats, intSewaID, intSamuhaID, intUpaSamuhaID, intDesgLevelID); ObjectValidation OV = BLLOrganizationDesignation.Validate(objOrgDesignation); if (!OV.IsValid) { this.lblStatusMessage.Text = OV.ErrorMessage; this.programmaticModalPopup.Show(); return; } if (this.txtCreatedDate_DT.Text.Trim() != "") { objOrgDesignation.CreatedDate = this.txtCreatedDate_DT.Text.Trim(); //"2066.10.09"; } objOrgDesignation.EntryBy = strUser; if (this.grdOrgDesignation.SelectedIndex == -1) { objOrgDesignation.Action = "A"; } else { objOrgDesignation.Action = "E"; } foreach (GridViewRow row in this.grdDesPost.Rows) { string strPostName = ""; string strOldPostName = ""; CheckBox cb = (CheckBox)(row.Cells[8].FindControl("chkPostSelect")); TextBox txtboxPostName = (TextBox)(row.Cells[5].FindControl("txtPostName")); TextBox txtboxOldPostName = (TextBox)(row.Cells[6].FindControl("txtOldPostName")); strPostName = txtboxPostName.Text.Trim(); strOldPostName = txtboxOldPostName.Text.Trim(); objPost = new ATTPost(int.Parse(row.Cells[0].Text.ToString()), int.Parse(row.Cells[1].Text.ToString()), row.Cells[8].Text.ToString(), int.Parse(row.Cells[2].Text.ToString()), strPostName, row.Cells[7].Text.ToString().Trim()); objPost.EntryBy = strUser; objPost.Action = ""; if (row.Cells[2].Text.ToString().Trim() == "0" && !cb.Checked) { objPost.Action = "A"; } if (row.Cells[2].Text.ToString().Trim() != "0") { if (cb.Checked) { objPost.Action = "D"; } else if ((strPostName != strOldPostName) && !cb.Checked) { objPost.Action = "E"; } } if (objPost.Action != "") { ObjectValidation OValidate = BLLPost.Validate(objPost); if (!OValidate.IsValid) { this.lblStatusMessage.Text = OValidate.ErrorMessage; this.programmaticModalPopup.Show(); return; } objOrgDesignation.LstPosts.Add(objPost); } } //if (this.ddlParentOrganization.SelectedIndex > 0) // objOrgDesignation.ParentOrg = int.Parse(this.ddlParentOrganization.SelectedValue.ToString()); //if (this.ddlParentDesignation.SelectedIndex > 0) // objOrgDesignation.ParentDes = int.Parse(this.ddlParentDesignation.SelectedValue.ToString()); objOrgDesignation.OrgName = this.ddlOrganization_Rqd.SelectedItem.Text; objOrgDesignation.DesName = this.ddlDesignation_Rqd.SelectedItem.Text; objOrgDesignation.SewaName = this.ddlSewa_Rqd.SelectedItem.Text; objOrgDesignation.SamuhaName = this.ddlSamuha_Rqd.SelectedItem.Text; objOrgDesignation.UpaSamuhaName = this.ddlUpaSamuha_Rqd.SelectedItem.Text; objOrgDesignation.DesgLevelName = this.ddlDesignationLevel_Rqd.SelectedItem.Text; if (BLLOrganizationDesignation.SaveOrganizationDesignation(objOrgDesignation)) { if (this.grdOrgDesignation.SelectedIndex > -1) { OrgDesignationList[this.grdOrgDesignation.SelectedIndex].OrgID = int.Parse(this.ddlOrganization_Rqd.SelectedValue.ToString()); OrgDesignationList[this.grdOrgDesignation.SelectedIndex].DesID = int.Parse(this.ddlDesignation_Rqd.SelectedValue.ToString()); OrgDesignationList[this.grdOrgDesignation.SelectedIndex].OrgName = this.ddlOrganization_Rqd.SelectedItem.Text.ToString(); OrgDesignationList[this.grdOrgDesignation.SelectedIndex].DesName = this.ddlDesignation_Rqd.SelectedItem.Text.ToString(); OrgDesignationList[this.grdOrgDesignation.SelectedIndex].TotalSeats = objOrgDesignation.TotalSeats; } else { OrgDesignationList.Add(objOrgDesignation); } this.grdOrgDesignation.DataSource = OrgDesignationList; this.grdOrgDesignation.DataBind(); this.lblStatusMessage.Text = "**Post Created Successfully"; this.programmaticModalPopup.Show(); ClearControls(); } } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }