Exemplo n.º 1
0
        public static List <ATTSession> GetSessionList(int orgID, int programID, int sessionID, string ContainDefSessionValue, string ContainDefSessionCourseValue)
        {
            List <ATTSession> SessionLST = new List <ATTSession>();

            foreach (DataRow row in DLLSession.GetSessionTable(orgID, programID, sessionID).Rows)
            {
                ATTSession objSession = new ATTSession
                                        (
                    int.Parse(row["ORG_ID"].ToString()),
                    int.Parse(row["PROGRAM_ID"].ToString()),
                    int.Parse(row["SESSION_ID"].ToString()),
                    row["SESSION_NAME"].ToString(),
                    row["FROM_DATE"].ToString(),
                    (row["TIME"] == System.DBNull.Value)?"":row["TIME"].ToString(),
                    row["TO_DATE"].ToString(),
                    ""

                                        );

                objSession.LstSessionCourse = BLL.BLLSessionCourse.GetSessionCourseList(orgID, programID, int.Parse(row["SESSION_ID"].ToString()), 0, ContainDefSessionCourseValue);

                SessionLST.Add(objSession);
            }

            if (ContainDefSessionValue == "Y")
            {
                ATTSession objSession = new ATTSession(0, 0, 0, "---Select Session ---", "", "", "", "");
                SessionLST.Insert(0, objSession);
            }

            return(SessionLST);
        }
Exemplo n.º 2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.ddlPrograms.SelectedIndex == 0)
        {
            this.lblStatus.Text        = "Save Error";
            this.lblStatusMessage.Text = "Please Select Program";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.lstSession.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "Save Error";
            this.lblStatusMessage.Text = "Please Select a Session To Assign Course";
            this.programmaticModalPopup.Show();
            return;
        }

        int count = 0;

        foreach (GridViewRow gvRow in this.grdCourses.Rows)
        {
            if (((CheckBox)gvRow.FindControl("chkSelect")).Checked == true)
            {
                count += 1;
            }
        }
        if (count == 0)
        {
            this.lblStatus.Text        = "Save Error";
            this.lblStatusMessage.Text = "Please Select a Course To be Assigned in Session";
            this.programmaticModalPopup.Show();
            return;
        }

        List <ATTSessionCourse> LstSessionCourse = new List <ATTSessionCourse>();
        List <ATTProgram>       ProgramLST       = (List <ATTProgram>)Session["Programs"];

        ATTSession SessionLST = ProgramLST[ddlPrograms.SelectedIndex].SessionLST[lstSession.SelectedIndex];

        try
        {
            foreach (GridViewRow row in grdCourses.Rows)
            {
                CheckBox CBSelect = (CheckBox)row.Cells[0].FindControl("chkSelect");
                if (CBSelect.Checked == true && row.Cells[3].Text != "E")
                {
                    ATTSessionCourse ObjSessionCourse = new ATTSessionCourse
                                                        (
                        (int)Session["OrgID"],
                        int.Parse(this.ddlPrograms.SelectedValue.ToString()),
                        int.Parse(this.lstSession.SelectedValue.ToString()),
                        int.Parse(row.Cells[1].Text.ToString()),
                        Session["NepDate"].ToString(),
                        "",
                        "",
                        "A"
                                                        );
                    LstSessionCourse.Add(ObjSessionCourse);
                }
                else if (CBSelect.Checked == false && row.Cells[3].Text == "E")
                {
                    ATTSessionCourse ObjSessionCourse = new ATTSessionCourse
                                                        (
                        (int)Session["OrgID"],
                        int.Parse(this.ddlPrograms.SelectedValue.ToString()),
                        int.Parse(this.lstSession.SelectedValue.ToString()),
                        int.Parse(row.Cells[1].Text.ToString()),
                        Session["NepDate"].ToString(),
                        "",
                        "",
                        "D"
                                                        );
                    LstSessionCourse.Add(ObjSessionCourse);
                }
            }

            if (BLLSessionCourse.SaveSessionCourse(LstSessionCourse) == true)
            {
                foreach (GridViewRow row in grdCourses.Rows)
                {
                    CheckBox CBSelect = (CheckBox)row.Cells[0].FindControl("chkSelect");
                    if (CBSelect.Checked == true && row.Cells[3].Text != "E")
                    {
                        ATTSessionCourse ObjSessionCourse = new ATTSessionCourse
                                                            (
                            (int)Session["OrgID"],
                            int.Parse(this.ddlPrograms.SelectedValue.ToString()),
                            int.Parse(this.lstSession.SelectedValue.ToString()),
                            int.Parse(row.Cells[1].Text.ToString()),
                            Session["NepDate"].ToString(),
                            "",
                            "",
                            "E"
                                                            );
                        SessionLST.LstSessionCourse.Add(ObjSessionCourse);
                    }
                    else if (CBSelect.Checked == false && row.Cells[3].Text == "E")
                    {
                        SessionLST.LstSessionCourse.RemoveAll(delegate(ATTSessionCourse obj)
                        {
                            return(obj.OrgID == (int)Session["OrgID"] &&
                                   obj.ProgramID == int.Parse(this.ddlPrograms.SelectedValue.ToString()) &&
                                   obj.SessionID == int.Parse(this.lstSession.SelectedValue.ToString()) &&
                                   obj.CourseID == int.Parse(row.Cells[1].Text.ToString()));
                        });
                        //ATTSessionCourse ObjSessionCourse = new ATTSessionCourse
                        //                                                  (
                        //                                                    (int)Session["OrgID"],
                        //                                                    int.Parse(this.ddlPrograms.SelectedValue.ToString()),
                        //                                                    int.Parse(this.lstSession.SelectedValue.ToString()),
                        //                                                    int.Parse(row.Cells[1].Text.ToString()),
                        //                                                    "12/12/2010",
                        //                                                    "",
                        //                                                    "",
                        //                                                    "D"
                        //                                                  );
                        //LstSessionCourse.Add(ObjSessionCourse);
                    }
                }
            }

            ddlPrograms.SelectedIndex = -1;
            lstSession.Items.Clear();
            grdCourses.DataSource = "";
            grdCourses.DataBind();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }