Пример #1
0
        /// <summary>
        /// 管理平台,保存一条角色信息
        /// </summary>
        /// <param name="HdpUIConfig">角色信息</param>
        /// <returns>SystemData.ReturnValue</returns>
        public short SaveHdpRole(HdpRole hdpRole)
        {
            string szField = string.Format("{0},{1},{2},{3},{4}"
                                           , SystemData.HdpRoleTable.ROLE_BAK
                                           , SystemData.HdpRoleTable.ROLE_CODE
                                           , SystemData.HdpRoleTable.ROLE_NAME
                                           , SystemData.HdpRoleTable.SERIAL_NO
                                           , SystemData.HdpRoleTable.STATUS);
            string szValue = string.Format("'{0}','{1}','{2}','{3}','{4}'"
                                           , hdpRole.RoleBak
                                           , hdpRole.RoleCode
                                           , hdpRole.RoleName
                                           , hdpRole.SerialNo
                                           , hdpRole.Status);
            string szSQL = string.Format(SystemData.SQL.INSERT, SystemData.DataTable.HDP_ROLE_T, szField, szValue);

            int nCount = 0;

            try
            {
                nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("HDPDBAccess.SaveHdpParameter", new string[] { "SQL" }, new object[] { szSQL }, "SQL执行失败!", ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            return(nCount > 0 ? SystemData.ReturnValue.OK : SystemData.ReturnValue.EXCEPTION);
        }
Пример #2
0
        /// <summary>
        /// 管理平台,修改一条产品信息
        /// </summary>
        /// <param name="hdpUIConfig">产品信息</param>
        /// <param name="szOldNameShort">旧的产品缩写</param>
        /// <returns>SystemData.ReturnValue</returns>
        public short ModifyHdpRole(string szOldRoleCode, HdpRole hdpRole)
        {
            if (base.MedQCAccess == null)
            {
                return(SystemData.ReturnValue.PARAM_ERROR);
            }

            string szField = string.Format("{0}='{1}',{2}='{3}',{4}='{5}',{6}='{7}',{8}='{9}'"
                                           , SystemData.HdpRoleTable.ROLE_BAK, hdpRole.RoleBak
                                           , SystemData.HdpRoleTable.ROLE_CODE, hdpRole.RoleCode
                                           , SystemData.HdpRoleTable.ROLE_NAME, hdpRole.RoleName
                                           , SystemData.HdpRoleTable.SERIAL_NO, hdpRole.SerialNo
                                           , SystemData.HdpRoleTable.STATUS, hdpRole.Status);
            string szCondition = string.Format("{0}='{1}'"
                                               , SystemData.HdpRoleTable.ROLE_CODE, szOldRoleCode);
            string szSQL = string.Format(SystemData.SQL.UPDATE, SystemData.DataTable.HDP_ROLE_T, szField, szCondition);

            int nCount = 0;

            try
            {
                nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("HDPDBAccess.ModifyHdpProduct", new string[] { "SQL" }, new object[] { szSQL }, "SQL执行失败!", ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            return(nCount > 0 ? SystemData.ReturnValue.OK : SystemData.ReturnValue.EXCEPTION);
        }
Пример #3
0
        private void LoadHdpRoleList()
        {
            this.dataGridView1.Rows.Clear();
            List <HdpRole> lstHdpRoles = null;
            short          shRet       = HdpRoleAccess.Instance.GetHdpRoleList(string.Empty, ref lstHdpRoles);

            if (shRet != SystemData.ReturnValue.OK &&
                shRet != SystemData.ReturnValue.RES_NO_FOUND)
            {
                MessageBoxEx.Show("获取病案质量问题分类字典失败!");
                return;
            }
            if (lstHdpRoles == null || lstHdpRoles.Count <= 0)
            {
                return;
            }
            for (int index = 0; index < lstHdpRoles.Count; index++)
            {
                HdpRole hdpRole = lstHdpRoles[index];

                int nRowIndex        = this.dataGridView1.Rows.Add();
                DataTableViewRow row = this.dataGridView1.Rows[nRowIndex];
                row.Tag = hdpRole; //将记录信息保存到该行
                this.SetRowData(row, hdpRole);
                this.dataGridView1.SetRowState(row, RowState.Normal);
            }
        }
Пример #4
0
        private void toolbtnSave_Click(object sender, EventArgs e)
        {
            if (this.m_lstCheckHdpRoleUser == null)
            {
                this.m_lstCheckHdpRoleUser = new List <HdpRoleUser>();
            }
            m_lstCheckHdpRoleUser.Clear();
            for (int index = 0; index < this.dataGridView1.Rows.Count; index++)
            {
                HdpRole hdpRole = this.dataGridView1.Rows[index].Tag as HdpRole;
                if ((bool)this.dataGridView1.Rows[index].Cells[this.colCheckBox.Index].Value == true)
                {
                    HdpRoleUser hdpRoleUser = new HdpRoleUser();
                    hdpRoleUser.UserID   = this.m_UserInfo.USER_ID;
                    hdpRoleUser.RoleCode = hdpRole.RoleCode;
                    m_lstCheckHdpRoleUser.Add(hdpRoleUser);
                }
            }
            short shRet = HdpRoleUserAccess.Instance.SaveRoleUserList(this.m_UserInfo.USER_ID, CheckHdpRoleUserList);
            //兼容用户登录,插入一条用户账号密码信息到USER_RIGHT_T表中
            UserRightBase userRight = UserRightBase.Create(UserRightType.MedQC);

            userRight.UserID    = this.m_UserInfo.USER_ID;
            userRight.RightType = UserRightType.MedQC;
            shRet = RightAccess.Instance.GetUserRight(this.m_UserInfo.USER_ID, UserRightType.MedQC, ref userRight);

            shRet = RightAccess.Instance.SaveUserRight(userRight);
            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.ShowError("授权失败");
                return;
            }
            MessageBoxEx.ShowMessage("授权成功");
            this.DialogResult = DialogResult.OK;
        }
Пример #5
0
        /// <summary>
        /// 获取指定行最新修改后的数据
        /// </summary>
        /// <param name="row">指定行</param>
        /// <param name="hdpRole">最新修改后的数据</param>
        /// <returns>bool</returns>
        private bool MakeRowData(DataTableViewRow row, ref HdpRole hdpRole)
        {
            if (row == null || row.Index < 0)
            {
                return(false);
            }
            hdpRole = new  HdpRole();
            HdpRole oldHdpRole = row.Tag as  HdpRole;

            if (!this.dgvRoleList.IsNewRow(row))
            {
                if (oldHdpRole == null)
                {
                    MessageBoxEx.Show("质量问题分类字典行数据信息为空!");
                    return(false);
                }
            }

            if (this.dgvRoleList.IsDeletedRow(row))
            {
                hdpRole = oldHdpRole;
                return(true);
            }
            if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colSerialNO.Index].Value))
            {
                this.dgvRoleList.CurrentCell = row.Cells[this.colSerialNO.Index];
                this.dgvRoleList.BeginEdit(true);
                MessageBoxEx.Show("您必须设置序号!");
                return(false);
            }
            if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colRoleName.Index].Value))
            {
                this.dgvRoleList.CurrentCell = row.Cells[this.colRoleName.Index];
                this.dgvRoleList.BeginEdit(true);
                MessageBoxEx.Show("您必须设置角色名称!");
                return(false);
            }
            if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colRoleCode.Index].Value))
            {
                this.dgvRoleList.CurrentCell = row.Cells[this.colRoleCode.Index];
                this.dgvRoleList.BeginEdit(true);
                MessageBoxEx.Show("您必须设置角色代码!");
                return(false);
            }
            if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colStatus.Index].Value))
            {
                MessageBoxEx.Show("您必须设置状态!");
                return(false);
            }
            if (hdpRole == null)
            {
                hdpRole = new  HdpRole();
            }
            hdpRole.SerialNo = (string)row.Cells[this.colSerialNO.Index].Value;
            hdpRole.RoleName = (string)row.Cells[this.colRoleName.Index].Value;
            hdpRole.RoleCode = (string)row.Cells[this.colRoleCode.Index].Value;
            hdpRole.Status   = (string)row.Cells[this.colStatus.Index].Value == "开启"?"1":"0";
            hdpRole.RoleBak  = row.Cells[this.colRoleBak.Index].Value == null ? "" : (string)row.Cells[this.colRoleBak.Index].Value;
            return(true);
        }
Пример #6
0
        /// <summary>
        /// 设置指定行显示的数据,以及绑定的数据
        /// </summary>
        /// <param name="row">指定行</param>
        /// <param name="hdpRole">绑定的数据</param>
        /// <returns>bool</returns>
        private bool SetRowData(DataGridViewRow row, HdpRole hdpRole)
        {
            if (row == null || row.Index < 0 || hdpRole == null)
            {
                return(false);
            }
            row.Tag = hdpRole;
            row.Cells[this.colRoleName.Index].Value = hdpRole.RoleName;
            row.Cells[this.colRoleCode.Index].Value = hdpRole.RoleCode;
            row.Cells[this.colCheckBox.Index].Value = false;

            return(true);
        }
Пример #7
0
        /// <summary>
        /// 增加一行记录
        /// </summary>
        private void AddNewItem()
        {
            //创建数据
            HdpRole qcEventInfo = new  HdpRole();
            //创建行
            int index            = this.dgvRoleList.Rows.Add();
            DataTableViewRow row = this.dgvRoleList.Rows[index];

            row.Tag = qcEventInfo;
            this.dgvRoleList.SetRowState(row, RowState.New);
            this.UpdateUIState();

            this.dgvRoleList.CurrentCell = row.Cells[this.colSerialNO.Index];
            this.dgvRoleList.BeginEdit(true);
        }
Пример #8
0
        /// <summary>
        /// 设置指定行显示的数据,以及绑定的数据
        /// </summary>
        /// <param name="row">指定行</param>
        /// <param name="hdpRole">绑定的数据</param>
        /// <returns>bool</returns>
        private bool SetRowData(DataGridViewRow row, HdpRole hdpRole)
        {
            if (row == null || row.Index < 0 || hdpRole == null)
            {
                return(false);
            }
            row.Tag = hdpRole;
            row.Cells[this.colSerialNO.Index].Value = hdpRole.SerialNo;
            row.Cells[this.colRoleName.Index].Value = hdpRole.RoleName;
            row.Cells[this.colRoleCode.Index].Value = hdpRole.RoleCode;
            row.Cells[this.colStatus.Index].Value   = hdpRole.Status == "1"?"开启":"关闭";
            row.Cells[this.colRoleBak.Index].Value  = hdpRole.RoleBak;

            return(true);
        }
Пример #9
0
        private void toolbtnSave_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count <= 0)
            {
                return;
            }
            HdpRole hdpRole = this.dataGridView1.SelectedRows[0].Tag as HdpRole;
            short   shRet   = HdpRoleGrantAccess.Instance.GetHdpRoleGrantList(hdpRole.RoleCode, string.Empty, ref this.m_lstHdpRoleGrant);

            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.Show("该角色未找到授权信息,无法复制");
                return;
            }
            this.DialogResult = DialogResult.OK;
        }
Пример #10
0
        private void toolbtnAuthority_Click(object sender, EventArgs e)
        {
            if (this.dgvRoleList.SelectedRows.Count <= 0)
            {
                return;
            }
            HdpRole hdpRole = this.dgvRoleList.SelectedRows[0].Tag as HdpRole;

            if (hdpRole == null)
            {
                MessageBoxEx.Show("获取角色信息失败");
                return;
            }
            //RoleGrantForm form = new RoleGrantForm();
            RoleGrantCheckListForm form = new RoleGrantCheckListForm();

            form.RoleInfo = hdpRole;
            form.ShowDialog();
        }
