コード例 #1
0
    protected void ddlCommittee_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddlCommittee.SelectedIndex > 0)
            {
                this.ddlCommitteePost.DataSource     = BLLGroupMember.GetGroupMemberList(int.Parse(this.ddlCommittee.SelectedValue));
                this.ddlCommitteePost.DataTextField  = "MemberPosition";
                this.ddlCommitteePost.DataValueField = "OPositionID";
                this.ddlCommitteePost.DataBind();

                this.ddlCommitteePost.Enabled = this.EnableCommittee;
            }
            else
            {
                this.ddlCommitteePost.Enabled = this.EnableCommittee;
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = "Error Status";
            this.lblStatusMessage.Text = ex.Message;
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.ddlOrg_Rqd.SelectedIndex <= 0)
        {
            this.lblStatusMessage.Text = "Please select any organization from list";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.lstCommittee.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "Please select any group from list";
            this.programmaticModalPopup.Show();
            return;
        }

        List <ATTGroupMember> lst = (List <ATTGroupMember>)Session["TmpGrpMember"];

        int index = 0;

        foreach (GridViewRow row in this.grdGrpMember.Rows)
        {
            lst[index].FromDate = ((TextBox)row.FindControl("txxFromDate_Rdt")).Text;
            //lst[index].ToDate = ((TextBox)row.FindControl("txtToDate_Dt")).Text;
            lst[index].ToDate = "";
            lst[index].MemberPostion.PositionID = int.Parse(((DropDownList)row.FindControl("ddlPosition_Rqd")).SelectedValue);

            if (lst[index].Action != "D")
            {
                if
                (
                    lst[index].FromDate == lst[index].OFromDate &&
                    lst[index].ToDate == lst[index].OToDate &&
                    lst[index].PositionID == lst[index].OPositionID && lst[index].Action != "A"
                )
                {
                    lst[index].Action = "N";
                }
                else
                {
                    if (lst[index].Action == "A")
                    {
                        lst[index].Action = "A";
                    }
                    else
                    {
                        lst[index].Action = "E";
                    }
                }
            }

            index++;
        }

        try
        {
            BLLGroupMember.AddGroupMember(lst);
            lst.RemoveAll
            (
                delegate(ATTGroupMember m)
            {
                return(m.Action == "D");
            }
            );
            List <ATTGroupMember> lstGroupMem = ((List <ATTGroup>)Session["GroupLst"])[this.lstCommittee.SelectedIndex].LstGroupMember;
            lstGroupMem = lst;

            this.ClearMe();

            this.lblStatusMessage.Text = "Group member successfully saved.";
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }