コード例 #1
0
        private DataTable getDataFromUserType(string usertyp)
        {
            DBSqlConnection con   = new DBSqlConnection();
            string          query = @"SELECT * FROM [dbo].[UserType] where [UserType] = '" + usertyp + "' ";
            DataTable       dt    = new DataTable();

            try
            {
                SqlDataAdapter da = new SqlDataAdapter(query, con.getSqlConnection());
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    txtUtyp.Text = dt.Rows[0]["UserType"].ToString();
                }
            }
            catch (Exception r)
            {
                r.Message.ToString();
            }
            finally
            {
                con.CloseConnection();
            }
            return(dt);
        }
コード例 #2
0
        //#endregion

        public string topsSave(string dateH, string nameH)
        {
            string          save = "";
            string          upd  = @"INSERT INTO [dbo].[Holidaylist]([FullDate],[HolidayName])VALUES('" + dateH + "','" + nameH + "')";
            DBSqlConnection con  = new DBSqlConnection();

            con.getSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(upd, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                lblMsg.Text = "Data Save Successfully.";
            }
            catch (Exception r)
            {
                save        = r.Message;
                lblMsg.Text = r.Message;
            }
            finally
            {
                con.CloseConnection();
            }
            return(save);
        }
コード例 #3
0
        private string cTopicSave(string cTitle, string cTopic, string cId)
        {
            string          save = "";
            string          upd  = @"INSERT INTO [dbo].[Course_Topic]([Title],[Topic],[Co_ID])VALUES('" + cTitle + "','" + cTopic + "','" + cId + "')";
            DBSqlConnection con  = new DBSqlConnection();

            con.getSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(upd, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                lblMsg.Text = "Data Save Successfully.";
            }
            catch (Exception r)
            {
                save        = r.Message;
                lblMsg.Text = r.Message;
            }
            finally
            {
                con.CloseConnection();
            }
            return(save);
        }
コード例 #4
0
        private DataTable getDepIdFromD(int depId)
        {
            DataTable       dtgridtridual = new DataTable();
            string          sqldual       = @"SELECT [Topic]  FROM [dbo].[Departments]  WHERE [Dep_ID] ='" + depId + "' ";
            DBSqlConnection con           = new DBSqlConnection();

            try
            {
                SqlDataAdapter dagridual = new SqlDataAdapter(sqldual, con.getSqlConnection());
                dagridual.Fill(dtgridtridual);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dtgridtridual = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dtgridtridual);
        }
コード例 #5
0
        private DataTable dep()
        {
            string          sql3 = @"select * from [dbo].[Departments]";
            DBSqlConnection con  = new DBSqlConnection();
            DataTable       dt   = new DataTable();

            try
            {
                SqlDataAdapter da = new SqlDataAdapter(sql3, con.getSqlConnection());
                da.Fill(dt);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dt = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dt);
        }
コード例 #6
0
        private DataTable GetDataFromTriTopic(string title)
        {
            DBSqlConnection con = new DBSqlConnection();
            string          sql = @"select * from [dbo].[Course_Topic] where [Title]='" + title + "'";
            DataTable       dt  = new DataTable();

            try
            {
                SqlDataAdapter da = new SqlDataAdapter(sql, con.getSqlConnection());
                da.Fill(dt);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dt = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dt);
        }
コード例 #7
0
        private DataTable GetDataFromFaculty(string facId)
        {
            DBSqlConnection con = new DBSqlConnection();
            string          sql = @"select * from [dbo].[Faculties] where [ShortName]='" + facId + "'";
            DataTable       dt  = new DataTable();

            try
            {
                SqlDataAdapter da = new SqlDataAdapter(sql, con.getSqlConnection());
                da.Fill(dt);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dt = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dt);
        }
コード例 #8
0
        private DataTable GetDataTopTri(string facId)
        {
            DataTable       dtgridtrid = new DataTable();
            string          sqltri     = @"select * from [dbo].[CourseTriTopic] where  [FacName]='" + facId + "'";
            DBSqlConnection con        = new DBSqlConnection();

            try
            {
                SqlDataAdapter dagrid = new SqlDataAdapter(sqltri, con.getSqlConnection());
                dagrid.Fill(dtgridtrid);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dtgridtrid = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dtgridtrid);
        }
