예제 #1
0
        /// <summary>
        /// 装载病案质量问题分类信息
        /// </summary>
        private void LoadHdpProductList()
        {
            this.dgvProductList.Rows.Clear();
            List <HdpProduct> lstHdpProducts = null;
            short             shRet          = HdpProductAccess.Instance.GetHdpProductList(ref lstHdpProducts);

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

                int nRowIndex        = this.dgvProductList.Rows.Add();
                DataTableViewRow row = this.dgvProductList.Rows[nRowIndex];
                row.Tag = hdpProduct; //将记录信息保存到该行
                this.SetRowData(row, hdpProduct);
                this.dgvProductList.SetRowState(row, RowState.Normal);
            }
        }
예제 #2
0
        private void btnCopyGrant_Click(object sender, EventArgs e)
        {
            if (this.cboProduct.SelectedItem == null)
            {
                return;
            }
            HdpProduct        hdpProduct = this.cboProduct.SelectedItem as HdpProduct;
            CopyRoleGrantForm form       = new CopyRoleGrantForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                List <HdpRoleGrant> lstHdpRoleGrant = form.lstHdpRoleGrant;
                foreach (HdpRoleGrant hdpRoleGrant in form.lstHdpRoleGrant)
                {
                    if (dicHdpRoleGrant.ContainsKey(hdpRoleGrant.RoleRightKey))
                    {
                        continue;
                    }
                    foreach (Control item in this.flpGrant.Controls)
                    {
                        CheckBox chk = item as CheckBox;
                        //if ((chk.Tag as RightPoint).RightKey == hdpRoleGrant.RoleRightKey)
                        //{
                        //    chk.Checked = true;
                        //    break;
                        //}
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 增加一行记录
        /// </summary>
        private void AddNewItem()
        {
            //创建数据
            HdpProduct qcEventInfo = new HdpProduct();
            //创建行
            int maxNo = 0;

            foreach (DataTableViewRow oneRow in dgvProductList.Rows)
            {
                string szSerialNO = oneRow.Cells[this.colSerialNO.Index].Value.ToString();
                if (!string.IsNullOrEmpty(szSerialNO) && maxNo < int.Parse(szSerialNO))
                {
                    maxNo = int.Parse(szSerialNO);
                }
            }
            int index            = this.dgvProductList.Rows.Add();
            DataTableViewRow row = this.dgvProductList.Rows[index];

            row.Cells[this.colSerialNO.Index].Value = maxNo + 1;
            row.Tag = qcEventInfo;
            this.dgvProductList.SetRowState(row, RowState.New);
            this.UpdateUIState();
            this.dgvProductList.CurrentCell = row.Cells[this.colNameShort.Index];
            this.dgvProductList.BeginEdit(true);
        }
예제 #4
0
        /// <summary>
        /// 获取指定行最新修改后的数据
        /// </summary>
        /// <param name="row">指定行</param>
        /// <param name="hdpProduct">最新修改后的数据</param>
        /// <returns>bool</returns>
        private bool MakeRowData(DataTableViewRow row, ref HdpProduct hdpProduct)
        {
            if (row == null || row.Index < 0)
            {
                return(false);
            }
            hdpProduct = new HdpProduct();
            HdpProduct oldHdpProduct = row.Tag as HdpProduct;

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

            if (this.dgvProductList.IsDeletedRow(row))
            {
                hdpProduct = oldHdpProduct;
                return(true);
            }
            if (GlobalMethods.Misc.IsEmptyString(row.Cells[this.colSerialNO.Index].Value.ToString()))
            {
                this.dgvProductList.CurrentCell = row.Cells[this.colSerialNO.Index];
                this.dgvProductList.BeginEdit(true);
                MessageBoxEx.Show("您必须设置序号!");
                return(false);
            }
            if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colNameShort.Index].Value))
            {
                this.dgvProductList.CurrentCell = row.Cells[this.colNameShort.Index];
                this.dgvProductList.BeginEdit(true);
                MessageBoxEx.Show("您必须设置产品缩写!");
                return(false);
            }
            if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colEnName.Index].Value))
            {
                this.dgvProductList.CurrentCell = row.Cells[this.colEnName.Index];
                this.dgvProductList.BeginEdit(true);
                MessageBoxEx.Show("您必须设置英文名称!");
                return(false);
            }
            if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colCnName.Index].Value))
            {
                MessageBoxEx.Show("您必须设置中文名称!");
                return(false);
            }
            if (hdpProduct == null)
            {
                hdpProduct = new HdpProduct();
            }
            hdpProduct.SERIAL_NO   = row.Cells[this.colSerialNO.Index].Value.ToString();
            hdpProduct.NAME_SHORT  = (string)row.Cells[this.colNameShort.Index].Value;
            hdpProduct.CN_NAME     = (string)row.Cells[this.colCnName.Index].Value;
            hdpProduct.EN_NAME     = (string)row.Cells[this.colEnName.Index].Value;
            hdpProduct.PRODUCT_BAK = row.Cells[this.colProductBak.Index].Value == null ? "" : (string)row.Cells[this.colProductBak.Index].Value;
            return(true);
        }
