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();
        }
    }
Exemplo n.º 2
0
 public static bool SaveParticipantPost(ATTParticipantPost objParticipantPost)
 {
     return(true);
 }