Пример #1
0
        /// <summary>
        /// 获取指定检查项目代码、价格项目序号的对照记录
        /// </summary>
        /// <param name="ExamItemCode"></param>
        /// <param name="ChargeItemNo"></param>
        /// <returns></returns>
        public override IModel GetModel(string ExamItemCode, string ChargeItemNo)
        {
            strSql = "select * from " + TableName + "  where EXAM_ITEM_CODE='" + ExamItemCode + "' and CHARGE_ITEM_NO=" + ChargeItemNo;
            DataTable dt = GetDataTable(strSql);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            MExamVsCharge model = new MExamVsCharge();

            if (dt.Rows[0]["CHARGE_ITEM_NO"].ToString() == "")
            {
                model.CHARGE_ITEM_NO = null;
            }
            else
            {
                model.CHARGE_ITEM_NO = Convert.ToInt32(dt.Rows[0]["CHARGE_ITEM_NO"].ToString());
            }
            model.CHARGE_ITEM_CODE = dt.Rows[0]["CHARGE_ITEM_CODE"].ToString();
            if (dt.Rows[0]["AMOUNT"].ToString() == "")
            {
                model.AMOUNT = null;
            }
            else
            {
                model.AMOUNT = Convert.ToInt32(dt.Rows[0]["AMOUNT"].ToString());
            }
            model.CHARGE_ITEM_SPEC = dt.Rows[0]["CHARGE_ITEM_SPEC"].ToString();
            model.EXAM_ITEM_CODE   = dt.Rows[0]["EXAM_ITEM_CODE"].ToString();
            model.UNITS            = dt.Rows[0]["UNITS"].ToString();
            return(model);
        }
Пример #2
0
        /// <summary>
        /// 查询是否存在指定的对照记录
        /// </summary>
        /// <param name="imodel"></param>
        /// <returns></returns>
        public override bool Exists(IModel imodel)
        {
            MExamVsCharge model = (MExamVsCharge)imodel;

            strSql = "select * from " + TableName + " where EXAM_ITEM_CODE='" + model.EXAM_ITEM_CODE + "' and CHARGE_ITEM_NO=" + model.CHARGE_ITEM_NO;
            return(recordIsExist(strSql));
        }
Пример #3
0
        /// <summary>
        /// 批量插入对照记录
        /// </summary>
        /// <param name="ht2"></param>
        /// <returns></returns>
        public override int AddMore(Hashtable ht2)
        {
            MExamVsCharge model = new MExamVsCharge();
            Hashtable     ht    = new Hashtable();
            Hashtable     htstr = new Hashtable();

            if (ht2.Count > 0)
            {
                for (int i = 0; i < ht2.Count; i++)
                {
                    ht.Clear();
                    model = (MExamVsCharge)ht2[i];
                    ht.Add("EXAM_ITEM_CODE", model.EXAM_ITEM_CODE);
                    ht.Add("CHARGE_ITEM_NO", model.CHARGE_ITEM_NO);
                    ht.Add("CHARGE_ITEM_CODE", model.CHARGE_ITEM_CODE);
                    ht.Add("CHARGE_ITEM_SPEC", model.CHARGE_ITEM_SPEC);
                    ht.Add("AMOUNT", model.AMOUNT);
                    ht.Add("UNITS", model.UNITS);
                    htstr.Add(i, StringConstructor.InsertSql(TableName, ht).ToString());
                }
                return(ExecuteNonSql(htstr));
            }
            else
            {
                return(0);
            }
        }
Пример #4
0
        /// <summary>
        /// 保存修改检查项目对应的价表对照关系
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Save_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection dgvsrCharge   = dgv_Charge_Item_Dic.SelectedRows;
            DataGridViewSelectedRowCollection dgvsrExamItem = dgv_Exam_Item.SelectedRows;

            if (dgvsrCharge.Count <= 0)
            {
                MessageBoxEx.Show("请选择需要对应的价表项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!SIS.Function.ExpressionValidat.IsNumeric(txt_AMOUNT.Text))
            {
                MessageBoxEx.Show("请输入对应的数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            Hashtable ht     = new Hashtable();
            Hashtable nht    = new Hashtable();
            int       m      = 0;
            int       n      = 0;
            string    exitcd = "";

            foreach (DataGridViewRow dr in dgvsrExamItem)
            {
                int i = 0;
                exitcd = dr.Cells["EXAM_ITEM_CODE"].Value.ToString();
                nht.Add(m, dr.Cells["EXAM_ITEM_CODE"].Value.ToString());
                foreach (DataGridViewRow ndr in dgvsrCharge)
                {
                    MExamVsCharge mevc = new MExamVsCharge();
                    mevc.AMOUNT           = Convert.ToInt16(txt_AMOUNT.Text);
                    mevc.EXAM_ITEM_CODE   = dr.Cells["EXAM_ITEM_CODE"].Value.ToString();
                    mevc.CHARGE_ITEM_NO   = i++;
                    mevc.CHARGE_ITEM_SPEC = ndr.Cells["CHARGE_ITEM_SPEC"].Value.ToString();
                    mevc.CHARGE_ITEM_CODE = ndr.Cells["CHARGE_ITEM_CODE"].Value.ToString();
                    mevc.UNITS            = ndr.Cells["UNITS"].Value.ToString();
                    ht.Add(n, mevc);
                    n++;
                }
                m++;
            }
            int j = bExamCharge.DeleteMore(nht);

            j = bExamCharge.AddMore(ht);
            if (j > 0)
            {
                txt_AMOUNT.Text = "";
                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Find_Exam_vs_CHarge("EXAM_ITEM_CODE='" + exitcd + "' And ");
            }
            else
            {
                MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #5
0
        /// <summary>
        /// 插入一条对照记录
        /// </summary>
        /// <param name="imodel"></param>
        /// <returns></returns>
        public override int Add(IModel imodel)
        {
            MExamVsCharge model = (MExamVsCharge)imodel;
            Hashtable     ht    = new Hashtable();

            ht.Add("EXAM_ITEM_CODE", model.EXAM_ITEM_CODE);
            ht.Add("CHARGE_ITEM_NO", model.CHARGE_ITEM_NO);
            ht.Add("CHARGE_ITEM_CODE", model.CHARGE_ITEM_CODE);
            ht.Add("CHARGE_ITEM_SPEC", model.CHARGE_ITEM_SPEC);
            ht.Add("AMOUNT", model.AMOUNT);
            ht.Add("UNITS", model.UNITS);
            return(ExecuteSql(StringConstructor.InsertSql(TableName, ht).ToString()));
        }