Ejemplo n.º 1
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            try
            {
                switch (AjaxType)
                {
                case "GETGASUSERLIST":
                    List <GasUser> userlist = GasUserManageService.GetInstance().GetGasUserList(base.loginOperator.Account);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <GasUser>(userlist, userlist.Count)
                    };
                    break;

                case "GETCOMPANY":
                    List <Company> list = IotMService.GetInstance().GetCompanyList();
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <Company>(list, list.Count)
                    };
                    break;

                case "GETGASUSER":
                    string companyId = "", userId = "";
                    if (context.Request.Form["companyId"] != null && context.Request.Form["companyId"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["companyId"].ToString().Trim();
                    }
                    if (context.Request.Form["userId"] != null && context.Request.Form["userId"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["userId"].ToString().Trim();
                    }
                    if (companyId != "" && userId != "")
                    {
                        GasUser gasUser = IotMService.GetInstance().GetGasUserByUserId(userId, companyId);
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.TToJson <GasUser>(gasUser)
                        };
                    }
                    break;

                case "ADDGASUSER":
                    companyId = ""; userId = "";
                    if (context.Request.Form["companyId"] != null && context.Request.Form["companyId"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["companyId"].ToString().Trim();
                    }
                    if (context.Request.Form["userId"] != null && context.Request.Form["userId"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["userId"].ToString().Trim();
                    }
                    if (companyId != "" && userId != "")
                    {
                        jsonMessage = GasUserManageService.GetInstance().AddGasUser(base.loginOperator.Account, userId, companyId);
                    }
                    break;

                case "DELETEGASUSER":
                    companyId = ""; userId = "";
                    if (context.Request.Form["Company"] != null && context.Request.Form["Company"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["Company"].ToString().Trim();
                    }
                    if (context.Request.Form["UserID"] != null && context.Request.Form["UserID"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["UserID"].ToString().Trim();
                    }
                    if (companyId != "" && userId != "")
                    {
                        jsonMessage = GasUserManageService.GetInstance().RemoveGasUser(base.loginOperator.Account, userId, companyId);
                    }
                    break;

                case "CHARGE":
                    companyId = ""; userId = ""; decimal money = 0;
                    if (context.Request.Form["companyId"] != null && context.Request.Form["companyId"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["companyId"].ToString().Trim();
                    }
                    if (context.Request.Form["userId"] != null && context.Request.Form["userId"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["userId"].ToString().Trim();
                    }
                    if (context.Request.Form["money"] != null && context.Request.Form["money"].ToString().Trim() != string.Empty)
                    {
                        money = decimal.Parse(context.Request.Form["money"].ToString().Trim());
                    }
                    if (companyId == "" || userId == "" || money == 0)
                    {
                        break;
                    }
                    string result = IotMService.GetInstance().Charge(userId, companyId, money);
                    if (result == "")
                    {
                        GasUser           gasUser = IotMService.GetInstance().GetGasUserByUserId(userId, companyId);
                        Olb_PaymentRecord payMent = new Olb_PaymentRecord()
                        {
                            Account        = base.loginOperator.Account,
                            GasUserID      = userId,
                            PayMoney       = money,
                            PayTime        = DateTime.Now,
                            Balance        = gasUser.Balance,
                            GasUserAddress = gasUser.Address,
                            GasUserName    = gasUser.UserName
                        };
                        PaymentManageService.GetInstance().AddPaymentRecord(payMent);
                        jsonMessage = new Message()
                        {
                            Result = true, TxtMessage = "充值成功。"
                        };
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 2
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            WCFServiceProxy <IUserManage> proxy = null;

            try
            {
                switch (AjaxType)
                {
                //查询用户表讯息
                case "QUERY":
                    CommonSearch <View_UserMeter> InfoSearch = new CommonSearch <View_UserMeter>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_UserMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where
                    };
                    List <View_UserMeter> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_UserMeter>(list, sCondition.TTotalCount)
                    };
                    break;

                //查询用户表具视图
                case "QUERYHISTORY":
                    CommonSearch <View_UserMeterHistory> InfoSearchView = new CommonSearch <View_UserMeterHistory>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request["UserID"] != null && context.Request["UserID"].ToString().Trim() != string.Empty)
                    {
                        Where += "and UserID='" + context.Request["UserID"].ToString() + "'";
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_UserMeterHistory", TFieldKey = "ReadDate", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "ReadDate DESC", TWhere = Where
                    };
                    List <View_UserMeterHistory> listView = InfoSearchView.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_UserMeterHistory>(listView, sCondition.TTotalCount)
                    };
                    break;

                //查询街道
                case "QUERYSTREET":
                    //CommonSearch<IoT_Street> InfoSearch = new CommonSearch<IoT_Street>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName       = "View_Community",
                        TFieldKey    = "ID",
                        TTotalCount  = -1,
                        TPageCurrent = 1,
                        TFieldOrder  = "ID ASC",
                        TWhere       = Where
                    };
                    CommonSearch <View_Community> InfoSearchStreet = new CommonSearch <View_Community>();
                    List <View_Community>         listStreet       = InfoSearchStreet.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_Community>(listStreet, sCondition.TTotalCount)
                    };
                    break;

                //查询历史资料笔数
                case "GETHISTORYCOUNT":
                    string TimeKind  = string.Empty;   //按照时间类型
                    string UserKind  = string.Empty;   //按照人员类型
                    string CompanyID = string.Empty;   //公司ID
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    //CommonSearch<IoT_Street> InfoSearch = new CommonSearch<IoT_Street>();
                    try
                    {
                        if (context.Request["Time"] != null && context.Request["Time"].ToString().Trim() != string.Empty)
                        {
                            TimeKind = context.Request["Time"];
                        }
                        if (context.Request["User"] != null && context.Request["User"].ToString().Trim() != string.Empty)
                        {
                            UserKind = context.Request["User"];
                        }
                        if (UserKind != "*" && UserKind != "")
                        {
                            Where += "AND charindex(','+CAST(Community AS NVARCHAR(10))+',',','+'" + UserKind + "'+',')>=1";
                        }
                        if (TimeKind != "*")
                        {
                            Where += "and CONVERT(varchar(100), ReadDate, 23)='" + TimeKind + "'";
                        }
                        WCFServiceProxy <IChaoBiao>  proxy1  = new WCFServiceProxy <IChaoBiao>();
                        List <View_UserMeterHistory> listAll = proxy1.getChannel.GetModelList(Where);
                        if (listAll == null || listAll.Count <= 0)
                        {    //如果查询出笔数大于0,返回True
                            jsonMessage = new Message()
                            {
                                Result     = true,
                                TxtMessage = ""
                            };
                        }
                        else
                        {    //否则返回False
                            jsonMessage = new Message()
                            {
                                Result     = false,
                                TxtMessage = ""
                            };
                        }
                    }
                    catch (Exception)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = ""
                        };
                    }
                    break;

                //获取当前的公司
                case "GETCOMPANY":
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = loginOperator.CompanyID
                    };
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 3
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;
            //获取操作类型AType:ADD,EDIT,DELETE,QUERY
            string    AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            SystemLog Info;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            WCFServiceProxy <ISystemLogManage> proxy = null;

            try
            {
                switch (AjaxType)
                {
                case "QUERY":
                    string Where = "1=1 ";
                    if (base.loginOperator.CompanyID.ToUpper() != "ZZCY")
                    {
                        Where += "  AND CompanyID='" + base.loginOperator.CompanyID + "'";
                    }
                    if (context.Request.Form["LogType"] != null && context.Request.Form["LogType"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND LogType=" + context.Request.Form["LogType"].ToString();
                    }
                    if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND LogTime>='" + context.Request.Form["Date1"].ToString() + "'";;
                    }
                    if (context.Request.Form["Date2"] != null && context.Request.Form["Date2"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND LogTime<='" + context.Request.Form["Date2"].ToString() + "'";;
                    }
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += "  AND " + context.Request.Form["TWhere"].ToString();
                    }
                    CommonSearch <SystemLog> userInfoSearch = new CommonSearch <SystemLog>();
                    SearchCondition          sCondition     = new SearchCondition()
                    {
                        TBName = "S_SystemLog", TFieldKey = "LogID", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "LogID DESC", TWhere = Where
                    };
                    List <SystemLog> list = userInfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <SystemLog>(list, sCondition.TTotalCount)
                    };
                    break;

                case "ADD":
                    proxy          = new WCFServiceProxy <ISystemLogManage>();
                    Info           = new CommonModelFactory <SystemLog>().GetModelFromContext(context);
                    Info.CompanyID = base.loginOperator.CompanyID;
                    Info.OperID    = base.loginOperator.OperID;
                    Info.OperName  = base.loginOperator.Name;
                    Info.LogTime   = System.DateTime.Now;
                    ClientHelper clientHelper = new ClientHelper();
                    Info.LoginIP      = clientHelper.ClientIP;
                    Info.LoginBrowser = clientHelper.clientBrowser;
                    Info.LoginSystem  = clientHelper.ClientSystem;
                    jsonMessage       = proxy.getChannel.AddSystemLog(Info);
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch
            { }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 4
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string   AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            IoT_User Info; View_UserMeter viewInfo;
            WCFServiceProxy <IUserManage> proxy = null;

            try
            {
                switch (AjaxType)
                {
                //查询用户
                case "QUERY":

                    CommonSearch <IoT_User> InfoSearch = new CommonSearch <IoT_User>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "IoT_User", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where
                    };
                    List <IoT_User> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <IoT_User>(list, sCondition.TTotalCount)
                    };
                    break;

                //查询用户表具视图
                case "QUERYVIEW":

                    CommonSearch <View_UserMeter> InfoSearchView = new CommonSearch <View_UserMeter>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_UserMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where
                    };
                    List <View_UserMeter> listView = InfoSearchView.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_UserMeter>(listView, sCondition.TTotalCount)
                    };
                    break;

                //查询临时用户
                case "QUERYTEMP":

                    CommonSearch <IoT_UserTemp> InfoSearchTemp = new CommonSearch <IoT_UserTemp>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "IoT_UserTemp", TFieldKey = "MeterNo", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "MeterNo ASC", TWhere = Where
                    };
                    List <IoT_UserTemp> listTemp = InfoSearchTemp.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <IoT_UserTemp>(listTemp, sCondition.TTotalCount)
                    };
                    break;

                case "QUERYALARMPARM":
                    //TODO:查询用户当前设置的报警参数
                    CommonSearch <Iot_MeterAlarmPara> meterAlarmPara = new CommonSearch <Iot_MeterAlarmPara>();
                    viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context);

                    if (viewInfo.MeterNo != null && viewInfo.MeterNo.ToString().Trim() != string.Empty)
                    {
                        Where      = $"MeterNo = '{viewInfo.MeterNo.ToString().Trim()}'";
                        sCondition = new SearchCondition()
                        {
                            TBName = "Iot_MeterAlarmPara", TFieldKey = "MeterNo", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "MeterNo ASC", TWhere = Where
                        };
                        List <Iot_MeterAlarmPara> listMAP = meterAlarmPara.GetList(ref sCondition, context);
                        if (listMAP.Count == 1)
                        {
                            jsonMessage = new Message()
                            {
                                Result     = true,
                                TxtMessage = JsToJson.SerializeToJsonString(listMAP[0])
                            };
                        }
                        else
                        {
                            jsonMessage = new Message()
                            {
                                Result     = false,
                                TxtMessage = "没有找到配置数据。"
                            };
                        }
                    }
                    break;

                //单户创建
                case "ADD":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "cjyh_dhcj"))
                    {
                        Info           = new CommonModelFactory <IoT_User>().GetModelFromContext(context);
                        Info.CompanyID = base.loginOperator.CompanyID;
                        proxy          = new WCFServiceProxy <IUserManage>();
                        jsonMessage    = proxy.getChannel.Add(Info);
                    }
                    break;


                //编辑用户信息和表信息
                case "EDITUSERMETER":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dagl_bjyh"))
                    {
                        viewInfo    = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context);
                        proxy       = new WCFServiceProxy <IUserManage>();
                        jsonMessage = proxy.getChannel.EditUserMeter(viewInfo);
                    }
                    break;

                //删除用户信息和表信息
                case "DELETEUSERMETER":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dagl_scyh"))
                    {
                        viewInfo    = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context);
                        proxy       = new WCFServiceProxy <IUserManage>();
                        jsonMessage = proxy.getChannel.DeleteUserMeter(viewInfo);
                    }
                    break;

                //批量删除用户
                case "BATCHDELETE":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dagl_scyh"))
                    {
                        viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context);
                        proxy    = new WCFServiceProxy <IUserManage>();

                        if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                        {
                            string strNo = context.Request.Form["strNo"];

                            string[] arrNo = strNo.Split(',');

                            for (int i = 0; i < arrNo.Length; i++)
                            {
                                proxy.getChannel.BatchDeleteUserMeter(arrNo[i]);
                            }
                        }
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = "删除用户成功"
                        };
                    }
                    break;

                //批量excel导入
                case "BATCHIMPORT":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "cjyh_dhcj"))
                    {
                        viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context);
                        proxy    = new WCFServiceProxy <IUserManage>();

                        if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                        {
                            string strNo = context.Request.Form["strNo"];

                            string[] arrNo = strNo.Split(',');

                            for (int i = 0; i < arrNo.Length; i++)
                            {
                                proxy.getChannel.BatchImport(arrNo[i]);
                            }
                        }
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = "导入用户成功"
                        };
                    }
                    break;

                //批量添加用户
                case "BATCHADD":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "cjyh_dhcj"))
                    {
                        viewInfo = new CommonModelFactory <View_UserMeter>().GetModelFromContext(context);
                        proxy    = new WCFServiceProxy <IUserManage>();

                        string street = "";
                        if (context.Request.Form["Street"] != null && context.Request.Form["Street"].ToString().Trim() != string.Empty)
                        {
                            street = context.Request.Form["Street"].ToString().Trim();
                        }
                        string community = "";
                        if (context.Request.Form["Community"] != null && context.Request.Form["Community"].ToString().Trim() != string.Empty)
                        {
                            community = context.Request.Form["Community"].ToString().Trim();
                        }
                        string meterType = "";
                        if (context.Request.Form["MeterType"] != null && context.Request.Form["MeterType"].ToString().Trim() != string.Empty)
                        {
                            meterType = context.Request.Form["MeterType"].ToString().Trim();
                        }

                        if (context.Request.Form["Rows"] != null && context.Request.Form["Rows"].ToString().Trim() != string.Empty)
                        {
                            UserRows    rows     = JsToJson.Deserialize <UserRows>(context.Request.Form["Rows"].ToString());
                            List <User> userlist = rows.Rows;

                            int     count = 0; string error = "";
                            Message tempM = null;
                            foreach (User u in userlist)
                            {
                                if (u.MeterNo.Trim() == "")
                                {
                                    tempM = new Message()
                                    {
                                        Result = false, TxtMessage = string.Format("UserID={0}的表号未填写\r", u.UserID)
                                    };
                                }
                                else
                                {
                                    IoT_User tempUser = new IoT_User();

                                    tempUser.UserID    = u.UserID;
                                    tempUser.UserName  = u.UserName;
                                    tempUser.Address   = u.Address;
                                    tempUser.Community = community;
                                    tempUser.Street    = street;
                                    tempUser.CompanyID = loginOperator.CompanyID;
                                    tempUser.State     = '1';

                                    IoT_Meter tempMeter = new IoT_Meter();
                                    tempMeter.MeterType = meterType;
                                    tempMeter.MeterNo   = u.MeterNo;
                                    tempMeter.CompanyID = loginOperator.CompanyID;
                                    tempM = proxy.getChannel.BatchAddUserMeter(tempUser, tempMeter);
                                }
                                if (tempM.Result)
                                {
                                    count++;
                                }
                                else
                                {
                                    error = tempM.TxtMessage;
                                }
                            }
                            if (count > 0)
                            {
                                jsonMessage = new Message()
                                {
                                    Result     = true,
                                    TxtMessage = "批量添加用户" + count + "个成功," + (userlist.Count - count) + "个失败,失败原因:" + error
                                };
                            }
                            else
                            {
                                jsonMessage = new Message()
                                {
                                    Result     = false,
                                    TxtMessage = "批量添加用户失败"
                                };
                            }
                        }
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex) {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 5
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            WCFServiceProxy <ISetUploadCycle> proxy = null;

            try
            {
                switch (AjaxType)
                {
                //查询充值的历史资料
                case "QUERY":
                    CommonSearch <View_ChongZhi> InfoSearch = new CommonSearch <View_ChongZhi>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["DateS"] != null && context.Request.Form["DateS"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND convert(char(10),TopUpDate,120)>='" + context.Request.Form["DateS"].ToString() + "'";;
                    }
                    if (context.Request.Form["DateE"] != null && context.Request.Form["DateE"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND convert(char(10),TopUpDate,120)<='" + context.Request.Form["DateE"].ToString() + "'";;
                    }
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_ChongZhi", TFieldKey = "AID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "TopUpDate DESC", TWhere = Where
                    };
                    List <View_ChongZhi> list = InfoSearch.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_ChongZhi>(list, sCondition.TTotalCount)
                    };
                    break;

                //执行充值动作
                case "CXCHONGZHI":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "CZ_CXCZ"))    //营业厅撤销充值
                    {
                        IoT_MeterTopUp Info;
                        WCFServiceProxy <IChongzhiManage> proxy1 = null;
                        Info = new CommonModelFactory <IoT_MeterTopUp>().GetModelFromContext(context);
                        List <IoT_MeterTopUp> lstIoT_MeterTopUp = new List <IoT_MeterTopUp>();
                        //表号
                        string MeterNo = string.IsNullOrEmpty(context.Request["MeterNo"]) == true ? "" : context.Request["MeterNo"].ToString();
                        //充值金额
                        string Amount = string.IsNullOrEmpty(context.Request["Amount"]) == true ? "" : context.Request["Amount"].ToString();
                        //表ID
                        string MeterID = string.IsNullOrEmpty(context.Request["MeterID"]) == true ? "" : context.Request["MeterID"].ToString();
                        //人员ID
                        string UserID = string.IsNullOrEmpty(context.Request["UserID"]) == true ? "" : context.Request["UserID"].ToString();
                        //PK
                        string ID = string.IsNullOrEmpty(context.Request["AID"]) == true ? "" : context.Request["AID"].ToString();
                        //任务编号
                        string TaskID  = string.IsNullOrEmpty(context.Request["TaskID"]) == true ? "" : context.Request["TaskID"].ToString();
                        string Context = string.IsNullOrEmpty(context.Request["Context"]) == true ? "" : context.Request["Context"].ToString();
                        Info.Amount    = decimal.Parse(Amount);
                        Info.MeterID   = int.Parse(MeterID);
                        Info.MeterNo   = MeterNo;
                        Info.ID        = int.Parse(ID);
                        Info.Context   = Context;
                        Info.Oper      = base.loginOperator.Name;
                        Info.CompanyID = base.loginOperator.CompanyID;
                        Info.TopUpDate = DateTime.Now;
                        Info.UserID    = UserID;
                        Info.TopUpType = '1';    //充值类型目前未知
                        Info.State     = '0';    //等待充值状态
                        Info.TaskID    = TaskID; //等待充值状态
                        proxy1         = new WCFServiceProxy <IChongzhiManage>();
                        jsonMessage    = proxy1.getChannel.UPD(Info);
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            //获取操作类型AType:list,oneinfo
            string  AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "调用失败。"
            };
            WCFServiceProxy <IGetMonitorInfo> proxy = null;

            try
            {
                switch (AjaxType)
                {
                case "LIST":    //获取采集端服务器列表
                    proxy = new WCFServiceProxy <IGetMonitorInfo>();
                    DataArge       arglist = proxy.getChannel.GetMonitorInfo("");
                    List <CJDInfo> list    = (List <CJDInfo>)arglist.Data;
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <CJDInfo>(list, list.Count)
                    };
                    break;

                case "ONEINFO":    //获取某一台采集服务器 监视信息
                    proxy = new WCFServiceProxy <IGetMonitorInfo>();
                    string dscId     = context.Request.Form["dscId"] == null ? string.Empty : context.Request.Form["dscId"].ToString();
                    string mac       = context.Request.Form["mac"] == null ? string.Empty : context.Request.Form["mac"].ToString();
                    string datetime  = context.Request.Form["datetime"] == null ? string.Empty : context.Request.Form["datetime"].ToString();
                    string pageIndex = context.Request.Form["page"] == null ? string.Empty : context.Request.Form["page"].ToString();
                    string pageSize  = context.Request.Form["rows"] == null ? string.Empty : context.Request.Form["rows"].ToString();
                    //获取日志
                    LogCollection logCollection = proxy.getChannel.GetDCSLog(dscId, mac, Convert.ToDateTime(datetime), Convert.ToInt32(pageIndex), Convert.ToInt32(pageSize), IoTM.Common.Log.ReadLogDataType.OneMeterData);
                    //LogCollection logCollection = new LogCollection();
                    //logCollection.Rows = 1;
                    //List<TxtMessage> listTxtMessage = new List<TxtMessage>();
                    //TxtMessage txtmsg;
                    //for (int j = 0; j < 20; j++)
                    //{
                    //    txtmsg = new TxtMessage();
                    //    txtmsg.Message =DateTime.Now.ToString("j: "+"yyyy-MM-dd HH:mm:ss.fff");
                    //    listTxtMessage.Add(txtmsg);
                    //}
                    //logCollection.ListTxtMessage = listTxtMessage;

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <TxtMessage>(logCollection.ListTxtMessage, logCollection.Rows)
                    };
                    //context.Response.Write(JSon.ListToJson<TxtMessage>(logCollection.ListTxtMessage, logCollection.ListTxtMessage.Count));
                    //return;
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 7
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string                      AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            IoT_ChangeMeter             Info;
            WCFServiceProxy <IHuanBiao> Iproxy = null;

            try
            {
                switch (AjaxType)
                {
                //查询换标记录
                case "QUERY":
                    CommonSearch <View_HuanBiao> InfoSearch = new CommonSearch <View_HuanBiao>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_HuanBiao", TFieldKey = "HID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "FinishedDate DESC", TWhere = Where
                    };
                    List <View_HuanBiao> list = InfoSearch.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_HuanBiao>(list, sCondition.TTotalCount)
                    };
                    break;

                //查询换标历史记录
                case "HISTORYMETER":
                    CommonSearch <View_HistoryUserMeter> InfoSearch1 = new CommonSearch <View_HistoryUserMeter>();

                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_HistoryUserMeter", TFieldKey = "MeterNo", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "MeterNo DESC", TWhere = Where
                    };
                    List <View_HistoryUserMeter> list1 = InfoSearch1.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_HistoryUserMeter>(list1, sCondition.TTotalCount)
                    };
                    break;

                //新增换标申请
                case "ADD":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs"))
                    {
                        Info = new CommonModelFactory <IoT_ChangeMeter>().GetModelFromContext(context);
                        List <IoT_ChangeMeter> lstIoT_ChangeMeter = new List <IoT_ChangeMeter>();
                        View_UserMeter         View_UserMeters    = new View_UserMeter();
                        string MeterNo = string.IsNullOrEmpty(context.Request["MeterNo"]) == true ? "" : context.Request["MeterNo"].ToString();
                        string UserID  = string.IsNullOrEmpty(context.Request["UserID"]) == true ? "" : context.Request["UserID"].ToString();
                        string Reason  = string.IsNullOrEmpty(context.Request["Reason"]) == true ? "" : context.Request["Reason"].ToString();
                        Iproxy          = new WCFServiceProxy <IHuanBiao>();
                        View_UserMeters = Iproxy.getChannel.getView_UserMeterList(UserID, MeterNo, loginOperator.CompanyID);
                        Info.CompanyID  = View_UserMeters.CompanyID;
                        //Info.OldGasSum = View_UserMeters.LastTotal;这里不太清楚
                        Info.OldMeterNo = View_UserMeters.MeterNo;
                        Info.Reason     = Reason;
                        Info.State      = '1';
                        Info.UserID     = View_UserMeters.UserID;
                        //Info.ChangeUseSum = View_UserMeters.CompanyID;
                        //Info.ChangeGasSum = View_UserMeters.CompanyID;
                        //Info.p = View_UserMeters.CompanyID;
                        Info.RegisterDate = DateTime.Now;
                        jsonMessage       = Iproxy.getChannel.AddShenQing(Info);
                    }
                    break;

                //修改换标申请
                case "EDIT":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs"))
                    {
                        Info = new CommonModelFactory <IoT_ChangeMeter>().GetModelFromContext(context);
                        string Reason = string.IsNullOrEmpty(context.Request["Reason"]) == true ? "" : context.Request["Reason"].ToString();
                        string HID    = string.IsNullOrEmpty(context.Request["HID"]) == true ? "" : context.Request["HID"].ToString();
                        Info.ID        = int.Parse(HID);
                        Info.Reason    = Reason;
                        Info.CompanyID = loginOperator.CompanyID;
                        Iproxy         = new WCFServiceProxy <IHuanBiao>();
                        jsonMessage    = Iproxy.getChannel.Edit(Info);
                    }
                    break;

                //撤销换表申请
                case "REVOKE":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "SQREVOKE"))
                    {
                        Iproxy = new WCFServiceProxy <IHuanBiao>();
                        string ID = string.Empty;
                        if (context.Request["HID"] != null && context.Request["HID"].ToString().Trim() != string.Empty)
                        {
                            ID = context.Request["HID"].ToString() == "" ? "0" : context.Request["HID"].ToString();
                        }
                        jsonMessage = Iproxy.getChannel.revoke(ID, loginOperator.CompanyID);
                    }
                    break;

                //换表登记
                case "DENGJI":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "DENGJI"))
                    {
                        string dayGas          = string.Empty; //上期结算底数
                        string NewMeterType_DJ = string.Empty; //新表类型
                        string TotalAmountS    = string.Empty; //本期用量
                        string MeterType_DJ    = string.Empty; //原表类型
                        string Direction_DJ    = string.Empty; //原表进气方向
                        string ID = string.Empty;              //原表进气方向
                        if (context.Request.Form["dayGas"] != null && context.Request.Form["dayGas"].ToString().Trim() != string.Empty)
                        {
                            dayGas = context.Request.Form["dayGas"].ToString() == "" ? "0" : context.Request.Form["dayGas"].ToString();
                        }
                        if (context.Request.Form["NewMeterType_DJ"] != null && context.Request.Form["dayGas"].ToString().Trim() != string.Empty)
                        {
                            NewMeterType_DJ = context.Request.Form["NewMeterType_DJ"].ToString() == "" ? "" : context.Request.Form["NewMeterType_DJ"].ToString();
                        }
                        if (context.Request.Form["TotalAmountS"] != null && context.Request.Form["TotalAmountS"].ToString().Trim() != string.Empty)
                        {
                            TotalAmountS = context.Request.Form["TotalAmountS"].ToString() == "" ? "0" : context.Request.Form["TotalAmountS"].ToString();
                        }
                        if (context.Request.Form["MeterType_DJ"] != null && context.Request.Form["MeterType_DJ"].ToString().Trim() != string.Empty)
                        {
                            MeterType_DJ = context.Request.Form["MeterType_DJ"].ToString() == "" ? "" : context.Request.Form["MeterType_DJ"].ToString();
                        }
                        if (context.Request.Form["Direction_DJ"] != null && context.Request.Form["Direction_DJ"].ToString().Trim() != string.Empty)
                        {
                            Direction_DJ = context.Request.Form["Direction_DJ"].ToString() == "" ? "" : context.Request.Form["Direction_DJ"].ToString();
                        }
                        if (context.Request.Form["ID"] != null && context.Request.Form["ID"].ToString().Trim() != string.Empty)
                        {
                            ID = context.Request.Form["ID"].ToString() == "" ? "0" : context.Request.Form["ID"].ToString();
                        }
                        Info           = new CommonModelFactory <IoT_ChangeMeter>().GetModelFromContext(context);
                        Info.CompanyID = loginOperator.CompanyID;
                        Info.State     = '2';
                        Info.ID        = int.Parse(ID);
                        Iproxy         = new WCFServiceProxy <IHuanBiao>();
                        if (MeterType_DJ != "01")  //不是金额表则将换表时剩余金额改为0
                        {
                            Info.RemainingAmount = 0;
                        }
                        //注意换表时剩余金额(仅针对金额表)
                        jsonMessage = Iproxy.getChannel.Dengji(Info);
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (Iproxy != null)
                {
                    Iproxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 8
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string Action   = context.Request.QueryString["Action"] == null ? string.Empty : context.Request.QueryString["Action"].ToString().ToUpper();
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            try
            {
                switch (AjaxType)
                {
                //查询
                case "QUERY":
                    switch (Action)
                    {
                    case "0":        //依据用户
                        string          Where      = string.Empty;
                        SearchCondition sCondition = new SearchCondition()
                        {
                            TBName = "IoT_User", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where
                        };
                        CommonSearch <View_UserMeter> InfoSearchView = new CommonSearch <View_UserMeter>();
                        Where  = "1=1 ";
                        Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                        if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                        {
                            Where += context.Request.Form["TWhere"].ToString();
                        }
                        sCondition = new SearchCondition()
                        {
                            TBName = "View_UserMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where
                        };
                        List <View_UserMeter> listView = InfoSearchView.GetList(ref sCondition, context);
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.ListToJson <View_UserMeter>(listView, sCondition.TTotalCount)
                        };
                        break;

                    case "1":        //依据充值方式
                        Where  = "1=1 ";
                        Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                        if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                        {
                            Where += context.Request.Form["TWhere"].ToString();
                        }
                        InfoSearchView = new CommonSearch <View_UserMeter>();
                        sCondition     = new SearchCondition()
                        {
                            TBName = "View_UserMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where
                        };
                        List <View_UserMeter> listView1 = InfoSearchView.GetList(ref sCondition, context);
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.ListToJson <View_UserMeter>(listView1, sCondition.TTotalCount)
                        };
                        break;

                    case "2":        //依据操作员
                        Where  = "1=1 ";
                        Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                        if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                        {
                            Where += context.Request.Form["TWhere"].ToString();
                        }
                        InfoSearchView = new CommonSearch <View_UserMeter>();
                        sCondition     = new SearchCondition()
                        {
                            TBName = "View_UserMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where
                        };
                        List <View_UserMeter> listView2 = InfoSearchView.GetList(ref sCondition, context);
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.ListToJson <View_UserMeter>(listView2, sCondition.TTotalCount)
                        };
                        break;

                    case "USERCZHISTORY":
                        //拼接Where条件
                        Where  = "1=1 ";
                        Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                        string Date1 = context.Request.QueryString["Date1"] == null ? string.Empty : context.Request.QueryString["Date1"].ToString().ToUpper();
                        string Date2 = context.Request.QueryString["Date2"] == null ? string.Empty : context.Request.QueryString["Date2"].ToString().ToUpper();
                        if (Date1 != "")
                        {
                            Where += "AND TopUpDate>='" + Date1 + "' ";
                        }
                        if (Date2 != "")
                        {
                            Where += "AND TopUpDate<='" + Date2 + "' ";
                        }
                        //实现查询
                        CommonSearch <View_ChongZhi> InfoSearchView_ChongZhi = new CommonSearch <View_ChongZhi>();
                        SearchCondition View_ChongZhi = new SearchCondition()
                        {
                            TBName = "View_ChongZhi", TFieldKey = "AID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "TopUpDate DESC", TWhere = Where
                        };
                        List <View_ChongZhi> lstView_ChongZhi = InfoSearchView_ChongZhi.GetList(ref View_ChongZhi, context);
                        //将讯息转换为Json字符串
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.ListToJson <View_ChongZhi>(lstView_ChongZhi, View_ChongZhi.TTotalCount)
                        };
                        break;

                    default:
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "没有此统计类型。"
                        };
                        break;
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                //if (proxy != null)
                //    proxy.CloseChannel();
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 9
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            WCFServiceProxy <IMeterGasBill> proxy = null;

            try
            {
                switch (AjaxType)
                {
                case "QUERY":

                    CommonSearch <View_MeterGasBill> InfoSearch = new CommonSearch <View_MeterGasBill>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_MeterGasBill", TFieldKey = "BillID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "BillID ASC", TWhere = Where
                    };
                    List <View_MeterGasBill> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_MeterGasBill>(list, sCondition.TTotalCount)
                    };
                    break;

                case "SETTLE":
                {
                    int priceId = 0; string month = ""; string meterNo = "";
                    if (context.Request.Form["PriceType"] != null && context.Request.Form["PriceType"].ToString().Trim() != string.Empty)
                    {
                        priceId = int.Parse(context.Request.Form["PriceType"].ToString().Trim());
                    }
                    if (context.Request.Form["Month"] != null && context.Request.Form["Month"].ToString().Trim() != string.Empty)
                    {
                        month = context.Request.Form["Month"].ToString().Trim();
                    }
                    if (context.Request.Form["MeterNo"] != null && context.Request.Form["MeterNo"].ToString().Trim() != string.Empty)
                    {
                        meterNo = context.Request.Form["MeterNo"].ToString().Trim();
                    }

                    proxy       = new WCFServiceProxy <IMeterGasBill>();
                    jsonMessage = proxy.getChannel.SettleMeterGas(meterNo, month);

                    break;
                }

                case "GETSETTLE":
                {
                    int priceId = 0;
                    if (context.Request.Form["PriceType"] != null && context.Request.Form["PriceType"].ToString().Trim() != string.Empty)
                    {
                        priceId = int.Parse(context.Request.Form["PriceType"].ToString().Trim());
                    }

                    proxy = new WCFServiceProxy <IMeterGasBill>();
                    List <IoT_Meter> meterList = proxy.getChannel.GetMeterByPriceId(loginOperator.CompanyID, priceId);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <IoT_Meter>(meterList, meterList.Count)
                    };
                    break;
                }

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex) {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 10
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            WCFServiceProxy <ISetUploadCycle> proxy = null;

            try
            {
                switch (AjaxType)
                {
                case "QUERY":
                    CommonSearch <View_ChongZhi> InfoSearch = new CommonSearch <View_ChongZhi>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' and State=0";
                    if (context.Request.Form["DateS"] != null && context.Request.Form["DateS"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND convert(char(10),TopUpDate,120)>='" + context.Request.Form["DateS"].ToString() + "'";;
                    }
                    if (context.Request.Form["DateE"] != null && context.Request.Form["DateE"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND convert(char(10),TopUpDate,120)<='" + context.Request.Form["DateE"].ToString() + "'";;
                    }
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_ChongZhi", TFieldKey = "AID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "TopUpDate DESC", TWhere = Where
                    };
                    List <View_ChongZhi> list = InfoSearch.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_ChongZhi>(list, sCondition.TTotalCount)
                    };
                    break;

                case "REVIEW":

                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "'";
                    if (context.Request["ID"] != null && context.Request["ID"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND AID=" + context.Request["ID"].ToString();;
                    }
                    CommonSearch <View_ChongZhi> InfoSearch1 = new CommonSearch <View_ChongZhi>();
                    SearchCondition sCondition1 = new SearchCondition()
                    {
                        TBName = "View_ChongZhi", TFieldKey = "AID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "TopUpDate DESC", TWhere = Where
                    };
                    List <View_ChongZhi> list1 = InfoSearch1.GetList(ref sCondition1, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_ChongZhi>(list1, sCondition1.TTotalCount)
                    };
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 11
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;
            //获取操作类型AType:ADD,EDIT,DELETE,QUERY
            string   AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            MenuInfo Info;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            switch (AjaxType)
            {
            case "QUERY":
                string Where = "1=1 ";
                if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                {
                    Where += "AND " + context.Request.Form["TWhere"].ToString();
                }

                if (context.Request.QueryString["Code"] != null && context.Request.QueryString["Code"].ToString().Trim() != string.Empty)
                {
                    Where += "AND  FatherCode= '" + context.Request.QueryString["Code"].ToString() + "'";
                }
                else
                {
                    Where += "AND (  Type= '00' or  Type= '01' or  Type= '03' )";
                }
                CommonSearch <MenuInfo> userInfoSearch = new CommonSearch <MenuInfo>();
                SearchCondition         sCondition     = new SearchCondition()
                {
                    TBName = "S_DefineMenu", TFieldKey = "MenuCode", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "Type,FatherCode,OrderNum ASC", TWhere = Where
                };
                List <MenuInfo> list = userInfoSearch.GetList(ref sCondition, context);
                jsonMessage = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.ListToJson <MenuInfo>(list, sCondition.TTotalCount)
                };
                break;

            case "ADD":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "tjcd"))
                {
                    Info        = new CommonModelFactory <MenuInfo>().GetModelFromContext(context);
                    jsonMessage = new WCFServiceProxy <IMenuManage>().getChannel.AddMenu(Info);

                    if (jsonMessage.Result)
                    {
                        new WCFServiceProxy <IMenuManage>().getChannel.ReSetCompany(base.loginOperator.CompanyID);
                    }
                }
                break;

            case "EDIT":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjcd"))
                {
                    Info        = new CommonModelFactory <MenuInfo>().GetModelFromContext(context);
                    jsonMessage = new WCFServiceProxy <IMenuManage>().getChannel.EditMenu(Info);
                    if (jsonMessage.Result)
                    {
                        new WCFServiceProxy <IMenuManage>().getChannel.ReSetCompany(base.loginOperator.CompanyID);
                    }
                }
                break;

            case "DELETE":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "sccd"))
                {
                    Info        = new CommonModelFactory <MenuInfo>().GetModelFromContext(context);
                    jsonMessage = new WCFServiceProxy <IMenuManage>().getChannel.DeleteMenu(Info);
                    if (jsonMessage.Result)
                    {
                        new WCFServiceProxy <IMenuManage>().getChannel.ReSetCompany(base.loginOperator.CompanyID);
                    }
                }
                break;

            case "QUERYFATHER":
                Where = "1=1 ";

                if (context.Request.QueryString["MenuType"] != null && context.Request.QueryString["MenuType"].ToString().Trim() != string.Empty)
                {
                    string MenuType = context.Request.QueryString["MenuType"].ToString();
                    Where += "AND  Type= '" + MenuType + "'";
                }

                userInfoSearch = new CommonSearch <MenuInfo>();
                sCondition     = new SearchCondition()
                {
                    TBName = "S_DefineMenu", TFieldKey = "MenuCode", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "Type,FatherCode,OrderNum ASC", TWhere = Where
                };
                list        = userInfoSearch.GetList(ref sCondition, context);
                jsonMessage = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.ListToJson <MenuInfo>(list, sCondition.TTotalCount)
                };
                break;

            default:
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = "操作未定义。"
                };
                break;
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 12
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };

            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            //context.Response.Write(AjaxType);
            //context.Response.End();
            ADContext Info = new ADContext();
            WCFServiceProxy <IADContextDAL> proxy = null;

            Info  = new CommonModelFactory <ADContext>().GetModelFromContext(context);
            proxy = new WCFServiceProxy <IADContextDAL>();

            try {
                switch (AjaxType)
                {//查询用户
                case "QUERY":

                    CommonSearch <ADContext> InfoSearch = new CommonSearch <ADContext>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "ADContext", TFieldKey = "AC_ID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "AC_ID desc", TWhere = Where
                    };
                    List <ADContext> list = InfoSearch.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <ADContext>(list, sCondition.TTotalCount)
                    };
                    break;

                //广告主题列表
                case "QUERYVIEW":

                    CommonSearch <ADContext> InfoSearchView = new CommonSearch <ADContext>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "ADContext", TFieldKey = "AC_ID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = " AC_ID desc", TWhere = Where
                    };

                    List <ADContext> listView = InfoSearchView.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <ADContext>(listView, sCondition.TTotalCount)
                    };
                    break;

                //广告主题列表
                case "QUERYVIEWLIST":

                    CommonSearch <ADContext> InfoSearchView2 = new CommonSearch <ADContext>();
                    Where  = "1=1 and State != 0 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "ADContext", TFieldKey = "AC_ID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = " AC_ID desc", TWhere = Where
                    };

                    List <ADContext> listView2 = InfoSearchView2.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <ADContext>(listView2, sCondition.TTotalCount)
                    };
                    break;

                //添加主题广告
                case "ADD":
                    Info.CompanyID  = base.loginOperator.CompanyID;
                    Info.State      = 0;
                    Info.CreateDate = DateTime.Now;
                    jsonMessage     = proxy.getChannel.Add(Info);

                    break;

                case "EDIT":
                    Info.CompanyID = base.loginOperator.CompanyID;
                    jsonMessage    = proxy.getChannel.Edit(Info);
                    break;

                //删除信息
                case "DELCONTENT":
                    jsonMessage = proxy.getChannel.Delete((int)Info.AC_ID);
                    break;

                //草稿->可发布
                case "UPDATEOK":
                    jsonMessage = proxy.getChannel.UpadteAdStatus(Info.AC_ID, 1);
                    break;

                //可发布-> 草稿
                case "UPDATENO":
                    jsonMessage = proxy.getChannel.UpadteAdStatus(Info.AC_ID, 0);
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "1.操作未定义!" + AjaxType
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 13
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            View_ValveControl Info;
            WCFServiceProxy <IValveControl> proxy      = null;
            WCFServiceProxy <IMeterManage>  proxyMeter = null;



            try
            {
                switch (AjaxType)
                {
                case "QUERY":

                    CommonSearch <View_ValveControl> InfoSearch = new CommonSearch <View_ValveControl>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_ValveControl", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "RegisterDate Desc", TWhere = Where
                    };
                    List <View_ValveControl> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_ValveControl>(list, sCondition.TTotalCount)
                    };
                    break;



                //开阀
                case "KAIFA":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fmcz_kf"))
                    {
                        proxyMeter = new WCFServiceProxy <IMeterManage>();
                        proxy      = new WCFServiceProxy <IValveControl>();

                        string reason = "";
                        if (context.Request.Form["Reason"] != null && context.Request.Form["Reason"].ToString().Trim() != string.Empty)
                        {
                            reason = context.Request.Form["Reason"].ToString().Trim();
                        }

                        if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                        {
                            string strNo = context.Request.Form["strNo"];

                            string[] arrNo = strNo.Split(',');

                            for (int i = 0; i < arrNo.Length; i++)
                            {
                                IoT_Meter meter = proxyMeter.getChannel.GetMeterByNo(arrNo[i]);
                                proxy.getChannel.TurnOn(meter, reason, loginOperator.Name);
                            }
                        }
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = "操作成功"
                        };
                    }
                    break;

                //关阀
                case "GUANFA":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fmcz_gf"))
                    {
                        proxyMeter = new WCFServiceProxy <IMeterManage>();
                        proxy      = new WCFServiceProxy <IValveControl>();

                        string reason = "";
                        if (context.Request.Form["Reason"] != null && context.Request.Form["Reason"].ToString().Trim() != string.Empty)
                        {
                            reason = context.Request.Form["Reason"].ToString().Trim();
                        }

                        if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                        {
                            string strNo = context.Request.Form["strNo"];

                            string[] arrNo = strNo.Split(',');

                            for (int i = 0; i < arrNo.Length; i++)
                            {
                                IoT_Meter meter = proxyMeter.getChannel.GetMeterByNo(arrNo[i]);
                                proxy.getChannel.TurnOff(meter, reason, loginOperator.Name);
                            }
                        }
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = "操作成功"
                        };
                    }
                    break;


                case "UNDO":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fmcz_cx"))
                    {
                        Info  = new CommonModelFactory <View_ValveControl>().GetModelFromContext(context);
                        proxy = new WCFServiceProxy <IValveControl>();
                        proxy.getChannel.Undo(Info.TaskID, Info.Context);

                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = "操作成功"
                        };
                    }
                    break;


                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex) {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 14
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };

            string    AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            ADPublish Info     = new ADPublish();
            WCFServiceProxy <IADPublishDAL>     proxy     = new WCFServiceProxy <IADPublishDAL>();
            WCFServiceProxy <IADPublishUserDAL> proxyPU   = new WCFServiceProxy <IADPublishUserDAL>();
            WCFServiceProxy <IADUserDAL>        proxyAdU  = new WCFServiceProxy <IADUserDAL>();
            WCFServiceProxy <IADContextDAL>     proxyGGZT = new WCFServiceProxy <IADContextDAL>();

            Info = new CommonModelFactory <ADPublish>().GetModelFromContext(context);


            try
            {
                switch (AjaxType)
                {//查询用户
                case "QUERY":

                    CommonSearch <View_AdPublish> InfoSearch = new CommonSearch <View_AdPublish>();
                    string Where = "1=1 and CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_AdPublish", TFieldKey = "AP_ID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "AP_ID asc", TWhere = Where
                    };
                    List <View_AdPublish> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_AdPublish>(list, sCondition.TTotalCount)
                    };
                    break;

                //列表
                case "QUERYVIEW":

                    CommonSearch <View_AdPublish> InfoSearchView = new CommonSearch <View_AdPublish>();
                    Where = "1=1 and CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_AdPublish", TFieldKey = "AP_ID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = " AP_ID asc", TWhere = Where
                    };

                    List <View_AdPublish> listView = InfoSearchView.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_AdPublish>(listView, sCondition.TTotalCount)
                    };
                    break;

                //添加广告内容
                case "ADD":

                    //1.添加到发布主表
                    Info.CompanyID = base.loginOperator.CompanyID;
                    jsonMessage    = proxy.getChannel.Add(Info);
                    //当发布成功后再进行后续人员添加操作;
                    if (jsonMessage.Result)
                    {
                        //取得返回AP_ID
                        long recAP_ID = long.Parse(jsonMessage.TxtMessage);
                        //2.添加到发布用户表中;
                        if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                        {
                            ADPublishUser adPUser = new ADPublishUser();
                            adPUser.AP_ID     = recAP_ID;
                            adPUser.CompanyID = loginOperator.CompanyID;
                            //State和FinishDate两个字段由APP程序完成
                            adPUser.State = 0;
                            //adPUser.FinishedDate = DateTime.Now;
                            adPUser.Context = context.Request.Form["CNContext"] == null ? string.Empty : context.Request.Form["CNContext"].ToString();
                            string strNo = context.Request.Form["strNo"];
                            jsonMessage = proxyPU.getChannel.groupAdd(adPUser, strNo);
                            if (!jsonMessage.Result)
                            {
                                break;
                            }
                        }
                        //当是发布状态时调用接口
                        if (Info.State == 1 || Info.State == 2)
                        {
                            //3.调用APP段发布接口
                            string pmApp = proxy.getChannel.ADPubManager(recAP_ID);
                            if (pmApp.IndexOf("APP接口") >= 0)
                            {
                                jsonMessage.TxtMessage = pmApp;
                                break;
                            }
                            //4.更新广告主题表中的状态;
                            if (Info.State == 1 || Info.State == 2)
                            {
                                jsonMessage = proxyGGZT.getChannel.UpadteAdStatus(long.Parse(Info.AC_ID.ToString()), 2);
                            }
                        }
                    }

                    break;

                case "EDIT":
                    Info.CompanyID = base.loginOperator.CompanyID;
                    jsonMessage    = proxy.getChannel.Edit(Info);
                    if (jsonMessage.Result)
                    {
                        ADPublishUser adPUser = new ADPublishUser();
                        adPUser.AP_ID     = Info.AP_ID;
                        adPUser.CompanyID = loginOperator.CompanyID;
                        //if (Info.State == 1 || Info.State == 2)
                        //{
                        //    adPUser.State = 1;
                        //}
                        //else
                        //{
                        adPUser.State = 0;
                        //}

                        adPUser.Context = context.Request.Form["CNContext"] == null ? string.Empty : context.Request.Form["CNContext"].ToString();
                        string strNo = context.Request.Form["strNo"];
                        jsonMessage = proxyPU.getChannel.groupAdd(adPUser, strNo);
                        if (!jsonMessage.Result)
                        {
                            break;
                        }

                        if (Info.State == 1 || Info.State == 2)
                        {
                            //3.调用APP段发布接口
                            string pmApp = proxy.getChannel.ADPubManager(long.Parse(Info.AP_ID.ToString()));
                            if (pmApp.IndexOf("APP接口") >= 0)
                            {
                                jsonMessage.TxtMessage = pmApp;
                                break;
                            }

                            //2.更新广告主题表中的状态;
                            if (Info.State == 1 || Info.State == 2)
                            {
                                jsonMessage = proxyGGZT.getChannel.UpadteAdStatus(long.Parse(Info.AC_ID.ToString()), 2);
                            }
                        }
                    }

                    break;

                //删除信息
                case "DELETINFO":

                    jsonMessage = proxy.getChannel.Delete(Info.AP_ID);

                    break;

                //更新状态
                case "UPDATESTATE":
                    jsonMessage = proxy.getChannel.UpadteAdStatus(Info.AP_ID, 1);
                    //3.更新广告主题表中的状态;
                    if (jsonMessage.Result)
                    {
                        //3.调用APP段发布接口
                        string pmApp = proxy.getChannel.ADPubManager(long.Parse(Info.AP_ID.ToString()));
                        if (pmApp.IndexOf("APP接口") >= 0)
                        {
                            jsonMessage.TxtMessage = pmApp;
                            break;
                        }
                        else
                        {
                            jsonMessage = proxyGGZT.getChannel.UpadteAdStatus(long.Parse(Info.AC_ID.ToString()), 2);
                        }
                    }
                    break;

                //发布人员信息
                case "QUERYVIEWPUINFO":

                    CommonSearch <View_AdPublishUserInfo> InfoSearchView_pu = new CommonSearch <View_AdPublishUserInfo>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_AdPublishUserInfo", TFieldKey = " ID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "  ID asc", TWhere = Where
                    };

                    List <View_AdPublishUserInfo> listView_pu = InfoSearchView_pu.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_AdPublishUserInfo>(listView_pu, sCondition.TTotalCount)
                    };
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义!"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 15
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            //View_AlarmInfo Info;
            //WCFServiceProxy<IAlarmInfo> proxy=null;
            try
            {
                switch (AjaxType)
                {
                case "QUERY":

                    CommonSearch <View_AlarmInfo> InfoSearch = new CommonSearch <View_AlarmInfo>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";

                    if (context.Request.Form["AlermItem"] != null && context.Request.Form["AlermItem"] != "")
                    {
                        Where += $" and AlarmValue ='{ context.Request.Form["AlermItem"]}'";
                    }
                    if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND ReportDate>='" + context.Request.Form["Date1"].ToString() + "'";;
                    }
                    if (context.Request.Form["Date2"] != null && context.Request.Form["Date2"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND ReportDate<='" + context.Request.Form["Date2"].ToString() + "'";;
                    }

                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_AlarmInfo", TFieldKey = "ReportDate", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "ReportDate DESC", TWhere = Where
                    };
                    List <View_AlarmInfo> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_AlarmInfo>(list, sCondition.TTotalCount)
                    };
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex) {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                //if (proxy != null)
                //    proxy.CloseChannel();
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 16
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;
            //获取操作类型AType:ADD,EDIT,DELETE,QUERY
            string          AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            CompanyOperator Info;
            string          webCookie = context.Session.SessionID.ToString();
            WCFServiceProxy <ICompanyOperatorManage> proxy;
            WCFServiceProxy <ILoginerManage>         proxyLoginer;
            string          Where = "1=1 ";
            SearchCondition sCondition;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            switch (AjaxType)
            {
            case "QUERY":
                CommonSearch <CompanyOperator> CompanyOperatorSearch = new CommonSearch <CompanyOperator>();
                Where += "AND CompanyID='" + base.loginOperator.CompanyID + "' ";
                if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                {
                    Where += context.Request.Form["TWhere"].ToString();
                }
                sCondition = new SearchCondition()
                {
                    TBName = "S_CompanyOperator", TFieldKey = "OperID,CompanyID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "OperID ASC", TWhere = Where
                };
                List <CompanyOperator> list = CompanyOperatorSearch.GetList(ref sCondition, context);
                //将密码设置为空
                list.ForEach(p => p.Pwd = string.Empty);
                jsonMessage             = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.ListToJson <CompanyOperator>(list, sCondition.TTotalCount)
                };
                break;

            case "LOADLOGINER":
                jsonMessage = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <CompanyOperator>(base.loginOperator)
                };
                break;

            case "HEARTCOOKIE":
                //向数据中心更新登录信息
                proxyLoginer = new WCFServiceProxy <ILoginerManage>();
                try
                {
                    proxyLoginer.getChannel.RegisterClient(Md5.GetMd5(webCookie), base.loginOperator.OperID, base.loginOperator.CompanyID);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = Md5.GetMd5(context.Session.SessionID.ToString())
                    };
                }
                catch { }
                finally
                {
                    proxyLoginer.CloseChannel();
                }
                break;

            case "ADD":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "tjczy"))
                {
                    Info           = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context);
                    Info.CompanyID = base.loginOperator.CompanyID;
                    Info.Pwd       = Md5.GetMd5(base.loginOperator.CompanyID + base.loginOperator.CompanyID);
                    Info.OperType  = 0;   //0一般操作员:1企业主账号(每个企业仅一个);
                    if (Info.PhoneLogin == true && Info.Phone == string.Empty)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = string.Format("添加失败,请输入为操作员{0}绑定的手机号码。", Info.OperID)
                        };
                    }
                    else
                    {
                        WCFServiceProxy <ICompanyOperatorManage> proxyCompanyOperatorManage
                            = new WCFServiceProxy <ICompanyOperatorManage>();
                        try
                        {
                            jsonMessage = proxyCompanyOperatorManage.getChannel.AddCompanyOperator(Info);
                        }
                        catch { }
                        finally
                        {
                            proxyCompanyOperatorManage.CloseChannel();
                        }
                    }
                }
                break;

            case "EDIT":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjczy"))
                {
                    Info     = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context);
                    Info.Pwd = null;
                    if (Info.CompanyID != base.loginOperator.CompanyID)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "操作员所属企业与登录账号所属企业不一致,编辑失败。"
                        };
                    }
                    else
                    {
                        if (Info.PhoneLogin == true && Info.Phone == string.Empty)
                        {
                            jsonMessage = new Message()
                            {
                                Result     = false,
                                TxtMessage = string.Format("编辑失败,请输入为操作员{0}绑定的手机号码。", Info.OperID)
                            };
                        }
                        else
                        {
                            proxy = new WCFServiceProxy <ICompanyOperatorManage>();
                            try
                            {
                                jsonMessage = proxy.getChannel.EditCompanyOperator(Info);
                            }
                            catch
                            { }
                            finally
                            {
                                proxy.CloseChannel();
                            }
                        }
                    }
                }
                break;

            //case "EDITOPERAREA":
            //    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjczy"))
            //    {
            //        Info = new CommonModelFactory<CompanyOperator>().GetModelFromContext(context);
            //        Info.Pwd = null;
            //        if (Info.CompanyID != base.loginOperator.CompanyID)
            //        {
            //            jsonMessage = new Message()
            //            {
            //                Result = false,
            //                TxtMessage = "操作员所属企业与登录账号所属企业不一致,编辑失败。"
            //            };
            //        }
            //        else
            //        {
            //            proxy = new WCFServiceProxy<ICompanyOperatorManage>();
            //            try
            //            {
            //                string nodes = context.Request.Form["nodes"].ToString();
            //                jsonMessage = proxy.getChannel.EditOperatorArea(Info, nodes.Split(','));
            //            }
            //            catch
            //            { }
            //            finally
            //            {
            //                proxy.CloseChannel();
            //            }
            //        }
            //    }
            //    break;
            case "DELETE":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "scczy"))
                {
                    Info = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context);
                    if (Info.CompanyID != base.loginOperator.CompanyID)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "操作员所属企业与登录账号所属企业不一致,删除失败。"
                        };
                    }
                    else
                    {
                        proxy = new WCFServiceProxy <ICompanyOperatorManage>();
                        try
                        {
                            jsonMessage = proxy.getChannel.DeleteCompanyOperator(Info);
                        }
                        catch
                        {
                        }
                        finally
                        {
                            proxy.CloseChannel();
                        }
                    }
                }
                break;

            case "RESETPWD":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "czmm"))
                {
                    Info = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context);
                    if (Info.CompanyID != base.loginOperator.CompanyID)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "操作员所属企业与登录账号所属企业不一致,删除失败。"
                        };
                    }
                    else
                    {
                        CompanyOperator infoEditPwd = new CompanyOperator()
                        {
                            OperID    = Info.OperID,
                            CompanyID = Info.CompanyID,
                            Pwd       = Md5.GetMd5(Info.CompanyID + Info.CompanyID)
                        };
                        proxy = new WCFServiceProxy <ICompanyOperatorManage>();
                        try
                        {
                            jsonMessage = proxy.getChannel.EditCompanyOperator(infoEditPwd);
                            if (jsonMessage.Result)
                            {
                                jsonMessage.TxtMessage = "操作员密码已重置为初始密码:" + Info.CompanyID;
                            }
                        }
                        catch
                        {
                        }
                        finally
                        {
                            proxy.CloseChannel();
                        }
                    }
                }
                break;

            case "EDITPWD":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "xgmm"))
                {
                    Info = new CommonModelFactory <CompanyOperator>().GetModelFromContext(context);
                    if (Info.CompanyID != base.loginOperator.CompanyID)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "操作员所属企业与登录账号所属企业不一致,修改失败。"
                        };
                    }
                    else if (Info.OperID != base.loginOperator.OperID)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "当前登录者与您修改的账号不一致,修改失败。"
                        };
                    }
                    else
                    {
                        //验证输入旧密码
                        CommonSearch <CompanyOperator> userInfoSearch = new CommonSearch <CompanyOperator>();
                        Where      = " OperID='" + Info.OperID + "' AND CompanyID='" + Info.CompanyID + "'";
                        sCondition = new SearchCondition()
                        {
                            TBName = "S_CompanyOperator", TFieldKey = "OperID", TTotalCount = -1, TWhere = Where
                        };
                        CompanyOperator dbInfo = userInfoSearch.GetFirstTModel(ref sCondition);
                        string          OldPwd = context.Request.Form["OldPwd"] == null ? string.Empty : context.Request.Form["OldPwd"].ToString();
                        if (sCondition.TTotalCount == -1 || dbInfo == null)
                        {
                            jsonMessage = new Message()
                            {
                                Result     = false,
                                TxtMessage = "数据中心未返回信息,请稍候再试。"
                            };
                        }
                        else if (Md5.GetMd5(dbInfo.CompanyID + OldPwd.Trim()) != dbInfo.Pwd)
                        {
                            jsonMessage = new Message()
                            {
                                Result     = false,
                                TxtMessage = "原密码验证失败。"
                            };
                        }
                        else
                        {
                            CompanyOperator infoEditPwd = new CompanyOperator()
                            {
                                OperID    = dbInfo.OperID,
                                CompanyID = dbInfo.CompanyID,
                                Pwd       = Md5.GetMd5(dbInfo.CompanyID + Info.Pwd)
                            };
                            proxy = new WCFServiceProxy <ICompanyOperatorManage>();
                            try
                            {
                                jsonMessage = proxy.getChannel.EditCompanyOperator(infoEditPwd);
                            }
                            catch
                            {
                            }
                            finally
                            {
                                proxy.CloseChannel();
                            }
                        }
                    }
                }
                break;

            //case "LOADAREATREE":

            //    string operID = context.Request.Form["OperID"].ToString();
            //    jsonMessage = new Message() { Result = true, TxtMessage = CreateAreaTreeToJson(base.loginOperator.CompanyID, operID) };
            //    break;

            default:
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = "操作未定义。"
                };
                break;
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 17
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;
            //获取操作类型AType:ADD,EDIT,DELETE,QUERY
            string      AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            DefineRight Info;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            switch (AjaxType)
            {
            case "LOADLEFTMENU":
                jsonMessage = new Message()
                {
                    Result = true, TxtMessage = CommonOperRightHelper.MenuListToJson(base.loginOperator)
                };
                break;

            //新菜单栏加载菜单
            case "LOADNEWLEFTMENU":
                jsonMessage = new Message()
                {
                    Result = true, TxtMessage = CommonOperRightHelper.GetLeftMenu(base.loginOperator)
                };
                break;

            case "LOADHIDEMENUCODE":
                jsonMessage = new Message()
                {
                    Result = true, TxtMessage = CommonOperRightHelper.GetHidMenuCode(base.loginOperator)
                };
                break;

            case "LOADCOMPANYRIGHT":
                List <DefineRight> list = new WCFServiceProxy <IOperRightManage>().getChannel.LoadCompanyDefineRight(base.loginOperator.CompanyID);
                jsonMessage = new Message()
                {
                    Result = true, TxtMessage = JSon.ListToJson <DefineRight>(list, list.Count)
                };
                break;

            case "LOADCOMPANYMENU":
                jsonMessage = new Message()
                {
                    Result = true, TxtMessage = CommonOperRightHelper.CompanyMenuListToJson(base.loginOperator.CompanyID)
                };
                break;

            //加载两级菜单树(zzcy)
            case "LOADNEWCOMPANYMENU":
                jsonMessage = new Message()
                {
                    Result = true, TxtMessage = CommonOperRightHelper.MenuListToJson(base.loginOperator)
                };
                break;

            //获取公司菜单
            case "LOADMENUBYCOMPANY":
                string companyId = context.Request.Form["CompanyID"] == null ? string.Empty : context.Request.Form["CompanyID"].ToString().Trim();
                jsonMessage = new Message()
                {
                    Result = true, TxtMessage = CommonOperRightHelper.GetMenuListToJson(companyId)
                };

                break;

            case "LOADRIGHTMENU":
                string rightCode = context.Request.Form["rightCode"] == null ? string.Empty : context.Request.Form["rightCode"].ToString().Trim();
                jsonMessage = new Message()
                {
                    Result = true, TxtMessage = CommonOperRightHelper.GetCompanyRightMenuCode(base.loginOperator.CompanyID, rightCode)
                };
                break;

            case "LOADCOMPANYOPERRIGHT":
                string operID = context.Request.Form["OperID"] == null ? string.Empty : context.Request.Form["OperID"].ToString();
                WCFServiceProxy <IOperRightManage> proxy = new WCFServiceProxy <IOperRightManage>();
                try
                {
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = proxy.getChannel.LoadCompanyOperDefineRight(base.loginOperator.CompanyID, operID)
                    };
                }
                catch
                {
                }
                finally
                {
                    proxy.CloseChannel();
                }
                break;

            //编辑公司菜单(分配菜单)
            case "EDITCOMPANYMENU":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fpqycd"))
                {
                    companyId = context.Request.Form["CompanyID"] == null ? string.Empty : context.Request.Form["CompanyID"].ToString().Trim();

                    List <String> List            = new List <String>();
                    string        CompanyMenuCode = context.Request.Form["CompanyMenuCode"] == null ? string.Empty : context.Request.Form["CompanyMenuCode"].ToString();
                    foreach (string menu in CompanyMenuCode.Split(','))
                    {
                        List.Add(menu);
                    }
                    jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.EditCompanyMenu(companyId, List);
                }
                break;



            case "ADDQXZ":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "tjqxz"))
                {
                    Info           = new CommonModelFactory <DefineRight>().GetModelFromContext(context);
                    Info.CompanyID = base.loginOperator.CompanyID;
                    string RightMenuCode        = context.Request.Form["RightMenuCode"] == null ? string.Empty : context.Request.Form["RightMenuCode"].ToString();
                    List <DefineRightMenu> List = new List <DefineRightMenu>();
                    foreach (string menu in RightMenuCode.Split(','))
                    {
                        List.Add(new DefineRightMenu()
                        {
                            CompanyID = base.loginOperator.CompanyID, MenuCode = menu, RightCode = Info.RightCode
                        });
                    }
                    jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.AddCompanyDefineRight(Info, List.Distinct().ToList());
                }
                break;

            case "EDITQXZ":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjqxz"))
                {
                    Info           = new CommonModelFactory <DefineRight>().GetModelFromContext(context);
                    Info.CompanyID = base.loginOperator.CompanyID;
                    List <DefineRightMenu> List = new List <DefineRightMenu>();
                    string RightMenuCode        = context.Request.Form["RightMenuCode"] == null ? string.Empty : context.Request.Form["RightMenuCode"].ToString();
                    foreach (string menu in RightMenuCode.Split(','))
                    {
                        List.Add(new DefineRightMenu()
                        {
                            CompanyID = base.loginOperator.CompanyID, MenuCode = menu, RightCode = Info.RightCode
                        });
                    }
                    jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.AddCompanyDefineRight(Info, List.Distinct().ToList());
                }
                break;

            case "DELETEQXZ":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "scqxz"))
                {
                    Info           = new CommonModelFactory <DefineRight>().GetModelFromContext(context);
                    Info.CompanyID = base.loginOperator.CompanyID;
                    jsonMessage    = new WCFServiceProxy <IOperRightManage>().getChannel.DelCompanyDefineRight(Info);
                }
                break;

            case "EDITOPERRIGHT":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "fpqxz"))
                {
                    string             OperID       = context.Request.Form["OperID"] == null ? string.Empty : context.Request.Form["OperID"].ToString();
                    string             RightCode    = context.Request.Form["RightCode"] == null ? string.Empty : context.Request.Form["RightCode"].ToString();
                    List <DefineRight> lDefineRight = new List <DefineRight>();
                    foreach (string tmp in RightCode.Split(','))
                    {
                        lDefineRight.Add(new DefineRight()
                        {
                            CompanyID = base.loginOperator.CompanyID, RightCode = tmp
                        });
                    }
                    if (OperID == string.Empty)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "请选择您要分配权限组的操作员。"
                        };
                    }
                    else
                    {
                        jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.EditCompanyOperRight(base.loginOperator.CompanyID, OperID, lDefineRight);
                    }
                }
                break;

            case "REMOVECACHE":
                jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.RemoveCompanyRightCache(base.loginOperator.CompanyID);
                break;

            default:
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = "操作未定义。"
                };
                break;
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 18
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            try
            {
                switch (AjaxType)
                {
                case "GETPAYMENT":
                    string startDate = "", endDate = "";
                    if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty)
                    {
                        startDate = context.Request.Form["Date1"].ToString().Trim();
                    }
                    if (context.Request.Form["Date2"] != null && context.Request.Form["Date2"].ToString().Trim() != string.Empty)
                    {
                        endDate  = context.Request.Form["Date2"].ToString().Trim();
                        endDate += " 23:59";
                    }

                    DateTime startTime = Convert.ToDateTime(startDate);
                    DateTime endTime   = Convert.ToDateTime(endDate);

                    List <Olb_PaymentRecord> list = PaymentManageService.GetInstance().GetPaymentRecord(startTime, endTime, base.loginOperator.Account);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <Olb_PaymentRecord>(list, list.Count)
                    };
                    break;

                case "GETGASBILL":
                    string companyId = "", userId = "", month = "";
                    if (context.Request.Form["month"] != null && context.Request.Form["month"].ToString().Trim() != string.Empty)
                    {
                        month = context.Request.Form["month"].ToString().Trim();
                    }
                    if (context.Request.Form["companyId"] != null && context.Request.Form["companyId"].ToString().Trim() != string.Empty)
                    {
                        companyId = context.Request.Form["companyId"].ToString().Trim();
                    }
                    if (context.Request.Form["userId"] != null && context.Request.Form["userId"].ToString().Trim() != string.Empty)
                    {
                        userId = context.Request.Form["userId"].ToString().Trim();
                    }

                    List <GasFeeBill> listBill = new List <GasFeeBill>();
                    GasFeeBill        bill     = IotMService.GetInstance().GetGasUserBill(userId, companyId, month);
                    if (bill == null)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "本月还未产生账单"
                        };
                    }
                    else
                    {
                        listBill.Add(bill);
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.ListToJson <GasFeeBill>(listBill, listBill.Count)
                        };
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 19
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };

            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            ADUser Info = new ADUser();
            WCFServiceProxy <IADUserDAL> proxy = null;

            Info  = new CommonModelFactory <ADUser>().GetModelFromContext(context);
            proxy = new WCFServiceProxy <IADUserDAL>();

            try
            {
                switch (AjaxType)
                {//查询用户
                case "QUERY":

                    CommonSearch <View_AdUser> InfoSearch = new CommonSearch <View_AdUser>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_AdUser", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID desc", TWhere = Where
                    };
                    List <View_AdUser> list = InfoSearch.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_AdUser>(list, sCondition.TTotalCount)
                    };
                    break;

                //广告屏用户列表
                case "QUERYVIEW":

                    CommonSearch <View_AdUser> InfoSearchView = new CommonSearch <View_AdUser>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_AdUser", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = " UserID desc", TWhere = Where
                    };

                    List <View_AdUser> listView = InfoSearchView.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_AdUser>(listView, sCondition.TTotalCount)
                    };
                    break;

                //广告主题列表
                case "QUERYVIEWSC":

                    List <ADUserSC> listSC = proxy.getChannel.getListSC();
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <ADUserSC>(listSC, listSC.Count)
                    };


                    break;

                //用户列表
                case "QUERYVIEWUSER":

                    CommonSearch <View_UserInfo> InfoSearchViewUser = new CommonSearch <View_UserInfo>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_UserInfo", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = " UserID desc", TWhere = Where
                    };

                    List <View_UserInfo> listViewUser = InfoSearchViewUser.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_UserInfo>(listViewUser, sCondition.TTotalCount)
                    };
                    break;

                //用户列表
                case "QUERYVIEWUSERADD":
                    //List<View_UserInfo> listViewUserADD = proxy.getChannel.getUserListShow(loginOperator.CompanyID);

                    CommonSearch <View_UserInfo> InfoSearchViewUserADD = new CommonSearch <View_UserInfo>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_UserInfoADDC", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = " UserID desc", TWhere = Where
                    };

                    List <View_UserInfo> listViewUserADD = InfoSearchViewUserADD.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_UserInfo>(listViewUserADD, sCondition.TTotalCount)
                    };
                    break;

                //添加信息
                case "GROUPADD":
                    if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                    {
                        string strNo = context.Request.Form["strNo"];

                        string[] arrNo = strNo.Split(',');

                        for (int i = 0; i < arrNo.Length; i++)
                        {
                            string[] userInfo = arrNo[i].Split('|');
                            Info.UserID    = userInfo[0].ToString();
                            Info.CompanyID = userInfo[1].ToString();
                            Info.Street    = userInfo[2].ToString();
                            Info.Community = userInfo[3].ToString();
                            Info.Adress    = userInfo[4].ToString();
                            Info.AddTime   = DateTime.Now;
                            Info.Ver       = "1.0";
                            jsonMessage    = proxy.getChannel.Add(Info);
                            if (!jsonMessage.Result)
                            {
                                break;
                            }
                        }
                    }

                    break;

                case "DELETE":
                    jsonMessage = proxy.getChannel.Delete(Info.UserID, Info.CompanyID);
                    break;

                //删除信息
                case "GROUPDEL":
                    if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                    {
                        string strNo = context.Request.Form["strNo"];

                        string[] arrNo = strNo.Split(',');

                        for (int i = 0; i < arrNo.Length; i++)
                        {
                            string[] userInfo = arrNo[i].Split('|');
                            Info.UserID    = userInfo[0].ToString();
                            Info.CompanyID = userInfo[1].ToString();
                            jsonMessage    = proxy.getChannel.Delete(Info.UserID, Info.CompanyID);
                            if (!jsonMessage.Result)
                            {
                                break;
                            }
                        }
                    }

                    //jsonMessage = proxy.getChannel.Delete(Info.UserID,Info.CompanyID);
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义!" + AjaxType
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 20
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string     AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            IoT_AdInfo Info;
            WCFServiceProxy <IAdInfoManage> proxy = null;

            try
            {
                switch (AjaxType)
                {
                case "QUERY":
                    CommonSearch <IoT_AdInfo> InfoSearch = new CommonSearch <IoT_AdInfo>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";

                    if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND StartDate>='" + context.Request.Form["Date1"].ToString() + "'";;
                    }
                    if (context.Request.Form["Date2"] != null && context.Request.Form["Date2"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND EndDate<='" + context.Request.Form["Date2"].ToString() + "'";;
                    }

                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "IoT_AdInfo", TFieldKey = "FileIndex", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "FileIndex ASC", TWhere = Where
                    };
                    List <IoT_AdInfo> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <IoT_AdInfo>(list, sCondition.TTotalCount)
                    };
                    break;

                case "ADD":
                {
                    HttpPostedFile   postedFile = context.Request.Files[0];
                    System.IO.Stream stream     = postedFile.InputStream;
                    //将流转换为二进制数组
                    byte[] bytes = new byte[stream.Length];
                    stream.Read(bytes, 0, bytes.Length);
                    Binary     binaryData = new Binary(bytes);
                    IoT_AdInfo adInfo     = new IoT_AdInfo();

                    adInfo.FileData      = binaryData;
                    adInfo.CompanyID     = base.loginOperator.CompanyID;
                    adInfo.PublishStatus = 0;        //未发布

                    if (context.Request.Form["CycleTime"] != null && context.Request.Form["CycleTime"].ToString().Trim() != string.Empty)
                    {
                        adInfo.CycleTime = int.Parse(context.Request.Form["CycleTime"].ToString());
                    }
                    if (context.Request.Form["EndDate"] != null && context.Request.Form["EndDate"].ToString().Trim() != string.Empty)
                    {
                        adInfo.EndDate = context.Request.Form["EndDate"].ToString();
                    }
                    if (context.Request.Form["StartDate"] != null && context.Request.Form["StartDate"].ToString().Trim() != string.Empty)
                    {
                        adInfo.StartDate = context.Request.Form["StartDate"].ToString();
                    }
                    if (context.Request.Form["ShowStatus"] != null && context.Request.Form["ShowStatus"].ToString().Trim() != string.Empty)
                    {
                        adInfo.ShowStatus = int.Parse(context.Request.Form["ShowStatus"].ToString());
                    }
                    if (context.Request.Form["PublishStatus"] != null && context.Request.Form["PublishStatus"].ToString().Trim() != string.Empty)
                    {
                        adInfo.PublishStatus = int.Parse(context.Request.Form["PublishStatus"].ToString());
                    }
                    if (context.Request.Form["FileIndex"] != null && context.Request.Form["FileIndex"].ToString().Trim() != string.Empty)
                    {
                        adInfo.FileIndex = int.Parse(context.Request.Form["FileIndex"].ToString());
                    }
                    if (context.Request.Form["FileName"] != null && context.Request.Form["FileName"].ToString().Trim() != string.Empty)
                    {
                        adInfo.FileName = context.Request.Form["FileName"].ToString();
                    }
                    adInfo.FileSize = postedFile.ContentLength;
                    proxy           = new WCFServiceProxy <IAdInfoManage>();
                    jsonMessage     = proxy.getChannel.Add(adInfo);
                }
                break;

                case "EDIT":
                {
                    Info        = new CommonModelFactory <IoT_AdInfo>().GetModelFromContext(context);
                    proxy       = new WCFServiceProxy <IAdInfoManage>();
                    jsonMessage = proxy.getChannel.Edit(Info);
                }
                break;

                case "DELETE":
                {
                    Info        = new CommonModelFactory <IoT_AdInfo>().GetModelFromContext(context);
                    proxy       = new WCFServiceProxy <IAdInfoManage>();
                    jsonMessage = proxy.getChannel.Delete(Info);
                }
                break;

                case "PUBLISH":
                {
                    IoT_SetAdInfo setInfo = new CommonModelFactory <IoT_SetAdInfo>().GetModelFromContext(context);
                    setInfo.SetType  = 0;       //发布
                    setInfo.SendTime = DateTime.Now;
                    proxy            = new WCFServiceProxy <IAdInfoManage>();
                    jsonMessage      = proxy.getChannel.Publish(setInfo);
                }
                break;

                case "UNPUBLISH":
                {
                    IoT_SetAdInfo setInfo = new CommonModelFactory <IoT_SetAdInfo>().GetModelFromContext(context);
                    proxy       = new WCFServiceProxy <IAdInfoManage>();
                    jsonMessage = proxy.getChannel.UnPublish(setInfo);
                }
                break;

                case "EDITADINFO":
                {
                    IoT_SetAdInfo setInfo = new CommonModelFactory <IoT_SetAdInfo>().GetModelFromContext(context);
                    setInfo.SetType      = 1;   //编辑
                    setInfo.DeleteStatus = 0;
                    setInfo.SendTime     = DateTime.Now;
                    proxy       = new WCFServiceProxy <IAdInfoManage>();
                    jsonMessage = proxy.getChannel.EditAdInfo(setInfo);
                }
                break;

                case "DELETEADINFO":
                {
                    IoT_SetAdInfo setInfo = new CommonModelFactory <IoT_SetAdInfo>().GetModelFromContext(context);
                    setInfo.SetType      = 2;   //删除
                    setInfo.DeleteStatus = 1;
                    setInfo.SendTime     = DateTime.Now;
                    proxy       = new WCFServiceProxy <IAdInfoManage>();
                    jsonMessage = proxy.getChannel.EditAdInfo(setInfo);
                }
                break;

                case "QUERYCONTROL":
                    CommonSearch <IoT_SetAdInfo> setAdInfoSearch = new CommonSearch <IoT_SetAdInfo>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "IoT_SetAdInfo", TFieldKey = "SendTime", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "SendTime Desc", TWhere = Where
                    };
                    List <IoT_SetAdInfo> setAdInfoList = setAdInfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <IoT_SetAdInfo>(setAdInfoList, sCondition.TTotalCount)
                    };
                    break;

                case "QUERYMETERVIEW":
                    CommonSearch <View_AdInfoMeter> InfoSearch_User = new CommonSearch <View_AdInfoMeter>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    if (context.Request.Form["ID"] != null && context.Request.Form["ID"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND ID=" + context.Request.Form["ID"].ToString().Trim();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_AdInfoMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "FinishedDate DESC", TWhere = Where
                    };
                    List <View_AdInfoMeter> list_User = InfoSearch_User.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_AdInfoMeter>(list_User, sCondition.TTotalCount)
                    };
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex) {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 21
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;
            //获取操作类型AType:ADD,EDIT,DELETE,QUERY
            string         AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            ReportTemplate Info;
            WCFServiceProxy <IOperRightManage> proxy;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            switch (AjaxType)
            {
            case "QUERY":
                string Where = "1=1 ";
                if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                {
                    Where += "AND " + context.Request.Form["TWhere"].ToString();
                }
                CommonSearch <ReportTemplate> userInfoSearch = new CommonSearch <ReportTemplate>();
                SearchCondition sCondition = new SearchCondition()
                {
                    TBName = "ReportTemplate", TFieldShow = "RID,ReportName", TFieldKey = "RID,ReportName", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "RID ASC", TWhere = Where
                };
                List <ReportTemplate> list = userInfoSearch.GetList(ref sCondition, context);
                jsonMessage = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.ListToJson <ReportTemplate>(list, sCondition.TTotalCount)
                };
                break;

            case "EDITNAME":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "xgbbmc"))
                {
                    Info = new CommonModelFactory <ReportTemplate>().GetModelFromContext(context);

                    proxy       = new WCFServiceProxy <IOperRightManage>();
                    jsonMessage = proxy.getChannel.EditReportName(Info);
                }
                break;

            case "EXPORT":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dcbbmb"))
                {
                    try
                    {
                        int rID = -1;
                        int.TryParse(context.Request.QueryString["RID"].ToString(), out rID);
                        string rName          = context.Request.QueryString["RName"] == null ? "报表模板" : context.Request.QueryString["RName"].ToString();
                        string strSaveDictory = string.Format("{0}\\ReportTemplateExport\\{1}\\{2}\\{3}\\",
                                                              context.Server.MapPath("~"), base.loginOperator.CompanyID, base.loginOperator.OperID, System.DateTime.Now.ToString("yyyyMMdd"));
                        string strSavePath = string.Format("{0}\\ReportTemplateExport\\{1}\\{2}\\{3}\\{4}.rpt",
                                                           context.Server.MapPath("~"), base.loginOperator.CompanyID, base.loginOperator.OperID, System.DateTime.Now.ToString("yyyyMMdd"), rName);
                        string strDownloadUrl = string.Format("{0}/ReportTemplateExport/{1}/{2}/{3}/{4}.rpt",
                                                              "..", base.loginOperator.CompanyID, base.loginOperator.OperID, System.DateTime.Now.ToString("yyyyMMdd"), rName);
                        ReportDataSourceDs ds = new Reports().ReadReport(rID);
                        if (!Directory.Exists(strSaveDictory))
                        {
                            Directory.CreateDirectory(strSaveDictory);
                        }
                        ds.WriteXml(strSavePath);
                        jsonMessage = new Message()
                        {
                            Result = true, TxtMessage = strDownloadUrl
                        };

                        //以字符流的形式下载文件
                        FileStream fs    = new FileStream(strSavePath, FileMode.Open);
                        byte[]     bytes = new byte[(int)fs.Length];
                        fs.Read(bytes, 0, bytes.Length);
                        fs.Close();
                        context.Response.ContentEncoding = System.Text.Encoding.UTF8;
                        context.Response.ContentType     = "application/octet-stream";
                        //通知浏览器下载文件而不是打开
                        context.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(rName) + ".rpt");
                        context.Response.BinaryWrite(bytes);
                        context.Response.Flush();
                        context.Response.End();
                    }
                    catch (Exception e)
                    {
                        jsonMessage = new Message()
                        {
                            Result = false, TxtMessage = e.Message
                        };
                    }
                }
                break;

            case "DELETE":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "scbbmb"))
                {
                    Info = new CommonModelFactory <ReportTemplate>().GetModelFromContext(context);
                    Reports r       = new Reports();
                    string  dResult = r.DeleteReportTemplate(Info.RID);
                    jsonMessage = new Message()
                    {
                        Result     = dResult == string.Empty ? true : false,
                        TxtMessage = dResult == string.Empty ? "删除成功" : dResult
                    };
                }
                break;

            case "QUERYCOMPANYREPORT":
                Where = "1=1 ";
                if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                {
                    Where += "AND " + context.Request.Form["TWhere"].ToString();
                }
                CommonSearch <CompanyReport> reportInfoSearch = new CommonSearch <CompanyReport>();
                sCondition = new SearchCondition()
                {
                    TBName = "View_CompanyReport", TFieldKey = "CompanyID,MenuCode", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "RID ASC", TWhere = Where
                };

                List <CompanyReport> reportlist = reportInfoSearch.GetList(ref sCondition, context);
                jsonMessage = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.ListToJson <CompanyReport>(reportlist, sCondition.TTotalCount)
                };
                break;

            default:
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = "操作未定义。"
                };
                break;
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 22
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            //IoT_User Info; View_UserMeter viewInfo;
            WCFServiceProxy <IUserManage> proxy = null;

            try
            {
                switch (AjaxType)
                {
                //查询用户表讯息
                case "QUERY":
                    CommonSearch <View_UserMeter> InfoSearch = new CommonSearch <View_UserMeter>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_UserMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where
                    };
                    List <View_UserMeter> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_UserMeter>(list, sCondition.TTotalCount)
                    };
                    break;

                //实现营业厅充值动作
                case "CHONGZHI":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "CHONGZHI"))
                    {
                        IoT_MeterTopUp Info;
                        WCFServiceProxy <IChongzhiManage> proxy1 = null;
                        Info = new CommonModelFactory <IoT_MeterTopUp>().GetModelFromContext(context);
                        List <IoT_MeterTopUp> lstIoT_MeterTopUp = new List <IoT_MeterTopUp>();
                        string MeterNo  = string.IsNullOrEmpty(context.Request["MeterNo"]) == true ? "" : context.Request["MeterNo"].ToString();
                        string Amount   = string.IsNullOrEmpty(context.Request["Amount"]) == true ? "0" : context.Request["Amount"].ToString();
                        string MeterID  = string.IsNullOrEmpty(context.Request["MeterID"]) == true ? "" : context.Request["MeterID"].ToString();
                        string UserID   = string.IsNullOrEmpty(context.Request["UserID"]) == true ? "" : context.Request["UserID"].ToString();
                        string OperID   = string.IsNullOrEmpty(context.Request["OperId"]) ? "" : context.Request["OperId"].ToString();
                        string OperName = string.IsNullOrEmpty(context.Request["OperName"]) ? "" : context.Request["OperName"].ToString();
                        string PayType  = string.IsNullOrEmpty(context.Request["PayType"]) ? "0" : context.Request["PayType"].ToString();

                        if (Amount == "0")    //后台验证输入的金额是否为空
                        {
                            jsonMessage = new Message()
                            {
                                Result     = false,
                                TxtMessage = "请输入正确的充值金额。"
                            };
                            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
                            return;
                        }
                        Info.Amount     = decimal.Parse(Amount);        //充值金额
                        Info.MeterID    = int.Parse(MeterID);           //充值的表ID
                        Info.MeterNo    = MeterNo;                      //充值表号
                        Info.Oper       = base.loginOperator.Name;      //操作员
                        Info.CompanyID  = base.loginOperator.CompanyID; //公司
                        Info.TopUpDate  = DateTime.Now;                 //充值时间,后面会被写到表上的时间覆盖,用来表示写到表上的时间
                        Info.PayDate    = DateTime.Now;                 //充值时间,用户支付完成的时间
                        Info.UserID     = UserID;                       //充值户号
                        Info.TopUpType  = '0';                          //充值类型为"本地营业厅"
                        Info.State      = '0';                          //等待充值状态
                        Info.PayType    = Convert.ToChar(PayType);      //付款类型:0 现金 1 支付宝 2 微信
                        Info.SFOperID   = OperID;
                        Info.SFOperName = OperName;
                        proxy1          = new WCFServiceProxy <IChongzhiManage>();
                        jsonMessage     = proxy1.getChannel.Add(Info);
                        proxy1.CloseChannel();
                    }
                    break;

                case "PRINT":
                    //打印票据(修改打印状态为已打印)
                    WCFServiceProxy <IChongzhiManage> proxy2 = new WCFServiceProxy <IChongzhiManage>();
                    string id = string.IsNullOrEmpty(context.Request["id"]) ? "" : context.Request["id"].ToString();
                    if (id == "")
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = "票据不存在"
                        };
                    }
                    else
                    {
                        string result = proxy2.getChannel.PrintTicket(id);
                        if (result == "")
                        {
                            jsonMessage = new Message()
                            {
                                Result     = true,
                                TxtMessage = ""
                            };
                        }
                    }
                    proxy2.CloseChannel();

                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 23
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string       AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            IoT_SetAlarm Info;
            WCFServiceProxy <ISetAlarm> proxy = null;

            try
            {
                switch (AjaxType)
                {
                case "QUERY":

                    CommonSearch <IoT_SetAlarm> InfoSearch = new CommonSearch <IoT_SetAlarm>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";

                    if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND convert(char(10),RegisterDate,120)='" + context.Request.Form["Date1"].ToString() + "'";;
                    }
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "IoT_SetAlarm", TFieldKey = "RegisterDate", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "RegisterDate DESC", TWhere = Where
                    };
                    List <IoT_SetAlarm> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <IoT_SetAlarm>(list, sCondition.TTotalCount)
                    };
                    break;



                case "QUERYUSER":

                    CommonSearch <View_AlarmMeter> InfoSearch_User = new CommonSearch <View_AlarmMeter>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    if (context.Request.Form["ID"] != null && context.Request.Form["ID"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND ID=" + context.Request.Form["ID"].ToString().Trim();
                    }

                    sCondition = new SearchCondition()
                    {
                        TBName = "View_AlarmMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID DESC", TWhere = Where
                    };
                    List <View_AlarmMeter> list_User = InfoSearch_User.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_AlarmMeter>(list_User, sCondition.TTotalCount)
                    };
                    break;


                case "ADD":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs"))
                    {
                        Info              = new CommonModelFactory <IoT_SetAlarm>().GetModelFromContext(context);
                        Info.CompanyID    = base.loginOperator.CompanyID;
                        Info.Oper         = base.loginOperator.Name;
                        Info.RegisterDate = DateTime.Now;
                        Info.Par4         = Convert.ToInt32(Convert.ToDecimal(Info.Par4) * 100).ToString();

                        proxy = new WCFServiceProxy <ISetAlarm>();

                        if (context.Request.Form["Scope"] != null && context.Request.Form["Scope"].ToString().Trim() != string.Empty)
                        {
                            if (context.Request.Form["Scope"].ToString().Trim() == "所有用户")
                            {
                                jsonMessage = proxy.getChannel.AddSetAlarmAll(Info);
                            }
                            else if (context.Request.Form["Scope"].ToString().Trim() == "选择用户")
                            {
                                List <IoT_AlarmMeter> alarmMeter = new List <IoT_AlarmMeter>();
                                if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                                {
                                    string strNo = context.Request.Form["strNo"];

                                    string[] arrNo = strNo.Split(',');

                                    for (int i = 0; i < arrNo.Length; i++)
                                    {
                                        IoT_AlarmMeter meter = new IoT_AlarmMeter();
                                        meter.MeterNo = arrNo[i];
                                        alarmMeter.Add(meter);
                                    }
                                }
                                jsonMessage = proxy.getChannel.Add(Info, alarmMeter);
                            }
                            //选择区域用户
                            else
                            {
                                if (context.Request.Form["strArea"] != null && context.Request.Form["strArea"].ToString().Trim() != string.Empty)
                                {
                                    string   strNo = context.Request.Form["strArea"];
                                    string[] arrNo = strNo.Split(',');
                                    jsonMessage = proxy.getChannel.AddSetAlarmArea(Info, arrNo.ToList());
                                }
                            }
                        }
                    }
                    break;

                case "EDIT":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs"))
                    {
                        Info        = new CommonModelFactory <IoT_SetAlarm>().GetModelFromContext(context);
                        proxy       = new WCFServiceProxy <ISetAlarm>();
                        jsonMessage = proxy.getChannel.Edit(Info);
                    }
                    break;

                case "DELETE":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, ""))
                    {
                        Info        = new CommonModelFactory <IoT_SetAlarm>().GetModelFromContext(context);
                        proxy       = new WCFServiceProxy <ISetAlarm>();
                        jsonMessage = proxy.getChannel.Delete(Info);
                    }
                    break;

                case "UNDO":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs"))
                    {
                        Info        = new CommonModelFactory <IoT_SetAlarm>().GetModelFromContext(context);
                        proxy       = new WCFServiceProxy <ISetAlarm>();
                        jsonMessage = proxy.getChannel.UnSetParamter(Info);
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex) {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 24
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };

            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            ADItem Info     = new ADItem();
            WCFServiceProxy <IADItemDAL> proxy = null;

            Info  = new CommonModelFactory <ADItem>().GetModelFromContext(context);
            proxy = new WCFServiceProxy <IADItemDAL>();
            //文件控制接口
            WCFServiceProxy <IADFileService> fileContrl = new WCFServiceProxy <IADFileService>();

            try
            {
                switch (AjaxType)
                {//查询用户
                case "QUERY":

                    CommonSearch <ADItem> InfoSearch = new CommonSearch <ADItem>();
                    string Where = "1=1 ";

                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "ADItem", TFieldKey = "AI_ID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "OrderID asc", TWhere = Where
                    };
                    List <ADItem> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <ADItem>(list, sCondition.TTotalCount)
                    };
                    break;

                //列表
                case "QUERYVIEW":

                    CommonSearch <ADItem> InfoSearchView = new CommonSearch <ADItem>();
                    Where = "1=1 ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "ADItem", TFieldKey = "AI_ID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = " OrderID asc", TWhere = Where
                    };

                    List <ADItem> listView = InfoSearchView.GetList(ref sCondition, context);
                    //SysCookie.UrlParaStr = "InfoCount?" + listView.Count;//取得条数据,方便生成序列号
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <ADItem>(listView, sCondition.TTotalCount)
                    };
                    break;

                //添加广告内容
                case "ADD":

                    //提取上传地址配置值
                    string         ADFilePath = System.Configuration.ConfigurationManager.AppSettings["ADFilePath"].ToString();
                    HttpPostedFile postedFile = context.Request.Files[0];

                    //提取扩展名
                    string fileExtendName = Info.FileName.Substring(Info.FileName.IndexOf("."), Info.FileName.Length - Info.FileName.IndexOf("."));
                    //将文件存到服务器上
                    postedFile.SaveAs(ADFilePath + @"\" + Info.FileName);
                    //将生成文件流
                    System.IO.Stream stream = postedFile.InputStream;

                    //将文件转换成文件流并存入二进制数组
                    byte[] data = new byte[stream.Length];
                    stream.Read(data, 0, data.Length);
                    stream.Close();

                    Info.FileLength = data.Length;
                    Info.StorePath  = postedFile.FileName;
                    Info.StoreName  = loginOperator.CompanyID + string.Format("{0:yyMMdd}", DateTime.Now) + AdMComm.GetAddZero(proxy.getChannel.userPuFileNum(loginOperator.CompanyID) + 1, 5) + fileExtendName;
                    //调用共用文件上传接口
                    string fileRetrue = fileContrl.getChannel.UpLoad(loginOperator.CompanyID, Info.StoreName, data);
                    jsonMessage = proxy.getChannel.Add(Info);
                    break;

                case "EDIT":

                    HttpFileCollection files = HttpContext.Current.Request.Files;

                    if (files.Count > 0)
                    {
                        //提取上传地址配置值
                        string         eADFilePath = System.Configuration.ConfigurationManager.AppSettings["ADFilePath"].ToString();
                        HttpPostedFile epostedFile = context.Request.Files[0];
                        //提取扩展名
                        string efileExtendName = Info.FileName.Substring(Info.FileName.IndexOf("."), Info.FileName.Length - Info.FileName.IndexOf("."));
                        //将文件存到服务器上
                        epostedFile.SaveAs(eADFilePath + @"\" + Info.FileName);
                        //将生成文件流
                        System.IO.Stream estream = epostedFile.InputStream;

                        //将文件转换成文件流并存入二进制数组
                        byte[] edata = new byte[estream.Length];
                        estream.Read(edata, 0, edata.Length);
                        estream.Close();

                        Info.FileLength = edata.Length;
                        Info.StorePath  = epostedFile.FileName;
                        Info.StoreName  = loginOperator.CompanyID + string.Format("{0:yyMMdd}", DateTime.Now) + AdMComm.GetAddZero(proxy.getChannel.userPuFileNum(loginOperator.CompanyID) + 1, 5) + efileExtendName;
                        //调用共用文件上传接口
                        string efileRetrue = fileContrl.getChannel.UpLoad(loginOperator.CompanyID, Info.StoreName, edata);
                    }

                    jsonMessage = proxy.getChannel.Edit(Info);
                    break;

                case "UPORDER":

                    //if (Info.OrderID != null) orderIDre = short.Parse(Info.OrderID.ToString());
                    jsonMessage = proxy.getChannel.upOrder(Info);
                    break;

                case "DOWNORDER":
                    //if (Info.OrderID != null) orderIDre = short.Parse(Info.OrderID.ToString());
                    jsonMessage = proxy.getChannel.downOrder(Info);
                    break;

                //删除信息
                case "DELFILE":

                    jsonMessage = proxy.getChannel.Delete(Info.AI_ID);
                    //调用共用文件接口,删除文件
                    string dfileRetrue = fileContrl.getChannel.Delete(loginOperator.CompanyID, Info.StoreName);
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "1.操作未定义!"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 25
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            IoT_SetSettlementDay          Info;
            WCFServiceProxy <ISettlement> proxy = null;

            try
            {
                switch (AjaxType)
                {
                //查询
                case "QUERY":
                    CommonSearch <View_SettlementDayMeterView> InfoSearch = new CommonSearch <View_SettlementDayMeterView>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";

                    if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND convert(char(10),RegisterDate,120)='" + context.Request.Form["Date1"].ToString() + "'";;
                    }
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_SettlementDayMeterView", TFieldKey = "DayID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "RegisterDate DESC", TWhere = Where
                    };
                    List <View_SettlementDayMeterView> list = InfoSearch.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_SettlementDayMeterView>(list, sCondition.TTotalCount)
                    };
                    break;

                //查询失败用户
                case "QUERYUSERFILE":
                    CommonSearch <View_SettlementDayMeter> InfoSearch_UserFILE = new CommonSearch <View_SettlementDayMeter>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "'  AND State='3'";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    if (context.Request.Form["DayID"] != null && context.Request.Form["DayID"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND MeterID=" + context.Request.Form["DayID"].ToString().Trim();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_SettlementDayMeter", TFieldKey = "MeterID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "MeterID DESC", TWhere = Where
                    };
                    List <View_SettlementDayMeter> list_UserFILE = InfoSearch_UserFILE.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_SettlementDayMeter>(list_UserFILE, sCondition.TTotalCount)
                    };
                    break;

                //查询所有设定结算日的用户
                case "QUERYUSER":
                    CommonSearch <View_SettlementDayMeter> InfoSearch_User = new CommonSearch <View_SettlementDayMeter>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    if (context.Request.Form["MeterID"] != null && context.Request.Form["MeterID"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND MeterID=" + context.Request.Form["MeterID"].ToString().Trim();
                    }

                    sCondition = new SearchCondition()
                    {
                        TBName = "View_SettlementDayMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID DESC", TWhere = Where
                    };
                    List <View_SettlementDayMeter> list_User = InfoSearch_User.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_SettlementDayMeter>(list_User, sCondition.TTotalCount)
                    };
                    break;

                //新增结算日
                case "ADD":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs"))
                    {
                        Info              = new CommonModelFactory <IoT_SetSettlementDay>().GetModelFromContext(context);
                        Info.CompanyID    = base.loginOperator.CompanyID;
                        Info.Oper         = base.loginOperator.Name;
                        Info.RegisterDate = DateTime.Now;
                        List <IoT_SettlementDayMeter> alarmMeter = new List <IoT_SettlementDayMeter>();
                        string Total           = string.IsNullOrEmpty(context.Request.Form["Total"]) == true ? "" : context.Request.Form["Total"].ToString();
                        string Context         = string.IsNullOrEmpty(context.Request.Form["Context"]) == true ? "" : context.Request.Form["Context"].ToString();
                        string SettlementDay   = (string.IsNullOrEmpty(context.Request.Form["strDay"]) == true ? "0" : context.Request.Form["strDay"].ToString());
                        string SettlementMonth = (string.IsNullOrEmpty(context.Request.Form["strMonth"]) == true ? "0" : context.Request.Form["strMonth"].ToString());
                        Info.CompanyID = base.loginOperator.CompanyID;
                        Info.Context   = Context;
                        //Info.ReportType = ReportType;
                        Info.RegisterDate    = DateTime.Now;
                        Info.SettlementDay   = int.Parse(SettlementDay);
                        Info.State           = '0';
                        Info.TaskID          = "";//目前还不知道任务ID的取值方法
                        Info.Total           = int.Parse(Total);
                        Info.SettlementMonth = int.Parse(SettlementMonth);
                        proxy = new WCFServiceProxy <ISettlement>();
                        if (!string.IsNullOrEmpty(context.Request.Form["hidType"]) && (context.Request.Form["hidType"].ToString() != ""))
                        {
                            //判断所选用户类型
                            alarmMeter = new List <IoT_SettlementDayMeter>();
                            if (context.Request.Form["hidType"].ToString() == "1")
                            {
                                Info.Scope = "所有用户";
                                //jsonMessage = proxy.getChannel.AddSetAlarmAll(Info);
                            }
                            else if (context.Request.Form["hidType"].ToString() == "2")
                            {
                                Info.Scope = "选择用户";
                            }
                            else
                            {
                                //Info.Scope = context.Request.Form["hidType"].ToString();
                                string   strNo = context.Request.Form["communityStr"] == null ? "" : context.Request.Form["communityStr"];
                                string[] arrNo = strNo.Split(',');
                                Info.Scope = context.Request.Form["hidType"].ToString();
                                //jsonMessage = proxy.getChannel.AddSetAlarmArea(Info, arrNo.ToList());
                            }
                            if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                            {
                                string   strNo = context.Request.Form["strNo"];
                                string[] arrNo = strNo.Split(',');
                                for (int i = 0; i < arrNo.Length; i++)
                                {
                                    IoT_SettlementDayMeter meter = new IoT_SettlementDayMeter();
                                    meter.MeterNo = arrNo[i];
                                    alarmMeter.Add(meter);
                                }
                            }
                            jsonMessage = proxy.getChannel.Add(Info, alarmMeter);
                        }
                    }
                    break;

                //撤销
                case "REVOKE":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "RVJSR"))
                    {
                        proxy = new WCFServiceProxy <ISettlement>();
                        string ID = string.Empty;
                        if (context.Request["ID"] != null && context.Request["ID"].ToString().Trim() != string.Empty)
                        {
                            ID = context.Request["ID"].ToString() == "" ? "0" : context.Request["ID"].ToString();
                        }
                        jsonMessage = proxy.getChannel.revoke(ID, loginOperator.CompanyID);
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                    //修改
                    //case "EDIT":
                    //    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs"))
                    //    {
                    //        Info = new CommonModelFactory<IoT_SetSettlementDay>().GetModelFromContext(context);
                    //        proxy = new WCFServiceProxy<ISettlement>();
                    //        jsonMessage = proxy.getChannel.Edit(Info);
                    //    }
                    //    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 26
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;
            //获取操作类型AType:ADD,EDIT,DELETE,QUERY
            string      AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            CompanyInfo Info;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            switch (AjaxType)
            {
            case "QUERY":
                string Where = "1=1 ";
                if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                {
                    Where += "AND " + context.Request.Form["TWhere"].ToString();
                }
                CommonSearch <CompanyInfo> userInfoSearch = new CommonSearch <CompanyInfo>();
                SearchCondition            sCondition     = new SearchCondition()
                {
                    TBName = "S_CompanyInfo", TFieldKey = "CompanyID", TTotalCount = -1, TPageCurrent = 1, TPageCount = 1, TFieldOrder = "CompanyName ASC", TWhere = Where
                };
                List <CompanyInfo> list = userInfoSearch.GetList(ref sCondition, context);
                jsonMessage = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.ListToJson <CompanyInfo>(list, sCondition.TTotalCount)
                };
                break;

            case "ADD":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "tjzcqy"))
                {
                    Info        = new CommonModelFactory <CompanyInfo>().GetModelFromContext(context);
                    jsonMessage = new WCFServiceProxy <ICompanyManage>().getChannel.AddCompany(Info);
                }
                break;

            case "EDIT":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "bjzcqy"))
                {
                    Info        = new CommonModelFactory <CompanyInfo>().GetModelFromContext(context);
                    jsonMessage = new WCFServiceProxy <ICompanyManage>().getChannel.EditCompany(Info);
                }
                break;

            case "REMOVECACHE":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "qcqyqxhc"))
                {
                    Info        = new CommonModelFactory <CompanyInfo>().GetModelFromContext(context);
                    jsonMessage = new WCFServiceProxy <IOperRightManage>().getChannel.RemoveCompanyRightCache(Info.CompanyID);
                }
                break;

            case "RESETCOMPANYADMIN":
                if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "qyzzhcsh"))
                {
                    Info = new CommonModelFactory <CompanyInfo>().GetModelFromContext(context);
                    if (Info.CompanyID == base.loginOperator.CompanyID)
                    {
                        jsonMessage = new Message()
                        {
                            Result = false, TxtMessage = string.Format("您没有权限对当前企业管理账户{0}做初始化操作。", base.loginOperator.CompanyID)
                        };
                    }
                    else
                    {
                        jsonMessage = new WCFServiceProxy <ICompanyManage>().getChannel.ResetCompanyAdmin(Info);
                    }
                }
                break;

            default:
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = "操作未定义。"
                };
                break;
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 27
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string       AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            IoT_PricePar Info;
            WCFServiceProxy <IPriceParManage> proxy = null;

            try
            {
                switch (AjaxType)
                {
                case "QUERY":

                    CommonSearch <IoT_PricePar> InfoSearch = new CommonSearch <IoT_PricePar>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName      = "IoT_PricePar",
                        TFieldKey   = "ID",
                        TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "ID ASC", TWhere = Where
                    };
                    List <IoT_PricePar> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <IoT_PricePar>(list, sCondition.TTotalCount)
                    };
                    break;

                case "ADD":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "jggl_tjjg"))
                    {
                        Info           = new CommonModelFactory <IoT_PricePar>().GetModelFromContext(context);
                        Info.CompanyID = loginOperator.CompanyID;
                        proxy          = new WCFServiceProxy <IPriceParManage>();
                        jsonMessage    = proxy.getChannel.Add(Info);
                    }
                    break;

                case "EDIT":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "jggl_bjjg"))
                    {
                        Info        = new CommonModelFactory <IoT_PricePar>().GetModelFromContext(context);
                        proxy       = new WCFServiceProxy <IPriceParManage>();
                        jsonMessage = proxy.getChannel.Edit(Info);
                    }
                    break;

                case "DELETE":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "jggl_scjg"))
                    {
                        Info        = new CommonModelFactory <IoT_PricePar>().GetModelFromContext(context);
                        proxy       = new WCFServiceProxy <IPriceParManage>();
                        jsonMessage = proxy.getChannel.Delete(Info);
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex) {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
Ejemplo n.º 28
0
        public void ProcessRequest(HttpContext context)
        {
            //获取操作类型AType:list,oneinfo
            string  AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "调用失败。"
            };
            WCFServiceProxy <IGetMonitorInfo> proxy = null;

            try
            {
                switch (AjaxType)
                {
                case "LIST":    //获取采集端服务器列表
                    proxy = new WCFServiceProxy <IGetMonitorInfo>();
                    DataArge       arglist = proxy.getChannel.GetMonitorInfo("");
                    List <CJDInfo> list    = (List <CJDInfo>)arglist.Data;
                    string         str     = "[{\"id\":0,\"text\":\"采集服务器列表\",\"children\":[";
                    foreach (CJDInfo one in list)
                    {
                        str += "{\"id\":\"" + one.ID + "\",\"text\":\"" + one.ID + one.Name + "\"},";
                    }
                    str  = str.Trim(',');
                    str += "]}]";
                    context.Response.Write(str);
                    return;

                    //jsonMessage = new Message()
                    //  {
                    //      Result = true,
                    //      TxtMessage = JSon.ListToJson<CJDInfo>(list, list.Count)
                    //  };
                    break;

                case "ONEINFO":    //获取某一台采集服务器 监视信息
                    proxy = new WCFServiceProxy <IGetMonitorInfo>();
                    string      dscId       = context.Request.Form["dscId"] == null ? string.Empty : context.Request.Form["dscId"].ToString();
                    DataArge    arg         = proxy.getChannel.GetMonitorInfo(dscId);
                    MonitorInfo monitorinfo = (MonitorInfo)arg.Data;


                    ////是否保存监视信息
                    //string isSaveData = context.Request.Form["saveData"] == null ? "false" : context.Request.Form["saveData"].ToString();
                    //if (isSaveData == "true")
                    //{
                    //    Log.getInstance().FileSpace = 5;
                    //    Log.getInstance().Write(new MonitorLogMsg(dscId, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "," + monitorinfo.Cpu.ToString() + "," + monitorinfo.LinkCount.ToString() + "," + monitorinfo.Memory.ToString()));

                    //}
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.TToJson <MonitorInfo>(monitorinfo)
                    };
                    break;

                case "FILELIST":    //获取某一台采集服务器 监视信息
                    string              datafileDir  = System.Configuration.ConfigurationManager.AppSettings["SystemPath"].ToString() + "\\Data";
                    string[]            dirstring    = Directory.GetDirectories(datafileDir);
                    List <DataFileList> dataFilelist = new List <DataFileList>();
                    DataFileList        oneDataFile;
                    foreach (string onedir in dirstring)
                    {
                        oneDataFile            = new DataFileList();
                        oneDataFile.FileFolder = onedir.Substring(onedir.LastIndexOf("\\") + 1);
                        string[] filestring = Directory.GetFiles(onedir);
                        string   strlist    = "";
                        foreach (string onefile in filestring)
                        {
                            strlist += Path.GetFileNameWithoutExtension(onefile) + ";";
                        }
                        oneDataFile.fileName = strlist;
                        dataFilelist.Add(oneDataFile);
                    }
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <DataFileList>(dataFilelist, dataFilelist.Count)
                    };
                    break;

                case "ONEHISDATA":    //读取一个数据文件的数据
                    #region           读取一个数据文件的数据
                    //0001_201510092110.txt
                    string filename   = context.Request.Form["filename"] == null ? string.Empty : context.Request.Form["filename"].ToString();
                    string fileFolder = filename.Substring(filename.IndexOf('_') + 1, 8);

                    string datafileDirq = System.Configuration.ConfigurationManager.AppSettings["SystemPath"].ToString() + "\\Data";
                    string filepath     = datafileDirq + "\\" + fileFolder + "\\" + filename + ".txt";
                    if (File.Exists(filepath))
                    {
                        FileStream fs = File.Open(filepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                        // 创建一个数据流读入器,和打开的文件关联
                        StreamReader      srMyfile = new StreamReader(fs);
                        List <DataFormat> datalist = new List <DataFormat>();
                        DataFormat        onedata;
                        try
                        {
                            // 把文件指针重新定位到文件的开始
                            srMyfile.BaseStream.Seek(0, SeekOrigin.Begin);
                            string s1;
                            while ((s1 = srMyfile.ReadLine()) != null)
                            {
                                if (s1 != "")
                                {
                                    onedata = new DataFormat();
                                    string[] datas = s1.Split(',');
                                    onedata.DataDateTime = Convert.ToDateTime(datas[0]);
                                    onedata.CPU          = float.Parse(datas[1]);
                                    onedata.Link         = float.Parse(datas[2]);
                                    onedata.Memory       = float.Parse(datas[3]);
                                    datalist.Add(onedata);
                                }
                            }
                        }
                        catch { }
                        finally
                        {
                            srMyfile.Close();
                            fs.Close();
                        }
                        jsonMessage = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.ListToJson <DataFormat>(datalist, datalist.Count)
                        };
                        break;
                    }
                    #endregion           读取一个数据文件的数据
                    break;

                case "SAVEHISDATA":    //存储采集服务器 监视信息
                    #region 存储采集服务器 监视信息
                    string dscIdList = context.Request.Form["dscIdList"] == null ? string.Empty : context.Request.Form["dscIdList"].ToString();
                    if (dscIdList.Length > 0)
                    {
                        string[] idArrary = dscIdList.Split(',');
                        proxy = new WCFServiceProxy <IGetMonitorInfo>();
                        for (int i = 0; i < idArrary.Length; i++)
                        {
                            DataArge    argsave         = proxy.getChannel.GetMonitorInfo(idArrary[i]);
                            MonitorInfo savemonitorinfo = (MonitorInfo)argsave.Data;
                            Log.getInstance().FileSpace = 5;
                            Log.getInstance().Write(new MonitorLogMsg(idArrary[i], DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "," + savemonitorinfo.Cpu.ToString() + "," + savemonitorinfo.LinkCount.ToString() + "," + savemonitorinfo.Memory.ToString()));
                        }
                    }

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = ""
                    };
                    #endregion 存储采集服务器 监视信息
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }