Esempio n. 1
0
        /// <summary>
        ///获取项目信息
        /// </summary>
        /// <returns></returns>
        public APIRst GetProjectInfo()
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetProjectInfo();
                ProVModel pm       = new ProVModel();
                if (dtSource.Rows.Count > 0)
                {
                    pm = new ProVModel()
                    {
                        Id       = CommFunc.ConvertDBNullToInt32(dtSource.Rows[0]["Co_id"]),
                        ProName  = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["CoName"]),
                        Disabled = CommFunc.ConvertDBNullToInt32(dtSource.Rows[0]["Disabled"]),
                        Person   = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["CustName"]),
                        ProAddr  = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["CustAddr"]),
                        TelNo    = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["Mobile"]),
                        Area     = CommFunc.ConvertDBNullToDecimal(dtSource.Rows[0]["Area"]),
                        Remark   = CommFunc.ConvertDBNullToString(dtSource.Rows[0]["Remark"]),
                    };
                }
                rst.data = pm;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取获取能源分类列表错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 2
0
        /// <summary>
        /// 设置保存费率信息
        /// </summary>
        /// <param name="T1st">尖单价-对应的开始时间</param>
        /// <param name="T2nd">峰单价-对应的开始时间</param>
        /// <param name="T3rd">平单价-对应的开始时间</param>
        /// <param name="T4th">谷单价-对应的开始时间</param>
        /// <param name="Rate_id">费率ID号</param>
        /// <param name="Descr">费率描述</param>
        /// <param name="Pri1st">尖单价</param>
        /// <param name="Pri2nd">峰单价</param>
        /// <param name="Pri3rd">平单价</param>
        /// <param name="Pri4th">谷单价</param>
        /// <returns></returns>
        public APIRst SetSaveYdRate(string T1st, string T2nd, string T3rd, string T4th, int Rate_id, string Descr, decimal Pri1st, decimal Pri2nd, decimal Pri3rd, decimal Pri4th)
        {
            APIRst rst = new APIRst();

            try
            {
                v1_rateVModel rv  = new v1_rateVModel();
                v1_rateCfg    cfg = new v1_rateCfg();
                cfg.T1st = T1st;
                cfg.T2nd = T2nd;
                cfg.T3rd = T3rd;
                cfg.T4th = T4th;

                rv.Rate_id = Rate_id;
                rv.Descr   = Descr;
                rv.Pri1st  = Pri1st;
                rv.Pri2nd  = Pri2nd;
                rv.Pri3rd  = Pri3rd;
                rv.Pri4th  = Pri4th;

                rv.DataCfg = JsonHelper.Serialize(cfg);

                int    cnt = bll.SaveYdRate(rv);
                object obj = GetYdRateList(rv.Rate_id, "");
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取费率列表错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取第三层数据
        /// </summary>
        /// <param name="id">层级3的id号</param>
        /// <returns></returns>
        public APIRst GetLayer04(int co_id)
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetLayer03(co_id);
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    Id       = CommFunc.ConvertDBNullToInt32(s1["Co_id"]),
                    Name     = CommFunc.ConvertDBNullToString(s1["CoName"]),
                    Number   = CommFunc.ConvertDBNullToInt32(s1["Number"]),
                    Disabled = CommFunc.ConvertDBNullToInt32(s1["Disabled"]),
                    //Addr = CommFunc.ConvertDBNullToString(s1["CustAddr"]),
                };
                rst.data = res1.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取第三层数据信息错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 4
0
        /// <summary>
        /// 获取映射
        /// </summary>
        /// <param name="Module_id"></param>
        /// <param name="Action"></param>
        /// <returns></returns>
        public APIRst GetYdModuleOnMapList(int Module_id, int Action)
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetYdModuleOnMapList(Module_id, Action);
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    RowId     = (dtSource.Rows.IndexOf(s1) + 1),
                    Fun_id    = CommFunc.ConvertDBNullToInt32(s1["Fun_id"]),
                    FunName   = CommFunc.ConvertDBNullToString(s1["FunName"]),
                    FunType   = CommFunc.ConvertDBNullToString(s1["FunType"]),
                    TagName   = CommFunc.ConvertDBNullToString(s1["TagName"]),
                    DataValue = CommFunc.ConvertDBNullToString(s1["DataValue"]),
                    Action    = CommFunc.ConvertDBNullToInt32(s1["Action"]),
                    Status    = CommFunc.ConvertDBNullToInt32(s1["Status"]),
                    StatusS   = CommFunc.ConvertDBNullToInt32(s1["Status"]) == 1 ? "已设置" : "未设置",
                    Disabled  = CommFunc.ConvertDBNullToInt32(s1["Disabled"]),
                    @checked  = CommFunc.ConvertDBNullToInt32(s1["Disabled"])
                };
                object obj = new { total = dtSource.Rows.Count, rows = res1.ToList() };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取映射类型错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 5
