/// <summary> /// 添加会议室信息的方法 /// </summary> /// <param name="MeetingRoomM">会议室信息</param> /// <returns>被添加会议室ID</returns> public static int MeetingRoomAdd(MeetingRoomModel MeetingRoomM) { try { #region 设置参数 SqlParameter[] param = new SqlParameter[10]; param[0] = SqlHelper.GetParameter("@CompanyCD ",MeetingRoomM.CompanyCD ); param[1] = SqlHelper.GetParameter("@RoomName ",MeetingRoomM.RoomName ); param[2] = SqlHelper.GetParameter("@Place ",MeetingRoomM.Place ); param[3] = SqlHelper.GetParameter("@PersonCount ",MeetingRoomM.PersonCount ); param[4] = SqlHelper.GetParameter("@MultimediaFlag",MeetingRoomM.MultimediaFlag); param[5] = SqlHelper.GetParameter("@Remark ",MeetingRoomM.Remark ); param[6] = SqlHelper.GetParameter("@UsedStatus ",MeetingRoomM.UsedStatus ); param[7] = SqlHelper.GetParameter("@ModifiedDate ",MeetingRoomM.ModifiedDate ); param[8] = SqlHelper.GetParameter("@ModifiedUserID",MeetingRoomM.ModifiedUserID); SqlParameter paramid = new SqlParameter("@id", SqlDbType.Int); paramid.Direction = ParameterDirection.Output; param[9] = paramid; #endregion //创建命令 SqlCommand comm = new SqlCommand(); SqlHelper.ExecuteTransStoredProcedure("officedba.insertMeetingRoom", comm, param); int MeetingRoomID = Convert.ToInt32(comm.Parameters["@id"].Value); return MeetingRoomID; } catch { return 0; } }
/// <summary> /// 根据会议室ID修改会议室信息 /// </summary> /// <param name="MeetingRoomM">会议室信息</param> /// <returns>bool值</returns> public static bool UpdateMeetingRoom(MeetingRoomModel MeetingRoomM) { try { StringBuilder sql = new StringBuilder(); sql.AppendLine("UPDATE officedba.MeetingRoom set "); sql.AppendLine("CompanyCD =@CompanyCD ,"); sql.AppendLine("RoomName =@RoomName ,"); sql.AppendLine("Place =@Place ,"); sql.AppendLine("PersonCount =@PersonCount ,"); sql.AppendLine("MultimediaFlag=@MultimediaFlag,"); sql.AppendLine("Remark =@Remark ,"); sql.AppendLine("UsedStatus =@UsedStatus ,"); sql.AppendLine("ModifiedDate =@ModifiedDate ,"); sql.AppendLine("ModifiedUserID=@ModifiedUserID"); sql.AppendLine(" WHERE "); sql.AppendLine("ID = @ID "); SqlParameter[] param = new SqlParameter[10]; param[0] = SqlHelper.GetParameter("@ID ", MeetingRoomM.ID); param[1] = SqlHelper.GetParameter("@CompanyCD ",MeetingRoomM.CompanyCD ); param[2] = SqlHelper.GetParameter("@RoomName ",MeetingRoomM.RoomName ); param[3] = SqlHelper.GetParameter("@Place ",MeetingRoomM.Place ); param[4] = SqlHelper.GetParameter("@PersonCount ",MeetingRoomM.PersonCount ); param[5] = SqlHelper.GetParameter("@MultimediaFlag",MeetingRoomM.MultimediaFlag); param[6] = SqlHelper.GetParameter("@Remark ",MeetingRoomM.Remark ); param[7] = SqlHelper.GetParameter("@UsedStatus ",MeetingRoomM.UsedStatus ); param[8] = SqlHelper.GetParameter("@ModifiedDate ",MeetingRoomM.ModifiedDate ); param[9] = SqlHelper.GetParameter("@ModifiedUserID",MeetingRoomM.ModifiedUserID); SqlHelper.ExecuteTransSql(sql.ToString(), param); return SqlHelper.Result.OprateCount > 0 ? true : false; } catch { return false; } }
/// <summary> /// 根据会议室ID修改会议室信息 /// </summary> /// <param name="MeetingRoomM">会议室信息</param> /// <returns>bool值</returns> public static bool UpdateMeetingRoom(MeetingRoomModel MeetingRoomM) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; LogInfoModel logModel = new LogInfoModel(); //操作日志 bool isSucc = false;//定义返回变量 #region 设置操作日志内容 //设置公司代码 logModel.CompanyCD = userInfo.CompanyCD; //设置登陆用户ID logModel.UserID = userInfo.UserID; //设置模块ID 模块ID在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_MEETINGROOM_LIST; //操作单据编号 会议室名称 logModel.ObjectID = MeetingRoomM.RoomName; //操作对象 操作的表信息 logModel.ObjectName = ConstUtil.TABLE_NAME_DOC; //涉及关键元素 涉及其他业务、表关系 logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //备注 操作类型 logModel.Remark = ConstUtil.LOG_PROCESS_UPDATE; #endregion try { isSucc = MeetingRoomDBHelper.UpdateMeetingRoom(MeetingRoomM); } catch (System.Exception ex) { #region 操作失败时记录日志到文件 //定义变量 LogInfo logSys = new LogInfo(); //设置日志类型 需要指定为系统日志 logSys.Type = LogInfo.LogType.SYSTEM; //指定系统日志类型 出错信息 logSys.SystemKind = LogInfo.SystemLogKind.SYSTEM_ERROR; //指定登陆用户信息 logSys.UserInfo = userInfo; //设定模块ID logSys.ModuleID = ConstUtil.MODULE_ID_MEETINGROOM_LIST; //描述 logSys.Description = ex.ToString(); //输出日志 LogUtil.WriteLog(logSys); #endregion } if (isSucc)//操作成功 { logModel.Remark += "成功"; } else//操作失败 { logModel.Remark += "失败"; } //记录日志 LogDBHelper.InsertLog(logModel); return isSucc; }