예제 #1
0
 /// <summary>
 /// 写入用户登录日志
 /// </summary>
 public static void LoginLog(string UserName, string Msg)
 {
     try
     {
         Bll_Sys_LoginLog instance = new Bll_Sys_LoginLog();
         Sys_LoginLog     model    = new Sys_LoginLog()
         {
             EL_Date     = DateTime.Now,
             EL_UserCode = UserName,
             EL_UserName = SessionConfig.UserName(),
             EL_IP       = HttpContext.Current.Request.UserHostAddress,
             EL_Mac      = "",
             EL_Company  = SessionConfig.Company(),
             EL_Dept     = SessionConfig.DeptName(),
             EL_Success  = Msg
         };
         instance.Insert(model);
     }
     catch (System.Exception ex)
     {
         PlateLog.WriteInFile(SessionConfig.UserId(), SessionConfig.UserName(),
                              HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(),
                              ex.Message, PlateLog.LogMessageType.Error, ex);
     }
 }
예제 #2
0
        public ActionResult UploadImg(string code, string path, string module)
        {
            var list = cInstance.GetCompHisList(string.Format("AND CH_CompCode='{0}' AND CH_iType='File'", code));

            if (list.Count >= 1)
            {
                return(new JsonResult {
                    Data = new { result = "fail", Msg = "您已上传图纸图片,不能重复上传!" }
                });
            }

            string          fileName = Path.GetFileName(path);
            Bse_CompHistory comp     = new Bse_CompHistory();

            comp.CH_Code        = cInstance.GenerateHistoryCode();
            comp.CH_Date        = DateTime.Now;
            comp.CH_CompCode    = code;
            comp.CH_Auditor     = SessionConfig.UserId();
            comp.CH_AuditorName = SessionConfig.UserName();
            comp.CH_FilePath    = path;
            comp.CH_iType       = "File";
            comp.CH_Type        = "上传附件";
            cInstance.AddHis(comp);
            return(new JsonResult {
                Data = new { result = "success", Msg = "数据更新成功!" }
            });
        }
예제 #3
0
        /// <summary>
        /// 图纸文件上传后回调函数
        /// </summary>
        /// <param name="code"></param>
        /// <param name="path"></param>
        /// <param name="module"></param>
        /// <returns></returns>
        public ActionResult UploadDocComp(string code, string path, string type, string typename, string node, string nodename, string module)
        {
            string         fileName   = Path.GetFileName(path);
            Doc_Attachment attachment = new Doc_Attachment();

            attachment.Dat_Name    = fileName;
            attachment.Dat_Path    = path;
            attachment.Dat_Module  = module;
            attachment.Dat_RefCode = code;

            //文件类型(不同的类型不同的处理方式)
            attachment.Dat_Type        = Path.GetExtension(path).Trim('.');
            attachment.Dat_Date        = DateTime.Now;
            attachment.Dat_Creator     = SessionConfig.UserId();
            attachment.Dat_CreatorName = SessionConfig.UserName();
            attachment.Dat_Code        = diInstance.GenerateAttachmentCode();
            //图纸的类型-->全工艺 、工艺节点
            attachment.Dat_Udef1 = type;
            attachment.Dat_Udef2 = typename;
            attachment.Dat_Udef3 = node;
            attachment.Dat_Udef4 = nodename;
            diInstance.AddAttachment(attachment);

            BLL.Bll_Comm.OpLog("Upload", "Upload", string.Format("上传附件:{0}", attachment.Dat_RefCode));

            return(new JsonResult {
                Data = new { result = "success", Msg = "数据更新成功!" }
            });
        }
예제 #4
0
        private static Dictionary <string, string> ParseProc(string str)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(str))
            {
                string[] source = str.Split(new char[] { ';' });
                if ((source.Count <string>() <= 0) || (source.Count <string>() != 2))
                {
                    return(dictionary);
                }
                string[] strArray2 = source[0].Split(new char[] { ':' });
                string[] strArray3 = source[1].Split(new char[] { ':' });
                dictionary.Add(strArray2[0], strArray2[1]);
                if (strArray3.Count <string>() <= 0)
                {
                    return(dictionary);
                }
                Dictionary <string, string> dictionary2 = PaseProcParams(strArray3[1]);
                if (dictionary2.Count <= 0)
                {
                    return(dictionary);
                }
                foreach (KeyValuePair <string, string> pair in dictionary2)
                {
                    string str2 = pair.Value.Replace("{UserId}", SessionConfig.UserId());
                    dictionary.Add(pair.Key, str2);
                }
            }
            return(dictionary);
        }