0
        /// <summary>
        /// 获取历史数据
        /// </summary>
        /// <param name="co_id">支路ID号</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <returns></returns>
        public APIRst GetAlarmList(int co_id, DateTime start, DateTime end, string moduleName)
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetAlarmList(co_id, start, end, moduleName);
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     orderby s1["Module_id"], s1["CollectTime"]
                select new
                {
                    TagTime    = CommFunc.ConvertDBNullToDateTime(s1["CollectTime"]).ToString("yyyy-MM-dd HH:mm:ss"),
                    BuildName  = CommFunc.ConvertDBNullToString(s1["CoName"]),
                    ModuleName = CommFunc.ConvertDBNullToString(s1["ModuleName"]),
                    //FunName = "",
                    LastVal = 1,
                };
                rst.data = res1.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取历史数据错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 6
0
        /// <summary>
        /// 删除物业收费-单价详情
        /// </summary>
        /// <param name="Rate_id">费率ID号</param>
        /// <param name="csId">单价ID号</param>
        /// <returns></returns>
        public APIRst GetDelYdRateCs(int Rate_id, int csId)
        {
            APIRst rst = new APIRst();

            try
            {
                if (Rate_id == 0)
                {
                    throw new Exception("费率ID号不能为空");
                }
                if (csId == 0)
                {
                    throw new Exception("单价ID号不能为空");
                }
                int cc = bll.GetDelYdRateCs(Rate_id, csId);
                rst.data = cc;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("删除物业收费-单价详情:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 7
0
        /// <summary>
        /// 获取系统控制日志
        /// </summary>
        /// <returns></returns>
        public APIRst GetYdSysLogCtrl(string UName, DateTime StartTime, DateTime EndTime)
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetYdSysLogCtrl(UName, StartTime, EndTime);
                int       total    = dtSource.Rows.Count;
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    RowId   = CommFunc.ConvertDBNullToInt32(s1["RowId"]),
                    UName   = CommFunc.ConvertDBNullToString(s1["UName"]),
                    Content = CommFunc.ConvertDBNullToString(s1["Descr"]),
                    Result  = CommFunc.ConvertDBNullToInt32(s1["ErrCode"]) == 0 ? "已下发" : (CommFunc.ConvertDBNullToInt32(s1["ErrCode"]) == 1 ? "执行成功" : CommFunc.ConvertDBNullToString(s1["ErrTxt"])),
                    Ctime   = CommFunc.ConvertDBNullToDateTime(s1["Create_dt"]).ToString("yyyy-MM-dd HH:mm:ss"),
                };
                object obj = new { total = total, rows = res1.ToList() };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取系统操作日志内容错误(GetYdSysLogCtrl):" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 8
0
        /// <summary>
        /// 获取充值参数信息
        /// </summary>
        /// <returns></returns>
        public APIRst GetFrPay()
        {
            APIRst rst = new APIRst();

            try
            {
                var dt       = bll.GetFrPay();
                var dtsource = from s1 in dt.AsEnumerable()
                               select new
                {
                    frpay       = CommFunc.ConvertDBNullToFloat(s1["Price"]),
                    fCoName     = CommFunc.ConvertDBNullToString(s1["CoName"]),
                    vRdChrgType = CommFunc.ConvertDBNullToInt32(s1["ChrgType"])
                };
                rst.data = dtsource.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取充值参数信息错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 9
0
        /// <summary>
        /// 设置微信公众号信息
        /// </summary>
        /// <param name="appid">APPID</param>
        /// <param name="mchid">商户号</param>
        /// <param name="key">商户支付密钥</param>
        /// <param name="appsecret">公众号Secert(仅JSAPI支付时需配置)</param>
        /// <param name="redirect_uri">公众号回调页面(仅JSAPI支付时需配置)</param>
        /// <returns></returns>
        public APIRst SetWxCofig(string appid, string mchid, string key, string appsecret, string redirect_uri)
        {
            APIRst rst = new APIRst();

            try
            {
                if (string.IsNullOrEmpty(appid))
                {
                    throw new Exception(" APPID不能为空");
                }
                if (string.IsNullOrEmpty(mchid))
                {
                    throw new Exception(" 商户号不能为空");
                }
                if (string.IsNullOrEmpty(key))
                {
                    throw new Exception(" 商户支付密钥不能为空");
                }
                rst.data = bll.SetWxCofig(appid, mchid, key, appsecret, redirect_uri);
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("系统配置-微信公众号信息错误(SetAlarmCfg):" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 10
0
        /// <summary>
        /// 获取赠电参数
        /// </summary>
        /// <returns></returns>
        public APIRst GetZdCfg()
        {
            APIRst rst = new APIRst();

            try
            {
                var dt       = bll.GetZdCfg();
                var dtsource = from s1 in dt.AsEnumerable()
                               select new
                {
                    mthBaseRoom  = CommFunc.ConvertDBNullToDecimal(s1["mthBaseRoom"]),
                    mthBaseCrm   = CommFunc.ConvertDBNullToDecimal(s1["mthBaseCrm"]),
                    mthBaseIsAcp = CommFunc.ConvertDBNullToInt32(s1["mthBaseIsAcp"]),
                    BaseType     = CommFunc.ConvertDBNullToInt32(s1["BaseType"])
                };
                rst.data = dtsource.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取充赠电参数信息错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 11
0
        /// <summary>
        /// 获取告警参数--告警设置
        /// </summary>
        /// <returns></returns>
        public APIRst GetAlarmVal()
        {
            APIRst rst = new APIRst();

            try
            {
                var dt       = bll.GetAlarmVal();
                var dtsource = from s1 in dt.AsEnumerable()
                               select new
                {
                    AlarmVal1 = CommFunc.ConvertDBNullToDecimal(s1["AlarmVal1"]),
                    Rule1     = CommFunc.ConvertDBNullToDecimal(s1["Rule1"]),
                    AlarmVal2 = CommFunc.ConvertDBNullToDecimal(s1["AlarmVal2"]),
                    Rule2     = CommFunc.ConvertDBNullToDecimal(s1["Rule2"]),
                    AlarmVal3 = CommFunc.ConvertDBNullToDecimal(s1["AlarmVal3"]),
                    Rule3     = CommFunc.ConvertDBNullToDecimal(s1["Rule3"])
                };
                rst.data = dtsource.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取告警参数--告警设置信息错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 12
0
        /// <summary>
        /// 增加操作页面LOG
        /// </summary>
        /// <returns></returns>
        public APIRst AddLog(string content)
        {
            APIRst rst = new APIRst();

            try
            {
                //HttpRequestBase req = ((System.Web.HttpContextWrapper)actionContext.Request.Properties["MS_HttpContext"]).Request;
                //string nameSpace = actionContext.ActionDescriptor.ControllerDescriptor.ControllerType.Namespace;
                //string controllerName = actionContext.ActionDescriptor.ControllerDescriptor.ControllerName;
                //string actionName = actionContext.ActionDescriptor.ActionName;
                //string userHostAddress = "", absolutePath = "";
                //if (req != null)
                //{
                //    userHostAddress = req.UserHostAddress;
                //    absolutePath = req.Url.AbsolutePath;
                //}
                //else
                //{
                //    FileLog.WriteLog(string.Format("访问命名空间{0}控制器{1}操作对象{2}的HttpRequestBase对象不存在!", nameSpace, controllerName, actionName));
                //}
                YDS6000.BLL.WholeBLL.AddLog(user.Ledger, user.Uid, "", "", "", "", content);
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("增加访问记录错误:", ex.Message);
            }
            return(rst);
        }
Esempio n. 13
0
        /// <summary>
        /// 获取首页的LOGO,背景图和标题
        /// </summary>
        /// <returns></returns>
        public APIRst GetPicANDWord()
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetPicANDWord();
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    attached = CommFunc.ConvertDBNullToString(s1["Attached"]),
                    fname    = CommFunc.ConvertDBNullToString(s1["Fname"]),
                    BgImg    = CommFunc.ConvertDBNullToString(s1["BgImg"]),
                };
                object obj = new { total = dtSource.Rows.Count, rows = res1.ToList() };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取首页的LOGO,背景图和标题(GetPicANDWord)信息错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 14
0
        /// <summary>
        /// 获取登录页文字
        /// </summary>
        /// <returns></returns>
        public APIRst GetTheWords()
        {
            APIRst rst = new APIRst();

            try
            {
                var dt       = bll.GetTheWords();
                var dtsource = from s1 in dt.AsEnumerable()
                               select new
                {
                    frName      = CommFunc.ConvertDBNullToString(s1["Fname"]),
                    frCopyright = CommFunc.ConvertDBNullToString(s1["FCopyright"]),
                    BgImg       = CommFunc.ConvertDBNullToString(s1["BgImg"]),
                };
                rst.data = dtsource.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取登录页文字信息错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 15
0
        // 批量下发命令
        public APIRst YdBatchControlOfSsr(string v0Fun, string dataValue, string pStr)
        {
            APIRst rst = new APIRst();
            YdToGw gw  = new YdToGw(user.Ledger, user.Uid);
            V0Fun  fun = V0Fun.E;

            if (Enum.TryParse <V0Fun>(v0Fun, out fun) == false)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = "控制命令错误";
                return(rst);
            }
            //V0Fun fun = V0Fun.Ssr;
            try
            {
                foreach (string s in pStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    gw.YdToGwCmd(CommFunc.ConvertDBNullToInt32(s), fun, dataValue);
                }
                rst.data = "";
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("批量下发命令错误(YdBatchControlOfSsr)", ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 16
0
        /// <summary>
        /// 新增采集信息
        /// </summary>
        /// <param name="Mm_id">类型ID号</param>
        /// <param name="Fun_id">功能ID号</param>
        /// <param name="FunType">采集类型</param>
        /// <param name="FunName">采集项</param>
        /// <param name="Action">读写:0=读,1=写,3=读写</param>
        /// <returns></returns>
        public APIRst SetYdModelsOnSaveFunc(int Mm_id, int Fun_id, string FunType, string FunName, int Action)
        {
            APIRst rst = new APIRst();

            try
            {
                if (Mm_id == 0)
                {
                    throw new Exception("设备型号不能为空");
                }
                if (string.IsNullOrEmpty(FunType) && Fun_id != 0)
                {
                    throw new Exception("设备采集码不能为空");
                }
                if (string.IsNullOrEmpty(FunName) && Fun_id != 0)
                {
                    throw new Exception("请输入角色名称");
                }

                int cc = bll.SetYdModelsOnSaveFunc(Mm_id, Fun_id, FunType, FunName, Action);

                rst.data = cc;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("设置角色信息错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 17
0
        /// <summary>
        /// 获取物业收费-单价详情
        /// </summary>
        /// <param name="Rate_id">费率ID号</param>
        /// <returns></returns>
        public APIRst GetYdRateNewCs(int Rate_id)
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetYdRateNewCs(Rate_id);
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    CsId   = CommFunc.ConvertDBNullToInt32(s1["CsId"]),
                    Price  = Math.Round(CommFunc.ConvertDBNullToDecimal(s1["Price"]), 2, MidpointRounding.AwayFromZero),
                    PStart = CommFunc.ConvertDBNullToString(s1["PStart"]),
                    PEnd   = CommFunc.ConvertDBNullToString(s1["PEnd"]),
                };
                object obj = new { total = dtSource.Rows.Count, rows = res1.ToList() };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取物业收费-单价详情错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 18
0
        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <returns></returns>
        public APIRst GetUserList()
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetUserList();
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    RowId      = dtSource.Rows.IndexOf(s1) + 1,
                    Uid        = CommFunc.ConvertDBNullToInt32(s1["Uid"]),
                    USign      = CommFunc.ConvertDBNullToString(s1["USign"]),
                    UPasswd    = CommFunc.ConvertDBNullToString(s1["UPasswd"]),
                    UName      = CommFunc.ConvertDBNullToString(s1["UName"]),
                    Role_id    = CommFunc.ConvertDBNullToInt32(s1["Role_id"]),
                    Disabled   = CommFunc.ConvertDBNullToInt32(s1["Disabled"]),
                    RoleName   = CommFunc.ConvertDBNullToString(s1["Descr"]),
                    TelNo      = CommFunc.ConvertDBNullToString(s1["TelNo"]),
                    CreateName = CommFunc.ConvertDBNullToString(s1["CreateName"]),
                    CreateTime = CommFunc.ConvertDBNullToDateTime(s1["CreateTime"]).ToString("yyyy-MM-dd"),
                };
                rst.data = res1.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取用户列表错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 19
0
        /// <summary>
        /// 设置保存物业收费
        /// </summary>
        /// <param name="Rate_id">费率ID号</param>
        /// <param name="Descr">描述</param>
        /// <param name="Rule">计算规则: 0=正常,1=时间范围,2=数量范围</param>
        /// <param name="Unit">单位: Area=平方米,Bank=户数</param>
        /// <param name="UnitBase">单位基数</param>
        /// <param name="Disabled">是否弃用:0=否,1=是</param>
        /// <returns></returns>
        public APIRst SetSaveYdRateNew(int Rate_id, string Descr, int Rule, string Unit, decimal UnitBase, int Disabled)
        {
            APIRst rst = new APIRst();

            try
            {
                v1_rateVModel rv = new v1_rateVModel();
                rv.Rate_id  = Rate_id;
                rv.Descr    = Descr;
                rv.Attrib   = 1;
                rv.Rule     = Rule;
                rv.Unit     = Unit;
                rv.UnitBase = UnitBase;
                rv.Disabled = Disabled;

                int    cnt = bll.SaveYdRateNew(rv);
                object obj = GetYdRateNewList(rv.Rate_id, "");
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取费率列表错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 20
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <returns></returns>
        public APIRst GetUser()
        {
            APIRst rst = new APIRst();

            try
            {
                var dt       = bll.GetUser(0);
                var dtsource = from s1 in dt.AsEnumerable()
                               select new
                {
                    RowId         = CommFunc.ConvertDBNullToInt32(s1["RowId"]),
                    Rid           = CommFunc.ConvertDBNullToInt32(s1["Role_id"]),
                    Ledger        = CommFunc.ConvertDBNullToInt32(s1["Ledger"]),
                    Uid           = CommFunc.ConvertDBNullToInt32(s1["Uid"]),
                    Name          = CommFunc.ConvertDBNullToString(s1["UName"]),
                    Pwd           = CommFunc.ConvertDBNullToString(s1["UPasswd"]),
                    SName         = CommFunc.ConvertDBNullToString(s1["USign"]),
                    RName         = CommFunc.ConvertDBNullToString(s1["Descr"]),
                    TelNo         = CommFunc.ConvertDBNullToString(s1["TelNo"]),
                    Create_by     = CommFunc.ConvertDBNullToInt32(s1["Create_by"]),
                    Create_byName = CommFunc.ConvertDBNullToString(s1["Create_byName"]),
                    Create_dt     = CommFunc.ConvertDBNullToDateTime(s1["Create_dt"]).ToString("yyyy-MM-dd")
                };
                rst.data = dtsource.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取用户信息:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 21
0
        /// <summary>
        /// 设置回路信息(电能表信息)
        /// </summary>
        /// <param name="md">对象:Module_id,Meter_id=设备ID号,ModuleName=电能表名称,ModuleAddr=设备地址(电能表),Disabled=是否弃用(默认0),Remark=备注,EnergyItemCode=分类分项编码(01000),Create_by=建立人,Create_dt=建立时间,Update_by=更新人,Update_dt=更新人</param>
        /// <returns></returns>
        public APIRst YdModuleOnSaveMd(v1_gateway_esp_moduleVModel md)
        {
            APIRst rst = new APIRst();

            try
            {
                if (md.Meter_id == 0)
                {
                    throw new Exception("所属设备错误");
                }
                if (string.IsNullOrEmpty(md.ModuleName))
                {
                    throw new Exception("回路称不能为空");
                }
                if (string.IsNullOrEmpty(md.ModuleAddr))
                {
                    throw new Exception("回路地址不能为空");
                }

                int total = 0;
                bll.YdModuleOnSaveMd(md);
                object rows = this.GetYdModuleOnDetail(0, 0, 0, md.Module_id, out total);
                object obj  = new { total = total, rows = rows };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("设置回路信息(电能表信息)错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 22
0
        public APIRst YdPrepPayInMd_Reset(int module_id, int fun_id)
        {
            APIRst rst = new APIRst();

            try
            {
                int       cnt = bll.YdPrepPayInMd_Reset(module_id, fun_id);
                decimal   chrgVal = 0, useVal = 0, rdVal = 0, syZsVal = 0;
                DataTable dtSource = bll.GetYdPostPayInMdOnList(module_id);
                if (dtSource.Rows.Count > 0)
                {
                    chrgVal = CommFunc.ConvertDBNullToDecimal(dtSource.Rows[0]["ChrgVal"]);
                    useVal  = CommFunc.ConvertDBNullToDecimal(dtSource.Rows[0]["UseVal"]);
                    rdVal   = CommFunc.ConvertDBNullToDecimal(dtSource.Rows[0]["RdVal"]);
                    syZsVal = CommFunc.ConvertDBNullToDecimal(dtSource.Rows[0]["SyZsVal"]);
                }
                object obj = new { ChrgVal = chrgVal.ToString("f2"), UseVal = useVal.ToString("f2"), RdVal = rdVal.ToString("f2"), SyVal = (rdVal - syZsVal).ToString("f2"), SyZsVal = syZsVal.ToString("f2") };

                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取电表信息错误(GetYdPrepPayInMd_01OnInfo):", ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 23
0
        /// <summary>
        /// 获取费率列表
        /// </summary>
        /// <param name="Attrib">费率=0,物业收费标准=1</param>
        /// <returns></returns>
        public APIRst GetYdModuleRateList(int Attrib)
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetYdModuleRateList(Attrib);
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    id   = CommFunc.ConvertDBNullToInt32(s1["Rate_id"]),
                    text = CommFunc.ConvertDBNullToInt32(s1["Rate_id"]) == 0 ? "请选择" : CommFunc.ConvertDBNullToString(s1["Descr"]),
                };
                object obj = new { total = dtSource.Rows.Count, rows = res1.ToList() };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取费率列表错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 24
0
        /// <summary>
        /// 充值缴费--打印小票
        /// </summary>
        /// <param name="Log_id">支付记录id号</param>
        /// <returns></returns>
        public APIRst GetYdPayBill(long Log_id)
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetYdPayBill(Log_id);
                int       total    = dtSource.Rows.Count;
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    CoStrcName = CommFunc.ConvertDBNullToString(s1["CoStrcName"]),
                    CoName     = CommFunc.ConvertDBNullToString(s1["CoName"]),
                    Multiply   = CommFunc.ConvertDBNullToDecimal(s1["Multiply"]),
                    IsPayS     = CommFunc.ConvertDBNullToString(s1["IsPayS"]),
                    payTypeS   = CommFunc.ConvertDBNullToString(s1["payTypeS"]),
                    PayVal     = CommFunc.ConvertDBNullToDecimal(s1["PayVal"]).ToString("f2"),
                    PayAmt     = CommFunc.ConvertDBNullToDecimal(s1["PayAmt"]).ToString("f2"),
                    Price      = CommFunc.ConvertDBNullToDecimal(s1["Price"]).ToString("f3"),
                    strAmt     = CommFunc.ConvertDBNullToString(s1["strAmt"]),
                    Create_by  = CommFunc.ConvertDBNullToString(s1["Create_by"]),
                    Create_dt  = CommFunc.ConvertDBNullToString(s1["Create_dt"]),
                };
                rst.data = res1.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("GetYdPayBill:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 25
0
        /// <summary>
        /// 获取角色列表
        /// </summary>
        /// <returns></returns>
        public APIRst GetRoleList()
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetRoleList();
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    Role_id = CommFunc.ConvertDBNullToInt32(s1["Role_id"]),
                    Descr   = CommFunc.ConvertDBNullToString(s1["Descr"]),
                    Remark  = CommFunc.ConvertDBNullToString(s1["Remark"]),
                };
                rst.data = res1.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取角色列表错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 26
0
        // 充值明细信息
        public APIRst GetYdPrepPayInMd_01OnInfo(int co_id, int module_id, string moduleAddr, decimal price)
        {
            APIRst rst = new APIRst();

            try
            {
                decimal   rdVal = 0;
                decimal   payVal = 0, payAmt = 0, syVal = 0, syAmt = 0, chrgVal = 0, syZsVal = 0, syZsAmt = 0;
                DataTable dtSource = bll.GetYdPrepPayInMd_01OnInfo(co_id, module_id, moduleAddr);
                foreach (DataRow dr in dtSource.Rows)
                {
                    rdVal   = CommFunc.ConvertDBNullToDecimal(dr["RdVal"]);
                    chrgVal = CommFunc.ConvertDBNullToDecimal(dr["ChrgVal"]);
                    syZsVal = CommFunc.ConvertDBNullToDecimal(dr["SyZsVal"]);
                }
                rdVal  = rdVal - syZsVal;
                payVal = rdVal > 0 ? 0 : Math.Abs(rdVal);
                syVal  = rdVal;
                payAmt = Math.Round(payVal * price, 2, MidpointRounding.AwayFromZero);   /*需缴电费*/
                syAmt  = Math.Round(syVal * price, 2, MidpointRounding.AwayFromZero);    /*剩余电费*/
                //chrgVal = Math.Round(chrgVal * price, 2, MidpointRounding.AwayFromZero); /*总充值电量*/
                syZsAmt = Math.Round(syZsVal * price, 2, MidpointRounding.AwayFromZero); /*剩余赠电费*/

                object obj = new { PayVal = rdVal, PayAmt = payAmt, SyAmt = syAmt, ChrgVal = chrgVal, Price = price, SyZsVal = syZsVal, SyZsAmt = syZsAmt };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取电表信息错误(GetYdPrepPayInMd_01OnInfo):", ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 27
0
        /// <summary>
        /// 获取第二层数据
        /// </summary>
        /// <param name="co_id">层级2的id号</param>
        /// <returns></returns>
        public APIRst GetLayer03(int co_id)
        {
            APIRst rst = new APIRst();

            try
            {
                List <object> dd       = new List <object>();
                DataTable     dtSource = bll.GetLayer02(co_id);
                foreach (DataRow dr in dtSource.Rows)
                {
                    List <object> cc  = new List <object>();
                    object        obj = new
                    {
                        Id       = CommFunc.ConvertDBNullToInt32(dr["Co_id"]),
                        Name     = CommFunc.ConvertDBNullToString(dr["CoName"]),
                        Number   = CommFunc.ConvertDBNullToInt32(dr["Number"]),
                        Addr     = CommFunc.ConvertDBNullToString(dr["CustAddr"]),
                        WD       = CommFunc.ConvertDBNullToDecimal(dr["TagValWD"]).ToString("f2"),
                        SD       = CommFunc.ConvertDBNullToDecimal(dr["TagValSD"]).ToString("f2"),
                        Disabled = CommFunc.ConvertDBNullToInt32(dr["Disabled"]),
                    };
                    dd.Add(obj);
                }
                rst.data = dd; // res1.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取第二层数据错误:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 28
0
        /// <summary>
        /// 获取告警信息
        /// </summary>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="moduleName">设备名称</param>
        /// <returns></returns>
        public APIRst GetAlarmData(DateTime start, DateTime end, string moduleName)
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetAlarmData(start, end, moduleName);
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    PduName      = CommFunc.ConvertDBNullToString(s1["CoName"]),
                    ModuleName   = CommFunc.ConvertDBNullToString(s1["ModuleName"]),
                    AlarmTime    = CommFunc.ConvertDBNullToDateTime(s1["CollectTime"]),
                    Content      = CommFunc.ConvertDBNullToString(s1["FunName"]) + "越限",
                    CollectValue = CommFunc.ConvertDBNullToString(s1["CollectValue"]),
                    IaMax        = CommFunc.ConvertDBNullToString(s1["IaMax"]),
                    IaMin        = CommFunc.ConvertDBNullToString(s1["IaMin"]),
                };
                rst.data = res1.ToList();
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("获取告警信息:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Esempio n. 29
0
 /// <summary>
 /// 获取历史数据
 /// </summary>
 /// <param name="start">开始时间</param>
 /// <param name="end">结束时间</param>
 /// <param name="moduleName">设备名称</param>
 /// <returns></returns>
 public APIRst GetHisdata(DateTime start, DateTime end, string moduleName = "", string funName ="")
 {
     APIRst rst = new APIRst();
     try
     {
         DataTable dtSource = bll.GetHisdata(start, end, moduleName, funName);
         var res1 = from s1 in dtSource.AsEnumerable()
                    orderby s1["Module_id"],s1["Fun_id"], s1["TagTime"]
                    select new
                    {
                        TagTime = CommFunc.ConvertDBNullToDateTime(s1["TagTime"]).ToString("yyyy-MM-dd HH:mm:ss"),
                        PduName = CommFunc.ConvertDBNullToString(s1["CoName"]),
                        ModuleName = CommFunc.ConvertDBNullToString(s1["ModuleName"]),
                        FunName = CommFunc.ConvertDBNullToString(s1["FunName"]),
                        LastVal = CommFunc.ConvertDBNullToDecimal(s1["LastVal"]).ToString("f2"),
                    };
         rst.data = res1.ToList();
     }
     catch (Exception ex)
     {
         rst.rst = false;
         rst.err.code = (int)ResultCodeDefine.Error;
         rst.err.msg = ex.Message;
         FileLog.WriteLog("获取历史数据错误:" + ex.Message + ex.StackTrace);
     }
     return rst;
 }
Esempio n. 30
0
        /// <summary>
        /// 采集项下拉列表
        /// </summary>
        /// <param name="module_id">回路ID号</param>
        /// <returns></returns>
        public APIRst GetFunCombox(int module_id)
        {
            APIRst rst = new APIRst();

            try
            {
                DataTable dtSource = bll.GetFunCombox(module_id);
                var       res1     = from s1 in dtSource.AsEnumerable()
                                     select new
                {
                    id   = CommFunc.ConvertDBNullToString(s1["FunType"]),
                    text = CommFunc.ConvertDBNullToString(s1["FunName"]),
                };
                object obj = new { total = dtSource.Rows.Count, rows = res1.ToList() };
                rst.data = obj;
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("采集项下拉列表:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }