Пример #1
0
        private void GetList(HttpContext context, string btn)
        {
            if (btn != "show")
            {
                context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}");
                return;
            }
            try
            {
                BLL.sys_Bulletin bll = new BLL.sys_Bulletin();

                string strWhere = "";

                DataTable     dt      = bll.GetList(strWhere).Tables[0];
                string        rowsStr = Utils.ToJson(dt);
                StringBuilder jsonStr = new StringBuilder();
                jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":");
                jsonStr.Append("{\"total\":" + dt.Rows.Count + ",\"rows\":");
                jsonStr.Append(rowsStr);
                jsonStr.Append("}}");
                context.Response.Write(jsonStr);
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }
Пример #2
0
        private void GetListByPower(HttpContext context, string btn)
        {
            if (btn != "show")
            {
                context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}");
                return;
            }
            try
            {
                BLL.sys_Bulletin bll = new BLL.sys_Bulletin();
                //int recordNum = RequestHelper.GetInt("recordNum",0);


                Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo();

                string strWhere = "";

                DataTable     dt      = bll.GetListByPower(strWhere, 0, loginUserModel.DepId).Tables[0];
                string        rowsStr = Utils.ToJson(dt);
                StringBuilder jsonStr = new StringBuilder();
                jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":");
                jsonStr.Append("{\"total\":" + dt.Rows.Count + ",\"rows\":");
                jsonStr.Append(rowsStr);
                jsonStr.Append("}}");
                context.Response.Write(jsonStr);
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }
Пример #3
0
        private void GetData(HttpContext context, string btn)
        {
            if (btn != "show")
            {
                context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}");
                return;
            }
            try
            {
                int bulletinId       = RequestHelper.GetInt("id", 0);
                BLL.sys_Bulletin bll = new BLL.sys_Bulletin();


                DataTable dt = bll.GetList(bulletinId).Tables[0];
                if (dt.Rows.Count == 0)
                {
                    context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,该条数据已被其他人删除!\"}");
                    return;
                }
                string rowsStr = Utils.ToJson(dt);

                string attachStr = "";
                string attachId  = Utils.ObjectToStr(dt.Rows[0]["Attachment"]);
                if (attachId != "" && attachId != "0")
                {
                    DataTable attachDT = new BLL.System.sys_Attachment().GetList("ID in(" + attachId + ")").Tables[0];
                    attachStr = Utils.ToJson(attachDT);
                }

                StringBuilder jsonStr = new StringBuilder();
                jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":");
                jsonStr.Append(rowsStr);
                if (attachStr == "")
                {
                    jsonStr.Append(",\"attachinfo\":\"\"");
                }
                else
                {
                    jsonStr.Append(",\"attachinfo\":" + attachStr);
                }
                jsonStr.Append("}");
                context.Response.Write(jsonStr);
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }
Пример #4
0
        private void GetHomePage(HttpContext context)
        {
            try
            {
                string loginSalt = RequestHelper.GetQueryString("LoginSalt");
                Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo();
                if (loginUserModel == null || loginUserModel.Salt != loginSalt)
                {
                    context.Response.Write("{\"status\":\"0.1\",\"msg\":\"对不起,登录超时,请重新登录!\"}");
                    return;
                }
                string vt = new BLL.System.sys_Config().loadConfig().webversiontime;
                BLL.System.sys_Mail_Send mailBll = new BLL.System.sys_Mail_Send();
                int receiveNoRead = mailBll.GetReceiveNoRead(loginUserModel.ID);


                BLL.sys_Bulletin bll        = new BLL.sys_Bulletin();
                int       recordNumBulletin = RequestHelper.GetInt("recordNumBulletin", 0);
                string    strWhere          = "";
                DataTable bulletinDT        = bll.GetListByPower(strWhere, recordNumBulletin, loginUserModel.DepId).Tables[0];
                string    bulletinInfo      = Utils.ToJson(bulletinDT);

                BLL.System.sys_Menu menuBll = new BLL.System.sys_Menu();
                DataTable           todoDT  = menuBll.GetTodoList(loginUserModel.ID).Tables[0];
                string todoInfo             = Utils.ToJson(todoDT);

                DataTable nodoDT   = menuBll.GetNodoList(loginUserModel.ID).Tables[0];
                string    nodoInfo = Utils.ToJson(nodoDT);

                StringBuilder jsonStr = new StringBuilder();
                jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"vt\":\"" + vt + "\"");
                jsonStr.Append(",\"receiveNoRead\":" + receiveNoRead);
                jsonStr.Append(",\"bulletinInfo\":" + bulletinInfo);
                jsonStr.Append(",\"todoInfo\":" + todoInfo);
                jsonStr.Append(",\"nodoInfo\":" + nodoInfo);
                jsonStr.Append("}");
                context.Response.Write(jsonStr);
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"" + e.Message + "\"}");
            }
        }
