public override void SetAccess(FormM form, DFDictionary entity)
        {
            base.SetAccess(form, entity);
            var currentUser = Util.GetCurrentUser().UserId;

            if (UserRoleLoader.IsUserInRole(currentUser, "ProcessAdmin"))
            {
                form.GetControlM("btnEdit").Visible = true;
            }
            else
            {
                form.GetControlM("btnEdit").Visible = false;
            }
        }
Ejemplo n.º 2
0
        public override int Insert(FormM form, DFDictionary entity, ref string message)
        {
            form.GetControlM("SQL").MustInput = string.Empty;
            CheckInput(form, entity);
            var path       = DFPub.RelativeToPhysical(entity["SqlFilePath"]);
            var configPath = DFPub.RelativeToPhysical(entity["ConfigFile"]);
            var dt         = ReadExcel(path);

            if (dt.Columns.Contains("Result"))
            {
                dt.Columns.Remove("Result");
            }
            dt.Columns.Add("Result", typeof(string));
            var tables = GetTableConfig(configPath);

            ProcessData(dt, tables, entity);

            var failed  = dt.AsEnumerable().Count(a => a.GetValue("Result").Length > 0);
            var success = dt.AsEnumerable().Count(a => a.GetValue("Result").Length == 0);

            ExcelReader.WriteDataTableToExcel(dt, path);
            if (failed > 0)
            {
                message = string.Format("成功导入 {0},导入失败 {1},请查看失败日志<br><a href='{2}'>{2}</a>", success, failed, DFPub.PhysicalToRelative(path));
                return(DFPub.EXECUTE_ERROR);
            }
            else
            {
                message = string.Format("成功导入 {0}", success);
                return(DFPub.EXECUTE_SUCCESS);
            }
        }
 public override void SetAccess(FormM form, DFDictionary entity)
 {
     if (!AuthLoader.CheckFunctionAccess("代理申请", Util.GetCurrentUser().UserId))
     {
         form.GetControlM("btnProxyRequest").Visible = false;
     }
     base.SetAccess(form, entity);
 }
 public override void SetAccess(FormM form, DFDictionary entity)
 {
     // 编辑的时候 CodeType CodeName 是不能修改的
     if (entity["EditMode"] == "Edit")
     {
         var c = form.GetControlM("CodeType");
         if (null != c)
         {
             c.Readonly = true;
         }
         c = form.GetControlM("CodeName");
         if (null != c)
         {
             c.Readonly = true;
         }
     }
 }
Ejemplo n.º 5
0
        public override void SetAccess(FormM form, DFDictionary entity)
        {
            base.SetAccess(form, entity);
            // 检查按钮权限
            form.GetControlM("btnDelete").Visible         = false;
            form.GetControlM("btnCancelWorkflow").Visible = false;
            var user = Util.GetCurrentUser();

            if (AuthLoader.CheckFunctionAccess("WFCore_AllWF.btnDelete", user.UserId))
            {
                form.GetControlM("btnDelete").Visible = true;
            }
            if (AuthLoader.CheckFunctionAccess("WFCore_AllWF.btnCancelWorkflow", user.UserId))
            {
                form.GetControlM("btnCancelWorkflow").Visible = true;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 直接执行sql语句下载excel
        /// </summary>
        /// <param name="form"></param>
        /// <param name="entity"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public override int Update(FormM form, DFDictionary entity, ref string message)
        {
            form.GetControlM("ConfigFile").MustInput  = string.Empty;
            form.GetControlM("SqlFilePath").MustInput = string.Empty;
            CheckInput(form, entity);
            var       sql = entity["SQL"];
            DataTable dt  = null;

            using (var db = Pub.DB)
            {
                dt = db.ExecuteDataTable(sql);
            }
            var inputResultPath = ExportHelper.ExportDataTable(dt);
            var url             = DFPub.PhysicalToRelative(inputResultPath);

            base.WriteScript(string.Format("downloadFile('{0}')", url), ref message);
            return(DFPub.EXECUTE_SUCCESS);
        }
        public override void SetAccess(FormM form, DFDictionary entity)
        {
            var page = ((this.Parent as ucForm).Page as DFIndexWF);
            var list = InstanceStepExecutorDAO.QueryUnfinishedByInstanceId(entity["InstanceId"]);

            if (list.Count == 0)
            {
                form.GetControlM("btnRemind").Remove();
            }
            // 1 保存 2 提交 3 同意 4 不同意 5 回退 6 转签 7 加签
            var result = GetAccess(form, entity);

            if ((result & 1) <= 0)
            {
                form.GetControlM("btnSave").Remove();
                if (page != null)
                {
                    page.UcForm1.Form.GetControlMs_Like("btnEdit").ForEach(a => a.Remove());
                    page.UcForm1.Form.GetControlMs_Like("btnUpdate").ForEach(a => a.Remove());
                    page.UcForm1.Form.GetControlMs_Like("btnDelete").ForEach(a => a.Remove());
                    page.UcForm1.Form.GetControlMs_Like("btnAdd").ForEach(a => a.Remove());
                    page.UcForm1.Form.GetControlMs_Like("btnUpload").ForEach(a => a.Remove());
                }
            }
            if ((result & 2) <= 0)
            {
                form.GetControlM("btnSubmit").Remove();
            }
            if ((result & 4) <= 0)
            {
                form.GetControlM("btnApprove").Remove();
            }
            if ((result & 8) <= 0)
            {
                form.GetControlM("btnReject").Remove();
            }
            if ((result & 16) <= 0)
            {
                form.GetControlM("btnRollback").Remove();
            }
            if ((result & 32) <= 0)
            {
                form.GetControlM("btnTransferApprove").Remove();
            }
            if ((result & 64) <= 0)
            {
                form.GetControlM("btnAdditionalApprove").Remove();
            }
            base.SetAccess(form, entity);
        }
Ejemplo n.º 8
0
        public override void SetAccess(FormM form, DFDictionary entity)
        {
            // 编辑的时候用户名是不能修改的
            if (entity["EditMode"] == "Edit")
            {
                var c = form.GetControlM("UserName");
                if (null != c)
                {
                    c.Readonly = true;
                }
            }
            var list = new List <DFSelectItem>();

            SetSelectDataSource(form, "CompanyName", list, false);

            this.Model.Add("CompanyName", "");
            if (!string.IsNullOrWhiteSpace(entity["Category"]))
            {
                using (var db = Pub.DB)
                {
                    var sql = "";
                    if (entity["Category"] == "SENDER")
                    {
                        sql  = "select distinct TuoYun as value,TuoYun as text from YZ_M_TUOYUN where IsActive='Y'";
                        list = db.Query <DFSelectItem>(sql, new { }).ToList();
                    }
                    //else if(entity["Category"] == "RECEIVER")
                    //{
                    //    sql = "select distinct ReceiverCompany as value,ReceiverCompany as text from YZ_T_RECEIVER where IsActive='Y'";
                    //    list = db.Query<DFSelectItem>(sql, new { }).ToList();
                    //}
                    else if (entity["Category"] == "FORWARDER")
                    {
                        sql  = "select distinct Forwarder as value,Forwarder as text from YZ_M_FORWARDER where IsActive='Y'";
                        list = db.Query <DFSelectItem>(sql, new { }).ToList();
                    }

                    //list = db.Query<DFSelectItem>(sql, new {  }).ToList();
                }
                SetSelectDataSource(form, "CompanyName", list, false);
            }
            base.SetAccess(form, entity);
        }
Ejemplo n.º 9
0
        public override void SetAccess(FormM form, DFDictionary entity)
        {
            var InstanceStepExecutorId = entity["InstanceStepExecutorId"];
            var actionName             = DFPub.UrlDecode(entity["actionName"]);
            var action = entity["action"];

            if (string.IsNullOrWhiteSpace(InstanceStepExecutorId))
            {
                throw new WFException("缺少参数 InstanceStepExecutorId");
            }

            //form.GetControlM("NextStep").Text = actionName;
            var InstanceStepExecutor = InstanceStepExecutorDAO.Get(InstanceStepExecutorId);

            if (new StateEngineHelper().IsHideNextStep(InstanceStepExecutor.InstanceStepId))
            {
                // 加签不影响流程走向,所以要隐藏下一步
                form.GetControlM("NextStep").Visible = false;
            }
            else
            {
                if (action == "btnSubmit" || action == "btnApprove")
                {
                    var list = new StateEngineHelper().GetSubmitOrApproveSteps(InstanceStepExecutorId);
                    base.SetSelectDataSource(form, "NextStep", list.Select(a => new DFSelectItem()
                    {
                        Text = a.text, Value = a.value
                    }).ToList());
                }
                else if (action == "btnRollback" || action == "btnReject")
                {
                    var list = new StateEngineHelper().GetRejectOrRollbackSteps(InstanceStepExecutorId);
                    base.SetSelectDataSource(form, "NextStep", list.Select(a => new DFSelectItem()
                    {
                        Text = a.text, Value = a.value
                    }).ToList());
                }
            }
            base.SetAccess(form, entity);
        }
Ejemplo n.º 10
0
        public override void SetAccess(FormM form, DFDictionary entity)
        {
            var newDict = new Dictionary <string, string>();
            var dict    = JsonSerializeHelper.DeserializeObject <Dictionary <string, string> >(form.GetControlM("TableName").Options);

            //foreach (var item in dict)
            //{
            //    if (!string.IsNullOrWhiteSpace(item.Value))
            //    {
            //        if (AuthLoader.CheckFunctionAccess(item.Value, Util.GetCurrentUser().UserId))
            //        {
            //            newDict.Add(item.Key, item.Value);
            //        }
            //    }
            //}
            base.SetSelectDataSource(form, "TableName",
                                     dict.Select(a => new DFSelectItem()
            {
                Value = a.Key, Text = a.Value
            }).ToList(), true);
            base.SetAccess(form, entity);
        }