Ejemplo n.º 1
0
        private void DelData(HttpContext context, string btn)
        {
            if (btn != "btnDel")
            {
                context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}");
                return;
            }



            BLL.System.sys_Attachment bll = new BLL.System.sys_Attachment();

            Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo();
            //string status = "0";
            string operaAction = "";
            string operaMemo   = "";

            try
            {
                UpLoad    upFiles = new UpLoad();
                DataTable dt      = bll.GetList("Source=1 and UseId=0").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        upFiles.fileDel(dt.Rows[i]["FilePath"].ToString());
                    }
                }
                bll.Delete("Source=1 and UseId=0");

                //status = "1";
                operaAction = Enums.ActionEnum.Delete.ToString();
                operaMemo   = "清理上传文件";

                //写入操作日志
                BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo);

                context.Response.Write("{\"status\":\"1\",\"msg\":\"清理成功!\"}");
                return;
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }