Ejemplo n.º 1
0
 /// <summary>
 /// 新增護送精神病人服務單
 /// </summary>
 public BasicResult CreateToHospitalRecord(MentalillnessToHospitalReqInParm parm)
 {
     using (TphMtcContext context = new TphMtcContext(DbName.TPH_MTC))
     {
         var req = new GenTwoReqInParm <ActionType, MentalillnessToHospitalReqInParm>()
         {
             Parm_01 = ActionType.Add, Parm_02 = parm
         };
         var result = BeginService <GenTwoReqInParm <ActionType, MentalillnessToHospitalReqInParm>, GenOneReqResult <int> >(req, context);
         result = GetAction <ISendHospitalRecord>().Execute(result.RetCode, req);
         result = CommonFinally(result);
         return(new BasicResult(result.RetCode));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新護送精神病人服務單
        /// </summary>
        public BasicResult UpdateToHospitalRecord(MentalillnessToHospitalReqInParm parm)
        {
            if (parm.Id > 0)
            {
                using (TphMtcContext context = new TphMtcContext(DbName.TPH_MTC))
                {
                    var req = new GenTwoReqInParm <ActionType, MentalillnessToHospitalReqInParm>()
                    {
                        Parm_01 = ActionType.Modify, Parm_02 = parm
                    };
                    var result = BeginService <GenTwoReqInParm <ActionType, MentalillnessToHospitalReqInParm>, GenOneReqResult <int> >(req, context);
                    result = GetAction <ISendHospitalRecord>().Execute(result.RetCode, req);
                    result = CommonFinally(result);
                    return(new BasicResult(result.RetCode));
                }
            }

            return(new BasicResult(CommonCode.CheckError)
            {
                Message = "檢查錯誤 查無此案。"
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 取得警政單位
        /// </summary>
        public ResultList <PoliceStationReqInParm> GetPoliceStation(string id)
        {
            var req = new GenOneStringReqInParm()
            {
                Text = id
            };

            using (TphMtcContext context = new TphMtcContext(DbName.TPH_MTC))
            {
                var result = BeginService <GenOneStringReqInParm, GenOneReqResult <List <PoliceStation> > >(req, context);
                try
                {
                    var query = GetAction <IGetPoliceStationById>();
                    result = query.Execute(result.RetCode, req);
                    result = CommonFinally(result);

                    return(new ResultList <PoliceStationReqInParm>()
                    {
                        Code = result.RetCode.ReturnCode,
                        Message = result.RetCode.MessageText,
                        Data = result.Result_01.Select(o => new PoliceStationReqInParm {
                            Address = o.Address, IsDeleted = o.IsDeleted, Name = o.Name, Tel = o.Tel, Zip = o.Zip
                        })
                    });
                }
                catch (Exception ex)
                {
                    Rollback(result, ex);
                    return(new ResultList <PoliceStationReqInParm>()
                    {
                        Code = result.RetCode.ReturnCode,
                        Message = result.RetCode.MessageText,
                        Data = null
                    });
                }
            }
        }