Ejemplo n.º 1
0
    public int DeleteCourseLeader(InitializeModule.EnumCampus Campus, string AcademicYear, string SemesterID, string CourseID)
    {
        int iEffected = 0;
        Connection_StringCLS MyConnection_string = new Connection_StringCLS(Campus);
        SqlConnection        Conn = new SqlConnection(MyConnection_string.Conn_string.ToString());

        try
        {
            string sSQL = GetDeleteCommand();
//sSQL += sCondition;
            SqlCommand Cmd = new SqlCommand(sSQL, Conn);
            Cmd.Parameters.Add(new SqlParameter("@AcademicYear", AcademicYear));
            Cmd.Parameters.Add(new SqlParameter("@SemesterID", SemesterID));
            Cmd.Parameters.Add(new SqlParameter("@CourseID", CourseID));
            Conn.Open();
            iEffected = Cmd.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            LibraryMOD.ShowErrorMessage(ex);
        }
        finally
        {
            Conn.Close();
            Conn.Dispose();
        }
        return(iEffected);
    }
Ejemplo n.º 2
0
    public List <string> GetElective(string sCollege, string sDegree, string sMajor, int iOrder, InitializeModule.EnumCampus Campus)
    {
        Connection_StringCLS myConnection_String = new Connection_StringCLS(Campus);
        SqlConnection        Conn = new SqlConnection(myConnection_String.Conn_string);

        Conn.Open();
        SqlCommand    Cmd;
        SqlDataReader Rd;

        List <string> Result = new List <string>();

        try
        {
            string sElectSQL = "SELECT sEelecive FROM dbo.Reg_Specialization_Elective AS E";
            sElectSQL += " WHERE sMajor ='" + sMajor + "' AND sDegree='" + sDegree + "' AND sCollege ='" + sCollege + "' AND intOrder =" + iOrder;
            Cmd        = new SqlCommand(sElectSQL, Conn);
            Rd         = Cmd.ExecuteReader();
            while (Rd.Read())
            {
                Result.Add(Rd["sEelecive"].ToString());
            }
            Rd.Close();
        }
        catch (Exception ex)
        {
            Console.WriteLine("{0} Exception caught.", ex.Message);
        }
        finally
        {
            Conn.Close();
            Conn.Dispose();
        }
        return(Result);
    }
