Exemplo n.º 1
0
        public void Create(FormCollection collection)
        {
            var msg = new Msg();

            try
            {
                // 初始化对象
                Entity.T_Room room = new Entity.T_Room()
                {
                    Room_dorm_id     = Convert.ToInt32(collection["dorm_id"]),
                    Room_nickname    = collection["name"],
                    Room_note        = collection["note"],
                    Room_vid         = collection["vid"],
                    Number           = Convert.ToSByte(collection["number"]),
                    Room_building_id = Convert.ToInt32(collection["pid"]),
                };
                var Room = new Rooms();
                if (Room.Add(room))
                {
                    msg.Message = "添加成功!";
                }
                else
                {
                    throw new Exception("发生未知错误,添加失败!");
                }
            }
            catch (Exception ex)
            {
                msg.Code    = -1;
                msg.Message = ex.Message;
            }
            finally
            {
                Response.Write(msg.ToJson());
                Response.End();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 添加宿舍信息
 /// </summary>
 /// <param name="room"></param>
 /// <returns></returns>
 public bool Add(Entity.T_Room room)
 {
     return(RoomDb.Insert(room));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 更新宿舍信息
 /// </summary>
 /// <param name="Room"></param>
 /// <returns></returns>
 public bool Update(Entity.T_Room room)
 {
     return(RoomDb.Update(room));
 }