public override DFDictionary Get(FormM form, DFDictionary entity, ref string message)
 {
     if (entity["EditMode"] == "Edit")
     {
         return(base.Get(form, entity, ref message));
     }
     else
     {
         using (var db = Pub.DB)
         {
             //不是编辑 是新增 是第一次调整 则选择原有的记录作为默认值
             //如果不是第一次调整 则选择最新的一条记录作为默认值
             var s     = "select top 1 * from sm_t_process_ly_log where InstanceId=@InstanceId order by LastModifyTime desc";
             var sItem = db.Query <SM_T_PROCESS_LY>(s, new { InstanceId = entity["InstanceId"] }).FirstOrDefault();
             if (sItem == null)
             {
                 var sql2  = "select * from sm_t_process_ly where InstanceId=@InstanceId";
                 var item2 = db.Query <SM_T_PROCESS_LY>(sql2, new { InstanceId = entity["InstanceId"] }).FirstOrDefault();
                 if (item2 != null)
                 {
                     entity.Merge(item2.ToDFDictionary());
                 }
             }
             else
             {
                 entity.Merge(sItem.ToDFDictionary());
             }
         }
         return(entity);
     }
 }
        public override DFDictionary Get(FormM form, DFDictionary entity, ref string message)
        {
            using (var db = Pub.DB)
            {
                var sql  = "select InstanceId,ADC,ATJC,AIzn,AMF1,AMF2,BDC,BTJC,BIzn,BMF1,BMF2 from v_sm_t_process_cy where InstanceId=@InstanceId";
                var item = db.Query <v_sm_t_process_cy>(sql, new { InstanceId = entity["InstanceId"] }).FirstOrDefault();
                if (item != null)
                {
                    entity.Merge(item.ToDFDictionary());
                }

                var sql2  = "select InstanceId,Z1,Z2,Z3,Z4,Z5,Z6 from v_sm_t_process_ly where InstanceId=@InstanceId";
                var item2 = db.Query <v_sm_t_process_ly>(sql2, new { InstanceId = entity["InstanceId"] }).FirstOrDefault();
                if (item2 != null)
                {
                    entity.Merge(item2.ToDFDictionary());
                }

                var sql3  = "select InstanceId,AQ1,AQ2,AQ3,AQ4,AQ5,AQ6,AQ7,AQ8,AWT1,BWT1,AKK,BKK,AWT2,BWT2 from sm_t_process_aq where InstanceId=@InstanceId";
                var item3 = db.Query <SM_T_PROCESS_AQ>(sql3, new { InstanceId = entity["InstanceId"] }).FirstOrDefault();
                if (item3 != null)
                {
                    entity.Merge(item3.ToDFDictionary());
                }
            }
            return(entity);
        }
Пример #3
0
 public override DFDictionary Get(FormM form, DFDictionary entity, ref string message)
 {
     if (entity["EditMode"] == "Edit")
     {
         return(base.Get(form, entity, ref message));
     }
     else
     {
         using (var db = Pub.DB)
         {
             //不是编辑 是新增 是第一次调整 则选择原有的记录作为默认值
             //如果不是第一次调整 则选择最新的一条记录作为默认值
             var s     = "select top 1 * from sm_t_process_aq_log where InstanceId=@InstanceId order by LastModifyTime desc";
             var sItem = db.Query <SM_T_PROCESS_AQ>(s, new { InstanceId = entity["InstanceId"] }).FirstOrDefault();
             if (sItem == null)
             {
                 var sql3  = "select InstanceId,AQ1,AQ2,AQ3,AQ4,AQ5,AQ6,AQ7,AQ8,AWT1,BWT1,AKK,BKK,AWT2,BWT2 from sm_t_process_aq where InstanceId=@InstanceId";
                 var item3 = db.Query <SM_T_PROCESS_AQ>(sql3, new { InstanceId = entity["InstanceId"] }).FirstOrDefault();
                 if (item3 != null)
                 {
                     entity.Merge(item3.ToDFDictionary());
                 }
             }
             else
             {
                 entity.Merge(sItem.ToDFDictionary());
             }
             return(entity);
         }
     }
 }
Пример #4
0
 public override DFDictionary Get(FormM form, DFDictionary entity, ref string message)
 {
     try
     {
         var dict = new DFDictionary();
         if (!string.IsNullOrWhiteSpace(entity["UserId"]))
         {
             using (var db = Pub.DB)
             {
                 var sql  = "SELECT * FROM WF_M_USER where UserId=@UserId";
                 var item = db.Query <VM_WF_M_USER>(sql, new { UserId = entity["UserId"] }).FirstOrDefault();
                 if (null != item)
                 {
                     dict.Merge(DFDictionary.Create <VM_WF_M_USER>(item));
                 }
             }
         }
         return(dict);
     }
     catch (Exception ex)
     {
         message = ex.Message;
         return(null);
     }
 }
Пример #5
0
 public override DFDictionary Get(FormM form, DFDictionary entity, ref string message)
 {
     try
     {
         var dict = new DFDictionary();
         if (!string.IsNullOrWhiteSpace(entity["RoleId"]))
         {
             using (var db = Pub.DB)
             {
                 var sql  = "select * from WF_M_ROLE where RoleId=@RoleId";
                 var item = db.Query <WF_M_ROLE>(sql, new { RoleId = entity["RoleId"] }).FirstOrDefault();
                 if (null != item)
                 {
                     dict.Merge(DFDictionary.Create <WF_M_ROLE>(item));
                 }
             }
         }
         return(dict);
     }
     catch (Exception ex)
     {
         message = ex.Message;
         return(null);
     }
 }
Пример #6
0
        public override DFDictionary Get(FormM form, DFDictionary entity, ref string message)
        {
            try
            {
                var dict = new DFDictionary();
                if (!string.IsNullOrWhiteSpace(entity["RoleId"]))
                {
                    using (var db = Pub.DB)
                    {
                        var sql  = "select * from WF_M_ROLE where RoleId=@RoleId";
                        var item = db.Query <WF_M_ROLE>(sql, new { RoleId = entity["RoleId"] }).FirstOrDefault();
                        if (null != item)
                        {
                            dict.Merge(DFDictionary.Create <WF_M_ROLE>(item));
                        }

                        // 载入权限
                        sql = "select * from WF_M_AUTH_MODULE where RoleId=@RoleId";
                        var list1 = db.Query <WF_M_AUTH_MODULE>(sql, new { RoleId = entity["RoleId"] }).ToList();
                        dict.Add("DF_TREE_VIEWSTATE1", Base64StringHelper.ConvertToBase64String(JsonSerializeHelper.SerializeObject(
                                                                                                    list1.Select(a => new WFTreeNode {
                            id = a.ModuleId, _checked = true, expanded = true
                        }))));

                        sql = "select * from WF_M_AUTH_DATA where RoleId=@RoleId";
                        var list2 = db.Query <WF_M_AUTH_DATA>(sql, new { RoleId = entity["RoleId"] }).ToList();
                        dict.Add("DF_TREE_VIEWSTATE2", Base64StringHelper.ConvertToBase64String(JsonSerializeHelper.SerializeObject(
                                                                                                    list2.Select(a => new WFTreeNode {
                            id = a.DeptId, _checked = true, expanded = true
                        }))));
                    }
                }
                return(dict);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return(null);
            }
        }
Пример #7
0
        public virtual void ProcessData(DataTable dt, List <VM_TableMetadata> tables, DFDictionary entity)
        {
            var user = Util.GetCurrentUser().UserName;

            foreach (DataRow dr in dt.Rows)
            {
                try
                {
                    var drDict = entity.Merge(dr.ToDFDictionary());
                    foreach (var table in tables)
                    {
                        var dict = ConvertDFDictionary(table.Columns, drDict);
                        CheckData(table.Columns, dict, user, null);
                        SaveData(table, dict);
                    }
                }
                catch (WFException ex)
                {
                    dr.SetField <string>("Result", ex.Message);
                }
            }
        }