コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                DrugInfo oldDrugInfo = entity;
                DrugInfo sUnit       = this.ucDrugInfo1.InitDrugInfo(entity);
                string   msg         = string.Empty;



                if (!ValidateControls(out msg))
                {
                    return;
                }

                if (_TYPE == OperateType.Add)
                {
                    msg = PharmacyDatabaseService.AddDrugInfoApproveFlow(sUnit, this.ucDrugInfo1.FlowTypeID, AppClientContext.CurrentUser.Id, "新增药品");

                    //SaveData(true);
                }
                else if (_TYPE == OperateType.Edit)
                {
                    msg = PharmacyDatabaseService.ModifyDrugInfoApproveFlow(sUnit, this.ucDrugInfo1.FlowTypeID, AppClientContext.CurrentUser.Id, "修改药品");

                    // SaveData(false);
                }
                if (msg.Length == 0)
                {
                    MessageBox.Show("数据保存成功", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(msg, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                Refresh();
                SetEditMode(false);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log.Error(ex);
            }
        }
コード例 #2
0
ファイル: FormDrugInfo.cs プロジェクト: radtek/phamacy2016
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string msg = String.Empty;
                if (!this.ucGoodsInfo1.ValidateControls(out msg))
                {
                    MessageBox.Show(msg);
                    return;
                }

                this.ucGoodsInfo1.CellectDrugInfo();
                if (!this.ucGoodsInfo1.DataReady)
                {
                    return;
                }
                entity = this.ucGoodsInfo1.DrugInfo;

                if (entity.GoodsType != GoodsType.DrugDomestic && entity.GoodsType != GoodsType.DrugImport)
                {
                    string b = UI.RequiredFieldsCheck <GoodsAdditionalProperty> .CheckRequiredFields(this.ucGoodsInfo1.GoodsAdditional);

                    if (!string.IsNullOrEmpty(b))
                    {
                        MessageBox.Show("您选择的商品类型为非国产药品和进口药品,字段:" + b + ",为必填项,请点击“附属信息”按钮填写完整信息!");
                        return;
                    }
                }

                entity.GoodsAdditionalProperty = this.ucGoodsInfo1.GoodsAdditional;

                if (_TYPE == OperateType.Add)
                {
                    entity.ApprovalStatus = ApprovalStatus.Waitting;
                    entity.IsApproval     = false;
                    Guid typeid = (Guid)this.ucGoodsInfo1.comboBoxFlowID.SelectedValue;
                    entity.FlowID = Guid.NewGuid();
                    msg           = PharmacyDatabaseService.AddDrugInfoApproveFlow(entity, typeid, AppClientContext.CurrentUser.Id, "新增品种信息:" + entity.ProductGeneralName);
                }
                else if (_TYPE == OperateType.Edit)
                {
                    Guid typeid = (Guid)this.ucGoodsInfo1.comboBoxFlowID.SelectedValue;
                    if (entity.IsApproval || entity.ApprovalStatusValue == (int)ApprovalStatus.Reject)
                    {
                        entity.ApprovalStatus = ApprovalStatus.Waitting;
                        entity.IsApproval     = false;
                        entity.FlowID         = Guid.NewGuid();
                        msg = PharmacyDatabaseService.ModifyDrugInfoApproveFlow(entity, typeid, AppClientContext.CurrentUser.Id, "审核后修改品种信息:" + entity.ProductGeneralName);
                    }
                    else
                    {
                        entity.ApprovalStatus = ApprovalStatus.Waitting;
                        msg = PharmacyDatabaseService.ModifyDrugInfoApproveFlow(entity, typeid, AppClientContext.CurrentUser.Id, "审核前修改品种信息" + entity.ProductGeneralName);
                    }
                }

                if (msg.Length == 0)
                {
                    MessageBox.Show("数据保存成功", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(msg, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                SetEditMode(false);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log.Error(ex);
            }
        }