예제 #5
0
 public ActionResult Index()
 {
     if (string.IsNullOrEmpty(SessionConfig.UserId()))
     {
         return(RedirectToAction("login"));
     }
     return(View());
 }
예제 #6
0
        public ActionResult InitGrid(int page, int rows, string search, string sidx, string sord)
        {
            string ModuleCode  = Request["ModuleCode"] == null ? "" : Request["ModuleCode"].ToString();
            string NameSpace   = Request["NameSpace"] == null ? "" : Request["NameSpace"].ToString();
            string LoginId     = Request["userid"] == null ? "" : Request["userid"].ToString(); // session
            string deptid      = Request["deptid"] == null ? "" : Request["deptid"].ToString(); // session
            string filters     = Request["filters"] == null ? "" : Request["filters"].ToString();
            string Inlinetype  = Request["itype"] == null ? "0" : Request["itype"].ToString();
            string GeneralType = Request["type"] == null ? "0" : Request["type"].ToString();
            string record      = Request["record"] == null ? "" : Request["record"];
            string filtersSql  = "1=1";

            if (!string.IsNullOrEmpty(filters))
            {
                filtersSql = filters.BuildSearch(ModuleCode);
                //filtersSql = BulidJqGridSearch.BuildSearch(filters);
                //动态查询入口更改,查询结果后进行筛选
                //filtersSql = "";
            }

            //临时赋值
            LoginId = SessionConfig.UserId();
            deptid  = SessionConfig.DeptId();

            //预留两个自定义参数

            Dictionary <String, String> param = new Dictionary <string, string>();

            param.Add("@Page", page.ToString());
            param.Add("@Rows", rows.ToString());
            param.Add("@Search", filtersSql);     //查询字段
            param.Add("@Sidx", sidx);             //排序字段
            param.Add("@Sord", sord);             //排序 ASC DESC
            param.Add("@ModuleCode", ModuleCode); //模块编码
            param.Add("@NameSpace", NameSpace);   //模块命名空间
            param.Add("@Userid", LoginId);
            param.Add("@Deptid", deptid);
            param.Add("@InlineType", Inlinetype);
            param.Add("@GeneralType", GeneralType);

            //获取所有的数据列
            var dt = instance.GetListPageAllRecords(ModuleCode, NameSpace, param);

            if (!string.IsNullOrEmpty(record))
            {
                dt = FilterDataTable(dt, "Record_ID='" + record + "'");
            }
            DataTable newDt = GetPagedTable(dt, page, rows, ModuleCode);


            //newDt.DefaultView.Sort = " CreateDate DESC ";
            //DataTable newDt = DataTablePage.GetPagedTable(dt, page, rows);

            //var json = DataTablePage.JsonForJqgrid(newDt, page, rows, dt.Rows.Count);
            var json = Bll_Comm.JsonForJqgrid(ModuleCode, newDt, page, rows, dt.Rows.Count);

            return(JavaScript(json));
        }
예제 #7
0
        public ActionResult AuditCallback(string code)
        {
            var list = cInstance.GetCompHisList(string.Format("AND CH_CompCode='{0}'", code));

            Bse_CompHistory model = list.FirstOrDefault(o => o.CH_iType == "File");

            List <Bse_CompHistory> auditHis = list.Where(o => o.CH_iType != "File").ToList();

            if (model != null)
            {
                try
                {
                    var d = System.IO.Path.GetTempPath();
                    //var d = @"E:\运营方案";
                    string filename = Path.GetFileName(model.CH_FilePath);
                    string temp     = Server.MapPath(model.CH_FilePath);
                    string srcpath  = temp;
                    string despath  = Path.Combine(d, filename);

                    ThumNail.AddWaterWord(string.Format("{0} {1}", SessionConfig.UserName(), DateTime.Now.ToString("yy-MM-dd hh:mm")), srcpath, despath, 10, auditHis.Count * 30);
                    //如果存在则表示生成成功
                    if (System.IO.File.Exists(despath))
                    {
                        System.IO.File.Copy(despath, srcpath, true);
                        System.IO.File.Delete(despath);
                    }
                }
                catch (Exception ex)
                {
                    return(new JsonResult {
                        Data = new { result = "fail", Msg = ex.Message }
                    });
                }

                Bse_CompHistory newModel = new Bse_CompHistory();
                newModel.CH_Code        = cInstance.GenerateHistoryCode();
                newModel.CH_CompCode    = model.CH_CompCode;
                newModel.CH_FilePath    = model.CH_FilePath;
                newModel.CH_Auditor     = SessionConfig.UserId();
                newModel.CH_AuditorName = SessionConfig.UserName();
                newModel.CH_Date        = DateTime.Now;
                newModel.CH_iType       = "His";
                newModel.CH_Type        = "审核";
                cInstance.AddHis(newModel);

                return(new JsonResult {
                    Data = new { result = "success", Msg = "数据更新成功!" }
                });
            }
            else
            {
                return(new JsonResult {
                    Data = new { result = "fail", Msg = "请上传图纸文件图片!" }
                });
            }
        }
예제 #8
0
        /// <summary>
        /// 全局异常处理:Error记录到文本
        /// </summary>
        /// <param name="filterContext"></param>
        public void OnException(ExceptionContext filterContext)
        {
            //写入文本日志
            //PlateLog.WriteInFile(SessionConfig.UserId(), SessionConfig.UserName(),
            //    HttpContext.Current.Request.UserHostAddress,HttpContext.Current.Request.Url.ToString(),
            //   filterContext.Exception.Message, PlateLog.LogMessageType.Error, filterContext.Exception);

            //写入数据库日志
            PlateLog.WriteError(SessionConfig.UserId(), SessionConfig.UserName(),
                                HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(),
                                filterContext.Exception.Message, PlateLog.LogMessageType.Error, filterContext.Exception);
        }
예제 #9
0
 /// <summary>
 /// 监控数据显示列表
 /// </summary>
 /// <param name="id">数据源所属模块(用于显示模板)</param>
 /// <returns></returns>
 public ActionResult Index(string id)
 {
     ViewData["DictList"] = aInstance.GetLevelTreeForAreaWithPermission(SessionConfig.UserId());
     if (string.IsNullOrEmpty(id))
     {
         ViewData["Module"] = "Data_ActModule";
     }
     else
     {
         ViewData["Module"] = id;
     }
     return(View());
 }
예제 #10
0
        public ActionResult Add()
        {
            Bse_Components info = new Bse_Components();

            info.Comp_Code        = cInstance.GenerateCompCode();
            info.Comp_Creator     = SessionConfig.UserId();
            info.Comp_CreatorName = SessionConfig.UserName();
            info.Comp_Date        = DateTime.Now;

            GetbackUrl();

            return(View(info));
        }
예제 #11
0
        public ActionResult top()
        {
            //Bll_System_Menu Menu = new Bll_System_Menu();
            //QX.Comm.MenuLocation local = QX.Comm.MenuLocation.TOP;
            //List<System_Menu> MenuList = Menu.GetMenu(local);
            var model = TopInsatance.GetModel(" AND Menu_User='******' ");

            ViewData["TopList"] = model != null ? model.Menu_Links : "";

            //登录人信息
            ViewData["UserName"] = !string.IsNullOrEmpty(SessionConfig.UserName()) ? SessionConfig.UserName() : "";
            ViewData["UserRole"] = !string.IsNullOrEmpty(SessionConfig.Stuff_LoginType()) ? instanceD.GetModel(" and Dict_Code='" + SessionConfig.Stuff_LoginType() + "'").Dict_Name: "";
            ViewData["IP"]       = SessionConfig.CurrentIP();

            return(View());
        }