コード例 #9
0
        private DataTable GetDataTopDual(string coId)
        {
            DataTable       dtgridtridual = new DataTable();
            string          sqldual       = @"select * from [dbo].[DualSemCourseTopic] where [Co_ID]='" + coId + "' ";
            DBSqlConnection con           = new DBSqlConnection();

            try
            {
                SqlDataAdapter dagridual = new SqlDataAdapter(sqldual, con.getSqlConnection());
                dagridual.Fill(dtgridtridual);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dtgridtridual = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dtgridtridual);
        }
コード例 #10
0
        private DataTable GetDataFromFaculy(string depId)
        {
            DBSqlConnection con = new DBSqlConnection();
            string          sql = @"select * from [dbo].[Departments] where [Dep_ID]='" + depId + "'; ";
            DataTable       dt  = new DataTable();

            try
            {
                SqlDataAdapter da = new SqlDataAdapter(sql, con.getSqlConnection());
                da.Fill(dt);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dt = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dt);
        }
コード例 #11
0
        private DataTable GetDataMarksLab()
        {
            DataTable       dtgridtridual = new DataTable();
            string          sqldual       = @"select * from [dbo].[Marks-Lab-Tri] ";
            DBSqlConnection con           = new DBSqlConnection();

            try
            {
                SqlDataAdapter dagridual = new SqlDataAdapter(sqldual, con.getSqlConnection());
                dagridual.Fill(dtgridtridual);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dtgridtridual = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dtgridtridual);
        }
コード例 #12
0
        private bool DeleteFromDataTabel(string DelId)
        {
            bool            isDelt = false;
            string          sql    = "Delete From Faculties WHERE  FId='" + DelId + "' ";
            DBSqlConnection con    = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isDelt = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isDelt = false;
            }
            finally
            {
                con.CloseConnection();
            }
            return(isDelt);
        }
コード例 #13
0
        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            bool            isDelt = false;
            string          sql    = "DELETE FROM  [dbo].[DateTable] ";
            DBSqlConnection con    = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isDelt = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isDelt = false;
            }
            finally
            {
                con.CloseConnection();
            }
            Response.Redirect("/UIDesign/CourseOutLine.aspx");
        }
コード例 #14
0
        private DataTable GetSearchDataTopic(int cCode)
        {
            DataTable dtgridtridual = new DataTable();
            string    sqldual       = @"select DateTable.Id, DateTable.FullDate, DateTable.Activities, Course_Topic.Topic from DateTable inner join Course_Topic on Course_Topic.CoT_ID=DateTable.CoT_ID";

            DBSqlConnection con = new DBSqlConnection();

            try
            {
                SqlDataAdapter dagridual = new SqlDataAdapter(sqldual, con.getSqlConnection());
                dagridual.Fill(dtgridtridual);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dtgridtridual = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dtgridtridual);
        }
コード例 #15
0
        private bool DeleteFromDeptTable(string Id)
        {
            bool            isDelt = false;
            string          sql    = "DELETE FROM [dbo].[Users] WHERE  User_ID='" + Id + "' ";
            DBSqlConnection con    = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isDelt = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isDelt = false;
            }
            finally
            {
                con.CloseConnection();
            }
            return(isDelt);
        }
コード例 #16
0
        private DataTable GetSearchFullUser()
        {
            DataTable dt      = new DataTable();
            string    sqldual = @"SELECT * FROM [dbo].[Users]";

            DBSqlConnection con = new DBSqlConnection();

            try
            {
                SqlDataAdapter da = new SqlDataAdapter(sqldual, con.getSqlConnection());
                da.Fill(dt);
            }
            catch (Exception r)
            {
                r.Message.ToString();
                dt = null;
            }
            finally
            {
                con.CloseConnection();
            }
            return(dt);
        }
        private bool updateTopic(string ctitle, string topic, string ctId)
        {
            bool   isUp = false;
            string sql  = "UPDATE [dbo].[Course_Topic] SET [Title] ='" + ctitle + "' ,[Topic] ='" + topic + "' WHERE [CoT_ID] ='" + ctId + "' ";

            DBSqlConnection con = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isUp = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isUp = false;
            }
            finally
            {
                con.CloseConnection();
            }
            return(isUp);
        }
