Exemple #1
0
        public string TimeLimit(string id)
        {
            TimeLimit_Cooperative_Info info = new TimeLimit_Cooperative_Info(HttpContext.Current.Session["CooperativeKey"].ToInt(), true);
            string TimeL = "'" + info.TimeLimit.ToInt() + "'";

            return(TimeL);
        }
        protected void GrDelete(object sender, CommandEventArgs e)
        {
            int nPageNumber             = int.Parse(txtPageNumber.Text);
            int nPageSize               = int.Parse(txtPageSize.Text);
            SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"];

            nUserLogin.CheckRole("CU0002");
            //if (!nUserLogin.Role.Del)W
            //{
            //    Response.Write("<script >alert('Bạn không có quyền xóa danh mục này!')</script>");
            //}
            //else
            {
                try
                {
                    int mKey = int.Parse(e.CommandArgument.ToString());
                    TimeLimit_Cooperative_Info info = new TimeLimit_Cooperative_Info(mKey);
                    //if ((DateTime.Now - info.CreatedDateTime).TotalDays > 7)
                    //{
                    //    Response.Write("<script >alert('Dữ liệu đã quá 7 ngày, không được phép xóa!')</script>");
                    //}
                    //else
                    {
                        info.Delete();
                        DataTable nTable = new DataTable();
                        switch (nUserLogin.GroupKey.ToInt())
                        {
                        case 2:
                        {
                            nTable = TimeLimit_Cooperative_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, nUserLogin.CooperativeKey, nUserLogin.GroupKey);
                            break;
                        }

                        case 3:
                        {
                            nTable = TimeLimit_Cooperative_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, nUserLogin.CooperativeVenturesKey, nUserLogin.GroupKey);
                            break;
                        }

                        case 4:
                        {
                            goto case 3;
                        }
                        }
                        if (nTable.Rows.Count == 0)
                        {
                            nTable.Rows.Add(0, 0, "", 0);
                        }
                        GV_List.DataSource = nTable;
                        GV_List.DataBind();
                        LoadPages();
                    }
                }
                catch
                {
                    Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
                }
            }
        }
        protected void SaveInfo()
        {
            TimeLimit_Cooperative_Info info = new TimeLimit_Cooperative_Info(int.Parse(txtKey.Text));

            info.TimeLimit = txtDateLimit.Text.ToInt();
            SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"];

            info.CreatedBy       = info.ModifiedBy = new Guid(nUserLogin.Key);
            info.CreatedDateTime = info.ModifiedDateTime = DateTime.Now;
            info.Save();
        }
        protected void LoadInfo(int Key)
        {
            TimeLimit_Cooperative_Info info = new TimeLimit_Cooperative_Info(Key);

            txtDateLimit.Text = info.TimeLimit.ToString();
        }