Пример #1
0
        protected void Button1_ServerClick(object sender, EventArgs e)
        {
            base.CheckAdminPower("DeleteTestPaper", PowerCheckType.Single);
            string intsForm = RequestHelper.GetIntsForm("SelectID");

            if (!string.IsNullOrEmpty(intsForm))
            {
                string[] Arr = intsForm.Split(',');
                for (int i = 0; i < Arr.Length; i++)
                {
                    TestPaperInfo TestPaperModel = TestPaperBLL.ReadPaper(int.Parse(Arr[i]));
                    string        FilePath       = ServerHelper.MapPath("~/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml");
                    if (File.Exists(FilePath))
                    {
                        File.Delete(FilePath);
                    }
                    FilePath = ServerHelper.MapPath("~/m/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml");
                    if (File.Exists(FilePath))
                    {
                        File.Delete(FilePath);
                    }
                    TestPaperBLL.DeletePaper(int.Parse(Arr[i]));
                }
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("TestPaper"), intsForm);
                ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl);
            }
        }
Пример #2
0
        private List <Dictionary <string, object> > GetPerPaidCourseList()
        {
            Dictionary <int, DateTime>          prepaidTestCateList = BLLMTestCate.ReadPrepaidTestCateList(base.UserID);
            List <Dictionary <string, object> > ReturnResult        = new List <Dictionary <string, object> >();

            if (prepaidTestCateList.Count > 0)
            {
                foreach (KeyValuePair <int, DateTime> Info in prepaidTestCateList)
                {
                    Dictionary <string, object> TempDic = new Dictionary <string, object>();
                    ProductInfo product = ProductBLL.ReadProduct(Info.Key);
                    if (product != null)
                    {
                        TempDic.Add("Title", product.Name);
                        if (!string.IsNullOrEmpty(product.ProductNumber))
                        {
                            TempDic.Add("IsVideo", true);
                        }
                        if (!string.IsNullOrEmpty(product.Accessory))
                        {
                            TempDic.Add("IsTest", true);
                        }
                    }
                    else
                    {
                        TempDic.Add("Title", "已删除课程");
                    }
                    TempDic.Add("ClassID", Info.Key);
                    TempDic.Add("PayDate", Info.Value);
                    TempDic.Add("RemainderDays", 30 - (DateTime.Now - Info.Value).Days);
                    TestPaperInfo testPaperModel             = TestPaperBLL.ReadPaper(base.UserID, Info.Key);
                    Dictionary <string, object> testPaperDic = new Dictionary <string, object>();
                    if (testPaperModel != null)
                    {
                        if (testPaperModel.IsPass == 1)
                        {
                            TempDic.Add("IsPass", true);
                        }
                        else
                        {
                            TempDic.Add("IsPass", false);
                            testPaperDic.Add("TestTime", Math.Round(36 - (DateTime.Now - testPaperModel.TestDate).TotalHours, 1));
                        }
                        testPaperDic.Add("Scorse", testPaperModel.Scorse);
                        TempDic.Add("TestCount", 1);
                    }
                    TempDic.Add("TestPaperInfo", testPaperDic);
                    ReturnResult.Add(TempDic);
                }
            }
            return(ReturnResult);
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int    id     = RequestHelper.GetQueryString <int>("ID");
                string Action = RequestHelper.GetQueryString <string>("Action");
                if (Action == "Delete")
                {
                    if (id != int.MinValue)
                    {
                        base.CheckAdminPower("DeleteTestPaper", PowerCheckType.Single);
                        TestPaperInfo TestPaperModel = TestPaperBLL.ReadPaper(id);
                        string        FilePath       = ServerHelper.MapPath("~/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml");
                        if (File.Exists(FilePath))
                        {
                            File.Delete(FilePath);
                        }
                        FilePath = ServerHelper.MapPath("~/m/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml");
                        if (File.Exists(FilePath))
                        {
                            File.Delete(FilePath);
                        }
                        TestPaperBLL.DeletePaper(id);
                        AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("TestPaper"), id);
                        ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), Request.UrlReferrer.ToString());
                    }
                }
                if (Action == "Search")
                {
                    string   searchUserName    = RequestHelper.GetQueryString <string>("username");
                    string   searchRealName    = RequestHelper.GetQueryString <string>("realname");
                    string   searchCompanyName = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("companyname").Trim());
                    string   searchCourseName  = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("coursename").Trim());
                    DateTime startDate         = RequestHelper.GetQueryString <DateTime>("StartDate");
                    DateTime endDate           = RequestHelper.GetQueryString <DateTime>("EndDate");
                    int      isPass            = RequestHelper.GetQueryString <int>("IsPass");
                    CompanyName.Text = searchCompanyName;
                    RealName.Text    = searchRealName;
                    UserName.Text    = searchUserName;
                    CourseName.Text  = searchCourseName;
                    if (startDate != DateTime.MinValue)
                    {
                        SearchStartDate.Text = startDate.ToString("d");
                    }
                    if (endDate != DateTime.MinValue)
                    {
                        SearchEndDate.Text = endDate.ToString("d");
                    }
                    if (isPass >= 0)
                    {
                        IsPass.Text = isPass.ToString();
                    }

                    base.CheckAdminPower("ReadTestPaper", PowerCheckType.Single);
                    deleteTestPaperPower = base.CompareAdminPower("DeleteTestPaper", PowerCheckType.Single);
                    TestPaperInfo testPaperSearch = new TestPaperInfo();
                    testPaperSearch.TestMinDate = startDate;
                    testPaperSearch.TestMaxDate = ShopCommon.SearchEndDate(endDate);
                    testPaperSearch.IsPass      = isPass;
                    testPaperSearch.PaperName   = searchCourseName;
                    if (!string.IsNullOrEmpty(searchCompanyName))
                    {
                        testPaperSearch.CompanyIdCondition = CompanyBLL.ReadCompanyIdStr(searchCompanyName, 1);
                    }

                    if (!string.IsNullOrEmpty(searchRealName) || !string.IsNullOrEmpty(searchUserName))
                    {
                        UserSearchInfo user = new UserSearchInfo();
                        user.UserName = searchUserName;
                        user.RealName = searchRealName;
                        testPaperSearch.UserIdCondition = UserBLL.ReadUserIdStr(UserBLL.SearchUserList(user));
                        if (string.IsNullOrEmpty(testPaperSearch.UserIdCondition))
                        {
                            testPaperSearch.UserIdCondition = "0";
                        }
                    }

                    base.BindControl(TestPaperBLL.ReadList(testPaperSearch, base.CurrentPage, base.PageSize, ref this.Count), this.RecordList, this.MyPager);
                }
            }
        }