public DataSet.DsPSMS.ST_SUBJECT_MSTDataTable getAllSubjectName(string subjectId, out string msg)
 {
     DataSet.DsPSMS.ST_SUBJECT_MSTDataTable result = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable();
     try
     {
         db.Open();
         result = db.getAllSubjectName(subjectId);
         if (result != null && result.Rows.Count > 0)
         {
             msg = result.Rows.Count + " user found";
         }
         else
         {
             result = null;
             msg    = "user not found";
         }
     }
     catch
     {
         msg = "error has occure when insert data";
         return(null);
     }
     finally
     {
         db.Close();
     }
     return(result);
 }
 public DataSet.DsPSMS.ST_SUBJECT_MSTDataTable selectSubjectByID(DataSet.DsPSMS.ST_SUBJECT_MSTRow subject, out string msg)
 {
     DataSet.DsPSMS.ST_SUBJECT_MSTDataTable result = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable();
     if (subject == null)
     {
         msg = "data is empty ";
         return(result);
     }
     try
     {
         db.Open();
         if (subject.SUBJECT_ID != null)
         {
             result = db.selectSubjectByID(subject);
         }
     }
     catch
     {
         msg = "error has occure when insert data";
         return(result);
     }
     finally
     {
         db.Close();
     }
     msg = "exist user";
     return(result);
 }
Esempio n. 3
0
 private void displaySubjectInGridView()
 {
     DataSet.DsPSMS.ST_SUBJECT_MSTDataTable resultDt = service.getAllSubjectData(out msg);
     if (resultDt != null)
     {
         subjectGridView.DataSource = resultDt;
         subjectGridView.DataBind();
     }
 }
        public DataSet.DsPSMS.ST_SUBJECT_MSTDataTable selectAllSubjectData()
        {
            string         query = "SELECT * FROM ST_SUBJECT_MST ORDER BY SUBJECT_ID ";
            SqlCommand     cmd   = new SqlCommand(query, conn);
            SqlDataAdapter da    = new SqlDataAdapter(cmd);

            DataSet.DsPSMS.ST_SUBJECT_MSTDataTable dt = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable();
            da.Fill(dt);
            return(dt);
        }
        //public DataSet.DsPSMS.ST_TEACHER_GRADERow selectTeacherGradeID(DataSet.DsPSMS.ST_TEACHER_GRADERow dr)
        //{
        //    string query = "SELECT * FROM ST_TEACHER_GRADE WHERE TEACHER_ID='" + dr.TEACHER_ID + "'and TEACH_GRADE='" + dr.TEACH_GRADE + "'and TEACH_SUBJECT='" + dr.TEACH_SUBJECT + "'";
        //    SqlCommand cmd = new SqlCommand(query, conn);
        //    SqlDataAdapter da = new SqlDataAdapter(cmd);
        //    DataSet.DsPSMS.ST_GRADE_SUBJECT_DETAILDataTable dt = new DataSet.DsPSMS.ST_GRADE_SUBJECT_DETAILDataTable();
        //    da.Fill(dt);
        //    //return single row
        //    return dt[0];
        //}

        public DataSet.DsPSMS.ST_SUBJECT_MSTDataTable getAllSubjectName(String subjectID)
        {
            string         query = "SELECT * FROM ST_SUBJECT_MST WHERE SUBJECT_ID IN (" + subjectID + ")";
            SqlCommand     cmd   = new SqlCommand(query, conn);
            SqlDataAdapter da    = new SqlDataAdapter(cmd);

            DataSet.DsPSMS.ST_SUBJECT_MSTDataTable dt = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable();
            da.Fill(dt);
            return(dt);
        }
Esempio n. 6
0
        public DataSet.DsPSMS.ST_SUBJECT_MSTDataTable selectSubjectByID(DataSet.DsPSMS.ST_SUBJECT_MSTRow dr)
        {
            string         query = "SELECT * FROM ST_SUBJECT_MST where SUBJECT_ID= '" + dr.SUBJECT_ID + "'";
            SqlCommand     cmd   = new SqlCommand(query, conn);
            SqlDataAdapter da    = new SqlDataAdapter(cmd);

            DataSet.DsPSMS.ST_SUBJECT_MSTDataTable dt = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable();
            da.Fill(dt);
            return(dt);
        }
Esempio n. 7
0
 public void bindThuSubject()
 {
     msg = "aaa";
     ddlthusublist.Items.Clear();
     DataSet.DsPSMS.ST_SUBJECT_MSTDataTable grades = timeService.getAllSubjectData(out msg);
     ddlthusublist.DataSource     = grades;
     ddlthusublist.DataTextField  = "SUBJECT_NAME";
     ddlthusublist.DataValueField = "SUBJECT_ID";
     ddlthusublist.DataBind();
     ddlthusublist.Items.Insert(0, new ListItem("Select Subject", "0"));
 }
        public DataSet.DsPSMS.ST_SUBJECT_MSTRow selectSubjectByid(int id)
        {
            //conn.Open();
            string         query = "SELECT * FROM ST_SUBJECT_MST WHERE SUBJECT_ID=" + id;
            SqlCommand     cmd   = new SqlCommand(query, conn);
            SqlDataAdapter da    = new SqlDataAdapter(cmd);

            DataSet.DsPSMS.ST_SUBJECT_MSTDataTable dt = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable();
            da.Fill(dt);
            //return single row
            return(dt[0]);
        }