예제 #5
0
        private bool LoadCboProducts()
        {
            this.toolcboProduct.Items.Clear();
            this.Update();
            List <HdpProduct> lstHdpProducts = null;
            short             shRet          = HdpProductAccess.Instance.GetHdpProductList(ref lstHdpProducts);

            if (shRet != SystemData.ReturnValue.OK &&
                shRet != SystemData.ReturnValue.RES_NO_FOUND)
            {
                MessageBoxEx.Show("获取产品信息失败!");
                return(false);
            }
            if (lstHdpProducts == null || lstHdpProducts.Count <= 0)
            {
                return(false);
            }
            int selectedIndex = 0;

            for (int index = 0; index < lstHdpProducts.Count; index++)
            {
                HdpProduct hdpProduct = lstHdpProducts[index];
                toolcboProduct.Items.Add(hdpProduct);
                if (hdpProduct.NAME_SHORT == DataCache.Instance.HdpProduct.NAME_SHORT)
                {
                    selectedIndex = index;
                }
            }
            this.toolcboProduct.SelectedIndex = selectedIndex;
            return(true);
        }
예제 #6
0
        /// <summary>
        /// 管理平台,修改一条产品信息
        /// </summary>
        /// <param name="hdpProduct">产品信息</param>
        /// <param name="szOldNameShort">旧的产品缩写</param>
        /// <returns>SystemData.ReturnValue</returns>
        public short ModifyHdpProduct(HdpProduct hdpProduct, string szOldNameShort)
        {
            if (base.MedQCAccess == null)
            {
                return(SystemData.ReturnValue.PARAM_ERROR);
            }

            string szField = string.Format("{0}='{1}',{2}='{3}',{4}='{5}',{6}='{7}',{8}='{9}'"
                                           , SystemData.HdpProductTable.CN_NAME, hdpProduct.CN_NAME
                                           , SystemData.HdpProductTable.EN_NAME, hdpProduct.EN_NAME
                                           , SystemData.HdpProductTable.NAME_SHORT, hdpProduct.NAME_SHORT
                                           , SystemData.HdpProductTable.PRODUCT_BAK, hdpProduct.PRODUCT_BAK
                                           , SystemData.HdpProductTable.SERIAL_NO, hdpProduct.SERIAL_NO);
            string szCondition = string.Format("{0}='{1}'"
                                               , SystemData.HdpProductTable.NAME_SHORT, szOldNameShort);
            string szSQL = string.Format(SystemData.SQL.UPDATE, SystemData.DataTable.HDP_PRODUCT_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);
        }
예제 #7
0
        /// <summary>
        /// 管理平台,保存一条产品信息
        /// </summary>
        /// <param name="HdpProduct">产品信息</param>
        /// <returns>SystemData.ReturnValue</returns>
        public short SaveHdpProduct(HdpProduct hdpProduct)
        {
            string szField = string.Format("{0},{1},{2},{3},{4}"
                                           , SystemData.HdpProductTable.CN_NAME, SystemData.HdpProductTable.EN_NAME
                                           , SystemData.HdpProductTable.NAME_SHORT, SystemData.HdpProductTable.PRODUCT_BAK
                                           , SystemData.HdpProductTable.SERIAL_NO);
            string szValue = string.Format("'{0}','{1}','{2}','{3}','{4}'"
                                           , hdpProduct.CN_NAME, hdpProduct.EN_NAME
                                           , hdpProduct.NAME_SHORT, hdpProduct.PRODUCT_BAK
                                           , hdpProduct.SERIAL_NO
                                           );
            string szSQL  = string.Format(SystemData.SQL.INSERT, SystemData.DataTable.HDP_PRODUCT_T, szField, szValue);
            int    nCount = 0;

            try
            {
                nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("HDPDBAccess.SaveHdpProduct", new string[] { "SQL" }, new object[] { szSQL }, "SQL执行失败!", ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            return(nCount > 0 ? SystemData.ReturnValue.OK : SystemData.ReturnValue.EXCEPTION);
        }
예제 #8
0
        /// <summary>
        /// 设置指定行显示的数据,以及绑定的数据
        /// </summary>
        /// <param name="row">指定行</param>
        /// <param name="hdpProduct">绑定的数据</param>
        /// <returns>bool</returns>
        private bool SetRowData(DataGridViewRow row, HdpProduct hdpProduct)
        {
            if (row == null || row.Index < 0 || hdpProduct == null)
            {
                return(false);
            }
            row.Tag = hdpProduct;
            row.Cells[this.colSerialNO.Index].Value   = hdpProduct.SERIAL_NO;
            row.Cells[this.colCnName.Index].Value     = hdpProduct.CN_NAME;
            row.Cells[this.colEnName.Index].Value     = hdpProduct.EN_NAME;
            row.Cells[this.colNameShort.Index].Value  = hdpProduct.NAME_SHORT;
            row.Cells[this.colProductBak.Index].Value = hdpProduct.PRODUCT_BAK;

            return(true);
        }
예제 #9
0
        /// <summary>
        /// 绘制产品信息
        /// </summary>
        /// <param name="e"></param>
        private void DrawProductInfoNew(PaintEventArgs e)
        {
            string     szProduct  = SystemConfig.Instance.Get(SystemData.ConfigKey.DEFAULT_LOGIN_PRODUCT, "");
            HdpProduct hdpProduct = null;
            short      shRet      = HdpProductAccess.Instance.GetHdpProduct(szProduct, ref hdpProduct);

            if (hdpProduct == null)
            {
                this.DrawProductInfo(e);
                return;
            }
            // 边界
            Rectangle rect = this.ClientRectangle;

            ControlPaint.DrawBorder3D(e.Graphics, rect, Border3DStyle.RaisedOuter);
            DataCache.Instance.HdpProduct = hdpProduct;
            // 产品名称
            rect = new Rectangle(8, 220, 255, 32);
            Font         font         = new Font("黑体", 15, FontStyle.Regular);
            Color        color        = Color.WhiteSmoke;
            SolidBrush   brush        = new SolidBrush(color);
            StringFormat stringFormat = new StringFormat();

            stringFormat.Alignment     = StringAlignment.Far;
            stringFormat.LineAlignment = StringAlignment.Near;
            string szProductCnName = hdpProduct.CN_NAME;

            e.Graphics.DrawString(szProductCnName, font, brush, rect, stringFormat);
            // 产品版本
            rect                       = new Rectangle(8, 245, 255, 16);
            font                       = new Font("宋体", 9, FontStyle.Regular);
            color                      = Color.FromArgb(154, 171, 193);
            brush                      = new SolidBrush(color);
            stringFormat               = new StringFormat();
            stringFormat.Alignment     = StringAlignment.Far;
            stringFormat.LineAlignment = StringAlignment.Near;
            string szProductVersion = hdpProduct.PRODUCT_BAK;

            e.Graphics.DrawString(szProductVersion, font, brush, rect, stringFormat);
            font.Dispose();
            brush.Dispose();
            stringFormat.Dispose();
        }
예제 #10
0
        private void toolbtnCopyGrant_Click(object sender, EventArgs e)
        {
            if (this.toolcboProduct.SelectedItem == null)
            {
                return;
            }
            HdpProduct        hdpProduct = this.toolcboProduct.SelectedItem as HdpProduct;
            CopyRoleGrantForm form       = new CopyRoleGrantForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                List <HdpRoleGrant> lstHdpRoleGrant = form.lstHdpRoleGrant;
                foreach (HdpRoleGrant hdpRoleGrant in form.lstHdpRoleGrant)
                {
                    if (hdpProduct.NAME_SHORT != hdpRoleGrant.Product)
                    {
                        continue;
                    }
                    //判断是否已存在于列表中
                    if (this.CheckGrantRowData(hdpRoleGrant))
                    {
                        continue;
                    }
                    hdpRoleGrant.GrantID  = hdpRoleGrant.MakeGrantID();
                    hdpRoleGrant.RoleCode = this.RoleInfo.RoleCode;
                    int             rowIndex = this.dataGridView1.Rows.Add();
                    DataGridViewRow row      = this.dataGridView1.Rows[rowIndex];
                    row.Tag = hdpRoleGrant;
                    row.Cells[this.colRoleRightKey.Index].Value = hdpRoleGrant.RoleRightKey;

                    row.Cells[this.colRoleRightDesc.Index].Value    = hdpRoleGrant.RoleRightDesc;
                    row.Cells[this.colRoleRightCommand.Index].Value = hdpRoleGrant.RoleRightCommand;

                    this.dataGridView1.SetRowState(rowIndex, RowState.New);
                }
            }
        }
예제 #11
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.dgvProductList.IsNormalRow(row) || this.dgvProductList.IsUnknownRow(row))
            {
                if (!this.dgvProductList.IsDeletedRow(row))
                {
                    return(SystemData.ReturnValue.CANCEL);
                }
            }

            HdpProduct hdpProduct = row.Tag as HdpProduct;

            if (hdpProduct == null)
            {
                return(SystemData.ReturnValue.FAILED);
            }
            string szNameShort = hdpProduct.NAME_SHORT;

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

            short shRet = SystemData.ReturnValue.OK;

            if (this.dgvProductList.IsDeletedRow(row))
            {
                if (!this.dgvProductList.IsNewRow(row))
                {
                    shRet = HdpProductAccess.Instance.DeleteHdpProduct(szNameShort);
                }
                if (shRet != SystemData.ReturnValue.OK)
                {
                    this.dgvProductList.SelectRow(row);
                    MessageBoxEx.Show("无法删除当前记录!");
                    return(SystemData.ReturnValue.FAILED);
                }
                this.dgvProductList.Rows.Remove(row);
            }
            else if (this.dgvProductList.IsModifiedRow(row))
            {
                shRet = HdpProductAccess.Instance.ModifyHdpProduct(hdpProduct, szNameShort);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    this.dgvProductList.SelectRow(row);
                    MessageBoxEx.Show("无法更新当前记录!");
                    return(SystemData.ReturnValue.FAILED);
                }
                row.Tag = hdpProduct;
                this.dgvProductList.SetRowState(row, RowState.Normal);
            }
            else if (this.dgvProductList.IsNewRow(row))
            {
                shRet = HdpProductAccess.Instance.SaveHdpProduct(hdpProduct);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    this.dgvProductList.SelectRow(row);
                    MessageBoxEx.Show("无法保存当前记录!");
                    return(SystemData.ReturnValue.FAILED);
                }
                row.Tag = hdpProduct;
                this.dgvProductList.SetRowState(row, RowState.Normal);
            }

            return(SystemData.ReturnValue.OK);
        }