Пример #5
0
        private void SetTop(HttpContext context, string btn)
        {
            if (btn != "btnSetTop" && btn != "btnCancelSetTop")
            {
                context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}");
                return;
            }
            string idStr   = RequestHelper.GetString("idStr");
            int    flagTop = RequestHelper.GetInt("flagTop", 0);

            if (idStr == "")
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"请选择需要操作的记录!\"}");
                return;
            }
            BLL.sys_Bulletin           bll            = new BLL.sys_Bulletin();
            Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo();
            string operaMessage = "";
            string status       = "0";
            string operaAction  = "";
            string operaMemo    = "";

            try
            {
                if (bll.SetTop(PageValidate.SafeLongFilter(idStr, 0), flagTop, loginUserModel.ID, loginUserModel.PerName, out operaMessage))
                {
                    status      = "1";
                    operaAction = Enums.ActionEnum.Delete.ToString();
                    operaMemo   = (flagTop == 0 ? "取消" : "") + "置顶公告:(" + idStr + ")";
                    //写入操作日志
                    BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo);
                }
                context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}");
                return;
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }
Пример #6
0
        private void DelData(HttpContext context, string btn)
        {
            if (btn != "btnDel")
            {
                context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}");
                return;
            }
            string idStr = RequestHelper.GetString("idStr");

            //string nameStr = RequestHelper.GetString("nameStr");
            if (idStr == "")
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"请选择需要删除的记录!\"}");
                return;
            }
            BLL.sys_Bulletin           bll            = new BLL.sys_Bulletin();
            Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo();
            string operaMessage = "";
            string status       = "0";
            string operaAction  = "";
            string operaMemo    = "";

            try
            {
                if (bll.DeleteList(PageValidate.SafeLongFilter(idStr, 0), out operaMessage))
                {
                    status      = "1";
                    operaAction = Enums.ActionEnum.Delete.ToString();
                    operaMemo   = "删除公告:(" + idStr + ")";
                    //写入操作日志
                    BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo);
                }
                context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}");
                return;
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }
Пример #7
0
        private void SaveData(HttpContext context, string btn)
        {
            if (btn != "btnSave" && btn != "btnSaveAndSubmit")
            {
                context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}");
                return;
            }
            string submitFlag     = RequestHelper.GetString("submitFlag");
            string id             = RequestHelper.GetString("id");
            string bulletinName   = RequestHelper.GetString("bulletinName");
            string receiveDepId   = RequestHelper.GetString("receiveDepId");
            string receiveDepName = RequestHelper.GetString("receiveDepName");
            string flagTop        = RequestHelper.GetString("flagTop");
            string content        = RequestHelper.GetString("content");
            string fileId         = RequestHelper.GetString("fileId");
            string attachId       = RequestHelper.GetString("attachId");

            if (bulletinName == "")
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"公告名称不能为空!\"}");
                return;
            }
            Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo();
            BLL.sys_Bulletin           bll            = new BLL.sys_Bulletin();
            Model.System.sys_Bulletin  model          = new Model.System.sys_Bulletin();
            model.ID              = Utils.StrToInt(id, 0);
            model.BulletinName    = bulletinName;
            model.ReceiveDepId    = receiveDepId;
            model.ReceiveDepName  = receiveDepName;
            model.BulletinContent = content;
            model.Attachment      = PageValidate.SafeLongFilter(attachId, 0);
            model.FlagTop         = Utils.StrToInt(flagTop, 0);
            model.BillState       = Utils.StrToInt(submitFlag, 0);
            model.FlagDel         = false;
            model.OperaId         = loginUserModel.ID;
            model.OperaName       = loginUserModel.PerName;
            model.OperaTime       = DateTime.Now;

            List <Model.System.sys_BulletinReceiveDep> modelsList = new List <Model.System.sys_BulletinReceiveDep>();

            Model.System.sys_BulletinReceiveDep models = new Model.System.sys_BulletinReceiveDep();
            string[] depArray = receiveDepId.Split(',');

            foreach (string depId in depArray)
            {
                models = new Model.System.sys_BulletinReceiveDep();
                models.ReceiveDepId = int.Parse(depId);
                models.FlagDel      = false;
                modelsList.Add(models);
            }
            model.sys_BulletinReceiveDeps = modelsList;
            string operaMessage = "";
            string status       = "0";
            string operaAction  = "";
            string operaMemo    = "";

            try
            {
                if (id == "")
                {
                    model.ID = bll.Add(model, PageValidate.SafeLongFilter(fileId, 0), out operaMessage);
                    if (model.ID > 0)
                    {
                        status      = "1";
                        operaAction = Enums.ActionEnum.Add.ToString();
                        operaMemo   = "新增公告:" + model.BulletinName + "(" + model.ID + ")";
                        //写入操作日志
                        BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo);
                    }
                }
                else
                {
                    if (bll.Update(model, PageValidate.SafeLongFilter(fileId, 0), out operaMessage))
                    {
                        status      = "1";
                        operaAction = Enums.ActionEnum.Edit.ToString();
                        operaMemo   = "修改公告:" + model.BulletinName + "(" + model.ID + ")";
                        //写入操作日志
                        BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo);
                    }
                }
                context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}");
                return;
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }