Exemple #1
0
        //申请新药
        public IActionResult ApplyDrug(string op, CHIS.Models.ViewModels.Code_DrugViewModel model, string recid = null)
        {
            return(TryCatchFunc(() =>
            {
                switch (op)
                {
                case "NEW":
                    _drugSvr.SaveNewModel(model, new CHIS_Code_Drug_Main_Apply
                    {
                        ApplyTime = DateTime.Now,
                        OpMan = UserSelf.OpManFullMsg,
                        StationId = UserSelf.StationId,
                        Status = "APPLYING"     //申请中
                    }, UserSelf.OpId, UserSelf.OpMan); return null;

                case "MODIFY":
                    break;

                case "DELETE":
                    break;

                default: throw new Exception("错误的操作码");
                }
                return null;
            }));
        }
Exemple #2
0
        //编辑的页面操作 op=NEWF/NEW/MODIFYF/MODIFY/DELETE ,mold为新增的方法,其中1为西药和成药,2为中药,3为材料,4为处置项,
        public IActionResult CHIS_Code_DrugMsg_Edit(string op, int mold,
                                                    CHIS.Models.ViewModels.Code_DrugViewModel model,//主表,仓库,药房属性
                                                    string recid = null)
        {
            var    now          = DateTime.Now;
            string editViewName = nameof(CHIS_Code_DrugMsg_Edit);
            //判断返回的页面
            //switch (mold)
            string typeTitle = "药品";

            switch (mold)
            {
            case 1:
                typeTitle = "成药";

                break;

            case 2:
                typeTitle = "中草药";
                break;

            case 3:
                typeTitle = "材料";

                break;

            case 4:
                typeTitle = "处置";

                break;

            default:
                typeTitle = "药品";
                break;
            }
            ViewBag.TypeTitle = typeTitle;

            // string editViewName= nameof(CHIS_Code_DrugMsg_Edit);
            var u = UserSelf;

            ViewBag.OP = op;// 初始化操作类别
            switch (ViewBag.OP = op.ToUpper())
            {
            case "NEWF":     //新增页面 空白的数据页面
                return(TryCatchFunc(() =>
                {
                    var modelNew = _drugSvr.GetNewModel(u.OpId, u.OpMan);
                    if (mold == 3 || mold == 4 && modelNew.CHIS_Code_Drug_Outpatient.UnitSmallId > 0)
                    {
                        modelNew.CHIS_Code_Drug_Outpatient.DosageUnitId = modelNew.CHIS_Code_Drug_Outpatient.UnitSmallId;
                    }
                    ViewBag.OP = "NEW";
                    return View(editViewName, modelNew);
                }));

            case "NEW":     // 更新新增的数据
                return(TryCatchFunc(() =>
                {
                    _drugSvr.SaveNewModel(model, null, u.OpId, u.OpMan);
                    return null;
                }));

            case "MODIFYF":     //修改 查找出修改的原始实体数据
                return(TryCatchFunc(() =>
                {
                    now = DateTime.Now;
                    var modelModify = _drugSvr.ModifyInitialModel(recid);
                    ViewBag.OP = "MODIFY";
                    base._setDebugText(now);
                    return View(editViewName, modelModify);
                }));

            case "MODIFY":     //修改后的数据
                return(TryCatchFunc(() =>
                {
                    _drugSvr.SaveModifyModel(model, u.OpId, u.OpMan);
                    return null;
                }));

            case "DELETE":     //删除,返回json
                return(TryCatchFuncW(async() =>
                {
                    await _drugSvr.DeleteAsync(recid);
                    return null;
                }));

            case "VIEW":
                return(TryCatchFunc(() =>
                {
                    var modelModify = _drugSvr.ModifyInitialModel(recid);
                    return View(editViewName, modelModify);
                }));

            default:
                return(View("Error", new Exception("没有定义页面命令!")));
            }
        }