예제 #12
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string szUserID = this.txtUserID.Text.Trim().ToUpper();

            if (GlobalMethods.Misc.IsEmptyString(szUserID))
            {
                MessageBoxEx.Show("请输入您的用户ID!");
                this.txtUserID.Focus();
                this.txtUserID.SelectAll();
                return;
            }
            this.Cursor = Cursors.WaitCursor;

            //获取用户信息
            UserInfo userInfo = null;

            if (szUserID.ToUpper() == "ADMINISTRATOR")
            {
                szUserID           = "administrator";//管理员账户要小写
                userInfo           = new UserInfo();
                userInfo.USER_ID   = szUserID;
                userInfo.USER_NAME = "管理员";
                goto ADMINISTRATOR_LOGIN;
            }
            short shRet = UserAccess.Instance.GetUserInfo(szUserID, ref userInfo);

            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.Show("登录失败,系统无法获取用户信息!");
                this.Cursor = Cursors.Default;
                return;
            }
            if (userInfo == null)
            {
                MessageBoxEx.Show("您输入的账号非法!");
                this.txtUserID.Focus();
                this.txtUserID.SelectAll();
                this.Cursor = Cursors.Default;
                return;
            }

            //查询用户权限信息
            UserRightType rightType     = UserRightType.MedQC;
            UserRightBase userRightBase = null;

            shRet = RightAccess.Instance.GetUserRight(szUserID, rightType, ref userRightBase);
            if (shRet != SystemData.ReturnValue.OK &&
                shRet != SystemData.ReturnValue.RES_NO_FOUND)
            {
                MessageBoxEx.Show("登录失败,系统无法获取用户权限!");
                this.Cursor = Cursors.Default;
                return;
            }

            //验证用户输入的密码
