/// <summary> /// 添加记录操作 /// </summary> protected void AddRecord() { HttpContext context = HttpContext.Current; HttpRequest request = context.Request; HttpResponse response = context.Response; Conference conference= new Conference(); string actualBeginTime=request.Params["textActualBeginTime"]; string actualDurationTime=request.Params["textActualDurationTime"]; string actualEndTime=request.Params["textActualEndTime"]; string actualUserNo=request.Params["textActualUserNo"]; string addTime=request.Params["textAddTime"]; string adminId=request.Params["textAdminId"]; string createrId=request.Params["textCreaterId"]; string maxUserNo=request.Params["textMaxUserNo"]; string password=request.Params["textPassword"]; string reserBeginTime=request.Params["textReserBeginTime"]; string reserDurationTime=request.Params["textReserDurationTime"]; string reserEndTime=request.Params["textReserEndTime"]; string updateTime=request.Params["textUpdateTime"]; conference.ActualBeginTime=DateTime.Now; if(!String.IsNullOrEmpty(actualDurationTime)) conference.ActualDurationTime=Convert.ToInt32(actualDurationTime); conference.ActualEndTime=DateTime.Now; if(!String.IsNullOrEmpty(actualUserNo)) conference.ActualUserNo=Convert.ToInt32(actualUserNo); conference.AddTime=DateTime.Now; if(!String.IsNullOrEmpty(adminId)) conference.AdminId=adminId; conference.ConferenceId=Guid.NewGuid().ToString("N"); if(!String.IsNullOrEmpty(createrId)) conference.CreaterId=createrId; if(!String.IsNullOrEmpty(maxUserNo)) conference.MaxUserNo=Convert.ToInt32(maxUserNo); if(!String.IsNullOrEmpty(password)) conference.Password=password; conference.ReserBeginTime=DateTime.Now; if(!String.IsNullOrEmpty(reserDurationTime)) conference.ReserDurationTime=reserDurationTime; conference.ReserEndTime=DateTime.Now; conference.UpdateTime=DateTime.Now; ResultModel result = ConferenceBll.Insert(conference); string jsonString = JsonConvert.SerializeObject(result); response.Write(result); }
/// <summary> /// 插入一条新记录 /// </summary> /// <param name="conference">Conference实体</param> /// <returns>插入记录的主键</returns> public static object Insert(Conference conference) { Object id = DataAccessUtility.Insert<Conference>(conference); return id; }
/// <summary> /// 修改Conference表中的某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> public static void Update(Conference conference) { DataAccessUtility.Update<Conference>(conference); }
/// <summary> /// 删除Conference表中的某条记录 /// </summary> /// <param name="user">要删除记录的对应的实体</param> public static void Delete(Conference conference) { DataAccessUtility.Delete<Conference>(conference); }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(Conference conference, bool isLog) { if (isLog) return Update(conference); ResultModel result = new ResultModel(); try { ConferenceDal.Update(conference); result.IsSuccess = true; result.ObjectRecordId = conference.ConferenceId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId =conference.ConferenceId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(Conference conference) { 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(Conference).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 = conference.ConferenceId; ConferenceDal.Update(conference); result.IsSuccess = true; result.ObjectRecordId = conference.ConferenceId; 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 =conference.ConferenceId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
/// <summary> /// 添加一条新记录 /// </summary> /// <param name="conference">Conference实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>添加结果,包括是否插入成功、记录主键等信息</returns> public static ResultModel Insert(Conference conference, bool isLog) { if (isLog) return Insert(conference); ResultModel result = new ResultModel(); object id = ""; try { id = ConferenceDal.Insert(conference); 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="conferenceId">主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetConferenceById(string conferenceId, bool isLog) { if (isLog) return GetConferenceById(conferenceId); Conference conference = new Conference(); ResultModel result = new ResultModel(); try { conference= ConferenceDal.GetModel(conferenceId); result.Data = conference; 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; } }