Esempio n. 9
0
        protected void btnUpdateSubject_Click(object sender, EventArgs e)
        {
            LinkButton btn           = (LinkButton)(sender);
            string     editSubjectId = btn.CommandName;

            subjectId.Text    = editSubjectId;
            subjectId.Enabled = false;

            subjectRow = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable().NewST_SUBJECT_MSTRow();
            if (editSubjectId != null)
            {
                subjectRow.SUBJECT_ID = editSubjectId;
            }
            DataSet.DsPSMS.ST_SUBJECT_MSTDataTable subjectData = service.selectSubjectByID(subjectRow, out msg);
            subjectName.Text = subjectData.Rows[0]["SUBJECT_NAME"].ToString();

            subjectAdd.Text        = "Update";
            subjectDelete.Enabled  = false;
            subjectShowAll.Enabled = false;
        }
Esempio n. 10
0
        protected void btnDeleteSubject_Click(object sender, EventArgs e)
        {
            subjectRow = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable().NewST_SUBJECT_MSTRow();
            msg        = "";
            if (!checkValidationForSubject())
            {
                subjectRow.SUBJECT_ID   = subjectId.Text;
                subjectRow.SUBJECT_NAME = subjectName.Text;
                DataSet.DsPSMS.ST_SUBJECT_MSTDataTable subjectData = service.selectSubjectByID(subjectRow, out msg);

                if (subjectData != null && subjectData.Rows.Count > 0)
                {
                    service.deleteSubject(subjectRow, out msg);
                    displaySubjectData();
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Data doesn't exist");
                }
            }
        }
Esempio n. 11
0
        private void displayGradeSubjectData()
        {
            DataSet.DsPSMS.ST_GRADE_SUBJECT_DETAILDataTable resultDt = service.getAllGradeSubjectData(out msg);
            gradeSubjectGridView.DataSource = null;
            gradeSubjectGridView.DataBind();

            if (resultDt != null)
            {
                BoundField subjectNameList = new BoundField();
                subjectNameList.HeaderText = "Subject";

                foreach (DataSet.DsPSMS.ST_GRADE_SUBJECT_DETAILRow row in resultDt.Rows)
                {
                    string subjectIdList = null;
                    string subjectName   = null;
                    if (row.SUBJECT_ID_LIST != null)
                    {
                        subjectIdList = row.SUBJECT_ID_LIST.ToString();
                    }

                    DataSet.DsPSMS.ST_SUBJECT_MSTDataTable subject = service.getAllSubjectName(subjectIdList, out msg);

                    foreach (DataSet.DsPSMS.ST_SUBJECT_MSTRow subjectRow in subject.Rows)
                    {
                        subjectName += subjectRow.SUBJECT_NAME.ToString();
                        subjectName += ",";
                    }
                    subjectName = subjectName.Substring(0, subjectName.Length - 1);

                    row.SUBJECT_ID_LIST = subjectName;

                    DataSet.DsPSMS.ST_GRADE_MSTRow grade = new DataSet.DsPSMS.ST_GRADE_MSTDataTable().NewST_GRADE_MSTRow();
                    grade.GRADE_ID = row.GRADE_ID;
                    DataSet.DsPSMS.ST_GRADE_MSTDataTable result = service.selectGradeByID(grade, out msg);
                    row.GRADE_ID = result.Rows[0]["GRADE_NAME"].ToString();
                }
                gradeSubjectGridView.DataSource = resultDt;
                gradeSubjectGridView.DataBind();
            }
        }
Esempio n. 12
0
        protected void btnAddSubject_Click(object sender, EventArgs e)
        {
            subjectRow = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable().NewST_SUBJECT_MSTRow();
            if (!checkValidationForSubject())
            {
                if (subjectAdd.Text.Equals("Add"))
                {
                    msg = "";
                    subjectRow.SUBJECT_ID   = subjectId.Text;
                    subjectRow.SUBJECT_NAME = subjectName.Text;
                    DataSet.DsPSMS.ST_SUBJECT_MSTDataTable subjectData = service.selectSubjectByID(subjectRow, out msg);

                    if (subjectData != null && subjectData.Rows.Count > 0)
                    {
                        ModelState.AddModelError(string.Empty, "Data already exists");
                    }
                    else
                    {
                        service.saveSubject(subjectRow, out msg);
                    }
                }
                else if (subjectAdd.Text.Equals("Update"))
                {
                    subjectRow.SUBJECT_NAME = subjectName.Text;
                    subjectRow.SUBJECT_ID   = subjectId.Text;
                    service.updateSubject(subjectRow, out msg);

                    subjectAdd.Text        = "Add";
                    subjectId.Enabled      = true;
                    subjectDelete.Enabled  = true;
                    subjectShowAll.Enabled = true;
                }
                displaySubjectData();
                displaySubjectInGridView();
                subjectId.Text   = "";
                subjectName.Text = "";
            }
        }
Esempio n. 13
0
 public DataSet.DsPSMS.ST_SUBJECT_MSTRow getSubjectByid(int id)
 {
     DataSet.DsPSMS.ST_SUBJECT_MSTRow resultData = new DataSet.DsPSMS.ST_SUBJECT_MSTDataTable().NewST_SUBJECT_MSTRow();
     resultData = timedb.selectSubjectByid(id);
     return(resultData);
 }