예제 #12
0
        public ActionResult Add()
        {
            Doc_Info info = new Doc_Info();

            info.Doc_Code        = diInstance.GenerateDocCode();
            info.Doc_Creator     = SessionConfig.UserId();
            info.Doc_CreatorName = SessionConfig.UserName();
            info.Doc_DpCode      = SessionConfig.DeptCode();
            info.Doc_DpName      = SessionConfig.DeptName();
            info.Doc_Date        = DateTime.Now;
            GetbackUrl();



            return(View(info));
        }
예제 #13
0
        public bool IsHaveDownloadPermission(string funCode, string module)
        {
            //分发的人、权限功能表、审核的人均由下载权限

            //通用的下载权限
            var flag  = pInstance.IsHavePermission(SessionConfig.UserId(), funCode);
            var flag1 = false;
            var flag2 = false;

            //分发
            flag1 = diInstance.IsHaveAllot(SessionConfig.UserId(), module);
            //审核权限
            flag2 = diInstance.IsHaveAudit(SessionConfig.UserId(), module);
            //有下载权限的前提下如果是并且是分发或者有审核权限的才能下载
            return(flag && (flag1 || flag2));
        }
예제 #14
0
        /// <summary>
        /// 判断用户是否有权限查看
        /// </summary>
        /// <returns></returns>
        public bool IsHavePermission(string id, string ftype, string compcode)
        {
            var model = cInstance.GetModel(string.Format("AND Comp_Code='{0}'", compcode));

            //如果是图纸本身的创建者则具有所有权限
            if (model != null && model.Comp_Creator == SessionConfig.UserId())
            {
                return(true);
            }

            //如果是Pic则判断查看权限,否则下载权限
            string type = ftype == "Pic"?"View":"Download";

            var flag1 = this.dinfoInstance.IsHaveAllotForComp(SessionConfig.UserId(), compcode, type);

            return(flag1);
        }
예제 #15
0
        /// <summary>
        /// 写入操作日志
        /// </summary>
        /// <param name="Module">模块编码 </param>
        /// <param name="ModuleName">模块名称</param>
        /// <param name="Message">异常信息</param>
        public static void OpLog(string Module, string ModuleName, string Message)
        {
            var IS_OPEN_PERMISSION = ConfigHelper.GetApp("IS_OPEN_FUNCATIONLOG");

            if (!string.IsNullOrEmpty(IS_OPEN_PERMISSION) && IS_OPEN_PERMISSION == "true")
            {
                try
                {
                    PlateLog.WriteOp(SessionConfig.UserId(), SessionConfig.UserName(),
                                     HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(),
                                     Message, PlateLog.LogMessageType.Info, Module, ModuleName);
                }
                catch (System.Exception ex)
                {
                    PlateLog.WriteInFile(SessionConfig.UserId(), SessionConfig.UserName(),
                                         HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(),
                                         Message, PlateLog.LogMessageType.Error, ex);
                }
            }
        }
예제 #16
0
        /// <summary>
        /// 绑定左侧菜单
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="DataSource"></param>
        /// <returns></returns>
        public static string BindLeftMenu(this HtmlHelper helper, List <System_Menu> DataSource)
        {
            ADOComm commInstance = new ADOComm();
            //权限过滤
            var IS_OPEN_PERMISSION = ConfigHelper.GetApp("IS_OPEN_PERMISSION");

            if (!string.IsNullOrEmpty(IS_OPEN_PERMISSION) && IS_OPEN_PERMISSION == "true")
            {
                string[] array = commInstance.UserPermissionArray(SessionConfig.UserId());
                DataSource = DataSource.Where(o => array.Contains(o.Menu_Code)).ToList();
            }

            StringBuilder sb = new StringBuilder();

            if (DataSource != null && DataSource.Count > 0)
            {
                sb.Append(LeftMenuMax(helper, DataSource));
            }
            return(sb.ToString());
        }
예제 #17
0
        public ActionResult Correct(string id, string rtype)
        {
            var model = diInstance.GetModel(string.Format("AND Doc_Code='{0}'", id));

            string isView = string.Empty;

            //是否本人修正(两种不同的显示方式)
            if (SessionConfig.UserId() == model.Doc_Creator)
            {
                ViewData["IsSelf"] = true;
            }
            else
            {
                ViewData["IsSelf"] = true;
            }

            GetbackUrl();

            return(View(model));
        }
예제 #18
0
        public ActionResult SaveQuickMenu()
        {
            var LinkHtml = Request["Html"].Trim();
            var model    = TopInsatance.GetModel(" AND Menu_User='******' ");

            if (model != null)
            {
                model.Menu_Links = LinkHtml;
                TopInsatance.Update(model);
            }
            else
            {
                var NewModel = new System_TopMenu()
                {
                    Menu_User  = SessionConfig.UserId(),
                    Menu_Links = LinkHtml
                };
                TopInsatance.Insert(NewModel);
            }
            return(Content("success"));
        }
예제 #19
0
        public ActionResult UploadDoc(string code, string path, string module)
        {
            string         fileName   = Path.GetFileName(path);
            Doc_Attachment attachment = new Doc_Attachment();

            attachment.Dat_Name        = fileName;
            attachment.Dat_Path        = path;
            attachment.Dat_Module      = module;
            attachment.Dat_RefCode     = code;
            attachment.Dat_Date        = DateTime.Now;
            attachment.Dat_Creator     = SessionConfig.UserId();
            attachment.Dat_CreatorName = SessionConfig.UserName();
            attachment.Dat_Code        = diInstance.GenerateAttachmentCode();
            diInstance.AddAttachment(attachment);

            BLL.Bll_Comm.OpLog("Upload", "Upload", string.Format("上传附件:{0}", attachment.Dat_RefCode));

            return(new JsonResult {
                Data = new { result = "success", Msg = "数据更新成功!" }
            });
        }
예제 #20
0
        /// <summary>
        /// 根据权限获取站点列表
        /// </summary>
        /// <param name="area"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public List <Bse_Station> GetStationListByPermission(string area, string where)
        {
            List <Sys_UserPermission> plist = pInstance.GetUserPermissionForArea(SessionConfig.UserId());

            StringBuilder      sb    = new StringBuilder();
            var                tlist = GetLevelAreaListWidthSeft(area, sb);
            List <Bse_Station> list  = new List <Bse_Station>();

            foreach (var d in list)
            {
                if (plist.Exists(o => o.PU_FunCode == d.SN_Code))
                {
                    list.Add(d);
                }
            }

            List <Bse_Station> slist  = new List <Bse_Station>();
            string             filter = string.Format("AND SN_AreaCode in({0}) AND {1}", sb.ToString().TrimEnd(','), where);

            slist = sInstance.GetListByWhere(filter);
            return(slist);
        }
예제 #21
0
파일: SysRole.cs 프로젝트: huaminglee/hfoa
        /// <summary>
        /// 系统权限控制
        /// </summary>
        /// <param name="Module">模块编码</param>
        /// <returns>页面权限控制JavaScript</returns>
        public static string SysRoleIoc(this HtmlHelper hepler, string Module)
        {
            var        IS_OPEN_PERMISSION = ConfigHelper.GetApp("IS_OPEN_PERMISSION");
            TagBuilder builder            = new TagBuilder("script");

            if (!string.IsNullOrEmpty(IS_OPEN_PERMISSION) && IS_OPEN_PERMISSION == "true")
            {
                string UserId = SessionConfig.UserId();

                builder.MergeAttribute("type", "text/javascript");
                List <Sys_UserPermission> list = BLL.Bll_Comm.UserNotPermisionnList(UserId).Where(o => o.PU_FunPCode == null ||
                                                                                                  (o.PU_FunPCode != null && !o.PU_FunPCode.StartsWith("C"))).ToList();
                StringBuilder JSBuilder = new StringBuilder();
                foreach (var item in list)
                {
                    JSBuilder.AppendFormat(" $('#{0}').remove();", item.Fun_UDef1);
                }
                builder.InnerHtml = " $(function(){ " + JSBuilder.ToString() + "});";
            }
            return(builder.ToString(TagRenderMode.Normal));
            //return "";
        }
