Esempio n. 1
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
     STD_ClassSubject sTD_ClassSubject = new STD_ClassSubject ();
     sTD_ClassSubject.ClassSubjectID=  int.Parse(Request.QueryString["ID"].ToString());
     sTD_ClassSubject.ClassSubjectName=  txtClassSubjectName.Text;
     sTD_ClassSubject.SubjectID=  int.Parse(ddlSubjectID.SelectedValue);
     sTD_ClassSubject.ClassID=  int.Parse(ddlClassID.SelectedValue);
     sTD_ClassSubject.AddedBy=  Profile.card_id;
     sTD_ClassSubject.AddedDate=  DateTime.Now;
     sTD_ClassSubject.UpdatedBy=  Profile.card_id;
     sTD_ClassSubject.UpdateDate = DateTime.Now;
     bool  resutl =STD_ClassSubjectManager.UpdateSTD_ClassSubject(sTD_ClassSubject);
     }catch(Exception ex){}Response.Redirect("AdminDisplaySTD_ClassSubject.aspx");
 }
Esempio n. 2
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
     STD_ClassSubject sTD_ClassSubject = new STD_ClassSubject ();
     //	sTD_ClassSubject.ClassSubjectID=  int.Parse(ddlClassSubjectID.SelectedValue);
     sTD_ClassSubject.ClassSubjectName=  txtClassSubjectName.Text;
     sTD_ClassSubject.SubjectID=  int.Parse(ddlSubjectID.SelectedValue);
     sTD_ClassSubject.ClassID=  int.Parse(ddlClassID.SelectedValue);
     sTD_ClassSubject.AddedBy=  Profile.card_id;
     sTD_ClassSubject.AddedDate=  DateTime.Now;
     sTD_ClassSubject.UpdatedBy=  Profile.card_id;
     sTD_ClassSubject.UpdateDate = DateTime.Now;
     int resutl =STD_ClassSubjectManager.InsertSTD_ClassSubject(sTD_ClassSubject);
     }catch(Exception ex){}Response.Redirect("AdminDisplaySTD_ClassSubject.aspx");
 }
Esempio n. 3
0
    public bool UpdateSTD_ClassSubject(STD_ClassSubject sTD_ClassSubject)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("UpdateSTD_ClassSubject", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ClassSubjectID", SqlDbType.Int).Value = sTD_ClassSubject.ClassSubjectID;
            cmd.Parameters.Add("@ClassSubjectName", SqlDbType.NVarChar).Value = sTD_ClassSubject.ClassSubjectName;
            cmd.Parameters.Add("@SubjectID", SqlDbType.Int).Value = sTD_ClassSubject.SubjectID;
            cmd.Parameters.Add("@ClassID", SqlDbType.Int).Value = sTD_ClassSubject.ClassID;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_ClassSubject.UpdatedBy;
            cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_ClassSubject.UpdateDate;
            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = sTD_ClassSubject.ExtraField1 == null ? "" : sTD_ClassSubject.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = sTD_ClassSubject.ExtraField2 == null ? "" : sTD_ClassSubject.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = sTD_ClassSubject.ExtraField3 == null ? "" : sTD_ClassSubject.ExtraField3;
            cmd.Parameters.Add("@ExtraField4", SqlDbType.NVarChar).Value = sTD_ClassSubject.ExtraField4 == null ? "" : sTD_ClassSubject.ExtraField4;
            cmd.Parameters.Add("@ExtraField5", SqlDbType.NVarChar).Value = sTD_ClassSubject.ExtraField5 == null ? "" : sTD_ClassSubject.ExtraField5;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
Esempio n. 4
0
    public STD_ClassSubject GetSTD_ClassSubjectFromReader(IDataReader reader)
    {
        try
        {
            STD_ClassSubject sTD_ClassSubject = new STD_ClassSubject
                (

                     DataAccessObject.IsNULL<int>(reader["ClassSubjectID"]),
                     DataAccessObject.IsNULL<string>(reader["ClassSubjectName"]),
                     DataAccessObject.IsNULL<int>(reader["SubjectID"]),
                     DataAccessObject.IsNULL<int>(reader["ClassID"]),
                     DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]),
                     DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"])
                );
            try
            {
                sTD_ClassSubject.SubjectName = DataAccessObject.IsNULL<string>(reader["SubjectName"].ToString());
            }
            catch (Exception ex)
            {
            }

            try
            {
                sTD_ClassSubject.ExtraField1 = DataAccessObject.IsNULL<string>(reader["ExtraField1"].ToString());
            }
            catch (Exception ex)
            {
            }

            try
            {
                sTD_ClassSubject.ExtraField2 = DataAccessObject.IsNULL<string>(reader["ExtraField2"].ToString());
            }
            catch (Exception ex)
            {
            }

            try
            {
                sTD_ClassSubject.ExtraField3 = DataAccessObject.IsNULL<string>(reader["ExtraField3"].ToString());
            }
            catch (Exception ex)
            {
            }

            try
            {
                sTD_ClassSubject.ExtraField4 = DataAccessObject.IsNULL<string>(reader["ExtraField4"].ToString());
            }
            catch (Exception ex)
            {
            }

            try
            {
                sTD_ClassSubject.ExtraField5 = DataAccessObject.IsNULL<string>(reader["ExtraField5"].ToString());
            }
            catch (Exception ex)
            {
            }
            try
            {
                sTD_ClassSubject.RowStatusID = int.Parse(reader["RowStatusID"].ToString());
            }
            catch (Exception ex)
            {
            }

             return sTD_ClassSubject;
        }
        catch(Exception ex)
        {
            return null;
        }
    }