Пример #11
0
 private void UserGrantForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (this.m_lstCheckHdpRoleUser == null)
     {
         this.m_lstCheckHdpRoleUser = new List <HdpRoleUser>();
     }
     this.m_lstCheckHdpRoleUser.Clear();
     for (int index = 0; index < this.dataGridView1.Rows.Count; index++)
     {
         HdpRole hdpRole = this.dataGridView1.Rows[index].Tag as HdpRole;
         if ((bool)this.dataGridView1.Rows[index].Cells[this.colCheckBox.Index].Value == true)
         {
             HdpRoleUser hdpRoleUser = new HdpRoleUser();
             hdpRoleUser.UserID   = this.m_UserInfo.USER_ID;
             hdpRoleUser.RoleCode = hdpRole.RoleCode;
             hdpRoleUser.RoleName = this.dataGridView1.Rows[index].Cells[this.colRoleName.Index].Value.ToString();
             this.m_lstCheckHdpRoleUser.Add(hdpRoleUser);
         }
     }
 }
Пример #12
0
 /// <summary>
 /// 设置指定行显示的数据,以及绑定的数据
 /// </summary>
 /// <param name="row">指定行</param>
 /// <param name="hdpRole">绑定的数据</param>
 /// <returns>bool</returns>
 private bool SetRowData(DataGridViewRow row, HdpRole hdpRole)
 {
     if (row == null || row.Index < 0 || hdpRole == null)
     {
         return(false);
     }
     row.Tag = hdpRole;
     row.Cells[this.colRoleName.Index].Value = hdpRole.RoleName;
     row.Cells[this.colRoleCode.Index].Value = hdpRole.RoleCode;
     row.Cells[this.colStatus.Index].Value   = hdpRole.Status == "1" ? "开启" : "关闭";
     row.Cells[this.colCheckBox.Index].Value = false;
     foreach (HdpRoleUser item in this.m_lstHdpRoleUser)
     {
         if (item.RoleCode == hdpRole.RoleCode)
         {
             row.Cells[this.colCheckBox.Index].Value = true;
             break;
         }
     }
     return(true);
 }
Пример #13
0
        /// <summary>
        /// 管理平台,获取角色管理列表
        /// </summary>
        /// <param name="szRoleName"></param>
        /// <param name="lstHdpRole"></param>
        /// <returns></returns>
        public short GetHdpRoleList(string szRoleName, ref List <HdpRole> lstHdpRole)
        {
            if (base.MedQCAccess == null)
            {
                return(SystemData.ReturnValue.PARAM_ERROR);
            }

            string szField = string.Format("{0},{1},{2},{3},{4}"
                                           , SystemData.HdpRoleTable.SERIAL_NO
                                           , SystemData.HdpRoleTable.ROLE_NAME
                                           , SystemData.HdpRoleTable.ROLE_CODE
                                           , SystemData.HdpRoleTable.STATUS
                                           , SystemData.HdpRoleTable.ROLE_BAK
                                           );
            string szCondition = string.Format(" 1=1 ");

            if (!string.IsNullOrEmpty(szRoleName))
            {
                szCondition = string.Format("{0} and {1}='{2}'"
                                            , szCondition
                                            , SystemData.HdpRoleTable.ROLE_NAME, szRoleName);
            }
            string szSQL = string.Format(SystemData.SQL.SELECT_WHERE_ORDER_ASC, szField
                                         , SystemData.DataTable.HDP_ROLE_T
                                         , szCondition
                                         , SystemData.HdpRoleTable.SERIAL_NO);
            IDataReader dataReader = null;

            try
            {
                dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text);
                if (dataReader == null || dataReader.IsClosed || !dataReader.Read())
                {
                    return(SystemData.ReturnValue.RES_NO_FOUND);
                }
                if (lstHdpRole == null)
                {
                    lstHdpRole = new List <HdpRole>();
                }
                do
                {
                    HdpRole hdpRole = new HdpRole();
                    if (!dataReader.IsDBNull(0))
                    {
                        hdpRole.SerialNo = dataReader.GetValue(0).ToString();
                    }
                    if (!dataReader.IsDBNull(1))
                    {
                        hdpRole.RoleName = dataReader.GetString(1);
                    }
                    if (!dataReader.IsDBNull(2))
                    {
                        hdpRole.RoleCode = dataReader.GetString(2);
                    }
                    if (!dataReader.IsDBNull(3))
                    {
                        hdpRole.Status = dataReader.GetString(3);
                    }
                    if (!dataReader.IsDBNull(4))
                    {
                        hdpRole.RoleBak = dataReader.GetString(4);
                    }

                    lstHdpRole.Add(hdpRole);
                } while (dataReader.Read());
                return(SystemData.ReturnValue.OK);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("HDPDBAccess.GetHdpRoleList", new string[] { "szSQL" }, new object[] { szSQL }, ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            finally
            {
                if (dataReader != null)
                {
                    dataReader.Close();
                    dataReader.Dispose();
                    dataReader = null;
                }
                base.MedQCAccess.CloseConnnection(false);
            }
        }
Пример #14
0
        /// <summary>
        /// 保存指定行的数据到远程数据表,需要注意的是:行的删除状态会与其他状态共存
        /// </summary>
        /// <param name="row">指定行</param>
        /// <returns>SystemData.ReturnValue</returns>
        private short SaveRowData(DataTableViewRow row)
        {
            if (row == null || row.Index < 0)
            {
                return(SystemData.ReturnValue.FAILED);
            }
            if (this.dgvRoleList.IsNormalRow(row) || this.dgvRoleList.IsUnknownRow(row))
            {
                if (!this.dgvRoleList.IsDeletedRow(row))
                {
                    return(SystemData.ReturnValue.CANCEL);
                }
            }

            HdpRole hdpRole = row.Tag as  HdpRole;

            if (hdpRole == null)
            {
                return(SystemData.ReturnValue.FAILED);
            }
            string szRoleCode = hdpRole.RoleCode;

            hdpRole = null;
            if (!this.MakeRowData(row, ref hdpRole))
            {
                return(SystemData.ReturnValue.FAILED);
            }

            short shRet = SystemData.ReturnValue.OK;

            if (this.dgvRoleList.IsDeletedRow(row))
            {
                if (!this.dgvRoleList.IsNewRow(row))
                {
                    shRet = HdpRoleAccess.Instance.DeleteHdpRole(szRoleCode);
                }
                if (shRet != SystemData.ReturnValue.OK)
                {
                    this.dgvRoleList.SelectRow(row);
                    MessageBoxEx.Show("无法删除当前记录!");
                    return(SystemData.ReturnValue.FAILED);
                }
                this.dgvRoleList.Rows.Remove(row);
            }
            else if (this.dgvRoleList.IsModifiedRow(row))
            {
                shRet = HdpRoleAccess.Instance.ModifyHdpRole(szRoleCode, hdpRole);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    this.dgvRoleList.SelectRow(row);
                    MessageBoxEx.Show("无法更新当前记录!");
                    return(SystemData.ReturnValue.FAILED);
                }
                row.Tag = hdpRole;
                this.dgvRoleList.SetRowState(row, RowState.Normal);
            }
            else if (this.dgvRoleList.IsNewRow(row))
            {
                shRet = HdpRoleAccess.Instance.SaveHdpRole(hdpRole);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    this.dgvRoleList.SelectRow(row);
                    MessageBoxEx.Show("无法保存当前记录!");
                    return(SystemData.ReturnValue.FAILED);
                }
                row.Tag = hdpRole;
                this.dgvRoleList.SetRowState(row, RowState.Normal);
            }
            return(SystemData.ReturnValue.OK);
        }