/// <summary> /// 添加记录操作 /// </summary> protected void AddRecord() { HttpContext context = HttpContext.Current; HttpRequest request = context.Request; HttpResponse response = context.Response; PhyExamReser phyExamReser= new PhyExamReser(); string addTime=request.Params["textAddTime"]; string age=request.Params["textAge"]; string applicantDescription=request.Params["textApplicantDescription"]; string applicantId=request.Params["textApplicantId"]; string arrangeAddress=request.Params["textArrangeAddress"]; string arrangeTime=request.Params["textArrangeTime"]; string birthdate=request.Params["textBirthdate"]; string deployerDescription=request.Params["textDeployerDescription"]; string deployerId=request.Params["textDeployerId"]; string email=request.Params["textEmail"]; string genderId=request.Params["textGenderId"]; string idNumber=request.Params["textIdNumber"]; string idType=request.Params["textIdType"]; string marriage=request.Params["textMarriage"]; string phyExamType=request.Params["textPhyExamType"]; string realName=request.Params["textRealName"]; string telephone=request.Params["textTelephone"]; string updateTime=request.Params["textUpdateTime"]; phyExamReser.AddTime=DateTime.Now; if(!String.IsNullOrEmpty(age)) phyExamReser.Age=Convert.ToInt32(age); if(!String.IsNullOrEmpty(applicantDescription)) phyExamReser.ApplicantDescription=applicantDescription; if(!String.IsNullOrEmpty(applicantId)) phyExamReser.ApplicantId=applicantId; if(!String.IsNullOrEmpty(arrangeAddress)) phyExamReser.ArrangeAddress=arrangeAddress; if(!String.IsNullOrEmpty(arrangeTime)) phyExamReser.ArrangeTime=Convert.ToChar(arrangeTime); phyExamReser.Birthdate=DateTime.Now; if(!String.IsNullOrEmpty(deployerDescription)) phyExamReser.DeployerDescription=deployerDescription; if(!String.IsNullOrEmpty(deployerId)) phyExamReser.DeployerId=deployerId; if(!String.IsNullOrEmpty(email)) phyExamReser.Email=email; if(!String.IsNullOrEmpty(genderId)) phyExamReser.GenderId=genderId; if(!String.IsNullOrEmpty(idNumber)) phyExamReser.IdNumber=idNumber; if(!String.IsNullOrEmpty(idType)) phyExamReser.IdType=idType; if(!String.IsNullOrEmpty(marriage)) phyExamReser.Marriage=marriage; if(!String.IsNullOrEmpty(phyExamType)) phyExamReser.PhyExamType=phyExamType; if(!String.IsNullOrEmpty(realName)) phyExamReser.RealName=realName; phyExamReser.ReserId=Guid.NewGuid().ToString("N"); if(!String.IsNullOrEmpty(telephone)) phyExamReser.Telephone=telephone; phyExamReser.UpdateTime=DateTime.Now; ResultModel result = PhyExamReserBll.Insert(phyExamReser); string jsonString = JsonConvert.SerializeObject(result); response.Write(result); }
/// <summary> /// 插入一条新记录 /// </summary> /// <param name="phyExamReser">PhyExamReser实体</param> /// <returns>插入记录的主键</returns> public static object Insert(PhyExamReser phyExamReser) { Object id = DataAccessUtility.Insert<PhyExamReser>(phyExamReser); return id; }
/// <summary> /// 修改PhyExamReser表中的某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> public static void Update(PhyExamReser phyExamReser) { DataAccessUtility.Update<PhyExamReser>(phyExamReser); }
/// <summary> /// 删除PhyExamReser表中的某条记录 /// </summary> /// <param name="user">要删除记录的对应的实体</param> public static void Delete(PhyExamReser phyExamReser) { DataAccessUtility.Delete<PhyExamReser>(phyExamReser); }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(PhyExamReser phyExamReser, bool isLog) { if (isLog) return Update(phyExamReser); ResultModel result = new ResultModel(); try { PhyExamReserDal.Update(phyExamReser); result.IsSuccess = true; result.ObjectRecordId = phyExamReser.ReserId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId =phyExamReser.ReserId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(PhyExamReser phyExamReser) { 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(PhyExamReser).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 = phyExamReser.ReserId; PhyExamReserDal.Update(phyExamReser); result.IsSuccess = true; result.ObjectRecordId = phyExamReser.ReserId; 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 =phyExamReser.ReserId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
/// <summary> /// 添加一条新记录 /// </summary> /// <param name="phyExamReser">PhyExamReser实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>添加结果,包括是否插入成功、记录主键等信息</returns> public static ResultModel Insert(PhyExamReser phyExamReser, bool isLog) { if (isLog) return Insert(phyExamReser); ResultModel result = new ResultModel(); object id = ""; try { id = PhyExamReserDal.Insert(phyExamReser); 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="phyExamReserId">主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetPhyExamReserById(string phyExamReserId, bool isLog) { if (isLog) return GetPhyExamReserById(phyExamReserId); PhyExamReser phyExamReser = new PhyExamReser(); ResultModel result = new ResultModel(); try { phyExamReser= PhyExamReserDal.GetModel(phyExamReserId); result.Data = phyExamReser; 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; } }