Esempio n. 5
0
 private void showSTD_ClassSubjectData()
 {
     STD_ClassSubject sTD_ClassSubject  = new STD_ClassSubject ();
      	sTD_ClassSubject = STD_ClassSubjectManager.GetSTD_ClassSubjectByClassSubjectID(Int32.Parse(Request.QueryString["ID"]));
      	txtClassSubjectName.Text =sTD_ClassSubject.ClassSubjectName.ToString();
      	ddlSubjectID.SelectedValue  =sTD_ClassSubject.SubjectID.ToString();
      	ddlClassID.SelectedValue  =sTD_ClassSubject.ClassID.ToString();
 }
Esempio n. 6
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //add Subject
        STD_Class sTD_Class = new STD_Class();
        try
        {

            //	sTD_Class.ClassID=  int.Parse(ddlClassID.SelectedValue);
            sTD_Class.ClassName = txtClassName.Text;
            sTD_Class.CourseID = int.Parse(ddlCourseID.SelectedValue);
            sTD_Class.ClassTypeID = 2;
            sTD_Class.ClassStatusID = 1;
            sTD_Class.AddedBy = Profile.card_id;
            sTD_Class.AddedDate = DateTime.Now;
            sTD_Class.UpdatedBy = Profile.card_id;
            sTD_Class.UpdateDate = DateTime.Now;
            sTD_Class.ClassID = STD_ClassManager.InsertSTD_Class(sTD_Class);
        }
        catch (Exception ex) { }

        //Add Student
        try {
            string ids = getStudentIDs(gvStudents);
            if (ids != "")
            {
                STD_ClassStudent sTD_ClassStudent = new STD_ClassStudent();
                sTD_ClassStudent.ClassStudentName = "";
                sTD_ClassStudent.StudentID = ids;
                sTD_ClassStudent.ClassID = sTD_Class.ClassID;
                sTD_ClassStudent.AddedBy = Profile.card_id;
                sTD_ClassStudent.AddedDate = DateTime.Now;
                sTD_ClassStudent.UpdatedBy = Profile.card_id;
                sTD_ClassStudent.UpdateDate = DateTime.Now;
                int resutl = STD_ClassStudentManager.InsertSTD_ClassStudent_List_KeepStudentInMultipleClassActive(sTD_ClassStudent);

                //string message = resutl + " New Entry Created";
                //ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Message", "alert('" + message + "');", true);

            }
        }
        catch (Exception ex) { }

        //Class Subject
        try
        {
            //delete all the rows for the
            STD_ClassSubjectManager.DeleteSTD_ClassSubjectByClassID(sTD_Class.ClassID);

            foreach (GridViewRow gr in gvSubject.Rows)
            {
                CheckBox chkSelect = (CheckBox)gr.FindControl("chkSelect");

                HiddenField hfSubjectID = (HiddenField)gr.FindControl("hfSubjectID");
                DropDownList ddlTeacherID = (DropDownList)gr.FindControl("ddlTeacherID");
                TextBox txtStartDate = (TextBox)gr.FindControl("txtStartDate");
                TextBox txtEndDate = (TextBox)gr.FindControl("txtEndDate");

                if (chkSelect.Checked)
                {
                    STD_ClassSubject sTD_ClassSubject = new STD_ClassSubject();
                    sTD_ClassSubject.ClassSubjectName = "1";
                    sTD_ClassSubject.SubjectID = int.Parse(hfSubjectID.Value);
                    sTD_ClassSubject.ClassID = sTD_Class.ClassID;
                    sTD_ClassSubject.ExtraField1 = txtStartDate.Text;
                    sTD_ClassSubject.ExtraField2 = txtEndDate.Text;
                    sTD_ClassSubject.ExtraField3 = "";
                    sTD_ClassSubject.ExtraField4 = "";
                    sTD_ClassSubject.ExtraField5 = "";
                    sTD_ClassSubject.AddedBy = Profile.card_id;
                    sTD_ClassSubject.AddedDate = DateTime.Now;
                    sTD_ClassSubject.UpdatedBy = Profile.card_id;
                    sTD_ClassSubject.UpdateDate = DateTime.Now;
                    sTD_ClassSubject.ClassSubjectID = STD_ClassSubjectManager.InsertSTD_ClassSubject(sTD_ClassSubject);

                    if (ddlTeacherID.SelectedIndex != 0)
                    {
                        STD_ClassSubjectEmployee sTD_ClassSubjectEmployee = new STD_ClassSubjectEmployee();
                        //	sTD_ClassSubjectEmployee.ClassSubjectEmployeeID=  int.Parse(ddlClassSubjectEmployeeID.SelectedValue);
                        sTD_ClassSubjectEmployee.ClassSubjectEmployeeName = "Need to fix later";
                        sTD_ClassSubjectEmployee.EmployeeID = ddlTeacherID.SelectedValue;
                        sTD_ClassSubjectEmployee.ClassSubjectID = sTD_ClassSubject.ClassSubjectID;
                        sTD_ClassSubjectEmployee.AddedBy = Profile.card_id;
                        sTD_ClassSubjectEmployee.AddedDate = DateTime.Now;
                        sTD_ClassSubjectEmployee.UpdatedBy = Profile.card_id;
                        sTD_ClassSubjectEmployee.UpdateDate = DateTime.Now;
                        sTD_ClassSubjectEmployee.ClassSubjectEmployeeID = STD_ClassSubjectEmployeeManager.InsertSTD_ClassSubjectEmployee(sTD_ClassSubjectEmployee);
                    }

                    //Add Student
                    try
                    {
                        string ids = getStudentIDs(gvStudents);
                        if (ids != "")
                        {
                            STD_ClassSubjectStudent sTD_ClassSubjectStudent = new STD_ClassSubjectStudent();
                            sTD_ClassSubjectStudent.ClassSubjectStudentName = "Need to fix later";
                            sTD_ClassSubjectStudent.StudentID = ids;
                            sTD_ClassSubjectStudent.ClassSubjectID = sTD_ClassSubject.ClassSubjectID;
                            sTD_ClassSubjectStudent.AddedBy = Profile.card_id;
                            sTD_ClassSubjectStudent.AddedDate = DateTime.Now;
                            sTD_ClassSubjectStudent.UpdatedBy = Profile.card_id;
                            sTD_ClassSubjectStudent.UpdateDate = DateTime.Now;
                            int resutl = STD_ClassSubjectStudentManager.InsertSTD_ClassSubjectStudent_List_KeepStudentInMultipleClassActive(sTD_ClassSubjectStudent);
                        }
                    }
                    catch (Exception ex) { }
                }
            }

        }
        catch (Exception ex) { }

        Response.Redirect("Enrollment.aspx?Message=Saved succfully..");
    }
