public static List <ATTPersonEMail> GetPersonEMail(object obj, double personID)
        {
            List <ATTPersonEMail> EMailList = new List <ATTPersonEMail>();

            try
            {
                foreach (DataRow row in DLLPersonEMail.GetPersonEMail(personID, obj).Rows)
                {
                    ATTPersonEMail EMail = new ATTPersonEMail(
                        double.Parse(row["P_ID"].ToString()), (string)row["E_TYPE"],
                        int.Parse(row["E_SNO"].ToString()),
                        (row["EMAIL"] == System.DBNull.Value ? "" : (string)row["EMAIL"]),
                        (row["ACTIVE"] == System.DBNull.Value ? "" : (string)row["ACTIVE"]),
                        (row["REMARK"] == System.DBNull.Value ? "" : (string)row["REMARK"]),
                        "", DateTime.Now);

                    EMail.EMailType = (string)row["EMAIL_TYPE"];

                    EMailList.Add(EMail);
                }
                return(EMailList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        ATTFacultyMember   objFacultyMember = null;
        ATTParticipantPost objparticipantPost;
        ATTPerson          objPerson;
        ATTParticipant     objParticipant = null;

        byte[]       ImageData        = new byte[0];
        int?         intCountryId     = null;
        int?         intBirthDistrict = null;
        int?         intReligion      = null;
        ATTUserLogin user             = (ATTUserLogin)Session["Login_User_Detail"];
        string       strUser          = user.UserName;
        int          intOrgID         = user.OrgID;
        int          intFacultyID     = int.Parse(Session["FacultyID"].ToString());

        if (this.txtProgramID.Text != "")
        {
            if (this.ddlPost.SelectedIndex == 0)
            {
                this.lblStatusMessage.Text = "Select Post of Participant";
                this.programmaticModalPopup.Show();
                return;
            }
        }

        if (this.ddlPost.SelectedIndex > 0)
        {
            if (this.ddlPostLevel.SelectedIndex == 0)
            {
                this.lblStatusMessage.Text = "Select Post Level";
                this.programmaticModalPopup.Show();
                return;
            }
        }
        try
        {
            if (this.ddlCountry.SelectedIndex > 0)
            {
                intCountryId = int.Parse(this.ddlCountry.SelectedValue.ToString());
            }
            if (this.ddlBirthDistrict.SelectedIndex > 0)
            {
                intBirthDistrict = int.Parse(this.ddlBirthDistrict.SelectedValue.ToString());
            }

            //Following code has been disabled since ddlReligion not required. Ashok.
            //if (this.ddlReligion.SelectedIndex > 0)
            //    intReligion = int.Parse(this.ddlReligion.SelectedValue.ToString());

            objPerson = new ATTPerson(
                0,
                this.txtFName_Rqd.Text.Trim(),
                this.txtMName.Text.Trim(),
                this.txtSurName_Rqd.Text.Trim(),
                this.txtDOB.Text.Trim(),
                ((this.ddlGender.SelectedIndex <= 0) ? "" : (this.ddlGender.SelectedValue)),
                ((this.ddlMarStatus.SelectedIndex <= 0) ? "" : (this.ddlMarStatus.SelectedValue)),
                this.txtFatherName.Text.Trim(),
                this.txtGFatherName.Text.Trim(),
                intCountryId,
                intBirthDistrict,
                intReligion,
                user.OrgID,
                104,
                ((Label)this.Master.FindControl("lblUsername")).Text,
                DateTime.Parse(Session["EngDate"].ToString()),
                ImageData,
                "P"
                );

            if (this.txtProgramID.Text == "")
            {
                objFacultyMember           = new ATTFacultyMember(intOrgID, intFacultyID, 0, Session["NepDate"].ToString(), "");
                objFacultyMember.ObjPerson = objPerson;
            }

            else
            {
                objParticipant           = new ATTParticipant(intOrgID, int.Parse(this.txtProgramID.Text.ToString()), 0, "", Session["NepDate"].ToString(), "");
                objParticipant.ObjPerson = objPerson;
            }

            if (this.ddlPost.SelectedIndex > 0)
            {
                objparticipantPost        = new ATTParticipantPost(0, int.Parse(ddlPost.SelectedValue.ToString()), int.Parse(ddlPostLevel.SelectedValue.ToString()), Session["NepDate"].ToString());
                objparticipantPost.Action = "A";
                if (this.txtProgramID.Text == "")
                {
                    objFacultyMember.LstParticipantPost.Add(objparticipantPost);
                }
                else
                {
                    objParticipant.LstParticipantPost.Add(objparticipantPost);
                }
            }

            foreach (GridViewRow row in this.grdAddress.Rows)
            {
                if (CheckNullString(row.Cells[10].Text.ToString()) != "")
                {
                    int?intDistrict = null;
                    int?intVDC      = null;
                    int?intWard     = null;

                    if (CheckNullString(row.Cells[7].Text.ToString()) != "")
                    {
                        intDistrict = int.Parse(CheckNullString(row.Cells[7].Text.ToString()));
                    }

                    if (CheckNullString(row.Cells[8].Text.ToString()) != "")
                    {
                        intVDC = int.Parse(CheckNullString(row.Cells[8].Text.ToString()));
                    }

                    if (CheckNullString(row.Cells[5].Text.ToString()) != "")
                    {
                        intWard = int.Parse(CheckNullString(row.Cells[5].Text.ToString()));
                    }

                    ATTPersonAddress PersonAddressATT = new ATTPersonAddress
                                                        (
                        0,
                        row.Cells[1].Text,
                        int.Parse(row.Cells[11].Text),
                        intDistrict,
                        intVDC,
                        intWard,
                        CheckNullString(row.Cells[6].Text),
                        CheckNullString(row.Cells[9].Text),
                        ((Label)this.Master.FindControl("lblUsername")).Text,
                        DateTime.Parse(Session["EngDate"].ToString())
                                                        );

                    PersonAddressATT.Action = CheckNullString(row.Cells[10].Text.ToString());
                    objPerson.LstPersonAddress.Add(PersonAddressATT);
                }
            }

            foreach (GridViewRow row in this.grdPhone.Rows)
            {
                if (CheckNullString(row.Cells[7].Text.ToString()) != "")
                {
                    ATTPersonPhone PersonPhoneATT = new ATTPersonPhone
                                                    (
                        0,
                        row.Cells[1].Text,
                        int.Parse(row.Cells[3].Text),
                        CheckNullString(row.Cells[4].Text),
                        CheckNullString(row.Cells[5].Text),
                        CheckNullString(row.Cells[6].Text),
                        ((Label)this.Master.FindControl("lblUsername")).Text,
                        DateTime.Parse(Session["EngDate"].ToString())
                                                    );

                    PersonPhoneATT.Action = CheckNullString(row.Cells[7].Text.ToString());
                    objPerson.LstPersonPhone.Add(PersonPhoneATT);
                }
            }

            foreach (GridViewRow row in this.grdEMail.Rows)
            {
                if (CheckNullString(row.Cells[7].Text) != "")
                {
                    ATTPersonEMail PersonEMailATT = new ATTPersonEMail
                                                    (
                        0,
                        row.Cells[1].Text,
                        int.Parse(row.Cells[3].Text),
                        CheckNullString(row.Cells[4].Text),
                        CheckNullString(row.Cells[5].Text),
                        CheckNullString(row.Cells[6].Text),
                        ((Label)this.Master.FindControl("lblUsername")).Text,
                        DateTime.Parse(Session["EngDate"].ToString())
                                                    );
                    PersonEMailATT.Action = CheckNullString(row.Cells[7].Text.ToString());
                    objPerson.LstPersonEMail.Add(PersonEMailATT);
                }
            }
            if (this.txtProgramID.Text == "")
            {
                BLLFacultyMember.SaveFacultyMember(objFacultyMember);
            }
            else
            {
                BLLParticipant.SaveParticipant(objParticipant);
            }
            ClearControls();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
Exemple #3
0
    protected void btnAddPerson_Click(object sender, EventArgs e)
    {
        int    iniUnit = 3;
        double orgID   = 0;
        int    iniType = 9;


        string strUser = "******";

        List <ATTPerson> PersonLST = (string)Session["AppOrResp"] == "A" ? (List <ATTPerson>)Session["Appellant"] : (List <ATTPerson>)Session["Respondant"];
        ATTPerson        objPerson = new ATTPerson();


        if (this.txtOrgID.Text.Trim() != "")
        {
            orgID = double.Parse(this.txtOrgID.Text.Trim());
        }


        #region "PERSONTABLE"
        objPerson = new ATTPerson(orgID, this.txtOrgName_RQD.Text.Trim(),
                                  "", "",
                                  "", "",
                                  "",
                                  "", "", null, null, null,
                                  iniUnit, iniType, strUser, DateTime.Now, new byte[0]);
        //objPerson.FullName = this.txtOrgName_RQD.Text.Trim() + " " + this.txtMName.Text.Trim() + " " + this.txtSurName_Rqd.Text.Trim();
        //objPerson.EntityType = "P";
        #endregion

        objPerson.FirstName = this.txtOrgName_RQD.Text.Trim();
//        objPerson.FullName = this.txtOrgName_RQD.Text.Trim();
        objPerson.IniUnit    = 9;
        objPerson.IniType    = 9;
        objPerson.EntryBy    = "manoz";
        objPerson.EntityType = "O";
        objPerson.Photo      = new byte[0];
        objPerson.RegdNO     = this.txtRegNo.Text.Trim();
        objPerson.PanNo      = this.txtPanNo.Text.Trim();

        #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() != "")))
        {
            strAddressAction = "E";
        }
        if (((this.ddlDistrict.SelectedIndex > 0) || (this.txtTole.Text.Trim() != "")))
        {
            strAddressAction = "A";
        }
        if (((this.ddlDistrict.SelectedIndex <= 0) && (this.txtTole.Text.Trim() == "")))
        {
            strAddressAction = "D";
        }
        if (strAddressAction != "")
        {
            PersonAddressATT.Action = strAddressAction;
            strAddressAction        = "";
            objPerson.LstPersonAddress.Add(PersonAddressATT);
        }

        strAddressAction   = "";
        intDistrictAddress = null;
        intVDCAddress      = null;
        intWardAddress     = null;


        #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);


        if ((string)Session["AppOrResp"] == "A")
        {
            Session["Appellant"] = PersonLST;
        }
        else
        {
            Session["Respondant"] = PersonLST;
        }



        this.grdPerson.DataSource = PersonLST;
        this.grdPerson.DataBind();

        //this.
    }
Exemple #4
0
    protected void btnAddPerson_Click(object sender, EventArgs e)
    {
        if (txtFromDate_RQD.Text == "")
        {
            this.lblStatusMessage.Text = "Enter From Date First";
            this.programmaticModalPopup.Show();
            return;
        }
        int    iniUnit          = 3;
        double empID            = 0;
        int    iniType          = 9;
        int?   intCountryId     = null;
        int?   intBirthDistrict = null;
        int?   intReligion      = null;

        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

        #region "RELATIVES AND BENEFICIARIES"
        //foreach (GridViewRow row in this.grdEmpRelatives.Rows)
        //{
        //    int? countryID = null;
        //    int? birthDistrict = null;
        //    int? religionID = null;
        //    if (  CheckNull.NullString(row.Cells[11].Text) != "")
        //        birthDistrict = int.Parse(row.Cells[11].Text);
        //    byte[] RelativeImageData = new byte[0];
        //    ATTPerson objRelativePerson = new ATTPerson
        //        (double.Parse(row.Cells[1].Text), row.Cells[2].Text,   CheckNull.NullString(row.Cells[3].Text),   CheckNull.NullString(row.Cells[4].Text),
        //          CheckNull.NullString(row.Cells[8].Text),   CheckNull.NullString(row.Cells[6].Text),   CheckNull.NullString(row.Cells[9].Text), "", "",
        //        countryID, birthDistrict, religionID, iniUnit, iniType, strUser, DateTime.Now, RelativeImageData);
        //    CheckBox cb = (CheckBox)row.Cells[17].FindControl("chkRelativeActive");
        //    CheckBox cbIsBen = (CheckBox)row.Cells[16].FindControl("chkIsBeneficiary");
        //    CheckBox cbWasBen = (CheckBox)row.Cells[20].FindControl("chkWasBeneficiary");

        //    ATTEmployeeBeneficiary EmpBeneficiaryATT = new ATTEmployeeBeneficiary(0, 0, null, null);
        //    if ((cbIsBen.Checked) && (!cbWasBen.Checked))
        //        EmpBeneficiaryATT.Action = "A";
        //    else if ((!cbIsBen.Checked) && (cbWasBen.Checked))
        //    {
        //        EmpBeneficiaryATT.Action = "E";
        //        EmpBeneficiaryATT.ToDate = DateTime.Now.Date.ToString("dd/MM/yyyy");
        //    }
        //    EmpBeneficiaryATT.EntryBy = strUser;

        //    ATTRelatives RelativesATT = new ATTRelatives(0, 0, int.Parse(row.Cells[13].Text), (cb.Checked ? "Y" : "N"));
        //    RelativesATT.Occupation =   CheckNull.NullString(row.Cells[15].Text);
        //    RelativesATT.EntryBy = strUser;
        //    if (  CheckNull.NullString(row.Cells[18].Text) == "A")
        //        RelativesATT.Action = "A";
        //    else
        //        RelativesATT.Action = "E";
        //    RelativesATT.ObjPerson = objRelativePerson;
        //    EmpBeneficiaryATT.ObjRelatives = RelativesATT;
        //    objEmployee.LstEmployeeBeneficiary.Add(EmpBeneficiaryATT);
        //}
        #endregion

        List <ATTWitnessSearch> WSearchLST         = (List <ATTWitnessSearch>)Session["WSearch"];
        ATTWitnessSearch        objWSearch         = new ATTWitnessSearch();
        ATTWitnessPerson        objCaesAndlitigant = (ATTWitnessPerson)Session["CaseAndLitigant"];//brought from witness person form caseID and litigantId

        List <ATTWitnessSearch> PersonList = new List <ATTWitnessSearch>();

        objWSearch.CaseID      = objCaesAndlitigant.CaseID;
        objWSearch.LItigantID  = objCaesAndlitigant.LitigantID;
        objWSearch.PersonID    = 0;
        objWSearch.WitnessID   = 0;
        objWSearch.WitnessName = this.txtFName_Rqd.Text.Trim() + " " + this.txtMName.Text.Trim() + " " + this.txtSurName_Rqd.Text.Trim();
        objWSearch.FromDate    = this.txtFromDate_RQD.Text;
        objWSearch.Action      = "A";

        objWSearch.ObjPerson = objPerson;

        WSearchLST.Add(objWSearch);
        PersonList.Add(objWSearch);

        Session["WSearch"] = WSearchLST;

        this.grdPerson.DataSource = PersonList;
        this.grdPerson.DataBind();

        ClearControls();
    }
    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";
        strAddressAction = "A";
        if (strAddressAction != "")
        {
            PersonAddressATT.Action = strAddressAction;
            strAddressAction        = "";
            objPerson.LstPersonAddress.Add(PersonAddressATT);
        }

        strAddressAction   = "";
        intDistrictAddress = null;
        intVDCAddress      = null;
        intWardAddress     = null;

        strAddressAction = "A";
        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";
        strAddressAction = "A";
        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);
        double PersonID = 0;
        if (this.txtPersonID.Text.Trim() != "")
        {
            PersonID = double.Parse(this.txtPersonID.Text.Trim());
        }

        lstPerson.Add(objPerson);
        if (lstPerson.Count > 0)
        {
            Session["MelMilaapKartaaInfo"] = lstPerson;
            // Session["PersonID"] = objPerson.PId;
            ClearControls();
            Response.Redirect("MelMilaapKartaa.aspx");
        }
        else
        {
            lblStatusMessage.Text = "Person List doesn't contain information";
            programmaticModalPopup.Show();
            return;
        }
    }
    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()");
    }