/// <summary> /// 添加记录操作 /// </summary> protected void AddRecord() { HttpContext context = HttpContext.Current; HttpRequest request = context.Request; HttpResponse response = context.Response; Consultation consultation= new Consultation(); string actualDoctorId=request.Params["textActualDoctorId"]; string actualDoctorId2=request.Params["textActualDoctorId2"]; string actualDoctorId3=request.Params["textActualDoctorId3"]; string actualDoctorId4=request.Params["textActualDoctorId4"]; string addTime=request.Params["textAddTime"]; string arrangeConTime=request.Params["textArrangeConTime"]; string beginConTime=request.Params["textBeginConTime"]; string callerId=request.Params["textCallerId"]; string cancelConResult=request.Params["textCancelConResult"]; string chargeType=request.Params["textChargeType"]; string conFile=request.Params["textConFile"]; string conObjective=request.Params["textConObjective"]; string consulationMode=request.Params["textConsulationMode"]; string consulationType=request.Params["textConsulationType"]; string consultationStatus=request.Params["textConsultationStatus"]; string description=request.Params["textDescription"]; string diagnosis=request.Params["textDiagnosis"]; string diagnosisFile=request.Params["textDiagnosisFile"]; string endConTime=request.Params["textEndConTime"]; string itemId=request.Params["textItemId"]; string notPassResult=request.Params["textNotPassResult"]; string processRequestTime=request.Params["textProcessRequestTime"]; string receiverId=request.Params["textReceiverId"]; string requestDoctorId=request.Params["textRequestDoctorId"]; string requestDoctorId2=request.Params["textRequestDoctorId2"]; string requestDoctorId3=request.Params["textRequestDoctorId3"]; string requestDoctorId4=request.Params["textRequestDoctorId4"]; string requestTime=request.Params["textRequestTime"]; string roomId=request.Params["textRoomId"]; string sectionOfficeId=request.Params["textSectionOfficeId"]; string updateTime=request.Params["textUpdateTime"]; if(!String.IsNullOrEmpty(actualDoctorId)) consultation.ActualDoctorId=actualDoctorId; if(!String.IsNullOrEmpty(actualDoctorId2)) consultation.ActualDoctorId2=actualDoctorId2; if(!String.IsNullOrEmpty(actualDoctorId3)) consultation.ActualDoctorId3=actualDoctorId3; if(!String.IsNullOrEmpty(actualDoctorId4)) consultation.ActualDoctorId4=actualDoctorId4; consultation.AddTime=DateTime.Now; consultation.ArrangeConTime=DateTime.Now; consultation.BeginConTime=DateTime.Now; if(!String.IsNullOrEmpty(callerId)) consultation.CallerId=callerId; if(!String.IsNullOrEmpty(cancelConResult)) consultation.CancelConResult=cancelConResult; if(!String.IsNullOrEmpty(chargeType)) consultation.ChargeType=chargeType; if(!String.IsNullOrEmpty(conFile)) consultation.ConFile=conFile; if(!String.IsNullOrEmpty(conObjective)) consultation.ConObjective=conObjective; if(!String.IsNullOrEmpty(consulationMode)) consultation.ConsulationMode=consulationMode; if(!String.IsNullOrEmpty(consulationType)) consultation.ConsulationType=consulationType; consultation.ConsultationId=Guid.NewGuid().ToString("N"); if(!String.IsNullOrEmpty(consultationStatus)) consultation.ConsultationStatus=consultationStatus; if(!String.IsNullOrEmpty(description)) consultation.Description=description; if(!String.IsNullOrEmpty(diagnosis)) consultation.Diagnosis=diagnosis; if(!String.IsNullOrEmpty(diagnosisFile)) consultation.DiagnosisFile=diagnosisFile; consultation.EndConTime=DateTime.Now; if(!String.IsNullOrEmpty(itemId)) consultation.ItemId=itemId; if(!String.IsNullOrEmpty(notPassResult)) consultation.NotPassResult=notPassResult; consultation.ProcessRequestTime=DateTime.Now; if(!String.IsNullOrEmpty(receiverId)) consultation.ReceiverId=receiverId; if(!String.IsNullOrEmpty(requestDoctorId)) consultation.RequestDoctorId=requestDoctorId; if(!String.IsNullOrEmpty(requestDoctorId2)) consultation.RequestDoctorId2=requestDoctorId2; if(!String.IsNullOrEmpty(requestDoctorId3)) consultation.RequestDoctorId3=requestDoctorId3; if(!String.IsNullOrEmpty(requestDoctorId4)) consultation.RequestDoctorId4=requestDoctorId4; consultation.RequestTime=DateTime.Now; if(!String.IsNullOrEmpty(roomId)) consultation.RoomId=roomId; if(!String.IsNullOrEmpty(sectionOfficeId)) consultation.SectionOfficeId=sectionOfficeId; consultation.UpdateTime=DateTime.Now; ResultModel result = ConsultationBll.Insert(consultation); string jsonString = JsonConvert.SerializeObject(result); response.Write(result); }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(Consultation consultation) { OperationLog log = new OperationLog(); ResultModel result = new ResultModel(); try { log.AddTime = DateTime.Now; log.IsSuccessId = SymbolicConstant.ISSUCCESS_TRUE; log.OperationLogId = System.Guid.NewGuid().ToString("N"); log.OperationContent = SymbolicConstant.OPERATIONCONTENT_UPDATE; log.OperationTable = typeof(Consultation).Name; log.OperationTypeCode = SymbolicConstant.OPERATIONTYPE_UPDATE; log.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; log.ResultMessage=SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; log.UserId = CurrentSession.getUser().UserId; log.ObjectRecordId = consultation.ConsultationId; ConsultationDal.Update(consultation); result.IsSuccess = true; result.ObjectRecordId = consultation.ConsultationId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { log.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE; log.ResultMessage=exception.Message; result.IsSuccess = false; result.ObjectRecordId =consultation.ConsultationId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(Consultation consultation, bool isLog) { if (isLog) return Update(consultation); ResultModel result = new ResultModel(); try { ConsultationDal.Update(consultation); result.IsSuccess = true; result.ObjectRecordId = consultation.ConsultationId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId =consultation.ConsultationId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 添加一条新记录 /// </summary> /// <param name="consultation">Consultation实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>添加结果,包括是否插入成功、记录主键等信息</returns> public static ResultModel Insert(Consultation consultation, bool isLog) { if (isLog) return Insert(consultation); ResultModel result = new ResultModel(); object id = ""; try { id = ConsultationDal.Insert(consultation); result.IsSuccess = true; result.ObjectRecordId = id.ToString(); result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_INSERT_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId = id.ToString(); result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据主键查询指定记录 /// </summary> /// <param name="consultationId">主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetConsultationById(string consultationId, bool isLog) { if (isLog) return GetConsultationById(consultationId); Consultation consultation = new Consultation(); ResultModel result = new ResultModel(); try { consultation= ConsultationDal.GetModel(consultationId); result.Data = consultation; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETMODEL_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 修改Consultation表中的某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> public static void Update(Consultation consultation) { DataAccessUtility.Update<Consultation>(consultation); }
/// <summary> /// 插入一条新记录 /// </summary> /// <param name="consultation">Consultation实体</param> /// <returns>插入记录的主键</returns> public static object Insert(Consultation consultation) { Object id = DataAccessUtility.Insert<Consultation>(consultation); return id; }
/// <summary> /// 删除Consultation表中的某条记录 /// </summary> /// <param name="user">要删除记录的对应的实体</param> public static void Delete(Consultation consultation) { DataAccessUtility.Delete<Consultation>(consultation); }