Ejemplo n.º 1
0
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="param">删除条件实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult DelInfo(Sys_ModuleParam param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            int affect             = 0;

            try
            {
                #region 判断
                if (param.ModuleID.ToInt32() <= 0)
                {
                    throw new WarnException("请指定要删除的模块ID!");
                }
                #endregion
                #region  除关联性,暂未加上

                #endregion
                WhereClip where = GetWhereClip(param);
                Sys_ModuleResult info = new Sys_ModuleResult();
                info.IsDeleted = true;
                affect         = this.Update <Sys_ModuleResult>(info, where);
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(ret);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取一条信息记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public Sys_ModuleResult GetInfo(Sys_ModuleParam param)
        {
            this.CheckSession();
            Sys_ModuleResult rst = new Sys_ModuleResult();

            #region 判断
            if (param.ModuleID.ToInt32() <= 0)
            {
                throw new WarnException("请指定ID!");
            }
            #endregion
            #region 保存实体
            WhereClip where = Sys_Module._.ModuleID == param.ModuleID;
            rst             = this.Select <Sys_ModuleResult>(where);
            #region 父级菜单
            if (rst.ModuleCode.ToStringHasNull().Length > 3)
            {
                string         parentCode = rst.ModuleCode.Substring(0, rst.ModuleCode.Length - 3);
                Sys_MenuResult parMenu    = this.Select <Sys_MenuResult>(new List <Field>()
                {
                    Sys_Menu._.MenuName
                }
                                                                         , Sys_Menu._.MenuCode == parentCode);
                if (parMenu != null)
                {
                    rst.ParentMenuName = parMenu.MenuName;
                }
            }
            #endregion
            #endregion
            return(rst);
        }
Ejemplo n.º 3
0
        public WCFAddUpdateResult AddOrUpdate(Sys_ModuleResult param)
        {
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            ExeResult          rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.Sys.Sys_ModuleBLL", "AddOrUpdate", param);
            ret = (rst == null ? new WCFAddUpdateResult() : rst.Result as WCFAddUpdateResult);
            return(ret);
        }
Ejemplo n.º 4
0
        public PageList <Sys_FormRightResult> GetPageList(Sys_FormRightParam param)
        {
            this.CheckSession();
            PageList <Sys_FormRightResult> rst = new PageList <Sys_FormRightResult>();

            try
            {
                #region 获取分页列表
                WhereClip where = GetWhereClip(param);
                List <Field> lstField = new List <Field>()
                {
                    Sys_FormRight._.FormRightID, Sys_FormRight._.NameSpace, Sys_FormRight._.FormEngName,
                    Sys_FormRight._.FormChsName, Sys_FormRight._.UserControlEngName, Sys_FormRight._.UserControlChsName,
                    Sys_FormRight._.OprControlEngName, Sys_FormRight._.OprControlChsName, Sys_FormRight._.OprPropertyName,
                    Sys_FormRight._.ModuleID, Sys_FormRight._.ActionCode, Sys_FormRight._.IsDeleted
                };
                rst = this.SelectList <Sys_FormRightResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(20), lstField, where, Sys_FormRight._.NameSpace.Desc);
                #endregion
                #region 单据对应模块名称
                if (rst != null && rst.ResultList != null)
                {
                    Sys_ModuleBLL moduleBll   = new Sys_ModuleBLL();
                    int?[]        arrModuleID = rst.ResultList.Select(a => a.ModuleID).Distinct().ToArray();
                    moduleBll.SessionInfo = this.SessionInfo;
                    List <Sys_ModuleResult> moduleList = new List <Sys_ModuleResult>();
                    if (arrModuleID.Length > 0)
                    {
                        moduleList = moduleBll.GetPageList(new Sys_ModuleParam()
                        {
                            PageIndex = 1, PageSize = arrModuleID.Length, ModuleIDs = arrModuleID
                        }).ResultList;
                    }
                    Sys_ModuleResult findModule = new Sys_ModuleResult();
                    foreach (Sys_FormRightResult info in rst.ResultList)
                    {
                        findModule = moduleList.Find(a => a.ModuleID == info.ModuleID);
                        if (findModule != null)
                        {
                            info.ModuleName = findModule == null ? "" : findModule.ModuleName;
                        }
                    }
                }
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(rst);
        }
Ejemplo n.º 5
0
        void GetModuleInfo(int moduleID)
        {
            this.ShowWaitting(enuWaitMsgType.BindData);
            Sys_ModuleResult info  = new Sys_ModuleResult();
            Sys_ModuleLogic  logic = new Sys_ModuleLogic(this);

            info = logic.GetInfo(new Sys_ModuleParam()
            {
                ModuleID = moduleID
            });
            this.ConvertEntityToControl <Sys_ModuleResult>(this.grpEditModule.Controls, info, null);
            this.HideWaitting();
        }
Ejemplo n.º 6
0
        public Sys_ModuleResult GetInfo(Sys_ModuleParam param)
        {
            Sys_ModuleResult ret = new Sys_ModuleResult();
            ExeResult        rst = new ExeResult();

            if (param.ModuleID.ToInt32() <= 0)
            {
                this.ShowMessage("请指定要修改的记录!");
                return(ret);
            }
            rst = this.Execute("ZNLCRM.BLL.Sys.Sys_ModuleBLL", "GetInfo", param);
            ret = rst == null ? new Sys_ModuleResult() : rst.Result as Sys_ModuleResult;
            return(ret);
        }
Ejemplo n.º 7
0
 private void btnSaveEditModule_Click(object sender, EventArgs e)
 {
     DevComponents.AdvTree.Node node = this.treMenu.SelectedNode;
     if (node == null)
     {
         this.ShowMessage("请指定菜单!");
         return;
     }
     Sys_ModuleResult   info     = Form_GetEditEntity("module") as Sys_ModuleResult;
     Sys_ModuleLogic    logic    = new Sys_ModuleLogic(this);
     WCFAddUpdateResult pageList = this.AsyncExecute <WCFAddUpdateResult, Sys_ModuleResult>(info, logic.AddOrUpdate, (a) => { if (a.Key.ToInt32() > 0)
                                                                                                                              {
                                                                                                                                  this.grpEditModule.Visible = false; this.BindModuleList(); this.HidEditWindow();
                                                                                                                              }
                                                                                            });
 }
Ejemplo n.º 8
0
        public Sys_FormRightResult GetInfo(Sys_FormRightParam param)
        {
            this.CheckSession();
            Sys_FormRightResult rst = new Sys_FormRightResult();

            try
            {
                #region 判断
                if (param.FormRightID <= 0)
                {
                    throw new WarnException("请指定关键字GUID!");
                }
                #endregion
                #region 保存实体
                WhereClip where = Sys_FormRight._.FormRightID == param.FormRightID;
                rst             = this.Select <Sys_FormRightResult>(where);
                if (rst != null)
                {
                    Sys_ModuleBLL moduleBll = new Sys_ModuleBLL();
                    moduleBll.SessionInfo = this.SessionInfo;
                    Sys_ModuleResult moduleRst = moduleBll.GetInfo(new Sys_ModuleParam()
                    {
                        ModuleID = rst.ModuleID.ToInt32()
                    });
                    rst.ModuleName = moduleRst == null ? "" : moduleRst.ModuleName;
                }

                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(rst);
        }
Ejemplo n.º 9
0
        object Form_GetEditEntity(string editName)
        {
            object ret = null;

            if (editName == "menu")
            {
                Sys_MenuResult info = new Sys_MenuResult();
                info.MenuType = "Folder";
                info          = this.ConvertControlToEntity <Sys_MenuResult>(this.grpEditMenu.Controls, info, null);
                ret           = info;
            }
            else
            {
                DevComponents.AdvTree.Node node = this.treMenu.SelectedNode;
                int menuID = 0;
                menuID = node.Tag.ToInt32();
                Sys_ModuleResult info = new Sys_ModuleResult();
                info.MenuID = menuID;
                info        = this.ConvertControlToEntity <Sys_ModuleResult>(this.grpEditModule.Controls, info, null);
                ret         = info;
            }
            return(ret);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 添加和新增修改
        /// </summary>
        /// <param name="param">新增或修改的实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult AddOrUpdate(Sys_ModuleResult param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                int affect = 0;
                #region 判断
                if (param.ModuleName.ToStringHasNull().Trim() == "")
                {
                    throw new WarnException("请指定菜单名称!");
                }
                if (param.MenuID.ToInt32() < 0)
                {
                    throw new WarnException("请指定所属菜单!");
                }
                if (param.TargetForm.ToStringHasNull().Trim() == "")
                {
                    throw new WarnException("请指定所属目标体窗!");
                }

                string         parentCode = "";
                Sys_MenuResult menuRst    = new Sys_MenuResult();
                menuRst = this.Select <Sys_MenuResult>(Sys_Menu._.MenuID == param.MenuID);
                if (param.MenuID > 0 && (menuRst == null || menuRst.MenuCode == ""))
                {
                    throw new WarnException("菜单编号的所属菜单不存在!");
                }
                parentCode = menuRst.MenuCode;
                #endregion
                #region 生成模块编号
                int maxModuleNum = 1;
                maxModuleNum = this.Count <Sys_ModuleResult>(Sys_Module._.MenuID == param.MenuID) + 1;
                #endregion
                #region 判断重复
                WhereClip whereChk = Sys_Module._.IsDeleted == false && Sys_Module._.ModuleName == param.ModuleName;
                if (param.ModuleID > 0)
                {
                    whereChk = whereChk & Sys_Module._.ModuleID != param.ModuleID;
                }
                int chkNum = this.Count <Sys_ModuleResult>(whereChk);
                if (chkNum > 0)
                {
                    throw new WarnException("存在重复的模块名称!");
                }
                #endregion
                #region 系统默认值
                if (param.ModuleID > 0)
                {
                    if (!param.ModuleCode.StartsWith(parentCode))
                    {
                        param.ModuleCode = parentCode + maxModuleNum.ToString().PadLeft(3, '0');
                    }
                    WhereClip where = Sys_Module._.ModuleID == param.ModuleID;
                    affect          = this.Update <Sys_ModuleResult>(param, where);
                }
                else
                {
                    Sys_ModuleResult codeRulerBll = new Sys_ModuleResult();
                    param.ModuleCode = parentCode + maxModuleNum.ToString().PadLeft(3, '0');
                    param.IsDeleted  = false;
                    affect           = this.Insert <Sys_ModuleResult>(param);
                    param            = this.Select <Sys_ModuleResult>(new List <Field>()
                    {
                        Sys_Module._.ModuleID
                    }, Sys_Module._.ModuleCode == param.ModuleCode);
                }
                #region 设置返回值
                ret.Key = param.ModuleID;
                #endregion
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(ret);
        }