Пример #1
0
        public DataTable LoadByUserID()
        {
            DataCollections _col = new DataCollections("P_AllContest");

            _col.Add(DataTypes.NVarchar, "UserId", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            return(dao.exeSelectPro(_col, "P_AllContest"));
        }
Пример #2
0
        public DataTable GetCOUNT_SUBMIT()
        {
            DataCollections col = new DataCollections("P_GET_COUNT_SUBMIT_BY_USERID");

            col.Add(DataTypes.Number, "@userid", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            return(dao.exeSelectPro(col, "P_GET_COUNT_SUBMIT_BY_USERID"));
        }
Пример #3
0
        public DataTable LoadByUserID(int filter)
        {
            int             iResult = 1;
            DataCollections col     = new DataCollections("V_" + TABLE_NAME);

            col.Add(DataTypes.NVarchar, "*", FieldTypes.DefaultValue, "", "");
            col.Add(DataTypes.NVarchar, "UserId", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            switch (filter)
            {
            case 1:     // dc phe duyet
                col.Add(DataTypes.Number, "IsAccepted", FieldTypes.Criterion, 1, "=");
                // col.FILTER = " DateAccept IS NOT NULL";
                col.ORDERBY = " ORDER BY DateAccept desc";
                break;

            case 2:     //chua phe duyet
                col.Add(DataTypes.Number, "IsAccepted", FieldTypes.Criterion, 0, "=");
                // col.FILTER = " DateAccept IS NULL";
                col.ORDERBY = " ORDER BY DateRequest desc";
                break;

            default:     // dang hoc
                col.Add(DataTypes.DateTime, "EndTime", FieldTypes.Criterion, DateTime.Now, ">");
                col.Add(DataTypes.DateTime, "StartTime", FieldTypes.Criterion, DateTime.Now, "<");
                // col.FILTER = " DateAccept IS NOT NULL";
                col.Add(DataTypes.Number, "IsAccepted", FieldTypes.Criterion, 1, "=");
                col.ORDERBY = " ORDER BY DateAccept desc";
                break;
            }

            return(dao.DoQuery(col, ref iResult));
        }
Пример #4
0
        public long Insert()
        {
            DataCollections _col = GetObject();

            _col.Add(DataTypes.Number, "UserId", FieldTypes.DefaultValue, CGlobal.GetUserID(), "");
            _col.Add(DataTypes.DateTime, "DateRequest", FieldTypes.DefaultValue, DateTime.Now, "");
            return(dao.DoInsertReturnID(_col));
        }
Пример #5
0
        public bool UpdatePointByID(long point)
        {
            DataCollections _col = GetObject();

            _col.Add(DataTypes.Number, "ID", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            _col.Add(DataTypes.Number, "Point", FieldTypes.DefaultValue, point, "");
            return(dao.DoUpdate(_col));
        }
Пример #6
0
        public long Insert()
        {
            DataCollections _col = GetObject();

            _col.Add(DataTypes.Number, "CreatedBy", FieldTypes.DefaultValue, CGlobal.GetUserID(), "");
            _col.Add(DataTypes.DateTime, "ModifiedOn", FieldTypes.DefaultValue, DateTime.Now.Date, "");
            return(dao.DoInsertReturnID(_col));
        }
Пример #7
0
        public DataTable GetMyNotiByUser(int notiMax)
        {
            DataCollections col = new DataCollections("P_GetMyNotiByUser");

            col.Add(DataTypes.Number, "@userid", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            col.Add(DataTypes.Number, "@notiMax", FieldTypes.Criterion, notiMax, "=");
            return(dao.exeSelectPro(col, "P_GetMyNotiByUser"));
        }
Пример #8
0
        public DataTable LoadBySearch(int status)
        {
            DataCollections col = new DataCollections("P_GetAllMyNotiByUser");

            col.Add(DataTypes.Number, "@userid", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            col.Add(DataTypes.Number, "@notiStatus", FieldTypes.Criterion, (status + 1), "=");
            return(dao.exeSelectPro(col, "P_GetAllMyNotiByUser"));
        }
Пример #9
0
        public DataTable LoadNotAcceptedByCreated()
        {
            int             iResult = 1;
            DataCollections col     = new DataCollections("V_Accepted");

            col.Add(DataTypes.NVarchar, "*", FieldTypes.DefaultValue, "", "");
            col.Add(DataTypes.Number, "createdby", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            return(dao.DoQuery(col, ref iResult));
        }
Пример #10
0
        public DataTable LoadByUserID()
        {
            int             iResult = 1;
            DataCollections col     = new DataCollections("V_" + TABLE_NAME);

            col.Add(DataTypes.NVarchar, "*", FieldTypes.DefaultValue, "", "");
            col.Add(DataTypes.NVarchar, "UserID", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            return(dao.DoQuery(col, ref iResult));
        }
Пример #11
0
        private DataCollections GetObject()
        {
            DataCollections _col = new DataCollections(TABLE_NAME);

            _col.Add(DataTypes.Number, "CreatedBy", FieldTypes.DefaultValue, CGlobal.GetUserID(), "");
            _col.Add(DataTypes.NVarchar, "Content", FieldTypes.DefaultValue, Content, "");
            _col.Add(DataTypes.Number, "NotiType", FieldTypes.DefaultValue, NotiType, "");
            return(_col);
        }
Пример #12
0
        public long Insert()
        {
            DataCollections _col = new DataCollections(TABLE_NAME);

            _col.Add(DataTypes.Number, "CreatedBy", FieldTypes.DefaultValue, CGlobal.GetUserID(), "");
            _col.Add(DataTypes.NVarchar, "Content", FieldTypes.DefaultValue, Content, "");
            _col.Add(DataTypes.Number, "NotiType", FieldTypes.DefaultValue, NotiType, "");
            return(dao.DoInsertReturnID(_col));
        }
Пример #13
0
        public bool UpdateByAdminType(long id, int type)
        {
            DataCollections _col = new DataCollections(TABLE_NAME);

            _col.Add(DataTypes.NVarchar, "ID", FieldTypes.Criterion, id, "=");
            _col.Add(DataTypes.Number, "UserType", FieldTypes.DefaultValue, type, "");
            _col.Add(DataTypes.Number, "AcceptBy", FieldTypes.DefaultValue, CGlobal.GetUserID(), "");
            return(dao.DoUpdate(_col));
        }
Пример #14
0
        public bool Update()
        {
            DataCollections _col = new DataCollections(TABLE_NAME);

            _col.Add(DataTypes.NVarchar, "Id", FieldTypes.Criterion, Id, "=");
            _col.Add(DataTypes.Number, "CreatedBy", FieldTypes.DefaultValue, CGlobal.GetUserID(), "");
            _col.Add(DataTypes.NVarchar, "Content", FieldTypes.DefaultValue, Content, "");
            _col.Add(DataTypes.Number, "NotiType", FieldTypes.DefaultValue, NotiType, "");
            return(dao.DoUpdate(_col));
        }
Пример #15
0
        public long InsertByAdmin()
        {
            DataCollections _col = new DataCollections(TABLE_NAME);

            _col.Add(DataTypes.Number, "AcceptBy", FieldTypes.DefaultValue, CGlobal.GetUserID(), "");
            _col.Add(DataTypes.NVarchar, "IsEnable", FieldTypes.DefaultValue, IsEnable, "");
            _col.Add(DataTypes.Number, "UserType", FieldTypes.DefaultValue, UserType, "");
            _col.Add(DataTypes.NVarchar, "UserName", FieldTypes.DefaultValue, UserName, "");
            _col.Add(DataTypes.NVarchar, "Password", FieldTypes.DefaultValue, Password, "");
            return(dao.DoInsertReturnID(_col));
        }
Пример #16
0
        //Lấy số lượng đơn xin vào lớp của các khóa học do Giáo viên đó tạo
        public int GetCountNotAcceptedByCreated()
        {
            int             iResult = 1;
            DataCollections col     = new DataCollections("V_Accepted");

            col.Add(DataTypes.NVarchar, "count(id)", FieldTypes.DefaultValue, "", "");
            col.Add(DataTypes.Number, "createdby", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            DataTable dt = dao.DoQuery(col, ref iResult);

            if (dt.Rows.Count <= 0)
            {
                return(0);
            }
            return(int.Parse(dt.Rows[0][0].ToString()));
        }
Пример #17
0
        public long Insert()
        {
            DataCollections _col = new DataCollections(TABLE_NAME);

            _col.Add(DataTypes.Number, "UserID", FieldTypes.DefaultValue, CGlobal.GetUserID(), "");
            _col.Add(DataTypes.DateTime, "TimeSubmiss", FieldTypes.DefaultValue, DateTime.Now, "");

            _col.Add(DataTypes.Number, "ProblemId", FieldTypes.DefaultValue, ProblemId, "");
            _col.Add(DataTypes.Number, "CompilerID", FieldTypes.DefaultValue, CompilerID, "");
            _col.Add(DataTypes.Number, "ProcessType", FieldTypes.DefaultValue, 1, "");
            _col.Add(DataTypes.Number, "ContestId", FieldTypes.DefaultValue, ContestId, "");
            _col.Add(DataTypes.Number, "Points", FieldTypes.DefaultValue, 0, "");

            return(dao.DoInsertReturnID(_col));
        }
Пример #18
0
        //public void LoadTypeToCombo(DevExpress.Web.Bootstrap.BootstrapComboBox objCombo, bool isAll)
        //{
        //    DataTable dt = LoadAll();
        //    if (isAll)
        //    {
        //        DataRow dr = dt.NewRow();
        //        dr["ID"] = "0";
        //        dr["PROJECT_NAME"] = "";
        //        dt.Rows.InsertAt(dr, 0);
        //    }
        //    objCombo.DataSource = dt;
        //    objCombo.TextField = "PROJECT_NAME";
        //    objCombo.ValueField = "ID";
        //    objCombo.DataBind();
        //    objCombo.SelectedIndex = 0;
        //}

        public DataTable LoadBySearch(int type)
        {
            int             iResult = 1;
            DataCollections col     = new DataCollections("V_" + TABLE_NAME);

            col.Add(DataTypes.NVarchar, "*", FieldTypes.DefaultValue, "", "");
            if (type >= 1 && type <= 3)
            {
                col.Add(DataTypes.Number, "NotiType", FieldTypes.Criterion, type, "=");
            }
            col.Add(DataTypes.Number, "CreatedBy", FieldTypes.Criterion, CGlobal.GetUserID(), "=");

            col.ORDERBY = " ORDER BY CreatedOn DESC";
            return(dao.DoQuery(col, ref iResult));
        }
Пример #19
0
        public string GetMyNotiNotSeenByUser()
        {
            DataCollections col = new DataCollections("P_GetMyNotiNotSeenByUser");

            col.Add(DataTypes.Number, "@userid", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            DataTable dt = dao.exeSelectPro(col, "P_GetMyNotiNotSeenByUser");

            try
            {
                return(dt.Rows[0][0].ToString());
            }
            catch
            {
                return("0");
            }
        }
Пример #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                initForm();
                long _problemId = getQueryString(ProblemId);
                long _contestId = getQueryString(ContestId);


                if (_problemId <= 0 || _contestId <= 0)
                {
                    Response.Redirect("MyContests.aspx");
                }
                if (!objMyContest.CheckIsAccepted(_contestId))
                {
                    HELPER.Client.Alert(this, "KHÓA HỌC NÀY CHƯA ĐƯỢC PHÊ DUYỆT");
                    Response.Redirect("MyContests.aspx");
                }
                if (!objContest.CheckIsAvailable(_contestId))
                {
                    HELPER.Client.Alert(this, "KHÓA HỌC NÀY ĐÃ HẾT HIỆU LỰC");
                    Response.Redirect("MyContests.aspx");
                }


                txtProblemName.Text = CGlobal.getDataByColumn(_problemId, "Name", "Problems");

                string _contestURL = CGlobal.getDataByColumn(_contestId, "Url", "Contests");
                string _ProblemURL = CGlobal.getDataByColumn(_problemId, "Url", "Problems");
                string _Username   = CGlobal.getDataByColumn(CGlobal.GetUserID(), "UserName", "Users");

                hdfUrl.Add(ContestsUrl, _contestURL);
                hdfUrl.Add(ProblemsUrl, _ProblemURL);
                hdfUrl.Add(UserName, _Username);
                hdfUrl.Add(ProblemId, _problemId);
                hdfUrl.Add(ContestId, _contestId);
                hdfUrl.Add(SubmissionId, -1);
                hdfUrl.Add(Point, 0);
                hdfUrl.Add(UserID, CGlobal.GetUserID());

                hdfUrl.Add(PathFolderSave, getPathFolderSave());

                hdfUrl.Add(CompilerID, 0);
                hdfUrl.Add(FolderTestCase, Server.MapPath(CConstant.C_DIRECTORY_TESTCASES));
                hdfUrl.Add(TextCode, string.Empty);
            }
        }
Пример #21
0
        void clickMulti(int clickType)
        {
            List <Object> selectItemsID = new List <object>();

            selectItemsID = grvData.GetSelectedFieldValues(grvData.KeyFieldName);
            try
            {
                long acceptBy = CGlobal.GetUserID();

                if (selectItemsID.Count <= 0)
                {
                    HELPER.Client.Alert(this, "Bạn chưa chọn thông báo nào!");
                }
                else
                {
                    foreach (object selectItemId in selectItemsID)
                    {
                        long myNotiID = long.Parse(selectItemId.ToString());

                        switch (clickType)
                        {
                        case 1:     // del , xóa
                            objMyNoti.Delete(myNotiID);
                            break;

                        case 2:     // đã xem
                            objMyNoti.UpdateStatus(myNotiID, 2);
                            break;

                        case 3:     // un accept, bỏ kích hoạt
                            objMyNoti.UpdateStatus(myNotiID, 1);
                            break;

                        default:
                            break;
                        }
                    }
                }
                Response.Redirect(Request.RawUrl, false);
            }
            catch (Exception ex)
            {
                HELPER.Client.Alert(this, "Lỗi cập nhật CSDL! " + ex.Message);
            }
        }
Пример #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long id = CGlobal.GetUserID();

            if (id <= 0)
            {
                Session[CGlobal.USER_ID] = 0;
                pnHello.Visible          = false;
                pnLogin.Visible          = true;
            }
            else
            {
                pnHello.Visible = true;
                pnLogin.Visible = false;
                lbFullName.Text = new DAL.DataUtils().getDataByColumn(id, "FullName", "[Users]");
                //  btnAdmin.Visible = user.IsAdmin(userID);
            }
        }
Пример #23
0
        public bool CheckIsAccepted(long contestID)
        {
            int             iResult = 1;
            DataCollections col     = new DataCollections("MyContest");

            col.Add(DataTypes.Number, "IsAccepted", FieldTypes.DefaultValue, "", "");
            col.Add(DataTypes.Number, "ContestId", FieldTypes.Criterion, contestID, "=");
            col.Add(DataTypes.Number, "UserId", FieldTypes.Criterion, CGlobal.GetUserID(), "=");
            DataTable dt = dao.DoQuery(col, ref iResult);

            try
            {
                return(Boolean.Parse(dt.Rows[0][0].ToString()));
            }
            catch
            {
                return(false);
            }
        }
Пример #24
0
        public DataTable LoadBySearchComponent(int type, long notiID)
        {
            int             iResult = 1;
            DataCollections col     = new DataCollections("V_" + TABLE_NAME);

            //col.Add(DataTypes.NVarchar, "*", FieldTypes.DefaultValue, "", "");
            //if (status >= 1 && status <= 3)
            //{
            //    col.Add(DataTypes.Number, "NotiType", FieldTypes.Criterion, status, "=");
            //}
            switch (type)
            {
            case 1:
                col.Add(DataTypes.NVarchar, "contestname", FieldTypes.DefaultValue, "", "");
                col.ORDERBY = " ORDER BY contestname";
                break;

            case 2:
                col.Add(DataTypes.NVarchar, "problemName", FieldTypes.DefaultValue, "", "");
                col.ORDERBY = " ORDER BY problemName";
                break;

            case 3:
                col.Add(DataTypes.NVarchar, "SendTo", FieldTypes.DefaultValue, "", "");
                col.ORDERBY = " ORDER BY SendTo";
                break;

            default:
                col.Add(DataTypes.NVarchar, "contestname", FieldTypes.DefaultValue, "", "");
                col.Add(DataTypes.NVarchar, "problemName", FieldTypes.DefaultValue, "", "");
                col.Add(DataTypes.NVarchar, "SendTo", FieldTypes.DefaultValue, "", "");
                col.ORDERBY = " ORDER BY CreatedOn DESC";
                break;
            }
            col.Add(DataTypes.Number, "NotificationID", FieldTypes.Criterion, notiID, "=");
            col.Add(DataTypes.Number, "CreatedBy", FieldTypes.Criterion, CGlobal.GetUserID(), "=");


            return(dao.DoQuery(col, ref iResult));
        }
Пример #25
0
        void accept(List <Object> selectItemsID)
        {
            DatabaseDAO dao = new DatabaseDAO();

            objMyContest = new BUS.BUS_MyContest(dao);
            BUS.BUS_Notification   objNoti   = new BUS.BUS_Notification(dao);
            BUS.BUS_MyNotification objMyNoti = new BUS.BUS_MyNotification(dao);
            try
            {
                long acceptBy = CGlobal.GetUserID();

                if (selectItemsID.Count <= 0)
                {
                    HELPER.Client.Alert(this, "Bạn chưa chọn đơn nào!");
                }
                else
                {
                    dao.BeginTransaction();
                    long idNoti = objNoti.Insert(acceptBy, "Đã phê duyệt đơn xin vào khóa học của bạn", 3);
                    foreach (object selectItemId in selectItemsID)
                    {
                        string[] re          = selectItemId.ToString().Split('|');
                        long     idMyContest = long.Parse(re[0]);
                        long     userId      = long.Parse(re[1]);
                        objMyContest.UpdateAcepted(idMyContest, acceptBy);
                        objMyNoti.Insert(idNoti, userId);
                    }
                    dao.EndTransaction();

                    Response.Redirect(Request.RawUrl, false);
                }
            }
            catch (Exception ex)
            {
                dao.RollBack();
                HELPER.Client.Alert(this, "Lỗi cập nhật CSDL! " + ex.Message);
            }
        }
Пример #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //lbTruyCap.Text = Application.Contents["SoNguoiTruyCap"].ToString();
            //lbTongTruyCap.Text = Application.Contents["TongTruyCap"].ToString();
            if (!IsPostBack)
            {
                lbTitle.Text = CGlobal.GetTitleAdmin();
                int num = objMyContest.GetCountNotAcceptedByCreated();
                if (num > 0)
                {
                    lbXinVaoLop.Text = " (" + num + ")";
                }
                //checkAdmin();
                //lbname.Text
            }
            long id = CGlobal.GetUserID();

            try
            {
                DataTable dt    = objUser.LoadByID(id);
                DataRow   dtRow = dt.Rows[0];
                lbUserFullName.Text     = dtRow["FullName"].ToString();
                lbUserName.Text         = dtRow["UserName"].ToString();
                lbUserCode.Text         = dtRow["UserCode"].ToString();
                imgAvatar.ImageUrl      = (dtRow["Avatar"].ToString());
                imgAvatarSlide.ImageUrl = (dtRow["Avatar"].ToString());

                if (!objUser.CheckIsAdmin(id))
                {
                    logOut();
                }
            }
            catch (Exception)
            {
                logOut();
            }
        }
Пример #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lbTruyCap.Text     = Application.Contents["SoNguoiTruyCap"].ToString();
            lbTongTruyCap.Text = Application.Contents["TongTruyCap"].ToString();
            getNoti();

            if (!IsPostBack)
            {
                lbTitle.Text = CGlobal.GetTitleUser();
            }
            long id = CGlobal.GetUserID();

            try
            {
                DataTable dt    = objUser.LoadByID(id);
                DataRow   dtRow = dt.Rows[0];
                lbUserFullName.Text     = dtRow["FullName"].ToString();
                lbUserName.Text         = dtRow["UserName"].ToString();
                lbUserCode.Text         = dtRow["UserCode"].ToString();
                imgAvatar.ImageUrl      = (dtRow["Avatar"].ToString());
                imgAvatarSlide.ImageUrl = (dtRow["Avatar"].ToString());

                if (objUser.CheckIsAdmin(id))
                {
                    liGoToAdmin.Visible = true;
                }
                else
                {
                    liGoToAdmin.Visible = false;
                }
            }
            catch
            {
                logOut();
            }
        }
Пример #28
0
        void clickMulti(int clickType)
        {
            List <Object> selectItemsID = new List <object>();

            selectItemsID = grvData.GetSelectedFieldValues(grvData.KeyFieldName);
            DatabaseDAO dao = new DatabaseDAO();

            objUser = new BUS.BUS_Users(dao);
            BUS.BUS_Notification   objNoti   = new BUS.BUS_Notification(dao);
            BUS.BUS_MyNotification objMyNoti = new BUS.BUS_MyNotification(dao);
            try
            {
                long acceptBy = CGlobal.GetUserID();

                if (selectItemsID.Count <= 0)
                {
                    HELPER.Client.Alert(this, "Bạn chưa chọn người dùng nào!");
                }
                else
                {
                    long idNoti = 0;
                    switch (clickType)
                    {
                    case 1:     // del , xóa
                        break;

                    case 2:     // accept, kích hoạt
                        idNoti = objNoti.Insert(acceptBy, "Đã kích hoạt tài khoản của bạn", 3);
                        break;

                    case 3:     // un accept, bỏ kích hoạt
                        break;

                    case 4:     // to Usertype 1, sinh viên
                        idNoti = objNoti.Insert(acceptBy, "Đã chuyển tài khoản của bạn thành tài khoản Sinh Viên", 3);
                        break;

                    case 5:     // to Usertype 2. Giáo viên
                        idNoti = objNoti.Insert(acceptBy, "Đã chuyển tài khoản của bạn thành tài khoản Giáo Viên", 3);
                        break;

                    default:
                        break;
                    }

                    foreach (object selectItemId in selectItemsID)
                    {
                        long userId = long.Parse(selectItemId.ToString());

                        switch (clickType)
                        {
                        case 1:     // del , xóa
                            objUser.Delete(userId);

                            break;

                        case 2:     // accept, kích hoạt
                            objUser.UpdateByAdminEnable(userId, 1);
                            objMyNoti.Insert(idNoti, userId);
                            break;

                        case 3:     // un accept, bỏ kích hoạt
                            objUser.UpdateByAdminEnable(userId, 0);
                            break;

                        case 4:     // to Usertype 1, sinh viên
                            objUser.UpdateByAdminType(userId, 1);
                            objMyNoti.Insert(idNoti, userId);
                            break;

                        case 5:     // to Usertype 2. Giáo viên
                            objUser.UpdateByAdminType(userId, 2);
                            objMyNoti.Insert(idNoti, userId);
                            break;

                        default:
                            break;
                        }
                    }

                    Response.Redirect(Request.RawUrl, false);
                }
            }
            catch (Exception ex)
            {
                HELPER.Client.Alert(this, "Lỗi cập nhật CSDL! " + ex.Message);
            }
        }