设置预约规则的客户端代码:
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
创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。