Пример #1
0
        } // function UpdateRecord

        /// <summary>
        /// 向数据库会议资源表中查询与某一会议相关的信息
        /// </summary>
        /// <param name="conId">会议id</param>
        /// <returns>一组资源信息</returns>
        /// 作者:王宇昊
        /// 创建时间:2014-09-19
        /// 修改时间:
        public List<ConUseResourceModel> GetUseResource(int conId)
        {
            try
            {
                
                List<ConUseResourceModel> UseResourceList = new List<ConUseResourceModel> ();
                string strSqlCmd;// 存储数据库命令语句   
                strSqlCmd = string.Format(@"select * from ConUseResource where ConId = '" + conId + "'");
                DataSet data = SqlHelperDB.GetDataSet(DB.SqlHelperDB.ConnectionString, strSqlCmd, "ConUseResource");

                foreach (DataRow row in data.Tables["ConUseResource"].Rows)
                {
                    ConUseResourceModel ConUse = new ConUseResourceModel();
                    ConUse.ConId = Convert.ToInt32(row["ConId"].ToString());
                    ConUse.DeviceId =Convert.ToInt32( row["DeViceId"].ToString());

                    UseResourceList.Add(ConUse);
                }
                return UseResourceList;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);

            } // try
        }// function GetUseResource
Пример #2
0
        }     // function DelARecord

        /// <summary>
        /// 会议管理员向会议使用资源表添加一条记录
        /// </summary>
        /// <param name="useRsc">使用资源实体类的实例化对象</param>
        /// <returns>true:添加成功;false:添加失败</returns>
        public bool AddConUseResource(ConUseResourceModel useRsc)
        {
            try
            {
                ConUseResourceDAL CURD = new ConUseResourceDAL();
                CURD.AddARecord(useRsc);
                return(true);
            }
            catch
            {
                return(false);
            }
        } // function AddConUseResource
Пример #3
0
        } // function AddRecord


        /// <summary>
        /// 向数据库会议资源表中删除一条新信息
        /// </summary>
        /// <param name="obj">要删除的会议资源信息</param>
        /// <returns>操作成功返回true,失败返回false</returns>
        /// 作者:吴欣哲
        /// 创建时间:2014-09-17
        /// 修改时间:
        public bool DelARecord(object obj)
        {
            try
            {
                ConUseResourceModel ConUseResource = (ConUseResourceModel)obj;
                string strSqlCmd; // sql命令存放语句

                strSqlCmd = string.Format("delete from ConUseResource where ConId = '{0}'",
                ConUseResource.ConId);

                SqlHelperDB.ExecuteSql(SqlHelperDB.ConnectionString, strSqlCmd);
                return true;
            }
            catch
            {
                throw new Exception();
            } // try
        } // function DelRecord
Пример #4
0
        /// <summary>
        /// 向数据库会议资源表中插入一条新信息
        /// </summary>
        /// <param name="obj">一条新的会议资源信息</param>
        /// <returns>操作成功返回true,失败返回false</returns>
        /// 作者:吴欣哲
        /// 创建时间:2014-09-17
        /// 修改时间:
        public bool AddARecord(object obj)
        {
            try
            {
                ConUseResourceModel ConUseResource = (ConUseResourceModel)obj;
                string strSqlCmd; // sql命令存放语句

                strSqlCmd = string.Format("insert into ConUseResource values('{0}','{1}')",
                 ConUseResource.ConId, ConUseResource.DeviceId);

                SqlHelperDB.ExecuteSql(SqlHelperDB.ConnectionString, strSqlCmd);
                return true;
            }
            catch
            {
                throw new Exception(); 
            } // try
        } // function AddRecord
Пример #5
0
        } // function DelRecord


        /// <summary>
        /// 向数据库会议资源表中修改一条新信息
        /// </summary>
        /// <param name="obj">要修改的会议资源信息</param>
        /// <returns>操作成功返回true,失败返回false</returns>
        /// 作者:吴欣哲
        /// 创建时间:2014-09-17
        /// 修改时间:
        public bool UpdateARecord(object obj)
        {
            try
            {
                ConUseResourceModel ConUseResource = (ConUseResourceModel)obj;
                string strSqlCmd; // sql命令存放语句

                strSqlCmd = string.Format("update ConUseResource set deviceid='{1}'where conid = '{0}'",
                 ConUseResource.ConId, ConUseResource.DeviceId);

                SqlHelperDB.ExecuteSql(SqlHelperDB.ConnectionString, strSqlCmd);
                return true;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message );
                
            } // try
        } // function UpdateRecord
Пример #6
0
        }// function GetBoardroomInfo

        /// <summary>
        /// 申请会议
        /// </summary>
        /// <param name="conferenceInfo">会议信息</param>
        /// <param name="resource">资源设备编号信息</param>
        /// <returns>是否成功申请</returns>
        /// 作者:王宇昊
        /// 创建时间:2014-09-18
        /// 修改时间:
        ///
        ///

        public int ConApply(ConferenceModel conferenceInfo, List <string> resource)
        {
            try
            {
                ConferenceDAL       ConDAL = new ConferenceDAL();
                ConUseResourceDAL   CURDAL = new ConUseResourceDAL();
                ConUseResourceModel CURM   = new ConUseResourceModel();
                //
                ResourceDAL   RDAL   = new ResourceDAL();
                ResourceModel RMODEL = new ResourceModel();

                int CId = ConDAL.AddARecordReturnId(conferenceInfo);//返回会议的ID
                if (CId != -1)
                {
                    foreach (string DeviceId in resource)
                    {
                        CURM.ConId    = CId;
                        CURM.DeviceId = Convert.ToInt32(DeviceId);
                        CURDAL.AddARecord(CURM);

                        // 将资源表中的状态标志改为1,被预订
                        RMODEL.ResourceId     = Convert.ToInt32(DeviceId);
                        RMODEL.ResourceStatus = '1';
                        RDAL.UpdateAStatus(RMODEL);
                    }
                    return(CId);
                }
                else
                {
                    return(-1);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }// function ConApply