Exemplo n.º 1
0
        internal void DrugDel()
        {
            int rowIndex = dataGridView1.CurrentCell.RowIndex;

            if (rowIndex < 0)
            {
                return;
            }

            if (MessageBox.Show(this, "是否确认删除所选择的药品字典?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            DataGridViewRow row = dataGridView1.Rows[rowIndex];

            DrugShop.Entities.Dict dict = row.DataBoundItem as DrugShop.Entities.Dict;

            try
            {
                //删除操作
                dict.Delete();

                //删除列表中的该行记录
                this.dataGridView1.Rows.Remove(row);
            }
            catch (System.Exception exc)
            {
                MessageBox.Show(this, "在删除药品字典时出错,错误:" + exc.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!this.ValidInput())
            {
                this.canClosed = false;
                return;
            }

            try
            {
                DrugShop.Entities.Dict drugDict = null;

                if (this.DrugDict == null)
                {
                    drugDict         = new DrugShop.Entities.Dict();
                    drugDict.ID      = ServiceContainer.GetService <IDrugDictService>().GetMaxCodeIDN();
                    drugDict.Remarks = string.Empty;
                }
                else
                {
                    drugDict = this.DrugDict;
                }

                drugDict.Code       = this.tbCode.Text;
                drugDict.ChinseName = this.tbChinseName.Text;

                drugDict.Type = this.cbxType.SelectedValue == null ? 0 : (int)this.cbxType.SelectedValue;

                drugDict.Spec       = this.tbSpec.Text;
                drugDict.Unit       = this.tbUnit.Content;
                drugDict.Price      = this.nudPrice.Value;
                drugDict.DownLimit  = (int)this.nudDown.Value;
                drugDict.UpLimit    = (int)this.nudUp.Value;
                drugDict.FileNo     = this.tbFileNo.Text.Trim();
                drugDict.InputCode1 = this.tbInputCode1.Text;
                drugDict.Effect     = this.tbEffect.Text.Trim();

                drugDict.Isotc = this.rbOTCYes.Checked ? 1 : 0;

                drugDict.Isenable = 1;

                if (this.DrugDict == null)
                {
                    drugDict.Insert();
                }
                else
                {
                    drugDict.Update();
                }

                this.canClosed    = true;
                this.DrugDict     = drugDict;
                this.DialogResult = DialogResult.OK;
            }
            catch (System.Exception exc)
            {
                MessageBox.Show(this, "ÔÚ±£´æÒ©Æ·×Öµäʱ³ö´í£¬´íÎó£º" + exc.Message, "´íÎóÌáʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.canClosed = false;
            }
        }
Exemplo n.º 3
0
        internal void DrugProp()
        {
            int rowIndex = dataGridView1.CurrentCell.RowIndex;

            if (rowIndex < 0)
            {
                return;
            }
            DataGridViewRow row = dataGridView1.Rows[rowIndex];

            DrugShop.Entities.Dict dict = row.DataBoundItem as DrugShop.Entities.Dict;

            DrugShop.Entities.Dict dict1 = CommonHelper.GetDataGridViewSelectRow <Dict>(this.dataGridView1);

            DrugDictEditor Editor = new DrugDictEditor();

            Editor.Initialize();
            Editor.DrugDict = dict;
            if (Editor.ShowDialog() == DialogResult.OK)
            {
                dict = Editor.DrugDict;
                CommonHelper.RefreshDataGridView <Dict>(dict, row, dataGridView1);
            }
        }