Ejemplo n.º 3
0
        public void bindnewsfeed()
        {
            Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
            SqlConnection        sc  = new SqlConnection(myConnection_String.Conn_string);
            SqlCommand           cmd = new SqlCommand("select TOP (5) * from ECT_SIS_News_Feed where isActive=1 order by dDate desc", sc);
            DataTable            dt  = new DataTable();
            SqlDataAdapter       da  = new SqlDataAdapter(cmd);

            try
            {
                sc.Open();
                da.Fill(dt);
                sc.Close();

                RepeaterNews.DataSource = dt;
                RepeaterNews.DataBind();
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine("{0} Exception caught.", ex);
            }
            finally
            {
                sc.Close();
            }
        }
        public void getdetails()
        {
            Connection_StringCLS connstr = new Connection_StringCLS(Campus);
            int sem  = 0;
            int Year = LibraryMOD.SeperateTerm(LibraryMOD.GetCurrentTerm(), out sem);

            int    iYear     = Year;
            int    iSem      = sem;
            string sSemester = LibraryMOD.GetSemesterString(iSem);

            lbl_AcademicYear.Text = iYear.ToString();
            lbl_Semester.Text     = sSemester.ToString();

            string    studentid         = Session["CurrentStudent"].ToString();
            var       services          = new DAL.DAL();
            DataTable dtStudentServices = services.GetStudentDetailsID(studentid, connstr.Conn_string);

            if (dtStudentServices.Rows.Count > 0)
            {
                lbl_StudentName.Text    = dtStudentServices.Rows[0]["strLastDescEn"].ToString();
                lbl_StudentID.Text      = dtStudentServices.Rows[0]["lngStudentNumber"].ToString();
                lbl_StudentContact.Text = dtStudentServices.Rows[0]["Phone"].ToString();
                lbl_StudentEmail.Text   = dtStudentServices.Rows[0]["sECTemail"].ToString();
                hdf_StudentEmail.Value  = dtStudentServices.Rows[0]["sECTemail"].ToString();
                lbl_CurrentMajor.Text   = dtStudentServices.Rows[0]["strCaption"].ToString();

                SqlConnection  sc  = new SqlConnection(connstr.Conn_string);
                SqlCommand     cmd = new SqlCommand("SELECT  Course_Balance_View_BothSides.iYear, Course_Balance_View_BothSides.Sem, Course_Balance_View_BothSides.Shift, Course_Balance_View_BothSides.Course, Course_Balance_View_BothSides.Class, Course_Balance_View_BothSides.Student, Course_Balance_View_BothSides.FactorBalance, Course_Balance_View_BothSides.IsIncluded_AtRisk, Reg_Courses.IsInternshipCourse FROM Course_Balance_View_BothSides INNER JOIN Reg_Courses ON Course_Balance_View_BothSides.Course = Reg_Courses.strCourse WHERE (Reg_Courses.IsInternshipCourse = 1) AND (Course_Balance_View_BothSides.iYear = " + iYear + ") AND (Course_Balance_View_BothSides.Sem = " + iSem + ") AND (Course_Balance_View_BothSides.Student = N'" + studentid + "')", sc);
                DataTable      dt  = new DataTable();
                SqlDataAdapter da  = new SqlDataAdapter(cmd);
                try
                {
                    sc.Open();
                    da.Fill(dt);
                    sc.Close();

                    if (dt.Rows.Count > 0)
                    {
                        //Continue
                    }
                    else
                    {
                        div_Alert.Attributes["class"] = "alert alert-danger alert-dismissible ";
                        lbl_Msg.Text         = "You are not allowed to generate this request (Only for students registered internship courses).";
                        lbl_Msg.Visible      = true;
                        div_msg.Visible      = true;
                        lnk_Generate.Enabled = false;
                    }
                }
                catch (Exception ex)
                {
                    sc.Close();
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    sc.Close();
                }
            }
        }
        public void getcourses(int term)
        {
            var services = new DAL.DAL();
            Connection_StringCLS connstr = new Connection_StringCLS(Campus);
            int sem  = 0;
            int Year = LibraryMOD.SeperateTerm(term, out sem);

            int       iYear     = Year;
            int       iSem      = sem;
            string    studentid = Session["CurrentStudent"].ToString();
            DataTable dt        = services.GetCoursesbyStudentId(studentid, connstr.Conn_string, iYear, iSem);

            if (dt.Rows.Count > 0)
            {
                drp_Course.DataSource     = dt;
                drp_Course.DataTextField  = "Course";
                drp_Course.DataValueField = "Code";
                drp_Course.DataBind();

                drp_Course.Items.Insert(0, new System.Web.UI.WebControls.ListItem("---Select a Course---", "---Select a Course---"));
            }
            else
            {
                drp_Course.Items.Insert(0, new System.Web.UI.WebControls.ListItem("---Select a Course---", "---Select a Course---"));
            }
        }
        protected void drp_Course_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (drp_Course.SelectedItem.Value != "---Select a Course---")
            {
                var services = new DAL.DAL();
                Connection_StringCLS connstr = new Connection_StringCLS(Campus);
                int sem  = 0;
                int Year = LibraryMOD.SeperateTerm(Convert.ToInt32(drp_Semester.SelectedItem.Value), out sem);

                int       iYear     = Year;
                int       iSem      = sem;
                string    studentid = Session["CurrentStudent"].ToString();
                DataTable dt        = services.GetCoursesbyCourseId(studentid, connstr.Conn_string, iYear, iSem, drp_Course.SelectedItem.Value);
                if (dt.Rows.Count > 0)
                {
                    lbl_CourseCode.Text = drp_Course.SelectedItem.Value;
                    lbl_Instructor.Text = dt.Rows[0]["strLecturerDescEn"].ToString();
                }
            }
            else
            {
                lbl_CourseCode.Text = "";
                lbl_Instructor.Text = "";
            }
        }
        public void getsemesters()
        {
            var services = new DAL.DAL();
            Connection_StringCLS connstr = new Connection_StringCLS(Campus);
            int sem  = 0;
            int Year = LibraryMOD.SeperateTerm(LibraryMOD.GetCurrentTerm(), out sem);

            int       iYear     = Year;
            int       iSem      = sem;
            string    studentid = Session["CurrentStudent"].ToString();
            DataTable dt        = services.GetSemestersbyTerm(iYear, iSem);

            if (dt.Rows.Count > 0)
            {
                drp_Semester.DataSource     = dt;
                drp_Semester.DataTextField  = "LongDesc";
                drp_Semester.DataValueField = "Term";
                drp_Semester.DataBind();

                drp_Semester.Items.Insert(0, new System.Web.UI.WebControls.ListItem("---Select a Semester---", "---Select a Semester---"));
                drp_Course.Items.Insert(0, new System.Web.UI.WebControls.ListItem("---Select a Course---", "---Select a Course---"));
            }
            else
            {
                drp_Semester.Items.Insert(0, new System.Web.UI.WebControls.ListItem("---Select a Semester---", "---Select a Semester---"));
                drp_Course.Items.Insert(0, new System.Web.UI.WebControls.ListItem("---Select a Course---", "---Select a Course---"));
            }
        }
        private int isPwdChanged(string sSID, string sPWD, InitializeModule.EnumCampus Campus)
        {
            int iEffected = 0;
            Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
            SqlConnection        Conn = new SqlConnection(myConnection_String.Conn_string);

            Conn.Open();
            try
            {
                string     sSQL = "UPDATE Cmn_User  SET Password = '******' WHERE UserName='******'";
                SqlCommand cmd  = new SqlCommand(sSQL, Conn);
                iEffected += cmd.ExecuteNonQuery();
                Conn.Close();

                myConnection_String = new Connection_StringCLS(Campus);
                Conn = new SqlConnection(myConnection_String.Conn_string);
                Conn.Open();
                sSQL       = "UPDATE Reg_Student_Accounts SET strOnlinePWD = '" + sPWD + "' WHERE lngStudentNumber='" + sSID + "'";
                cmd        = new SqlCommand(sSQL, Conn);
                iEffected += cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                showmsg(ex.Message);
            }
            finally
            {
                Conn.Close();
                Conn.Dispose();
            }
            return(iEffected);
        }
Ejemplo n.º 9
0
    private static int UpdateMoodleUserNo(int iUserNo, int iMoodleUserNo)
    {
        int iUpdated = 0;

        Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
        SqlConnection        conn = new SqlConnection(myConnection_String.Conn_string);

        conn.Open();
        try
        {
            string sSQL = "";

            sSQL  = "UPDATE Cmn_User";
            sSQL += " SET MoodleUserNo =" + iMoodleUserNo;
            sSQL += " WHERE UserNo =" + iUserNo;

            SqlCommand cmd = new SqlCommand(sSQL, conn);

            iUpdated = cmd.ExecuteNonQuery();
            return(iUpdated);
        }
        catch (Exception ex)
        {
            return(iUpdated);
        }
        finally
        {
            conn.Close();
            conn.Dispose();
        }
    }
Ejemplo n.º 10
0
        public void insert_online_payment(string sOrder, string sACC, string sSID, string sService, string amount)
        {
            CurrentCampus = (InitializeModule.EnumCampus)Session["CurrentCampus"];
            Connection_StringCLS connstr = new Connection_StringCLS(CurrentCampus);
            SqlConnection        sc      = new SqlConnection(connstr.Conn_string);
            SqlCommand           cmd     = new SqlCommand("INSERT INTO [ECTData].[dbo].[Acc_Payment_Order] values (@sOrder,@sACC,@sSID,@sService,@dDate,@isCaptured,@dCaptured,@sVoucherNo,@isCanceled,@cAmount,@cVAT,@tOrder)", sc);

            cmd.Parameters.AddWithValue("@sOrder", sOrder);
            cmd.Parameters.AddWithValue("@sACC", sACC);
            cmd.Parameters.AddWithValue("@sSID", sSID);
            cmd.Parameters.AddWithValue("@sService", sService);
            cmd.Parameters.AddWithValue("@dDate", DateTime.Now);
            cmd.Parameters.AddWithValue("@isCaptured", false);
            cmd.Parameters.AddWithValue("@dCaptured", DBNull.Value);
            cmd.Parameters.AddWithValue("@sVoucherNo", DBNull.Value);
            cmd.Parameters.AddWithValue("@isCanceled", false);
            cmd.Parameters.AddWithValue("@cAmount", amount);
            cmd.Parameters.AddWithValue("@cVAT", 0);
            cmd.Parameters.AddWithValue("@tOrder", DBNull.Value);
            try
            {
                sc.Open();
                cmd.ExecuteNonQuery();
                sc.Close();
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine(ex.Message);
            }
            finally
            {
                sc.Close();
            }
        }