ADMINISTRATOR_LOGIN:
            shRet = RightAccess.Instance.VerifyUser(szUserID, this.txtUserPwd.Text);
            if (shRet == SystemData.ReturnValue.FAILED)
            {
                MessageBoxEx.Show("您输入的登录口令错误!");
                this.txtUserPwd.Focus();
                this.txtUserPwd.SelectAll();
                this.Cursor = Cursors.Default;
                return;
            }
            if (shRet != SystemData.ReturnValue.OK &&
                shRet != SystemData.ReturnValue.RES_NO_FOUND)
            {
                MessageBoxEx.Show("登录失败,系统无法验证用户信息!");
                this.Cursor = Cursors.Default;
                return;
            }
            this.Cursor = Cursors.Default;
            SystemParam.Instance.UserInfo = userInfo;
            SystemConfig.Instance.Write(SystemData.ConfigKey.DEFAULT_LOGIN_USERID, szUserID);
            HdpProduct hdpProduct = (this.cboProduct.SelectedItem as HdpProduct);

            if (hdpProduct == null)
            {
                MessageBoxEx.Show("网络出现异常!");
                return;
            }
            string szProduct = hdpProduct.NAME_SHORT;

            SystemConfig.Instance.Write(SystemData.ConfigKey.DEFAULT_LOGIN_PRODUCT, szProduct);
            DataCache.Instance.HdpProduct = this.cboProduct.SelectedItem as HdpProduct;

            //查找用户角色
            List <HdpRoleUser> lstHdpRoleUser = null;

            shRet = HdpRoleUserAccess.Instance.GetHdpRoleUserList(szUserID, ref lstHdpRoleUser);
            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.Show("登录失败,系统无法获取用户权限!");
                this.Cursor = Cursors.Default;
                return;
            }
            //缓存用户角色权限信息
            List <HdpRoleGrant> lstHdpAllRoleGrant = new List <HdpRoleGrant>();

            foreach (HdpRoleUser item in lstHdpRoleUser)
            {
                List <HdpRoleGrant> lstHdpRoleGrant = new List <HdpRoleGrant>();
                shRet = HdpRoleGrantAccess.Instance.GetHdpRoleGrantList(item.RoleCode, string.Empty, ref lstHdpRoleGrant);
                if (shRet == SystemData.ReturnValue.OK)
                {
                    lstHdpAllRoleGrant.AddRange(lstHdpRoleGrant);
                }
            }
            DataCache.Instance.QcAdminDepts       = null;
            DataCache.Instance.DicHdpParameter    = null;
            DataCache.Instance.RoleName           = string.Join(",", lstHdpRoleUser.Select(m => m.RoleName).ToArray());
            RightHandler.Instance.LstHdpRoleGrant = lstHdpAllRoleGrant;

            this.DialogResult = DialogResult.OK;
        }
