コード例 #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (lstProgram.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "Select Program First";
            this.programmaticModalPopup.Show();
            return;
        }

        if (grdParticipant.Rows.Count > 0)
        {
            List <ATTParticipant> lstParticipant = new List <ATTParticipant>();
            try
            {
                foreach (GridViewRow rowPerson in grdPerson.Rows)
                {
                    bool     blnPersonAlreadyExists = false;
                    CheckBox cb;
                    cb = (CheckBox)(rowPerson.Cells[0].FindControl("chkSelectPerson"));
                    if (cb.Checked)
                    {
                        foreach (GridViewRow row in grdParticipant.Rows)
                        {
                            if (row.Cells[2].Text.Trim() == rowPerson.Cells[1].Text.Trim())
                            {
                                blnPersonAlreadyExists = true;
                                break;
                            }
                            else
                            {
                                blnPersonAlreadyExists = false;
                            }
                        }

                        if (!blnPersonAlreadyExists)
                        {
                            ATTParticipant attP = new ATTParticipant((int)Session["OrgID"], int.Parse(lstProgram.SelectedValue.ToString()), int.Parse(rowPerson.Cells[1].Text.ToString()), "", Session["NepDate"].ToString(), "");
                            lstParticipant.Add(attP);
                        }
                    }
                }
                BLLParticipant.SaveParticipant(lstParticipant);
                this.lstProgram_SelectedIndexChanged(sender, e);
            }
            catch (Exception ex)
            {
                this.lblStatusMessage.Text = ex.Message;
                this.programmaticModalPopup.Show();
                return;
            }
        }
        else
        {
            this.lblStatusMessage.Text = "Search Person to add Participant";
            this.programmaticModalPopup.Show();
            return;
        }
    }
コード例 #2
0
    protected void lstProgram_SelectedIndexChanged(object sender, EventArgs e)
    {
        grdParticipant.DataSource = "";
        grdParticipant.DataBind();
        List <ATTParticipant> PTList = BLLParticipant.GetParticipant((int)Session["OrgID"], int.Parse(lstProgram.SelectedValue.ToString()));

        grdParticipant.DataSource = PTList;
        grdParticipant.DataBind();
    }
    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();
        }
    }