Ejemplo n.º 11
0
    public List <CourseLeader> GetList(InitializeModule.EnumCampus Campus, string sCondition, bool isDeafaultIncluded)
    {
        Connection_StringCLS MyConnection_string = new Connection_StringCLS(Campus);
        string        sSQL = GetListSQL(sCondition);
        SqlConnection Conn = new SqlConnection(MyConnection_string.Conn_string.ToString());
        SqlCommand    Cmd  = new SqlCommand(sSQL, Conn);

        Conn.Open();
        SqlDataReader       reader  = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
        List <CourseLeader> results = new List <CourseLeader>();

        try
        {
//Default Value
            CourseLeader myCourseLeader = new CourseLeader();
            if (isDeafaultIncluded)
            {
//Change the code here
                myCourseLeader.AcademicYear = -1;
                myCourseLeader.SemesterID   = -1;
                myCourseLeader.CourseID     = "Select Course";

                results.Add(myCourseLeader);
            }
            while (reader.Read())
            {
                myCourseLeader = new CourseLeader();
                if (reader[LibraryMOD.GetFieldName(AcademicYearFN)].Equals(DBNull.Value))
                {
                    myCourseLeader.AcademicYear = 0;
                }
                else
                {
                    myCourseLeader.AcademicYear = int.Parse(reader[LibraryMOD.GetFieldName(AcademicYearFN)].ToString());
                }
                if (reader[LibraryMOD.GetFieldName(SemesterIDFN)].Equals(DBNull.Value))
                {
                    myCourseLeader.SemesterID = 0;
                }
                else
                {
                    myCourseLeader.SemesterID = int.Parse(reader[LibraryMOD.GetFieldName(SemesterIDFN)].ToString());
                }
                myCourseLeader.CourseID = reader[LibraryMOD.GetFieldName(CourseIDFN)].ToString();
                results.Add(myCourseLeader);
            }
        }
        catch (Exception ex)
        {
            LibraryMOD.ShowErrorMessage(ex);
        }
        finally
        {
            reader.Close();
            reader.Dispose();
            Conn.Close();
            Conn.Dispose();
        }
        return(results);
    }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Session["CurrentRole"] != null)
                {
                    CurrentRole = (int)Session["CurrentRole"];

                    iRegYear = (int)Session["RegYear"];
                    iRegSem  = (int)Session["RegSemester"];
                }
                else
                {
                    //showErr("Session is expired, Login again please...");
                    ClearSession();
                    Response.Redirect("Login.aspx");
                }
                if (Session["CurrentCampus"] != null)
                {
                    string sCampus = Session["CurrentCampus"].ToString();
                    Campus = (InitializeModule.EnumCampus)Session["CurrentCampus"];
                    //Campus_ddl.SelectedValue = ((int)Campus).ToString();
                    string sConn = "";
                    Connection_StringCLS ConnectionString;
                    switch (Campus)
                    {
                    case InitializeModule.EnumCampus.Males:
                        ConnectionString = new Connection_StringCLS(InitializeModule.EnumCampus.Males);
                        sConn            = ConnectionString.Conn_string;
                        break;

                    case InitializeModule.EnumCampus.Females:
                        ConnectionString = new Connection_StringCLS(InitializeModule.EnumCampus.Females);
                        sConn            = ConnectionString.Conn_string;
                        break;
                    }
                }
                if (Session["CurrentStudent"] != null)
                {
                    sNo   = Session["CurrentStudent"].ToString();
                    sName = Session["CurrentStudentName"].ToString();
                    if (!IsPostBack)
                    {
                        getservicedetails();
                        getdetails();
                        if (Session["PmtOrder"] != null)
                        {
                            cancelonlinepayment(Session["PmtOrder"].ToString());
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine("{0} Exception caught.", exp);
            }
            finally
            {
            }
        }
Ejemplo n.º 13
0
        public void updateonlinepayment(string sOrder, string sVoucherNo)
        {
            CurrentCampus = (InitializeModule.EnumCampus)Session["CurrentCampus"];
            Connection_StringCLS connstr = new Connection_StringCLS(CurrentCampus);
            SqlConnection        sc      = new SqlConnection(connstr.Conn_string);
            SqlCommand           cmd     = new SqlCommand("update [ECTData].[dbo].[Acc_Payment_Order] set sVoucherNo=@sVoucherNo,tOrder=@tOrder where sOrder=@sOrder", sc);

            //cmd.Parameters.AddWithValue("@isCaptured", true);
            //cmd.Parameters.AddWithValue("@dCaptured", DateTime.Now);
            cmd.Parameters.AddWithValue("@sVoucherNo", sVoucherNo);
            //cmd.Parameters.AddWithValue("@isCanceled", false);
            cmd.Parameters.AddWithValue("@sOrder", sOrder);
            cmd.Parameters.AddWithValue("@tOrder", DBNull.Value);
            try
            {
                sc.Open();
                cmd.ExecuteNonQuery();
                sc.Close();
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine(ex.Message);
            }
            finally
            {
                sc.Close();
            }
        }
        public void bindmyattendancewrnigns()
        {
            int iCSem  = 0;
            int iCYear = LibraryMOD.SeperateTerm(LibraryMOD.GetCurrentTerm(), out iCSem);
            Connection_StringCLS myConnection_String = new Connection_StringCLS(Campus);
            SqlConnection        sc = new SqlConnection(myConnection_String.Conn_string);
            //SqlCommand cmd = new SqlCommand("SELECT [strCourse],max([byteWarningType]) as max FROM [ECTData].[dbo].[Reg_Students_Warning] where intStudyYear=@intStudyYear and byteSemester=@byteSemester and lngStudentNumber=@lngStudentNumber GROUP BY [strCourse] order by strCourse", sc);
            SqlCommand cmd = new SqlCommand("SELECT iYear, Sem, Student, Course, Warning FROM  Warning_Both_Side WHERE (iYear = @intStudyYear) AND (Sem = @byteSemester) AND (Student=@lngStudentNumber) order by course asc", sc);

            cmd.Parameters.AddWithValue("@intStudyYear", iCYear);
            cmd.Parameters.AddWithValue("@byteSemester", iCSem);
            cmd.Parameters.AddWithValue("@lngStudentNumber", Session["CurrentStudent"].ToString());//BAM1906016 Session["CurrentStudent"].ToString()
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            try
            {
                sc.Open();
                da.Fill(dt);
                sc.Close();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine(ex.Message);
            }
            finally
            {
                sc.Close();
            }
        }
Ejemplo n.º 15
0
        public void getdetails()
        {
            Connection_StringCLS connstr = new Connection_StringCLS(Campus);

            int sem  = 0;
            int Year = LibraryMOD.SeperateTerm(LibraryMOD.GetCurrentTerm(), out sem);

            int    iYear     = Year;
            int    iSem      = sem;
            string sSemester = LibraryMOD.GetSemesterString(iSem);

            lbl_AcademicYear.Text = iYear.ToString();
            lbl_Semester.Text     = sSemester.ToString();

            string    studentid         = Session["CurrentStudent"].ToString();
            var       services          = new DAL.DAL();
            DataTable dtStudentServices = services.GetStudentDetailsID(studentid, connstr.Conn_string);

            if (dtStudentServices.Rows.Count > 0)
            {
                lbl_StudentName.Text    = dtStudentServices.Rows[0]["strLastDescEn"].ToString();
                lbl_StudentID.Text      = dtStudentServices.Rows[0]["lngStudentNumber"].ToString();
                lbl_StudentContact.Text = dtStudentServices.Rows[0]["Phone"].ToString();
                lbl_StudentEmail.Text   = dtStudentServices.Rows[0]["sECTemail"].ToString();
                hdf_StudentEmail.Value  = dtStudentServices.Rows[0]["sECTemail"].ToString();
            }
        }
Ejemplo n.º 16
0
    public int DeletePrivilegeObjects(InitializeModule.EnumCampus Campus, int ObjectID)
    {
        int iEffected = 0;
        Connection_StringCLS MyConnection_string = new Connection_StringCLS(Campus);
        SqlConnection        Conn = new SqlConnection(MyConnection_string.Conn_string.ToString());

        try
        {
            string sSQL = GetDeleteCommand();
//sSQL += sCondition;
            SqlCommand Cmd = new SqlCommand(sSQL, Conn);
            Cmd.Parameters.Add(new SqlParameter("@ObjectID", ObjectID));
            Conn.Open();
            iEffected = Cmd.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            LibraryMOD.ShowErrorMessage(ex);
        }
        finally
        {
            Conn.Close();
            Conn.Dispose();
        }
        return(iEffected);
    }
Ejemplo n.º 17
0
    public int GetNewOrder(int iLevel, int iSystem)
    {
        int           iOrder = 1;
        SqlConnection Conn   = new SqlConnection();

        try
        {
            InitializeModule.EnumCampus iCampus = InitializeModule.EnumCampus.ECTNew;
            //iCampus = InitializeModule.EnumCampus.ECTNew;
            Connection_StringCLS sConn = new Connection_StringCLS(iCampus);

            string sSQL = "SELECT Max(ShowOrder) FROM Cmn_PrivilegeObjects";

            sSQL += " Where SystemID=" + iSystem + " And iLevel=" + iLevel;

            Conn.ConnectionString = sConn.Conn_string.ToString();
            SqlCommand Cmd = new SqlCommand(sSQL, Conn);
            Conn.Open();

            iOrder += (int)Cmd.ExecuteScalar();
        }
        catch (Exception ex)
        {
            Console.WriteLine("{0} Exception caught.", ex.Message);
        }
        finally
        {
            //Conn.Close();
        }
        return(iOrder);
    }
        protected void LinkButton3_Click(object sender, EventArgs e)
        {
            Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
            SqlConnection        sc = new SqlConnection(ConfigurationManager.ConnectionStrings["ECTDataNew"].ConnectionString);

            SqlCommand     cmd = new SqlCommand("select * from ECT_SIS_News_Feed where isActive='0'", sc);
            DataTable      dt  = new DataTable();
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            try
            {
                sc.Open();
                da.Fill(dt);
                sc.Close();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine("{0} Exception caught.", ex);
            }
            finally
            {
                sc.Close();
            }
        }
        public void bindcount()
        {
            Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
            SqlConnection        sc = new SqlConnection(ConfigurationManager.ConnectionStrings["ECTDataNew"].ConnectionString);

            SqlCommand     cmd = new SqlCommand("select count(iSerial) as Total from ECT_SIS_News_Feed;  select  count(iSerial) as Active from ECT_SIS_News_Feed where isActive='1';  select count(iSerial) as Inactive from ECT_SIS_News_Feed where isActive='0'", sc);
            DataSet        ds  = new DataSet();
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            try
            {
                sc.Open();
                da.Fill(ds);
                sc.Close();

                lbl_total.Text    = ds.Tables[0].Rows[0]["Total"].ToString();
                lbl_Active.Text   = ds.Tables[1].Rows[0]["Active"].ToString();
                lbl_Inactive.Text = ds.Tables[2].Rows[0]["Inactive"].ToString();
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine("{0} Exception caught.", ex);
            }
            finally
            {
                sc.Close();
            }
        }
Ejemplo n.º 20
0
        private int add_log(string sUser, string sPCName, string sNtUser, int iUserID, string sURL)
        {
            int iAdded = 0;

            Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
            SqlConnection        conn = new SqlConnection(myConnection_String.Conn_string);

            conn.Open();
            try
            {
                string sSQL = "";

                sSQL = "INSERT INTO ECT_User_Log (sUser,dTime,sPCName,sNtUser,iUserID,sURL) VALUES ('" + sUser + "',GETDATE(),'" + sPCName + "','" + sNtUser + "'," + iUserID + ",'" + sURL + "')";

                SqlCommand cmd = new SqlCommand(sSQL, conn);

                iAdded = cmd.ExecuteNonQuery();
                return(iAdded);
            }
            catch (Exception ex)
            {
                return(iAdded);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
        public void bindtotal()
        {
            Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
            SqlConnection        sc = new SqlConnection(ConfigurationManager.ConnectionStrings["ECTDataNew"].ConnectionString);

            SqlCommand     cmd = new SqlCommand("select * from ECT_SIS_News_Feed", sc);
            DataTable      dt  = new DataTable();
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            try
            {
                sc.Open();
                da.Fill(dt);
                sc.Close();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine("{0} Exception caught.", ex);
            }
            finally
            {
                sc.Close();
            }
        }
        public static bool SetOpportunity(string sSID)
        {
            bool isSet = false;

            //U cannot use var from out of the scope. (Campus)
            InitializeModule.EnumCampus campus = InitializeModule.EnumCampus.Males;
            if (sSID.Contains("AF") || sSID.Contains("ESF"))
            {
                campus = InitializeModule.EnumCampus.Females;
            }
            Connection_StringCLS myConnection_String = new Connection_StringCLS(campus);
            SqlConnection        Conn = new SqlConnection(myConnection_String.Conn_string);

            Conn.Open();
            try
            {
                string sSQL = "UPDATE Reg_Applications SET isOpportunitySet=1";
                sSQL += " WHERE (lngStudentNumber = '" + sSID + "')";

                SqlCommand Cmd = new SqlCommand(sSQL, Conn);
                isSet = (Cmd.ExecuteNonQuery() > 0);
            }
            catch (Exception ex)
            {
                LibraryMOD.ShowErrorMessage(ex);
                //divMsg.InnerText = ex.Message;
            }
            finally
            {
                Conn.Close();
                Conn.Dispose();
            }
            return(isSet);
        }
Ejemplo n.º 23
0
        public void cancelonlinepayment(string sOrder)
        {
            //CurrentCampus = (InitializeModule.EnumCampus)Session["CurrentCampus"];
            Connection_StringCLS connstr = new Connection_StringCLS(Campus);
            SqlConnection        sc      = new SqlConnection(connstr.Conn_string);
            SqlCommand           cmd     = new SqlCommand("update [ECTData].[dbo].[Acc_Payment_Order] set isCanceled=@isCanceled where sOrder=@sOrder", sc);

            cmd.Parameters.AddWithValue("@isCanceled", true);
            cmd.Parameters.AddWithValue("@sOrder", sOrder);
            try
            {
                sc.Open();
                cmd.ExecuteNonQuery();
                sc.Close();
                Session["PmtOrder"] = null;
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine(ex.Message);
            }
            finally
            {
                sc.Close();
            }
        }
Ejemplo n.º 24
0
    public int GetFreeElectiveCoursesCount(string sNo, InitializeModule.EnumCampus Campus)
    {
        string sSQL    = "";
        int    iResult = 0;

        try
        {
            Connection_StringCLS myConnection_String = new Connection_StringCLS(Campus);
            SqlConnection        Conn = new SqlConnection(myConnection_String.Conn_string);
            Conn.Open();
            sSQL = GetFreeElectiveSQL(sNo);

            SqlCommand    Cmd = new SqlCommand(sSQL, Conn);
            SqlDataReader Rd  = Cmd.ExecuteReader();

            while (Rd.Read())
            {
                iResult += 1;
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("{0} Exception caught.", ex.Message);
        }
        finally
        {
        }
        return(iResult);
    }
Ejemplo n.º 25
0
    public string GetFreeElectiveCourses(string sNo, InitializeModule.EnumCampus Campus)
    {
        string sSQL    = "";
        string sResult = "";

        try
        {
            Connection_StringCLS myConnection_String = new Connection_StringCLS(Campus);
            SqlConnection        Conn = new SqlConnection(myConnection_String.Conn_string);
            Conn.Open();
            sSQL = GetFreeElectiveSQL(sNo);

            SqlCommand    Cmd = new SqlCommand(sSQL, Conn);
            SqlDataReader Rd  = Cmd.ExecuteReader();


            while (Rd.Read())
            {
                sResult += Rd["strCourse"].ToString() + " , ";
            }
            sResult = sResult.Substring(0, sResult.Length - 3);
        }
        catch (Exception ex)
        {
            Console.WriteLine("{0} Exception caught.", ex.Message);
        }
        finally
        {
        }
        return(sResult);
    }
Ejemplo n.º 26
0
        public void insert_online_payment(string sOrder, string sACC, string sSID, string sService, string amount)
        {
            double dGrossAmount = Convert.ToDouble(amount);
            double dPmtAmount   = Math.Round((dGrossAmount / 1.05), 2);
            double dVAT         = Math.Round((dGrossAmount - dPmtAmount), 2);

            DataTable CurrentdtSPList = Session["CurrentdtSPList"] as DataTable;

            CurrentCampus = (InitializeModule.EnumCampus)Session["CurrentCampus"];
            Connection_StringCLS connstr = new Connection_StringCLS(CurrentCampus);
            SqlConnection        sc      = new SqlConnection(connstr.Conn_string);
            SqlCommand           cmd     = new SqlCommand("INSERT INTO [ECTData].[dbo].[Acc_Payment_Order] values (@sOrder,@sACC,@sSID,@sService,@dDate,@isCaptured,@dCaptured,@sVoucherNo,@isCanceled,@cAmount,@cVAT,@tOrder)", sc);

            cmd.Parameters.AddWithValue("@sOrder", sOrder);
            cmd.Parameters.AddWithValue("@sACC", sACC);
            cmd.Parameters.AddWithValue("@sSID", sSID);
            cmd.Parameters.AddWithValue("@sService", sService);
            cmd.Parameters.AddWithValue("@dDate", DateTime.Now);
            cmd.Parameters.AddWithValue("@isCaptured", false);
            cmd.Parameters.AddWithValue("@dCaptured", DBNull.Value);
            cmd.Parameters.AddWithValue("@sVoucherNo", DBNull.Value);
            cmd.Parameters.AddWithValue("@isCanceled", false);
            cmd.Parameters.AddWithValue("@cAmount", dPmtAmount);
            cmd.Parameters.AddWithValue("@cVAT", dVAT);
            if (CurrentdtSPList.Rows.Count > 0)
            {
                //Convert Datatable to XML String to DB Save
                System.IO.StringWriter writer = new System.IO.StringWriter();
                CurrentdtSPList.TableName = "CurrentdtSPList";
                CurrentdtSPList.WriteXml(writer, XmlWriteMode.WriteSchema, true);
                cmd.Parameters.AddWithValue("@tOrder", writer.ToString());

                //StringReader theReader = new StringReader(writer.ToString());
                //DataSet theDataSet = new DataSet();
                //theDataSet.ReadXml(theReader);
            }
            else
            {
                cmd.Parameters.AddWithValue("@tOrder", DBNull.Value);
            }
            try
            {
                sc.Open();
                cmd.ExecuteNonQuery();
                sc.Close();
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine(ex.Message);
            }
            finally
            {
                sc.Close();
            }
        }
Ejemplo n.º 27
0
    public List <Privilege> GetObjectPrivileges(string sCondition)
    {
        InitializeModule.EnumCampus iCampus = InitializeModule.EnumCampus.ECTNew;
        //iCampus = InitializeModule.EnumCampus.ECTNew;
        Connection_StringCLS sConn = new Connection_StringCLS(iCampus);


        //, OP.ObjectID
        string sSQL = "SELECT P.PrivilegeID, P.PriviligeNameEn, P.DefaultEffect";

        sSQL += " FROM dbo.Cmn_Privilege AS P INNER JOIN dbo.Cmn_Permissions AS OP ON P.PrivilegeID = OP.PrivilegeID";

        sSQL += sCondition;

        sSQL = sSQL + " Order By P.PrivilegeID";

        SqlConnection Conn = new SqlConnection(sConn.Conn_string.ToString());

        SqlCommand Cmd = new SqlCommand(sSQL, Conn);

        Conn.Open();
        SqlDataReader    Rd      = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
        List <Privilege> results = new List <Privilege>();

        //int i = 0;
        try
        {
            while (Rd.Read())
            {
                Privilege MyPrivilege = new Privilege();
                MyPrivilege.PrivilegeID     = int.Parse(Rd["PrivilegeID"].ToString());
                MyPrivilege.PriviligeNameEn = Rd["PriviligeNameEn"].ToString();
                MyPrivilege.DefaultEffect   = int.Parse(Rd["DefaultEffect"].ToString());
                //MyPrivilege.isDataChanged = false;
                //MyPrivilege.iDataStatus = 1;//Old 2:New Recored

                results.Add(MyPrivilege);
                //i += 1;
            }
        }
        catch (Exception ex)
        {
        }
        finally
        {
            //'Response.Write(ex.Message)

            Rd.Close();
            Rd.Dispose();
            Conn.Close();
            Conn.Dispose();
        }
        //myStatus.Clear()

        return(results);
    }
Ejemplo n.º 28
0
        protected void btn_Create_Click(object sender, EventArgs e)
        {
            Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
            SqlConnection        sc = new SqlConnection(ConfigurationManager.ConnectionStrings["ECTDataNew"].ConnectionString);

            SqlCommand cmd = new SqlCommand("update ECT_SIS_News_Feed set sHeader=@sHeader,sDetail=@sDetail,dDate=@dDate,sLink=@sLink,sAttachment=@sAttachment,isActive=@isActive,sUser=@sUser,dCreated=@dCreated where iSerial=@iSerial", sc);

            cmd.Parameters.AddWithValue("@sHeader", txt_Header.Text.Trim());
            cmd.Parameters.AddWithValue("@sDetail", txt_Detail.Text.Trim());
            DateTime date = DateTime.ParseExact(txt_Date.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            cmd.Parameters.AddWithValue("@dDate", date);
            cmd.Parameters.AddWithValue("@sLink", txt_Link.Text.Trim());
            string path = "";

            if (flp_Upload.HasFile)
            {
                string extension = Path.GetExtension(flp_Upload.PostedFile.FileName);
                string filename  = Path.GetFileName(flp_Upload.PostedFile.FileName);
                flp_Upload.SaveAs(Server.MapPath("~/NewsFeed/" + filename));
                path = "NewsFeed/" + filename;
            }
            else
            {
                path = HyperLink1.NavigateUrl;
            }
            cmd.Parameters.AddWithValue("@sAttachment", path);
            cmd.Parameters.AddWithValue("@isActive", drp_Status.SelectedItem.Value);
            cmd.Parameters.AddWithValue("@sUser", sName);
            cmd.Parameters.AddWithValue("@dCreated", DateTime.Now);
            cmd.Parameters.AddWithValue("@iSerial", Request.QueryString["id"]);
            try
            {
                sc.Open();
                cmd.ExecuteNonQuery();
                sc.Close();

                //txt_Header.Text = "";
                //txt_Detail.Text = "";
                //txt_Link.Text = "";
                //txt_Date.Text = "";
                div_msg.Visible = true;
            }
            catch (Exception ex)
            {
                sc.Close();
                Console.WriteLine("{0} Exception caught.", ex);
            }
            finally
            {
                sc.Close();
            }
        }
Ejemplo n.º 29
0
        private List <Book> getBooks()
        {
            List <Book> myBooks = new List <Book>();

            Connection_StringCLS myConnection_String = new Connection_StringCLS(InitializeModule.EnumCampus.ECTNew);
            SqlConnection        conn = new SqlConnection(myConnection_String.Conn_string);

            conn.Open();
            try
            {
                string sSQL = "SELECT B.BookID, B.AccesstionNo, B.Title, B.Author, B.Publisher, B.Subject, B.Edition, B.PublishedYear, B.Campus AS Library, S.strBookStatusEn AS Status";
                sSQL += " FROM Library_Search_Web AS B INNER JOIN LibBooksStatuses AS S ON B.BookStatusID = S.BookStatusID";
                sSQL += " ORDER BY B.PublishedYear DESC, B.Title";

                SqlCommand cmd = new SqlCommand(sSQL, conn);

                SqlDataReader rd     = cmd.ExecuteReader();
                Book          myBook = new Book();
                while (rd.Read())
                {
                    myBook           = new Book();
                    myBook.BookID    = rd["BookID"].ToString();
                    myBook.AccNo     = rd["AccesstionNo"].ToString();
                    myBook.Title     = rd["Title"].ToString();
                    myBook.Author    = rd["Author"].ToString();
                    myBook.Publisher = rd["Publisher"].ToString();
                    myBook.Subject   = rd["Subject"].ToString();
                    myBook.Edition   = rd["Edition"].ToString();
                    myBook.Published = rd["PublishedYear"].ToString();
                    myBook.Library   = rd["Library"].ToString();
                    myBook.Status    = rd["Status"].ToString();
                    if (rd["Status"].ToString() == "Available")
                    {
                        myBook.iStatus = "1";
                    }
                    else
                    {
                        myBook.iStatus = "0";
                    }
                    myBooks.Add(myBook);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0} Exception caught.", ex.Message);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(myBooks);
        }
Ejemplo n.º 30
0
        public void getprofilepic()
        {
            Connection_StringCLS connstr = new Connection_StringCLS(Campus);
            string    studentid          = Session["CurrentStudent"].ToString();
            var       services           = new DAL.DAL();
            DataTable dtStudentProfile   = services.GetStudentDetailsForProfile(studentid, connstr.Conn_string);

            if (dtStudentProfile.Rows.Count > 0)
            {
                Session["ProfilePIc"] = dtStudentProfile.Rows[0]["strStudentPic"].ToString();
                Session["sEmail"]     = dtStudentProfile.Rows[0]["sECTemail"].ToString();
            }
        }