Esempio n. 7
0
 public static bool UpdateSTD_ClassSubject(STD_ClassSubject sTD_ClassSubject)
 {
     SqlSTD_ClassSubjectProvider sqlSTD_ClassSubjectProvider = new SqlSTD_ClassSubjectProvider();
     return sqlSTD_ClassSubjectProvider.UpdateSTD_ClassSubject(sTD_ClassSubject);
 }
Esempio n. 8
0
 public static int InsertSTD_ClassSubject(STD_ClassSubject sTD_ClassSubject)
 {
     SqlSTD_ClassSubjectProvider sqlSTD_ClassSubjectProvider = new SqlSTD_ClassSubjectProvider();
     return sqlSTD_ClassSubjectProvider.InsertSTD_ClassSubject(sTD_ClassSubject);
 }
Esempio n. 9
0
 public static STD_ClassSubject GetSTD_SubjectBySubjectIDnClassID(int SubjectID,int ClassID)
 {
     STD_ClassSubject sTD_ClassSubject = new STD_ClassSubject();
     SqlSTD_ClassSubjectProvider sqlSTD_ClassSubjectProvider = new SqlSTD_ClassSubjectProvider();
     sTD_ClassSubject = sqlSTD_ClassSubjectProvider.GetSTD_ClassSubjectBySubjectIDnClassID(SubjectID,ClassID);
     return sTD_ClassSubject;
 }
