示例#1
0
 /// <summary>
 /// 获取数据项配置
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 private string GetSjxpz(HttpContext context)
 {
     try
     {
         PointCfgBll pointCfgBll = new PointCfgBll();
         string      id          = context.Request["id"] ?? "";
         PointCfg    pointCfg    = pointCfgBll.QueryEntity(new PointCfg()
         {
             Id = id
         });
         return(_jss.Serialize(pointCfg));
     }
     catch (Exception e)
     {
         Log.Error("GetSjxpz出错:" + e);
         return(ErrorJson);
     }
 }
示例#2
0
        /// <summary>
        /// 保存遥信项编辑
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string YxxEdit(HttpContext context)
        {
            try
            {
                string id     = context.Request["h_id"] ?? "",
                       zlx    = context.Request["i_zlx"] ?? "",
                       sjx    = context.Request["s_sjx"] ?? "",
                       ztz    = context.Request["i_ztz"] ?? "",
                       sbzcz  = context.Request["i_ztz"] ?? "",
                       sbgjz  = context.Request["i_sbgjz"] ?? "",
                       cyzgj  = context.Request["i_cyzgj"] ?? "0",
                       dx     = context.Request["i_dx"] ?? "",
                       sjh    = context.Request["i_sjh"] ?? "",
                       dxmb   = context.Request["h_dxmb"] ?? "",
                       yj     = context.Request["i_yj"] ?? "",
                       yxdz   = context.Request["i_yxdz"] ?? "",
                       yjmb   = context.Request["h_yjmb"] ?? "",
                       fs     = context.Request["i_fs"] ?? "",
                       sfzdmj = context.Request["i_sfzdmj"] ?? "0",
                       zdmjgz = context.Request["s_zdmjgz"] ?? "",
                       sylx   = context.Request["h_sylx"] ?? "",
                       isuse  = context.Request["i_sfqy"] ?? "0";

                HttpPostedFile file       = context.Request.Files["i_sywj"];
                Stream         sywj       = null;
                string         sygs       = null;
                int            fileSize   = 0;
                byte[]         fileBuffer = null;
                if (fs.Length > 0 && file == null && string.IsNullOrEmpty(sylx))
                {
                    return("{\"total\":0,\"rows\":[],\"status\":\"0\",\"msg\":\"声音文件为空。\"}");
                }
                else if (fs.Length > 0 && file != null)
                {
                    sywj = file.InputStream;
                    sygs = file.FileName.Substring(file.FileName.LastIndexOf('.') + 1).ToLower();
                    if (!sygs.Equals("mp3") && !sygs.Equals("wma"))
                    {
                        return("{\"total\":0,\"rows\":[],\"status\":\"0\",\"msg\":\"声音文件格式不正确,请使用mp3、wma格式文件。\"}");
                    }
                    fileSize = file.ContentLength;
                    if (fileSize > 20480000)
                    {
                        return("{\"total\":0,\"rows\":[],\"status\":\"0\",\"msg\":\"声音文件过大,请选择其他声音文件。\"}");
                    }
                    fileBuffer = new byte[fileSize];
                    sywj.Read(fileBuffer, 0, fileSize);
                }
                PointCfg pointCfg = new PointCfg()
                {
                    Id              = id,
                    ZhuangLeiX      = zlx,
                    GatItemId       = sjx,
                    IsOverLimtWarn  = int.Parse(cyzgj),
                    Dx              = dx == "on" ? Constant.GjfsDx : "",
                    Yj              = yj == "on" ? Constant.GjfsYj : "",
                    Sy              = fs == "on" ? Constant.GjfsSy : "",
                    IsAutoCleanWarn = decimal.Parse(sfzdmj),
                    IsUse           = int.Parse(isuse),
                };
                if (!string.IsNullOrEmpty(zlx))
                {
                    pointCfg.ZhuangLeiX = zlx;
                }
                if (!string.IsNullOrEmpty(sjx))
                {
                    pointCfg.GatItemId = sjx;
                }
                if (!string.IsNullOrEmpty(ztz))
                {
                    pointCfg.YxStates = ztz;
                }
                if (!string.IsNullOrEmpty(sbzcz))
                {
                    pointCfg.YxEff = sbzcz;
                }
                if (!string.IsNullOrEmpty(sbgjz))
                {
                    pointCfg.YxWarn = sbgjz;
                }
                if (!string.IsNullOrEmpty(pointCfg.Dx))
                {
                    pointCfg.Sjh  = sjh;
                    pointCfg.Dxmb = dxmb;
                }
                if (!string.IsNullOrEmpty(pointCfg.Yj))
                {
                    pointCfg.Yxdz = yxdz;
                    pointCfg.Yjmb = yjmb;
                }
                if (!string.IsNullOrEmpty(pointCfg.Sy) && fileSize != 0)
                {
                    pointCfg.SndFileContext = fileBuffer;
                }
                pointCfg.SndFileType = sygs ?? sylx;
                if (pointCfg.IsAutoCleanWarn == 1)
                {
                    pointCfg.CleanWarnRule = decimal.Parse(zdmjgz);
                }
                new PointCfgBll().Modify(pointCfg);
                //操作日志
                string name = "";
                if (null != context.Session[Constant.LoginUser])
                {
                    name = (context.Session[Constant.LoginUser] as Employer ?? new Employer()).Name;
                }
                else
                {
                    return("{\"total\":0,\"rows\":[],\"status\":\"2\",\"msg\":\"修改成功!\"}");
                }
                new OprLogBll().Add(new OprLog()
                {
                    DataItemId = sjx,
                    Operator   = name,
                    OprSrc     = "保存遥信项编辑",
                    OperResult = "成功",
                    LogDate    = DateTime.Now
                });
                return("{\"total\":0,\"rows\":[],\"status\":\"1\",\"msg\":\"修改成功!\"}");
            }
            catch (Exception e)
            {
                Log.Error("YcxSave方法报错:" + e);
                return("{\"total\":0,\"rows\":[],\"status\":\"0\",\"msg\":\"修改出错,请稍后再试。\"}");
            }
        }
示例#3
0
 public void Modify(PointCfg bean)
 {
     _pointCfgDal.Modify(bean);
 }
示例#4
0
 public void Del(PointCfg bean)
 {
     _pointCfgDal.Del(bean);
 }
示例#5
0
 public PointCfg QueryEntity(PointCfg bean)
 {
     return(_pointCfgDal.QueryEntity(bean));
 }
示例#6
0
 public void Add(PointCfg bean)
 {
     _pointCfgDal.Add(bean);
 }