//获取所有菜单集合
        public DynObject GetMenus()
        {
            string    sqlString = "select MenuID,MenuName, CommandText,ActionID,DisplayOrder,ParentID FROM Menu order by ParentID, DisplayOrder";
            DataTable dataTable = GatewayFactory.Default.Db.ExecuteDataSet(CommandType.Text, sqlString).Tables[0];

            return(DynObjectTransverter.ToTransDataTable(dataTable));
        }
        public DynObject ExecQuery(string sqlString)
        {
            Check.Require(sqlString != null, "执行的sql语句不允许为空!");
            DataTable dataTable = GatewayFactory.Default.Db.ExecuteDataSet(CommandType.Text, sqlString).Tables[0];

            return(DynObjectTransverter.ToTransDataTable(dataTable));
        }
        public DynObject GetToDoListByUserID(int userID, string tableName)
        {
            //用户类型待做任务
            string    sqlString = "select WorkflowToDoListID, WorkflowToDoListName, Expression, BookmarkName, WorkflowInstanceID, WorkflowActivityInstanceID, ObjID from WorkflowToDoList where State = '待处理' and Type = '1'";
            DataTable dataTable = GatewayFactory.Default.Db.ExecuteDataSet(CommandType.Text, sqlString).Tables[0];

            return(DynObjectTransverter.ToTransDataTable(dataTable));
        }
        //获取用户所在角色集合
        public DynObject GetUserRoles(int userID)
        {
            Check.Require(userID > 0, "用户ID必需大于0!");
            string    sqlString = "select r.RoleID from [UserRole] as u inner join [Role] as r on u.RoleID=r.RoleID where  u.UserID=" + userID;
            DataTable dataTable = GatewayFactory.Default.Db.ExecuteDataSet(CommandType.Text, sqlString).Tables[0];

            return(DynObjectTransverter.ToTransDataTable(dataTable));
        }
        //获取用户角色所有功能集合
        public DynObject GetUserRoleActions(int roleID)
        {
            Check.Require(roleID > 0, "角色ID必需大于0!");
            string    sqlString = "select ActionID from [RoleAction] where RoleID=" + roleID;
            DataTable dataTable = GatewayFactory.Default.Db.ExecuteDataSet(CommandType.Text, sqlString).Tables[0];

            return(DynObjectTransverter.ToTransDataTable(dataTable));
        }
        //获取用户菜单集合
        public DynObject GetUserMenus(int userID)
        {
            //获取用户有权的3级菜单
            string    sqlString = "select MenuID,MenuName, CommandText,ActionID,DisplayOrder,ParentID FROM Menu where Grades = 3 and ActionID in (select ActionID from RoleAction where RoleID in (select RoleID from UserRole where UserID = " + userID + ")) order by ParentID, DisplayOrder";
            DataTable dtGrade3  = GatewayFactory.Default.Db.ExecuteDataSet(CommandType.Text, sqlString).Tables[0];

            if (dtGrade3.Rows.Count == 0)
            {
                return(DynObjectTransverter.ToTransDataTable(dtGrade3));
            }
            //获取二级菜单的ID
            DataView  dataView    = dtGrade3.DefaultView;
            DataTable dtGrade2IDs = dataView.ToTable(true, "ParentID");
            string    IDs         = "";

            for (int i = 0; i < dtGrade2IDs.Rows.Count; i++)
            {
                if (i < dtGrade2IDs.Rows.Count - 1)
                {
                    IDs += dtGrade2IDs.Rows[i][0].ToString() + ",";
                }
                else
                {
                    IDs += dtGrade2IDs.Rows[i][0].ToString();
                }
            }
            //获取二级菜单集合
            sqlString = "select MenuID,MenuName, CommandText,ActionID,DisplayOrder,ParentID FROM Menu where Grades = 2 and MenuID in (" + IDs + ") order by ParentID, DisplayOrder";
            DataTable dtGrade2 = GatewayFactory.Default.Db.ExecuteDataSet(CommandType.Text, sqlString).Tables[0];

            //获取一级菜单的ID
            dataView = dtGrade2.DefaultView;
            DataTable dtGrade1IDs = dataView.ToTable(true, "ParentID");

            IDs = "";
            for (int i = 0; i < dtGrade1IDs.Rows.Count; i++)
            {
                if (i < dtGrade1IDs.Rows.Count - 1)
                {
                    IDs += dtGrade1IDs.Rows[i][0].ToString() + ",";
                }
                else
                {
                    IDs += dtGrade1IDs.Rows[i][0].ToString();
                }
            }
            //获取一级菜单集合
            sqlString = "select MenuID,MenuName, CommandText,ActionID,DisplayOrder,ParentID FROM Menu where Grades = 1 and MenuID in (" + IDs + ") order by ParentID, DisplayOrder";
            DataTable dtGrade1 = GatewayFactory.Default.Db.ExecuteDataSet(CommandType.Text, sqlString).Tables[0];

            dtGrade1.Merge(dtGrade2);
            dtGrade1.Merge(dtGrade3);

            return(DynObjectTransverter.ToTransDataTable(dtGrade1));
        }
        public DynObject GetRelationFormByID(int relationFormID)
        {
            DynObject result       = null;
            DynEntity relationForm = GatewayFactory.Default.Find("RelationForm", relationFormID);

            if (relationForm != null)
            {
                result = DynObjectTransverter.JsonToDynObject(relationForm["Model"] as string);
            }
            return(result);
        }
        public DynObject GetDictFormByID(int dictFormID)
        {
            DynObject result   = null;
            DynEntity dictForm = GatewayFactory.Default.Find("DictForm", dictFormID);

            if (dictForm != null)
            {
                result = DynObjectTransverter.JsonToDynObject(dictForm["Model"] as string);
            }
            return(result);
        }
        public DynObject GetBillListFormByID(int billListFormID)
        {
            DynObject result       = null;
            DynEntity billListForm = GatewayFactory.Default.Find("BillListForm", billListFormID);

            if (billListForm != null)
            {
                result = DynObjectTransverter.JsonToDynObject(billListForm["Model"] as string);
            }
            return(result);
        }
        public void AddTreeForm(DynObject treeForm)
        {
            Check.Require(treeForm != null, "TreeForm对象不允许为空!");
            DynEntity treeFormEntity = new DynEntity("TreeForm");

            treeFormEntity["TreeFormID"]    = treeForm["TreeFormID"];
            treeFormEntity["TreeFormName"]  = treeForm["TreeFormName"];
            treeFormEntity["ModelType"]     = treeForm["ModelType"];
            treeFormEntity["ModelTypeName"] = treeForm["ModelTypeName"];
            treeFormEntity["ReferTypes"]    = treeForm["ReferTypes"];
            treeFormEntity["ColumnCount"]   = treeForm["ColumnCount"];
            treeFormEntity["Comment"]       = treeForm["Comment"];
            treeFormEntity["Model"]         = DynObjectTransverter.DynObjectToJson(treeForm);
            GatewayFactory.Default.Save(treeFormEntity);
        }
        public void AddRelationForm(DynObject relationForm)
        {
            Check.Require(relationForm != null, "RelationForm对象不允许为空!");
            DynEntity relationFormEntity = new DynEntity("RelationForm");

            relationFormEntity["RelationFormID"]   = relationForm["RelationFormID"];
            relationFormEntity["RelationFormName"] = relationForm["RelationFormName"];
            relationFormEntity["RelationType"]     = relationForm["RelationType"];
            relationFormEntity["MasterType"]       = relationForm["MasterType"];
            relationFormEntity["SlaveType"]        = relationForm["SlaveType"];
            relationFormEntity["MasterTypeName"]   = relationForm["MasterTypeName"];
            relationFormEntity["SlaveTypeName"]    = relationForm["SlaveTypeName"];
            relationFormEntity["ColumnCount"]      = relationForm["ColumnCount"];
            relationFormEntity["Comment"]          = relationForm["Comment"];
            relationFormEntity["Model"]            = DynObjectTransverter.DynObjectToJson(relationForm);
            GatewayFactory.Default.Save(relationFormEntity);
        }
        public void ModifyDictForm(DynObject dictForm)
        {
            Check.Require(dictForm != null, "DictForm对象不允许为空!");
            DynEntity dictFormEntity = GatewayFactory.Default.Find("DictForm", dictForm["DictFormID"]);

            Check.Require(dictFormEntity != null, "DictForm在数据库中不存在无法修改!");

            dictFormEntity["DictFormName"]  = dictForm["DictFormName"];
            dictFormEntity["ModelType"]     = dictForm["ModelType"];
            dictFormEntity["ModelTypeName"] = dictForm["ModelTypeName"];
            dictFormEntity["ReferTypes"]    = dictForm["ReferTypes"];
            dictFormEntity["ColumnCount"]   = dictForm["ColumnCount"];
            dictFormEntity["Comment"]       = dictForm["Comment"];
            dictFormEntity["Model"]         = DynObjectTransverter.DynObjectToJson(dictForm);
            //dictFormEntity["Script"] = GenerateDictFormJsCode(dictForm);
            GatewayFactory.Default.Save(dictFormEntity);
        }
        public void AddBillListForm(DynObject billListForm)
        {
            Check.Require(billListForm != null, "BillListForm对象不允许为空!");
            DynEntity billListFormEntity = new DynEntity("BillListForm");

            billListFormEntity["BillListFormID"]      = billListForm["BillListFormID"];
            billListFormEntity["BillListFormName"]    = billListForm["BillListFormName"];
            billListFormEntity["MasterType"]          = billListForm["MasterType"];
            billListFormEntity["DetailType"]          = billListForm["DetailType"];
            billListFormEntity["ReferTypes"]          = billListForm["ReferTypes"];
            billListFormEntity["BillName"]            = billListForm["BillName"];
            billListFormEntity["DetailMainReferType"] = billListForm["DetailMainReferType"];
            billListFormEntity["DetailMainReferName"] = billListForm["DetailMainReferName"];
            billListFormEntity["Comment"]             = billListForm["Comment"];
            billListFormEntity["Model"] = DynObjectTransverter.DynObjectToJson(billListForm);
            GatewayFactory.Default.Save(billListFormEntity);
        }
Esempio n. 14
0
        public void AddDynObjectsByTransaction(List <DynObject> objects)
        {
            Check.Require(objects != null && objects.Count > 0, "添加的对象列表不允许为空!");
            DbTransaction tran = GatewayFactory.Default.Db.BeginTransaction();

            try
            {
                foreach (var obj in objects)
                {
                    GatewayFactory.Default.Save(DynObjectTransverter.DynObject2DynEntity(obj), tran);
                }
                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
        }
        public void ModifyRelationForm(DynObject relationForm)
        {
            Check.Require(relationForm != null, "RelationForm对象不允许为空!");
            DynEntity relationFormEntity = GatewayFactory.Default.Find("RelationForm", relationForm["RelationFormID"]);

            Check.Require(relationFormEntity != null, "RelationForm在数据库中不存在无法修改!");

            relationFormEntity["RelationFormName"] = relationForm["RelationFormName"];
            relationFormEntity["RelationType"]     = relationForm["RelationType"];
            relationFormEntity["MasterType"]       = relationForm["MasterType"];
            relationFormEntity["SlaveType"]        = relationForm["SlaveType"];
            relationFormEntity["MasterTypeName"]   = relationForm["MasterTypeName"];
            relationFormEntity["SlaveTypeName"]    = relationForm["SlaveTypeName"];
            relationFormEntity["ColumnCount"]      = relationForm["ColumnCount"];
            relationFormEntity["Comment"]          = relationForm["Comment"];
            relationFormEntity["Model"]            = DynObjectTransverter.DynObjectToJson(relationForm);
            //relationFormEntity["Script"] = GenerateRelationFormJsCode(relationForm);

            GatewayFactory.Default.Save(relationFormEntity);
        }
        public void ModifyBillListForm(DynObject billListForm)
        {
            Check.Require(billListForm != null, "BillListForm对象不允许为空!");
            DynEntity billListFormEntity = GatewayFactory.Default.Find("BillListForm", billListForm["BillListFormID"]);

            Check.Require(billListFormEntity != null, "BillListForm在数据库中不存在无法修改!");

            billListFormEntity["BillListFormName"]    = billListForm["BillListFormName"];
            billListFormEntity["MasterType"]          = billListForm["MasterType"];
            billListFormEntity["DetailType"]          = billListForm["DetailType"];
            billListFormEntity["ReferTypes"]          = billListForm["ReferTypes"];
            billListFormEntity["BillName"]            = billListForm["BillName"];
            billListFormEntity["DetailMainReferType"] = billListForm["DetailMainReferType"];
            billListFormEntity["DetailMainReferName"] = billListForm["DetailMainReferName"];
            billListFormEntity["Comment"]             = billListForm["Comment"];
            billListFormEntity["Model"] = DynObjectTransverter.DynObjectToJson(billListForm);
            //billListFormEntity["Script"] = GenerateBillListFormJsCode(billListForm);

            GatewayFactory.Default.Save(billListFormEntity);
        }
Esempio n. 17
0
 public void Cancel()
 {
     if (DesignClass.ClassID > 0)
     {
         DynEntity        classEntity     = ApplicationDesignService.GetClassEntity(DesignClass.ClassID);
         string           dynAtrributeStr = classEntity["Attributes"] as string;
         List <DynObject> dynAttributes   = DynObjectTransverter.JsonToDynObjectList(dynAtrributeStr);
         foreach (var item in dynAttributes)
         {
             switch (item.DynClass.Name)
             {
             case "Persistable":
                 DesignClass.IsPersistable = true;
                 break;
             }
         }
         DesignClass.DisplayName = classEntity["Description"] as string;
         DesignClass.Description = classEntity["DisplayName"] as string;
         DesignClass.NamespaceID = Convert.ToInt32(classEntity["NamespaceID"]);
         DesignerViewModel.CurrentDesignClass = DesignClass;
     }
 }
Esempio n. 18
0
 public void ModifyDynObject(DynObject dynObject)
 {
     Check.Require(dynObject != null, "修改的对象不允许为空!");
     GatewayFactory.Default.Save(DynObjectTransverter.DynObject2DynEntity(dynObject), null);
 }
Esempio n. 19
0
        public DynObject GetDynObjectByID(string structName, params object[] pkValues)
        {
            DynEntity dynEntity = GatewayFactory.Default.Find(structName, pkValues);

            return(DynObjectTransverter.DynEntity2DynObject(dynEntity));
        }
Esempio n. 20
0
        public DynObject GetDynObjectByIDs(string structName, int firstID, int secondID)
        {
            DynEntity dynEntity = GatewayFactory.Default.Find(structName, firstID, secondID);

            return(DynObjectTransverter.DynEntity2DynObject(dynEntity));
        }
Esempio n. 21
0
        public DynObject GetDynObjectByID(string structName, int dynObjectID)
        {
            DynEntity dynEntity = GatewayFactory.Default.Find(structName, dynObjectID);

            return(DynObjectTransverter.DynEntity2DynObject(dynEntity));
        }