Esempio n. 10
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            //delete all the rows for the
            //STD_ClassSubjectManager.DeleteSTD_ClassSubjectByClassID(int.Parse(ddlClassID.SelectedValue));

            string ids = getSubjectID();

            foreach (GridViewRow gr in gvSubject.Rows)
            {
                CheckBox chkSelect = (CheckBox)gr.FindControl("chkSelect");

                HiddenField hfSubjectID = (HiddenField)gr.FindControl("hfSubjectID");

                TextBox txtStartDate = (TextBox)gr.FindControl("txtStartDate");
                TextBox txtEndDate = (TextBox)gr.FindControl("txtEndDate");

                if (chkSelect.Checked)
                {
                    STD_ClassSubject sTD_ClassSubject = new STD_ClassSubject();
                    //	sTD_ClassSubject.ClassSubjectID=  int.Parse(ddlClassSubjectID.SelectedValue);
                    sTD_ClassSubject.ClassSubjectName = "1";
                    sTD_ClassSubject.SubjectID = int.Parse(hfSubjectID.Value);
                    sTD_ClassSubject.ClassID = int.Parse(ddlClassID.SelectedValue);
                    sTD_ClassSubject.ExtraField1 = txtStartDate.Text;
                    sTD_ClassSubject.ExtraField2 = txtEndDate.Text;
                    sTD_ClassSubject.ExtraField3 = "";
                    sTD_ClassSubject.ExtraField4 = "";
                    sTD_ClassSubject.ExtraField5 = "";
                    sTD_ClassSubject.AddedBy = Profile.card_id;
                    sTD_ClassSubject.AddedDate = DateTime.Now;
                    sTD_ClassSubject.UpdatedBy = Profile.card_id;
                    sTD_ClassSubject.UpdateDate = DateTime.Now;
                    int resutl = STD_ClassSubjectManager.InsertSTD_ClassSubject(sTD_ClassSubject);
                }
                else
                {
                    if (bool.Parse(((HiddenField)gr.FindControl("hfPreviouslyChecked")).Value))
                    {
                        STD_ClassSubjectManager.DeleteSTD_ClassSubjectByClassIDnSubjectID(int.Parse(ddlClassID.SelectedValue), int.Parse(hfSubjectID.Value));
                    }
                }
            }

            //string ids=getSubjectID();
            //if (ids != "")
            //{
            //    string[] words = ids.Split(',');
            //    foreach (string word in words)
            //    {
            //        if (word != "")
            //        {
            //            STD_ClassSubject sTD_ClassSubject = new STD_ClassSubject();
            //            //	sTD_ClassSubject.ClassSubjectID=  int.Parse(ddlClassSubjectID.SelectedValue);
            //            sTD_ClassSubject.ClassSubjectName = "1";
            //            sTD_ClassSubject.SubjectID = int.Parse(word);
            //            sTD_ClassSubject.ClassID = int.Parse(ddlClassID.SelectedValue);
            //            sTD_ClassSubject.ExtraField1 = "";
            //            sTD_ClassSubject.ExtraField2 = "";
            //            sTD_ClassSubject.ExtraField3 = "";
            //            sTD_ClassSubject.ExtraField4 = "";
            //            sTD_ClassSubject.ExtraField5 = "";
            //            sTD_ClassSubject.AddedBy = Profile.card_id;
            //            sTD_ClassSubject.AddedDate = DateTime.Now;
            //            sTD_ClassSubject.UpdatedBy = Profile.card_id;
            //            sTD_ClassSubject.UpdateDate = DateTime.Now;
            //            int resutl = STD_ClassSubjectManager.InsertSTD_ClassSubject(sTD_ClassSubject);
            //        }
            //    }
            //}

        }
        catch (Exception ex) { }

        Response.Redirect("ClassSubjectAddTeacher.aspx?ID=" + ddlClassID.SelectedValue); //loadGrid();
    }
Esempio n. 11
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        try
        {
            //delete all the rows for the
            STD_ClassSubjectManager.DeleteSTD_ClassSubjectByClassID(int.Parse(ddlClassID.SelectedValue));

            string ids = getSubjectID();
            if (ids != "")
            {
                string[] words = ids.Split(',');
                foreach (string word in words)
                {
                    if (word != "")
                    {
                        STD_ClassSubject sTD_ClassSubject = new STD_ClassSubject();
                        sTD_ClassSubject.ClassSubjectName = ddlClassID.SelectedItem.Text ;
                        sTD_ClassSubject.SubjectID = int.Parse(word);
                        sTD_ClassSubject.ClassID = int.Parse(ddlClassID.SelectedValue);
                        sTD_ClassSubject.AddedBy = Profile.card_id;
                        sTD_ClassSubject.AddedDate = DateTime.Now;
                        sTD_ClassSubject.UpdatedBy = Profile.card_id;
                        sTD_ClassSubject.UpdateDate = DateTime.Now;
                        int resutl = STD_ClassSubjectManager.InsertSTD_ClassSubject(sTD_ClassSubject);
                    }
                }
            }
        }
        catch (Exception ex) { }
        Response.Redirect("ClassSubjectAddTeacher.aspx?ID=" + ddlClassID.SelectedValue); //loadGrid();
        btnUpdate.Visible = false;
    }