示例#1
0
    void GetDegreeLevel()
    {
        try
        {
            List <ATTDegreeLevel> Lst = BLLDegreeLevel.GetDegreeLevel(null, null);
            Session["LstDegreeLevel"] = Lst;

            lstDegreeLevel.DataSource     = Lst;
            lstDegreeLevel.DataTextField  = "DegreeLevelName";
            lstDegreeLevel.DataValueField = "DegreeLevelID";
            lstDegreeLevel.DataBind();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
            return;
        }
    }
示例#2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]);

        List <ATTDegreeLevel> LstDL = (List <ATTDegreeLevel>)Session["LstDegreeLevel"];

        int DegreeLevelID;

        try
        {
            if (lstDegreeLevel.SelectedIndex == -1)
            {
                DegreeLevelID = 0;
            }
            else
            {
                DegreeLevelID = LstDL[lstDegreeLevel.SelectedIndex].DegreeLevelID;
            }

            ATTDegreeLevel ObjAtt = new ATTDegreeLevel(DegreeLevelID, txtDegreeLevelName_Rqd.Text.Trim(), this.chkActiveDL.Checked == true ? "Y" : "N", user.UserName);

            foreach (GridViewRow row in grdDegree.Rows)
            {
                if (row.Cells[4].Text != "&nbsp;")
                {
                    ATTDegree LstAtt = new ATTDegree(int.Parse(row.Cells[0].Text.ToString()), int.Parse(row.Cells[1].Text.ToString()), row.Cells[2].Text, row.Cells[3].Text, row.Cells[4].Text);
                    LstAtt.EntryBy = user.UserName;
                    ObjAtt.LstDegree.Add(LstAtt);
                }
            }



            ObjectValidation OV = BLLDegreeLevel.Validate(ObjAtt);

            if (OV.IsValid == false)
            {
                lblStatusMessage.Text = OV.ErrorMessage;
                this.programmaticModalPopup.Show();
                return;
            }

            for (int i = 0; i < lstDegreeLevel.Items.Count; i++)
            {
                if (lstDegreeLevel.SelectedIndex != i)
                {
                    if (LstDL[i].DegreeLevelName.ToLower() == txtDegreeLevelName_Rqd.Text.Trim().ToLower())
                    {
                        this.lblStatusMessage.Text = "Degree Level Name Already Exists";
                        this.programmaticModalPopup.Show();
                        return;
                    }
                }
            }


            if (BLLDegreeLevel.SaveDegreeLevel(ObjAtt))
            {
                this.lblStatusMessage.Text = "Degree Information Saved";
                this.programmaticModalPopup.Show();
            }

            if (lstDegreeLevel.SelectedIndex > -1)
            {
                LstDL[lstDegreeLevel.SelectedIndex].DegreeLevelID   = ObjAtt.DegreeLevelID;
                LstDL[lstDegreeLevel.SelectedIndex].DegreeLevelName = txtDegreeLevelName_Rqd.Text.Trim();
                LstDL[this.lstDegreeLevel.SelectedIndex].Active     = (this.chkActiveDL.Checked == true ? "Y" : "N");
                LstDL[lstDegreeLevel.SelectedIndex].LstDegree.Clear();


                foreach (GridViewRow row in grdDegree.Rows)
                {
                    if (row.Cells[4].Text.Trim() != "D")
                    {
                        ATTDegree att = new ATTDegree(int.Parse(row.Cells[0].Text), int.Parse(row.Cells[1].Text), row.Cells[2].Text, row.Cells[3].Text);
                        LstDL[lstDegreeLevel.SelectedIndex].LstDegree.Add(att);
                    }
                }
            }
            else
            {
                LstDL.Add(ObjAtt);
            }


            lstDegreeLevel.DataSource     = LstDL;
            Session["LstDegreeLevel"]     = LstDL;
            lstDegreeLevel.DataTextField  = "DegreeLevelName";
            lstDegreeLevel.DataValueField = "DegreeLevelID";
            lstDegreeLevel.DataBind();

            ClearControls();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
            return;
        }
    }