コード例 #18
0
        private bool upDateUser(string uId, string fullName, string depName, string uType, string passWord)
        {
            bool   isUp = false;
            string sql  = "UPDATE [dbo].[Users] SET [UserName] ='" + fullName + "', [Department] = '" + depName + "' , [User_Type] = '" + uType + "' , [Password] = '" + passWord + "' WHERE [User_ID] ='" + depId + "' ";

            DBSqlConnection con = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isUp = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isUp = false;
            }
            finally
            {
                con.CloseConnection();
            }
            return(isUp);
        }
コード例 #19
0
        private int saveCourseInfo(string fullname, string depName, string uType, string passWord)
        {
            int             save    = 0;
            DBSqlConnection con     = new DBSqlConnection();
            string          sqlCinf = @"INSERT INTO [dbo].[Users] ([UserName]  ,[Department]   ,[User_Type] ,[Password] ) VALUES  ('" + fullname + "','" + depName + "','" + uType + "','" + passWord + "')";

            try
            {
                SqlCommand cmd = new SqlCommand(sqlCinf, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                save++;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                save = 0;
            }
            finally
            {
                con.CloseConnection();
            }

            return(save);
        }
コード例 #20
0
        private int saveCourseInfo(string mName, string mPath)
        {
            int             save    = 0;
            DBSqlConnection con     = new DBSqlConnection();
            string          sqlCinf = @"INSERT INTO [dbo].[UMenu] ([Menu_Name]  ,[Menu_Path] ) VALUES  ('" + mName + "','" + mPath + "')";

            try
            {
                SqlCommand cmd = new SqlCommand(sqlCinf, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                save++;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                save = 0;
            }
            finally
            {
                con.CloseConnection();
            }

            return(save);
        }
コード例 #21
0
        private bool updateFaculty(string fastName, string lastName, string shortName, string conNum, string email, string depName, string facID)
        {
            bool   isUp = false;
            string sql  = "UPDATE [dbo].[Faculties] SET [FirstName] ='" + fastName + "' ,[LastName] ='" + lastName + "' , [ShortName] ='" + shortName + "' , [ContactNo] ='" + conNum + "' , [Email] ='" + email + "', [Dep_ID] ='" + depName + "' WHERE [FId] ='" + facID + "' ";

            DBSqlConnection con = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isUp = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isUp = false;
            }
            finally
            {
                con.CloseConnection();
            }
            return(isUp);
        }
コード例 #22
0
        private int saveRoleId(string rType)
        {
            int             save    = 0;
            DBSqlConnection con     = new DBSqlConnection();
            string          sqlCinf = @"INSERT INTO [dbo].[UserType] ([UType] ) VALUES  ('" + rType + "')";

            try
            {
                SqlCommand cmd = new SqlCommand(sqlCinf, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                save++;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                save = 0;
            }
            finally
            {
                con.CloseConnection();
            }

            return(save);
        }
コード例 #23
0
        private bool updateHoliDate(string holiName, string holiDate, string facID)
        {
            bool   isUp = false;
            string sql  = "UPDATE [dbo].[Holidaylist] SET [HolidayName] ='" + holiName + "' ,[FullDate] ='" + holiDate + "' WHERE [Id] ='" + facID + "' ";

            DBSqlConnection con = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isUp = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isUp = false;
            }
            finally
            {
                con.CloseConnection();
            }
            return(isUp);
        }
コード例 #24
0
        private bool updateCourser(string cCod, string cTitle, string credit, string cID)
        {
            bool   isUp = false;
            string sql  = "UPDATE [dbo].[Courses] SET [Course_Code] ='" + cCod + "' ,[Title] ='" + cTitle + "', [Credit_Hour] ='" + credit + "' WHERE [Co_ID] ='" + cID + "' ";

            DBSqlConnection con = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isUp = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isUp = false;
            }
            finally
            {
                con.CloseConnection();
            }
            return(isUp);
        }
コード例 #25
0
        private bool upDateUser(string mId, string mName, string mPath)
        {
            bool   isUp = false;
            string sql  = "UPDATE [dbo].[UMenu] SET [Menu_Name] ='" + mName + "', [Menu_Path] = '" + mPath + "'  WHERE [Id] ='" + mId + "' ";

            DBSqlConnection con = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isUp = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isUp = false;
            }
            finally
            {
                con.CloseConnection();
            }
            return(isUp);
        }
コード例 #26
0
        private int savePerId(string mId, string rId)
        {
            int             save    = 0;
            DBSqlConnection con     = new DBSqlConnection();
            string          sqlCinf = @"INSERT INTO [dbo].[UPermission] ([MenuId]  ,[RoleId] ) VALUES  ('" + mId + "','" + rId + "')";

            try
            {
                SqlCommand cmd = new SqlCommand(sqlCinf, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                save++;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                save = 0;
            }
            finally
            {
                con.CloseConnection();
            }

            return(save);
        }
コード例 #27
0
        private bool upDateUser(string depName, string depFloor, string depId)
        {
            bool   isUp = false;
            string sql  = "UPDATE [dbo].[Departments] SET [DepName] ='" + depName + "', [Dep_Floor] = '" + depFloor + "' WHERE [Dep_ID] ='" + depId + "' ";

            DBSqlConnection con = new DBSqlConnection();

            try
            {
                SqlCommand cmd = new SqlCommand(sql, con.getSqlConnection());
                cmd.ExecuteNonQuery();
                isUp = true;
            }
            catch (Exception r)
            {
                r.Message.ToString();
                isUp = false;
            }
            finally
            {
                con.CloseConnection();
            }
            return(isUp);
        }
コード例 #28
0
        //public void LoadFullDataTop()
        //{

        //    if (DDDay.Text == day && DDSem.Text == semester && txtYear.Text == ayear && txtCCode.Text == cCode)
        //    {
        //        GetDataFromTCTopics(cCode);
        //    }
        //}
        //create shedule for Topics
        protected void btnCreat_Click(object sender, EventArgs e)
        {
            DDSem.Enabled       = true;
            txtCCode.Enabled    = false;
            DDDay.Enabled       = false;
            txtYear.Enabled     = false;
            ddCoTSelect.Enabled = false;
            txtFName.Enabled    = false;
            txtDatime.Enabled   = false;
            txtRoomNo.Enabled   = false;
            ddMarks.Enabled     = false;
            btnCreat.Enabled    = false;
            btnPrint.Enabled    = true;
            btnRefresh.Enabled  = true;
            //btnSear.Enabled = false;


            activities = "Class";

            int start, end, i, j, k;

            day      = DDDay.Text;
            semester = txtSems.Text;
            ayear    = txtYear.Text;

            fId     = txtFName.Text;
            dTimes  = txtDatime.Text;
            rRoomNo = txtRoomNo.Text;

            activities = "Class";

            txtCShedule.Text = "Day Time :  " + dTimes + " ;  Room No :  " + rRoomNo;
            cCoId            = Convert.ToInt32(txtCoId.Text);
            //cTId = Convert.ToInt32(txtCTId.Text);

            DateTime dateValue;

            if (day != null && semester != null && ayear != null)
            {
                if (semester == "Spring")
                {
                    start = 1;
                    end   = 4;
                }
                else if (semester == "Summer")
                {
                    start = 5;
                    end   = 8;
                }
                else
                {
                    start = 9;
                    end   = 12;
                }

                j = 0;


                cserialId = 0;
                //var serialIdPossition = 0;

                cTId = 0;

                var cTIdPossition = 0;
                if (!day.Contains("-"))
                {
                    for (k = start; k <= end; k++)
                    {
                        for (i = 1; i <= DateTime.DaysInMonth(Convert.ToInt32(ayear), k); i++)
                        {
                            dateValue = new DateTime(Convert.ToInt32(ayear), k, i);

                            string d = (dateValue.ToString("dddd"));
                            //string dval = GetHoliday(dateValue.ToShortDateString());

                            if (dateValue.ToString("dddd") == day)
                            {
                                if (!GetHoliday(i + "/" + k + "/" + ayear))
                                {
                                    cTId = GetcTId(cTIdPossition);
                                    if (cTId != 0)
                                    {
                                        cTIdPossition++;
                                        DBSqlConnection con = new DBSqlConnection();
                                        //string sql = @"insert into [dbo].[RutineTable](Semester,Date, Month, Year,FullDate, CourseCode, FacName, ClassTime,Day,RoomNo) values('" + semester + "','" + dateValue.ToString("dd") + "', '" + dateValue.ToString("MM") + "', '" + dateValue.ToString(ayear) + "','" + dateValue.ToString("MM/dd/yyyy") + "','" + cCode + "','" + fId + "','" + dTimes + "','" + Datbar + "','" + rRoomNo + "')";
                                        //string sql = @"INSERT INTO [dbo].[DateTable] ([Day] ,[Month] ,[Year] ,[FullDate] ,[Co_ID]) values('" + dateValue.ToString("dd") + "', '" + dateValue.ToString("MM") + "', '" + dateValue.ToString(ayear) + "','" + dateValue.ToString(i+"."+k+"."+ayear) + "','" + cCoId + "')";
                                        string     sql = @"INSERT INTO [dbo].[DateTable] ([FullDate] , [Co_ID], [CoT_ID],[Activities]) values('" + dateValue.ToString(i + "/" + k + "/" + ayear) + "','" + cCoId + "','" + cTId + "','" + activities.ToString() + "' )";
                                        SqlCommand com = new SqlCommand(sql, con.getSqlConnection());
                                        com.ExecuteNonQuery();
                                        con.CloseConnection();
                                    }
                                    j++;
                                }
                            }
                        }
                    }

                    GetDateTopic();
                }
                else
                {
                    string[] days = day.Split('-');
                    for (k = start; k <= end; k++)
                    {
                        for (i = 1; i <= DateTime.DaysInMonth(Convert.ToInt32(ayear), k); i++)
                        {
                            dateValue = new DateTime(Convert.ToInt32(ayear), k, i);
                            string d = (dateValue.ToString("dddd"));
                            //string dval = GetHoliday(dateValue.ToShortDateString());

                            if (dateValue.ToString("dddd") == days[0].ToString() || dateValue.ToString("dddd") == days[1].ToString())
                            {
                                if (!GetHoliday(i + "/" + k + "/" + ayear))
                                {
                                    cTId = GetcTId(cTIdPossition);
                                    if (cTId != 0)
                                    {
                                        cTIdPossition++;
                                        DBSqlConnection con = new DBSqlConnection();
                                        //string sql = @"insert into [dbo].[RutineTable](Semester,Date, Month, Year,FullDate, CourseCode, FacName, ClassTime,Day,RoomNo) values('" + semester + "','" + dateValue.ToString("dd") + "', '" + dateValue.ToString("MM") + "', '" + dateValue.ToString(ayear) + "','" + dateValue.ToString("MM/dd/yyyy") + "','" + cCode + "','" + fId + "','" + dTimes + "','" + Datbar + "','" + rRoomNo + "')";
                                        //string sql = @"INSERT INTO [dbo].[DateTable] ([Day] ,[Month] ,[Year] ,[FullDate] ,[Co_ID]) values('" + dateValue.ToString("dd") + "', '" + dateValue.ToString("MM") + "', '" + dateValue.ToString(ayear) + "','" + dateValue.ToString(i + "." + k + "." + ayear)  + "','" + cCoId + "')";
                                        //string sql = @"INSERT INTO [dbo].[DateTable] ([FullDate] , [Co_ID], [CoT_ID]) values('" + dateValue.ToString(i + "/" + k + "/" + ayear) + "','" + cCoId + "','" + cTId + "' )";
                                        string sql = @"INSERT INTO [dbo].[DateTable] ([FullDate] , [Co_ID], [CoT_ID],[Activities]) values('" + dateValue.ToString(i + "/" + k + "/" + ayear) + "','" + cCoId + "','" + cTId + "','" + activities.ToString() + "' )";

                                        SqlCommand com = new SqlCommand(sql, con.getSqlConnection());
                                        com.ExecuteNonQuery();
                                        con.CloseConnection();
                                    }
                                    j++;
                                }
                            }
                        }
                    }
                    GetDateTopic();
                }
            }
        }