private void DeleteData(int nExamID)
        {
            RandomExamBLL examBLL = new RandomExamBLL();

            examBLL.DeleteExam(nExamID);

            string strPath = Server.MapPath("/RailExamBao/Online/Photo/" + nExamID + "/");

            if (Directory.Exists(strPath))
            {
                string[] filenames = Directory.GetFiles(strPath);
                for (int i = 0; i < filenames.Length; i++)
                {
                    File.Delete(filenames[i]);
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.HasEditRight("成绩查询"))
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }

                if (PrjPub.HasDeleteRight("新增考试") && PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.IsAdmin && PrjPub.CurrentLoginUser.UseType == 0)
                {
                    hfDeleteRight.Value = "True";
                }
                else
                {
                    hfDeleteRight.Value = "False";
                }

                //如果是访问路局则只要是有成绩查询权限的用户均可以访问成绩查询页面
                if (PrjPub.IsServerCenter)
                {
                    hfIsAdmin.Value = "True";
                }
                //如果是访问路局则非本站段的用户不能访问成绩查询页面
                else
                {
                    hfOrgID.Value = ConfigurationManager.AppSettings["StationID"].ToString();
                    if ((PrjPub.CurrentLoginUser.StationOrgID.ToString() == hfOrgID.Value) || PrjPub.CurrentLoginUser.UseType == 0)
                    {
                        hfIsAdmin.Value = "True";
                    }
                    else
                    {
                        hfIsAdmin.Value = "False";
                    }
                }

                dateStartDateTime.DateValue = DateTime.Today.Year + "-" + DateTime.Today.Month + "-01";
                dateEndDateTime.DateValue   = DateTime.Today.ToString("yyyy-MM-dd");

                if (!string.IsNullOrEmpty(Request.QueryString.Get("begin")))
                {
                    dateStartDateTime.DateValue = Request.QueryString.Get("begin");
                }

                if (!string.IsNullOrEmpty(Request.QueryString.Get("end")))
                {
                    dateEndDateTime.DateValue = Request.QueryString.Get("end");
                }

                hfIsServer.Value = PrjPub.IsServerCenter.ToString();
                //hfHasTwoServer.Value = PrjPub.HasTwoServer().ToString();
                //hfIsMainServer.Value = PrjPub.IsMainServer().ToString();

                if (Request.QueryString.Get("Orgid") != "1" && !string.IsNullOrEmpty(Request.QueryString.Get("Orgid")))
                {
                    BindGrid();
                }
            }

            string strDeleteID = Request.Form.Get("DeleteID");

            if (!string.IsNullOrEmpty(strDeleteID))
            {
                RandomExamBLL             examBLL = new RandomExamBLL();
                RailExam.Model.RandomExam obj     = examBLL.GetExam(Convert.ToInt32(strDeleteID));

                if (obj.HasTrainClass)
                {
                    SessionSet.PageMessage = "不能删除有培训班的考试!";
                    BindGrid();
                    return;
                }

                examBLL.DeleteExam(int.Parse(strDeleteID));
                BindGrid();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.HasEditRight("成绩查询"))
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }

                //UseType=0为路局角色
                if (PrjPub.HasDeleteRight("新增考试") && PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.IsAdmin)// && PrjPub.CurrentLoginUser.UseType == 0
                {
                    hfDeleteRight.Value = "True";
                }
                else
                {
                    hfDeleteRight.Value = "False";
                }

                //如果是访问路局则只要是有成绩查询权限的用户均可以访问成绩查询页面
                if (PrjPub.IsServerCenter)
                {
                    hfIsAdmin.Value = "True";
                }
                //如果是访问路局则非本站段的用户不能访问成绩查询页面
                else
                {
                    hfOrgID.Value = ConfigurationManager.AppSettings["StationID"].ToString();
                    if ((PrjPub.CurrentLoginUser.StationOrgID.ToString() == hfOrgID.Value) || PrjPub.CurrentLoginUser.UseType == 0)
                    {
                        hfIsAdmin.Value = "True";
                    }
                    else
                    {
                        hfIsAdmin.Value = "False";
                    }
                }

                hfIsServer.Value = PrjPub.IsServerCenter.ToString();

                //hfWhereCluase.Value = "a.Org_ID=" + Request.QueryString.Get("orgID")
                //        +" and (Save_Status=1 or (Save_Status=2 and sysdate>Save_Date))";
            }

            string strDeleteID = Request.Form.Get("DeleteID");

            if (!string.IsNullOrEmpty(strDeleteID))
            {
                RandomExamBLL             examBLL = new RandomExamBLL();
                RailExam.Model.RandomExam obj     = examBLL.GetExam(Convert.ToInt32(strDeleteID));

                if (obj.HasTrainClass)
                {
                    SessionSet.PageMessage = "不能删除有培训班的考试!";
                    examsGrid.DataBind();
                    return;
                }

                examBLL.DeleteExam(int.Parse(strDeleteID));
                examsGrid.DataBind();
            }
        }