protected void btnOK_Click(object sender, EventArgs e) { List <ATTPerson> PersonLST;// = (List<ATTPerson>)Session["Person"]; if ((string)Session["AppOrResp"] == "A") { PersonLST = (List <ATTPerson>)Session["Appellant"];// = PersonLST; } else { PersonLST = (List <ATTPerson>)Session["Respondant"];// = PersonLST; } if (BLLPerson.SavePerson(PersonLST) == true) { this.grdPerson.DataSource = PersonLST; this.grdPerson.DataBind(); } }
protected void btnOK_Click(object sender, EventArgs e) { ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); int iniUnit = 9; double empID = 0; int iniType = 5;//Application ID int? intCountryId = null; int? intBirthDistrict = null; int? intReligion = null; string strUser = "******"; //user.UserName; List <ATTPerson> PersonLST = new List <ATTPerson>(); ATTPerson objPerson = new ATTPerson(); if (this.txtPersonID.Text.Trim() != "") { empID = double.Parse(this.txtPersonID.Text.Trim()); } if (this.ddlCountry.SelectedIndex > 0) { intCountryId = int.Parse(this.ddlCountry.SelectedValue.ToString()); } if (this.ddlBirthDistrict.SelectedIndex > 0) { intBirthDistrict = int.Parse(this.ddlBirthDistrict.SelectedValue.ToString()); } if (this.ddlReligion.SelectedIndex > 0) { intReligion = int.Parse(this.ddlReligion.SelectedValue.ToString()); } #region "PERSONTABLE" objPerson = new ATTPerson ( empID, this.txtFName_Rqd.Text.Trim(), this.txtMName.Text.Trim(), this.txtSurName_Rqd.Text.Trim(), this.txtDOB_DT.Text.Trim(), ((this.ddlGender.SelectedIndex <= 0) ? "" : (this.ddlGender.SelectedValue)), ((this.ddlMarStatus.SelectedIndex <= 0) ? "" : (this.ddlMarStatus.SelectedValue)), "", "", intCountryId, intBirthDistrict, intReligion, iniUnit, iniType, strUser, DateTime.Now, new byte[0] ); objPerson.FullName = this.txtFName_Rqd.Text.Trim() + " " + this.txtMName.Text.Trim() + " " + this.txtSurName_Rqd.Text.Trim(); objPerson.EntityType = "P"; #endregion #region "ADDRESS" int? intDistrictAddress = null; int? intVDCAddress = null; int? intWardAddress = null; string strAddressAction = ""; ATTPersonAddress PersonAddressATT = null; if (this.ddlDistrict.SelectedIndex > 0) { intDistrictAddress = int.Parse(this.ddlDistrict.SelectedValue); } if (this.ddlVDC.SelectedIndex > 0) { intVDCAddress = int.Parse(this.ddlVDC.SelectedValue); } if (this.ddlWard.SelectedIndex > 0) { intWardAddress = int.Parse(this.ddlWard.SelectedValue); } PersonAddressATT = new ATTPersonAddress ( 0, "P", int.Parse(hdnPerAddress.Value.ToString()), intDistrictAddress, intVDCAddress, intWardAddress, this.txtTole.Text.Trim(), "Y", strUser, DateTime.Now ); if (((this.ddlDistrict.SelectedIndex > 0) || (this.txtTole.Text.Trim() != "")) && (hdnPerAddress.Value != "0")) { strAddressAction = "E"; } if (((this.ddlDistrict.SelectedIndex > 0) || (this.txtTole.Text.Trim() != "")) && (hdnPerAddress.Value == "0")) { strAddressAction = "A"; } if (((this.ddlDistrict.SelectedIndex <= 0) && (this.txtTole.Text.Trim() == "")) && (hdnPerAddress.Value != "0")) { strAddressAction = "D"; } if (strAddressAction != "") { PersonAddressATT.Action = strAddressAction; strAddressAction = ""; objPerson.LstPersonAddress.Add(PersonAddressATT); } strAddressAction = ""; intDistrictAddress = null; intVDCAddress = null; intWardAddress = null; if (this.ddlDistrictTemp.SelectedIndex > 0) { intDistrictAddress = int.Parse(this.ddlDistrictTemp.SelectedValue); } if (this.ddlVDCTemp.SelectedIndex > 0) { intVDCAddress = int.Parse(this.ddlVDCTemp.SelectedValue); } if (this.ddlWardTemp.SelectedIndex > 0) { intWardAddress = int.Parse(this.ddlWardTemp.SelectedValue); } PersonAddressATT = new ATTPersonAddress ( 0, "T", int.Parse(hdnTempAddress.Value.ToString()), intDistrictAddress, intVDCAddress, intWardAddress, this.txtToleTemp.Text.Trim(), "Y", strUser, DateTime.Now ); if (((this.ddlDistrictTemp.SelectedIndex > 0) || (this.txtToleTemp.Text.Trim() != "")) && (hdnTempAddress.Value != "0")) { strAddressAction = "E"; } if (((this.ddlDistrictTemp.SelectedIndex > 0) || (this.txtToleTemp.Text.Trim() != "")) && (hdnTempAddress.Value == "0")) { strAddressAction = "A"; } if (((this.ddlDistrictTemp.SelectedIndex <= 0) && (this.txtToleTemp.Text.Trim() == "")) && (hdnTempAddress.Value != "0")) { strAddressAction = "D"; } if (strAddressAction != "") { PersonAddressATT.Action = strAddressAction; strAddressAction = ""; objPerson.LstPersonAddress.Add(PersonAddressATT); } #endregion #region "PHONE" foreach (GridViewRow row in this.grdPhone.Rows) { if (CheckNull.NullString(row.Cells[7].Text.ToString()) != "") { ATTPersonPhone PersonPhoneATT = new ATTPersonPhone(0, row.Cells[1].Text, int.Parse(row.Cells[3].Text.ToString()), CheckNull.NullString(row.Cells[4].Text.ToString()), CheckNull.NullString(row.Cells[5].Text.ToString()), CheckNull.NullString(row.Cells[6].Text.ToString()), strUser, DateTime.Now); PersonPhoneATT.Action = CheckNull.NullString(row.Cells[7].Text.ToString()); objPerson.LstPersonPhone.Add(PersonPhoneATT); } } #endregion #region "EMAIL" foreach (GridViewRow row in this.grdEMail.Rows) { if (CheckNull.NullString(row.Cells[7].Text.ToString()) != "") { ATTPersonEMail PersonEMailATT = new ATTPersonEMail(0, row.Cells[1].Text, int.Parse(row.Cells[3].Text.ToString()), CheckNull.NullString(row.Cells[4].Text.ToString()), CheckNull.NullString(row.Cells[5].Text.ToString()), CheckNull.NullString(row.Cells[6].Text.ToString()), strUser, DateTime.Now); PersonEMailATT.Action = CheckNull.NullString(row.Cells[7].Text.ToString()); objPerson.LstPersonEMail.Add(PersonEMailATT); } } #endregion PersonLST.Add(objPerson); try { BLLPerson.SavePerson(PersonLST); this.ClearME(); this.lblStatusMessage.Text = "Person has been saved successfully."; this.programmaticModalPopup.Show(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
protected void btnOK_Click(object sender, EventArgs e) { int iniUnit = 3; double empID = 0; int iniType = 9; int? intCountryId = null; int? intBirthDistrict = null; int? intReligion = null; List <ATTPerson> lstPerson = new List <ATTPerson>(); ATTPerson objPerson = new ATTPerson(); if (this.txtPersonID.Text.Trim() != "") { empID = double.Parse(this.txtPersonID.Text.Trim()); } if (this.ddlCountry.SelectedIndex > 0) { intCountryId = int.Parse(this.ddlCountry.SelectedValue.ToString()); } if (this.ddlBirthDistrict.SelectedIndex > 0) { intBirthDistrict = int.Parse(this.ddlBirthDistrict.SelectedValue.ToString()); } if (this.ddlReligion.SelectedIndex > 0) { intReligion = int.Parse(this.ddlReligion.SelectedValue.ToString()); } #region "PERSONTABLE" objPerson = new ATTPerson(empID, this.txtFName_Rqd.Text.Trim(), this.txtMName.Text.Trim(), this.txtSurName_Rqd.Text.Trim(), this.txtDOB_DT.Text.Trim(), ((this.ddlGender.SelectedIndex <= 0) ? "" : (this.ddlGender.SelectedValue)), ((this.ddlMarStatus.SelectedIndex <= 0) ? "" : (this.ddlMarStatus.SelectedValue)), "", "", intCountryId, intBirthDistrict, intReligion, iniUnit, iniType, strUser, DateTime.Now, new byte[0]); //objPerson.FullName = this.txtFName_Rqd.Text.Trim() + " " + this.txtMName.Text.Trim() + " " + this.txtSurName_Rqd.Text.Trim(); objPerson.EntityType = "P"; #endregion #region "ADDRESS" int? intDistrictAddress = null; int? intVDCAddress = null; int? intWardAddress = null; string strAddressAction = ""; ATTPersonAddress PersonAddressATT = null; if (this.ddlDistrict.SelectedIndex > 0) { intDistrictAddress = int.Parse(this.ddlDistrict.SelectedValue); } if (this.ddlVDC.SelectedIndex > 0) { intVDCAddress = int.Parse(this.ddlVDC.SelectedValue); } if (this.ddlWard.SelectedIndex > 0) { intWardAddress = int.Parse(this.ddlWard.SelectedValue); } PersonAddressATT = new ATTPersonAddress ( 0, "P", 1, intDistrictAddress, intVDCAddress, intWardAddress, this.txtTole.Text.Trim(), "Y", strUser, DateTime.Now ); if (((this.ddlDistrict.SelectedIndex > 0) || (this.txtTole.Text.Trim() != "")) && (hdnPerAddress.Value != "0")) { strAddressAction = "E"; } if (((this.ddlDistrict.SelectedIndex > 0) || (this.txtTole.Text.Trim() != "")) && (hdnPerAddress.Value == "0")) { strAddressAction = "A"; } // if (((this.ddlDistrict.SelectedIndex <= 0) && (this.txtTole.Text.Trim() == "")) && (hdnPerAddress.Value != "0")) strAddressAction = "D"; if (strAddressAction != "") { PersonAddressATT.Action = strAddressAction; strAddressAction = ""; objPerson.LstPersonAddress.Add(PersonAddressATT); } strAddressAction = ""; intDistrictAddress = null; intVDCAddress = null; intWardAddress = null; if (this.ddlDistrictTemp.SelectedIndex > 0) { intDistrictAddress = int.Parse(this.ddlDistrictTemp.SelectedValue); } if (this.ddlVDCTemp.SelectedIndex > 0) { intVDCAddress = int.Parse(this.ddlVDCTemp.SelectedValue); } if (this.ddlWardTemp.SelectedIndex > 0) { intWardAddress = int.Parse(this.ddlWardTemp.SelectedValue); } PersonAddressATT = new ATTPersonAddress ( 0, "T", 1, intDistrictAddress, intVDCAddress, intWardAddress, this.txtToleTemp.Text.Trim(), "Y", strUser, DateTime.Now ); if (((this.ddlDistrictTemp.SelectedIndex > 0) || (this.txtToleTemp.Text.Trim() != "")) && (hdnTempAddress.Value != "0")) { strAddressAction = "E"; } if (((this.ddlDistrictTemp.SelectedIndex > 0) || (this.txtToleTemp.Text.Trim() != "")) && (hdnTempAddress.Value == "0")) { strAddressAction = "A"; } //if (((this.ddlDistrictTemp.SelectedIndex <= 0) && (this.txtToleTemp.Text.Trim() == "")) && (hdnTempAddress.Value != "0")) strAddressAction = "D"; if (strAddressAction != "") { PersonAddressATT.Action = strAddressAction; strAddressAction = ""; objPerson.LstPersonAddress.Add(PersonAddressATT); } #endregion #region "PHONE" foreach (GridViewRow row in this.grdPhone.Rows) { if (CheckNull.NullString(row.Cells[7].Text.ToString()) != "") { ATTPersonPhone PersonPhoneATT = new ATTPersonPhone(0, row.Cells[1].Text, int.Parse(row.Cells[3].Text.ToString()), CheckNull.NullString(row.Cells[4].Text.ToString()), CheckNull.NullString(row.Cells[5].Text.ToString()), CheckNull.NullString(row.Cells[6].Text.ToString()), strUser, DateTime.Now); PersonPhoneATT.Action = CheckNull.NullString(row.Cells[7].Text.ToString()); objPerson.LstPersonPhone.Add(PersonPhoneATT); } } #endregion #region "EMAIL" foreach (GridViewRow row in this.grdEMail.Rows) { if (CheckNull.NullString(row.Cells[7].Text.ToString()) != "") { ATTPersonEMail PersonEMailATT = new ATTPersonEMail(0, row.Cells[1].Text, int.Parse(row.Cells[3].Text.ToString()), CheckNull.NullString(row.Cells[4].Text.ToString()), CheckNull.NullString(row.Cells[5].Text.ToString()), CheckNull.NullString(row.Cells[6].Text.ToString()), strUser, DateTime.Now); PersonEMailATT.Action = CheckNull.NullString(row.Cells[7].Text.ToString()); objPerson.LstPersonEMail.Add(PersonEMailATT); } } #endregion lstPerson.Add(objPerson); if (BLLPerson.SavePerson(lstPerson)) { Session["PersonName"] = lstPerson[0].FullName; Session["PersonID"] = double.Parse(lstPerson[0].PId.ToString()); ClearControls(); } // btnOK.Attributes.Add("OnClick", "self.close()"); }