예제 #22
0
        public ActionResult QuickLink()
        {
            var DataSource = MenuInstance.GetChildListMenu().OrderBy(o => o.Menu_Order).ToList();

            //权限过滤
            var IS_OPEN_PERMISSION = ConfigHelper.GetApp("IS_OPEN_PERMISSION");

            if (!string.IsNullOrEmpty(IS_OPEN_PERMISSION) && IS_OPEN_PERMISSION == "true")
            {
                DataSource = DataSource.Where(o => BLL.Bll_Comm.UserPermissionArray(SessionConfig.UserId()).Contains(o.Menu_Code))
                             .ToList();
            }

            ViewData["MenuList"] = DataSource;



            var model = TopInsatance.GetModel(" AND Menu_User='******' ");

            ViewData["TopList"] = model != null? model.Menu_Links:"";

            return(View());
        }
예제 #23
0
 public static void InsertRunSql(string Sql, Hashtable Params, string Fun, string Error)
 {
     try
     {
         StringBuilder strPara  = new StringBuilder();
         ADOSys_RunLog instance = new ADOSys_RunLog();
         Sys_RunLog    model    = new Sys_RunLog();
         model.Log_Date  = DateTime.Now;
         model.Log_Fun   = Fun;
         model.Log_Error = Error;
         foreach (DictionaryEntry item in Params)
         {
             strPara.Append(item.Key + "=" + item.Value);
         }
         model.Log_SQLParameter = strPara.ToString();
         model.Log_Author       = SessionConfig.UserId() + "," + SessionConfig.UserName();
         model.Log_SQL          = Sql;
         instance.Add(model);
     }
     catch (Exception)
     {
     }
 }
예제 #24
0
 private static string ParseSql(string SQL)
 {
     SQL = SQL.Replace("{UserId}", SessionConfig.UserId());
     return(SQL);
 }
예제 #25
0
파일: Bll_File.cs 프로젝트: huaminglee/hfoa
        /// <summary>
        /// 获取待办
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public List <Bse_File> GetDoingFileList(string where)
        {
            string condition = string.Format(" AND AuditStat ='{3}' AND CF_iType='{0}' AND DA_Allot='{2}' AND DA_Module='{4}' AND DA_iType='{5}'  AND {1}", "Normal", where, SessionConfig.UserId(), AudtiOperaTypeEnum.LastAudit.ToString(), "Bse_FileModule", AllotType.Distribution.ToString());

            return(instance.GetListByWhereExtend(condition));
        }
예제 #26
0
파일: Bll_File.cs 프로젝트: huaminglee/hfoa
        public List <Bse_File> GetMyFileList(string where)
        {
            //string condition = string.Format("AND isnull(Comp_Stat,'')='{0}' AND {1}", "Normal", where);
            // return cInstance.GetListByWhere(condition);

            //所有文档
            // List<Bse_Components> allList = new List<Bse_Components>();
            List <Bse_File> list      = new List <Bse_File>();
            string          condition = string.Format("AND isnull(CF_iType,'')='{0}' AND CF_Creator='{1}' AND {2}", "Normal", SessionConfig.UserId(), where);

            list = instance.GetListByWhere(condition);
            // List<Verify_TemplateConfig> rlNodes = auditInstance.GetVerifyNodesByCurUser(AuditModuleEnum.CompAudit.ToString(), SessionConfig.UserId());

            return(list);
        }
예제 #27
0
파일: Bll_File.cs 프로젝트: huaminglee/hfoa
        /// <summary>
        /// 获取所有文档
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public List <Bse_File> GetAllFileList(string where)
        {
            //string condition = string.Format("AND isnull(CF_iType,'')='{0}' AND {1}", "Normal", where);
            //return instance.GetListByWhere(condition);

            List <Bse_File> allList   = new List <Bse_File>();
            List <Bse_File> list      = new List <Bse_File>();
            string          condition = string.Format("AND isnull(CF_iType,'')='{0}' AND {1} AND CF_Code in (select DA_DocCode from doc_allot where da_allot='{2}' and isnull(da_ishandle,'NoHandle')='{3}') AND {1}", DocStat.Normal.ToString(), where, SessionConfig.UserId(), "Handle");

            list = instance.GetListByWhere(condition);
            List <Verify_TemplateConfig> rlNodes = auditInstance.GetVerifyNodesByCurUser(AuditModuleEnum.ComFileAudit.ToString(), SessionConfig.UserId());

            if (rlNodes.Count != 0)
            {
                var list2 = instance.GetListByWhere(string.Format("AND CF_iType='{0}' AND {1}", "Normal", where));
                allList = list.Union(list2).Distinct(o => o.CF_Code).ToList();
            }

            return(allList);
        }
예제 #28
0
파일: Bll_File.cs 프로젝트: huaminglee/hfoa
        /// <summary>
        /// 获取待审核
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        public List <Bse_File> GetAuditList(string filter)
        {
            string filterSql = auditInstance.GetAuditFilterWhere(AuditModuleEnum.ComFileAudit.ToString(), SessionConfig.UserId());
            string condition = string.Format("AND CF_iType='{0}' AND AuditStat<>'LastAudit'  AND {2} AND {1}", "Normal", filter, filterSql);

            return(instance.GetListByWhere(condition));
        }
예제 #29
0
파일: Bll_File.cs 프로젝트: huaminglee/hfoa
 /// <summary>
 /// 获取草稿列表
 /// </summary>
 /// <param name="filter"></param>
 /// <returns></returns>
 public List <Bse_File> GetFileList(string filter)
 {
     return(instance.GetListByWhere(string.Format(" AND CF_iType='{1}' AND CF_Creator='{2}' AND {0} ", filter, "Draft", SessionConfig.UserId())));
 }
예제 #30
0
        /// <summary>
        /// 获取监控显示数据(进行数据转换)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DataTable GetStationTable(string id, string where)
        {
            StringBuilder sb = new StringBuilder();

            List <Bse_Station> slist = GetStationListByWhere(id, "1=1");

            //如果该区域没有任何站点则直接返回空数据集
            if (slist.Count == 0)
            {
                Dictionary <string, object> dict = new Dictionary <string, object>();
                dict.Add("Area", "'NoArea'");
                dict.Add("Filter", where);
                var dt = sInstance.GetStationsData(dict);
                return(dt);
            }
            //用户拥有的权限
            List <Sys_UserPermission> plist = pInstance.GetUserPermissionWithRole(SessionConfig.UserId());

            var stlist = plist.Where(o => o.Fun_iType == "Station");

            //进行权限过滤
            foreach (var s in slist)
            {
                if (stlist.FirstOrDefault(o => o.PU_FunCode == s.SN_Code) != null)
                {
                    sb.AppendFormat("'{0}',", s.SN_Code);
                }
            }

            //如果用户没有权限查看站点则设置默认条件
            if (sb.Length == 0)
            {
                sb.Append("'NoPermission'");
            }

            string stations = sb.ToString().TrimEnd(',');

            Dictionary <string, object> list = new Dictionary <string, object>();

            list.Add("Area", stations);
            list.Add("Filter", where);

            var datatable = sInstance.GetStationsData(list);

            ///站点的配置参数
            List <Bse_CheckValue> clist = new List <Bse_CheckValue>();

            clist = cInstance.GetListByWhere(string.Format(" AND SC_StationCode in({0})", stations));

            foreach (DataRow r in datatable.Rows)
            {
                //对应列的数据显示配置
                var ds = clist.Where(o => o.SC_StationCode == r["Data_StationCode"].ToString());
                //有配置的数据显示
                foreach (var d in ds)
                {
                    if (d != null)
                    {
                        var index = TypeConverter.ObjectToInt(d.SC_Position);
                        if (!string.IsNullOrEmpty(d.SC_Rate))
                        {
                            try
                            {
                                object temp   = r["Data_Val" + index];
                                var    re     = d.SC_Rate.Replace("{val}", temp.ToString());
                                var    result = Comm.StringCompute.EvaluateSimpleexpression_r(re);
                                r["Data_Val" + index] = result;
                            }
                            catch (Exception ex)
                            {
                                //日志
                            }
                        }

                        r["Data_W" + index.ToString()] = d.SC_Warn;

                        r["Data_A" + index.ToString()] = d.SC_Alarm;
                    }
                }
            }

            return(datatable);
        }