设置预约规则的客户端代码:

             int stopHourInt = (int)stopHour.Value;            int stopMinuteInt = (int)stopMinute.Value;            //截止的时间            int stopTimeInt = stopHourInt * 100 + stopMinuteInt;            //提前的天数            int dayspan = (int)numDay.Value;            //声明一个Cla***oomConfig类  并设定具体的值            Cla***oomConfig  cla***oomConfig=new Cla***oomConfig ();            cla***oomConfig.DaySpan=dayspan ;            cla***oomConfig.StopTime=stopTimeInt;            cla***oomConfig.Id = roomConfigID;            cla***oomConfig.RoomID=this.itemID ;            //发送预约规则个服务器端,并获取返回结果            ResMessage  resMessage=tcpConnnection.SendReceiveObject
("AddRoomConfig","ResRoomConfig",5000, cla***oomConfig);            if (resMessage.Message == "操作成功")            {                GetCurrentRoomConfig();                MessageBox.Show("添加设置完成");            }            else            {                MessageBox.Show("出现错误,错误为" + resMessage.Message);            }

服务器端处理代码如下:

构造函数中声明:

  //学校管理员添加教室的相关设置            NetworkComms.AppendGlobalIncomingPacketHandler
("AddRoomConfig", HandleAddRoomConfig);

处理方法:

  private void HandleAddRoomConfig(PacketHeader header, Connection connection, Cla***oomConfig cla***oomConfig)        {            DoCla***oomConfig.Save(cla***oomConfig);            ResMessage theMessage = new ResMessage();            theMessage.Message = "操作成功";            connection.SendObject("ResRoomConfig", theMessage);        }

操作类:

 DoCla***oomConfig

数据库类:

 DBCla***oomConfig