Esempio n. 1
0
        /// <summary>
        /// 获取删除时插入日志表sql
        /// </summary>
        /// <param name="modelInfo"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        protected override string GetInsertDeleteHistory(XModelBase modelInfo, string userId)
        {
            XRoleInfo info = modelInfo as XRoleInfo;
            string    sql  = "Insert Into " + this.HistoryTableName + "(RID,RoleName,NameNum,Spell,SpellHeader,OrderIndex,IsUsed,Remark,InputUserId,InputTime,UpdateUserId,UpdateTime,OperateUserId,Operate,OperateTime,NewID) SELECT RID,RoleName,NameNum,Spell,SpellHeader,OrderIndex,IsUsed,Remark,InputUserId,InputTime,UpdateUserId,UpdateTime,'" + userId + "','删除',getdate(),newid() FROM " + this.TableName + " WHERE " + this.PrimaryKey + "='" + info.RID + "'";

            return(sql);
        }
Esempio n. 2
0
        private void FillRoleMenus(XRoleInfo roleInfo)
        {
            if (roleInfo != null)
            {
                m_SelectedMenuNodes = new List <TreeNode>();

                IList <XModelBase> roleMenus = this.m_RoleMenusBusiness.GetRoleMenus(roleInfo.RID);

                foreach (XTreeNode treeNode in this.tvRole.Nodes)
                {
                    this.GetSelectedMenuNodes(treeNode);
                    treeNode.Checked = false;
                }

                foreach (XTreeNode menuNode in this.m_SelectedMenuNodes)
                {
                    string menuId = menuNode.Code;
                    if (IsMenuInRoleMenus(menuId, roleMenus))
                    {
                        menuNode.Checked = true;
                    }
                }
            }

            this.tvRole.ExpandAll();
        }
Esempio n. 3
0
        /// <summary>
        /// 获取插入sql
        /// </summary>
        /// <param name="modelInfo"></param>
        /// <returns></returns>
        public override string GetInsertSql(XModelBase modelInfo)
        {
            XRoleInfo info = modelInfo as XRoleInfo;
            string    sql  = "Insert Into " + this.TableName + "(RID,RoleName,NameNum,Spell,SpellHeader,OrderIndex,IsUsed,Remark,InputUserId,InputTime,UpdateUserId,UpdateTime)Values('{0}','{1}',{2},'{3}','{4}',{5},'{6}','{7}','{8}',{9},'{10}',{11})";

            sql = String.Format(sql, info.RID, info.RoleName, info.NameNum, info.Spell, info.SpellHeader, info.OrderIndex, info.IsUsed == true?"1":"0", info.Remark, info.InputUserId, this.GetServerTimeFuncion(), info.UpdateUserId, this.GetServerTimeFuncion());
            return(sql);
        }
Esempio n. 4
0
 private void grdData_Click(object sender, EventArgs e)
 {
     if (this.grdData.CurrentRow != null &&
         this.grdData.CurrentRow.RowType == Janus.Windows.GridEX.RowType.Record)
     {
         XRoleInfo roleInfo = this.grdData.CurrentRow.DataRow as XRoleInfo;
         this.FillRoleMenus(roleInfo);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 获取更新Sql
        /// </summary>
        /// <param name="modelInfo"></param>
        /// <returns></returns>
        public override string GetUpdateSql(XModelBase modelInfo)
        {
            string sql = String.Empty;

            XRoleInfo info = modelInfo as XRoleInfo;

            sql = "Update " + this.TableName + " Set RoleName='{0}',NameNum={1},Spell='{2}',SpellHeader='{3}',OrderIndex={4},IsUsed='{5}',Remark='{6}',UpdateUserId='{7}',UpdateTime={8} Where RID='{9}'";
            sql = string.Format(sql, info.RoleName, info.NameNum, info.Spell, info.SpellHeader, info.OrderIndex, info.IsUsed == true?"1":"0", info.Remark, info.UpdateUserId, this.GetServerTimeFuncion(), info.RID);

            return(sql);
        }
Esempio n. 6
0
        /// <summary>
        /// 自定义修改校验
        /// </summary>
        /// <param name="modelInfo"></param>
        /// <returns></returns>
        protected override string GetValidateUpdateCustom(XModelBase modelInfo)
        {
            string    validateInfo = string.Empty;
            XRoleInfo role         = modelInfo as XRoleInfo;

            if (role == null)
            {
                return(this.GetNotRightType());
            }
            return(string.Empty);
        }
Esempio n. 7
0
        /// <summary>
        /// 设置修改时的默认值
        /// </summary>
        protected override void SetDefaultValue()
        {
            XRoleInfo info = this.m_CurrentModel as XRoleInfo;



            this.txtRoleName.Text    = info.RoleName;
            this.nebNameNum.Value    = info.NameNum;
            this.txtSpell.Text       = info.Spell;
            this.txtSpellHeader.Text = info.SpellHeader;
            this.nebOrderIndex.Value = info.OrderIndex;
            this.chkIsUsed.Checked   = info.IsUsed;
            this.txtRemark.Text      = info.Remark;
        }
Esempio n. 8
0
        /// <summary>
        /// 获取选中的角色
        /// </summary>
        /// <returns></returns>
        private IList <XRoleInfo> GetSelectedRoles()
        {
            IList <XRoleInfo> roleInfos = new List <XRoleInfo>();

            foreach (XTreeNode treeNode in this.tvRole.Nodes)
            {
                if (treeNode.Checked)
                {
                    XRoleInfo roleInfo = treeNode.Model as XRoleInfo;
                    if (roleInfo != null)
                    {
                        roleInfos.Add(roleInfo);
                    }
                }
            }

            return(roleInfos);
        }
Esempio n. 9
0
        /// <summary>
        /// 将数据行转换为实体
        /// </summary>
        /// <param name="modelRow">数据行记录</param>
        /// <returns>实体信息</returns>
        protected override void DataRow2ModelBase(XModelBase modelInfo, DataRow modelRow)
        {
            XRoleInfo info = modelInfo as XRoleInfo;

            info.ID           = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "RID"));              //主键
            info.RID          = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "RID"));              //主键
            info.RoleName     = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "RoleName"));         //角色名称
            info.NameNum      = XHelper.GetInt(XDataRowHelper.GetFieldValue(modelRow, "NameNum"));             //数值代码
            info.Spell        = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "Spell"));            //拼音
            info.SpellHeader  = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "SpellHeader"));      //拼音头
            info.OrderIndex   = XHelper.GetInt(XDataRowHelper.GetFieldValue(modelRow, "OrderIndex"));          //排序
            info.IsUsed       = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "IsUsed")) == "True"; //是否可用
            info.Remark       = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "Remark"));           //备注信息
            info.InputUserId  = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "InputUserId"));      //录入人
            info.InputTime    = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "InputTime"));        //录入时间
            info.UpdateUserId = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "UpdateUserId"));     //修改人
            info.UpdateTime   = XHelper.GetString(XDataRowHelper.GetFieldValue(modelRow, "UpdateTime"));       //修改时间
        }
Esempio n. 10
0
        /// <summary>
        /// 填充实体信息
        /// </summary>
        protected override void FillModelInfo()
        {
            XRoleInfo info = this.m_CurrentModel as XRoleInfo;

            if (this.m_EditStatus == XEditStatus.AddNew)
            {
                info.RID = this.GetNewId();
            }

            info.RoleName    = this.txtRoleName.Text;
            info.NameNum     = XHelper.GetInt(this.nebNameNum.Value);
            info.Spell       = this.txtSpell.Text;
            info.SpellHeader = this.txtSpellHeader.Text;
            info.OrderIndex  = XHelper.GetInt(this.nebOrderIndex.Value);
            info.IsUsed      = this.chkIsUsed.Checked;
            info.Remark      = this.txtRemark.Text;

            base.FillModelInfo();
        }
Esempio n. 11
0
        private void InitRoleTree()
        {
            this.tvRole.Nodes.Clear();

            IList <XModelBase> roleInfos = this.m_RoleBusiness.GetAll();

            foreach (XModelBase modelInfo in roleInfos)
            {
                XRoleInfo roleInfo = modelInfo as XRoleInfo;

                XTreeNode treeNode = new XTreeNode();

                treeNode.Code  = roleInfo.ID;
                treeNode.Name  = roleInfo.RoleName;
                treeNode.Model = roleInfo;
                //treeNode.Text = "(" + roleInfo.ID + ")" + roleInfo.RoleName;
                treeNode.Text = roleInfo.RoleName;

                this.tvRole.Nodes.Add(treeNode);
            }
        }
Esempio n. 12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.grdData.CurrentRow == null || this.grdData.CurrentRow.RowType != Janus.Windows.GridEX.RowType.Record)
            {
                XMessageBox.ShowError("请选择角色!");
                return;
            }

            XRoleInfo roleInfo = this.grdData.CurrentRow.DataRow as XRoleInfo;


            IList <XMenuInfo> selectedMenus = this.GetSelectedMenus();

            if (this.m_RoleMenusBusiness.SaveRoleMenus(roleInfo.RID, selectedMenus, XCommon.LoginUsersInfo.RID))
            {
                XMessageBox.ShowRemindMessage("保存成功!");
            }
            else
            {
                XMessageBox.ShowError("保存失败!");
            }
        }