예제 #13
0
        public short GetHdpProduct(string szNameShort, ref HdpProduct hdpProduct)
        {
            if (base.MedQCAccess == null)
            {
                return(SystemData.ReturnValue.PARAM_ERROR);
            }

            StringBuilder sbField = new StringBuilder();

            sbField.AppendFormat("{0},", SystemData.HdpProductTable.CN_NAME);
            sbField.AppendFormat("{0},", SystemData.HdpProductTable.EN_NAME);
            sbField.AppendFormat("{0},", SystemData.HdpProductTable.NAME_SHORT);
            sbField.AppendFormat("{0},", SystemData.HdpProductTable.PRODUCT_BAK);
            sbField.AppendFormat("{0}", SystemData.HdpProductTable.SERIAL_NO);
            string szCondition = string.Format("1=1");

            if (!string.IsNullOrEmpty(szNameShort))
            {
                szCondition = string.Format("{0} AND {1} = '{2}'"
                                            , szCondition
                                            , SystemData.HdpProductTable.NAME_SHORT
                                            , szNameShort);
            }
            string szSQL = string.Format(SystemData.SQL.SELECT_WHERE
                                         , sbField.ToString(), SystemData.DataTable.HDP_PRODUCT_T, szCondition);

            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 (hdpProduct == null)
                {
                    hdpProduct = new HdpProduct();
                }
                for (int i = 0; i < dataReader.FieldCount; i++)
                {
                    if (dataReader.IsDBNull(i))
                    {
                        continue;
                    }
                    switch (dataReader.GetName(i))
                    {
                    case SystemData.HdpProductTable.CN_NAME:
                        hdpProduct.CN_NAME = dataReader.GetString(i);
                        break;

                    case SystemData.HdpProductTable.EN_NAME:
                        hdpProduct.EN_NAME = dataReader.GetString(i);
                        break;

                    case SystemData.HdpProductTable.NAME_SHORT:
                        hdpProduct.NAME_SHORT = dataReader.GetString(i);
                        break;

                    case SystemData.HdpProductTable.PRODUCT_BAK:
                        hdpProduct.PRODUCT_BAK = dataReader.GetString(i);
                        break;

                    case SystemData.HdpProductTable.SERIAL_NO:
                        hdpProduct.SERIAL_NO = dataReader.GetValue(i).ToString();
                        break;

                    default: break;
                    }
                }
                return(SystemData.ReturnValue.OK);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            finally { base.MedQCAccess.CloseConnnection(false); }
        }
예제 #14
0
        /// <summary>
        /// 管理平台,获取产品信息列表
        /// </summary>
        /// <param name="lstHdpProduct">产品信息列表</param>
        /// <returns>SystemData.ReturnValue</returns>
        public short GetHdpProductList(ref List <HdpProduct> lstHdpProduct)
        {
            if (base.MedQCAccess == null)
            {
                return(SystemData.ReturnValue.PARAM_ERROR);
            }

            string szField = string.Format("{0},{1},{2},{3},{4}"
                                           , SystemData.HdpProductTable.SERIAL_NO
                                           , SystemData.HdpProductTable.NAME_SHORT
                                           , SystemData.HdpProductTable.CN_NAME
                                           , SystemData.HdpProductTable.EN_NAME
                                           , SystemData.HdpProductTable.PRODUCT_BAK);

            string szSQL = string.Format(SystemData.SQL.SELECT_ORDER_ASC, szField
                                         , SystemData.DataTable.HDP_PRODUCT_T, SystemData.HdpProductTable.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 (lstHdpProduct == null)
                {
                    lstHdpProduct = new List <HdpProduct>();
                }
                do
                {
                    HdpProduct hdpProduct = new HdpProduct();
                    if (!dataReader.IsDBNull(0))
                    {
                        hdpProduct.SERIAL_NO = dataReader.GetValue(0).ToString();
                    }
                    if (!dataReader.IsDBNull(1))
                    {
                        hdpProduct.NAME_SHORT = dataReader.GetString(1);
                    }
                    if (!dataReader.IsDBNull(2))
                    {
                        hdpProduct.CN_NAME = dataReader.GetString(2);
                    }
                    if (!dataReader.IsDBNull(3))
                    {
                        hdpProduct.EN_NAME = dataReader.GetString(3);
                    }
                    if (!dataReader.IsDBNull(4))
                    {
                        hdpProduct.PRODUCT_BAK = dataReader.GetString(4);
                    }
                    lstHdpProduct.Add(hdpProduct);
                } while (dataReader.Read());
                return(SystemData.ReturnValue.OK);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("HDPDBAccess.GetHdpProductList", 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);
            }
        }