public JsonResult UpdatePatientVillage(VVillages location) { try { if (location.Villageid == 0 || location.Villageid == null) { var addedvillage = _village.Add(new VVillages() { Village = location.Village, Wardid = location.Wardid }); location.Villageid = addedvillage.ID; } if (location.Patientid == 0) { return(Json(new { Result = "ERROR", Message = "Please Add Biodata First" })); } else { //Update patient location _patient.UpdatePatientLocation(location.Patientid, location.Villageid.Value); return(Json(new { Result = "OK" })); } } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public static bool Add(BaseVillage model) { if (model == null) { throw new ArgumentNullException("model"); } if (string.IsNullOrWhiteSpace(model.VNo)) { throw new ArgumentNullException("小区编号不能为空"); } model.VID = GuidGenerator.GetGuid().ToString(); IVillage factory = VillageFactory.GetFactory(); BaseVillage dbModel = factory.QueryVillageByVillageNo(model.VNo, model.CPID); if (dbModel != null) { throw new MyException("小区编号已经存在"); } dbModel = factory.QueryVillageByProxyNo(model.ProxyNo); if (dbModel != null) { throw new MyException("代理编号已存在"); } bool result = factory.Add(model); if (result) { OperateLogServices.AddOperateLog <BaseVillage>(model, OperateType.Add); } return(result); }
/// <summary> /// 创建默认小区 /// </summary> /// <param name="model"></param> /// <param name="dbOperator"></param> /// <returns></returns> public static bool AddVillageDefaultUser(BaseVillage model, DbOperator dbOperator) { model.DataStatus = DataStatus.Normal; model.LastUpdateTime = DateTime.Now; model.HaveUpdate = SystemDefaultConfig.DataUpdateFlag; IVillage factory = VillageFactory.GetFactory(); bool result = factory.Add(model, dbOperator); if (result) { OperateLogServices.AddOperateLog <BaseVillage>(model, OperateType.Add); } return(result); }
public IHttpActionResult Add(TOURIS_TV_VILLAGE villageView) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.DataIsntValid))); return(Content(HttpStatusCode.NotFound, resObj)); } TOURIS_TM_VILLAGE village = new TOURIS_TM_VILLAGE(); village.DISTRICT_ID = villageView.DISTRICT_ID; village.VILLAGE_CODE = villageView.VILLAGE_CODE; village.VILLAGE_NAME = villageView.VILLAGE_NAME; village.VILLAGE_DESCRIPTION = villageView.VILLAGE_DESCRIPTION; village.CREATED_BY = villageView.CREATED_BY; village.CREATED_TIME = villageView.CREATED_TIME; village.ROW_STATUS = eStat.fg.IsActive; rs = repo.Add(village); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Save, new Exception(eFunc.fg.SFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }