private void LoadRegionSeatInfos() { try { mListRegionSeats.Clear(); if (RegionItem == null) { return; } long regionID = RegionItem.ObjID; WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4410Codes.GetRegionSeatList; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add(regionID.ToString()); Service44101Client client = new Service44101Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service44101")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData == null) { ShowException(string.Format("Fail.\tListData is null")); return; } OperationReturn optReturn; for (int i = 0; i < webReturn.ListData.Count; i++) { string strInfo = webReturn.ListData[i]; optReturn = XMLHelper.DeserializeObject <RegionSeatInfo>(strInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } RegionSeatInfo info = optReturn.Data as RegionSeatInfo; if (info == null) { ShowException(string.Format("Fail.\tRegionSeatInfo is null")); return; } mListRegionSeats.Add(info); } CurrentApp.WriteLog("LoadRegionSeatInfo", string.Format("Load end.\t{0}", mListRegionSeats.Count)); } catch (Exception ex) { ShowException(ex.Message); } }
private void SaveRegionSeats() { try { if (RegionInfo == null) { return; } List <RegionSeatInfo> listCheckedSeats = new List <RegionSeatInfo>(); for (int i = 0; i < mListCheckableSeatItems.Count; i++) { var item = mListCheckableSeatItems[i]; if (item.IsChecked) { var regionSeat = ListRegionSeats.FirstOrDefault(s => s.SeatID == item.SeatID); if (regionSeat == null) { regionSeat = new RegionSeatInfo(); regionSeat.RegionID = RegionInfo.ObjID; regionSeat.SeatID = item.SeatID; regionSeat.Creator = CurrentApp.Session.UserID; regionSeat.CreateTime = DateTime.Now.ToUniversalTime(); } regionSeat.Modifier = CurrentApp.Session.UserID; regionSeat.ModifyTime = DateTime.Now.ToUniversalTime(); listCheckedSeats.Add(regionSeat); } } int count = listCheckedSeats.Count; WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4410Codes.SaveRegionSeatInfo; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add("1"); webRequest.ListData.Add(RegionInfo.ObjID.ToString()); webRequest.ListData.Add(count.ToString()); OperationReturn optReturn; for (int i = 0; i < count; i++) { optReturn = XMLHelper.SeriallizeObject(listCheckedSeats[i]); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } webRequest.ListData.Add(optReturn.Data.ToString()); } Service44101Client client = new Service44101Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service44101")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData == null) { ShowException(string.Format("Fail.\tListData is null")); return; } for (int i = 0; i < webReturn.ListData.Count; i++) { CurrentApp.WriteLog("SaveRegionSeats", string.Format("{0}", webReturn.ListData[i])); } CurrentApp.WriteLog("SaveRegionSeats", "Save end."); ShowInformation(string.Format("Save region seat end.")); if (PageParent != null) { PageParent.Reload(); } var parent = Parent as PopupPanel; if (parent != null) { parent.IsOpen = false; } } catch (Exception ex) { ShowException(ex.Message); } }
private void LoadRegionExtItems(ChildRegionItem childRegionItem, ObjItem regionItem) { try { long regionID = regionItem.ObjID; string strRegionName = regionItem.Name; WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4410Codes.GetRegionSeatList; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add(regionID.ToString()); Service44101Client client = new Service44101Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service44101")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData == null) { ShowException(string.Format("Fail.\tListData is null")); return; } OperationReturn optReturn; for (int i = 0; i < webReturn.ListData.Count; i++) { string strInfo = webReturn.ListData[i]; optReturn = XMLHelper.DeserializeObject <RegionSeatInfo>(strInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } RegionSeatInfo info = optReturn.Data as RegionSeatInfo; if (info == null) { ShowException(string.Format("Fail.\tRegionSeatInfo is null")); return; } if (ListAllSeatInfos == null) { continue; } var seatInfo = ListAllSeatInfos.FirstOrDefault(s => s.ObjID == info.SeatID); if (seatInfo == null) { continue; } RegionExtensionItem extItem = new RegionExtensionItem(); extItem.SeatInfo = seatInfo; extItem.ChildRegionID = childRegionItem.RegionID; extItem.RegionID = regionID; extItem.SeatID = seatInfo.ObjID; extItem.SeatName = seatInfo.Name; extItem.Extension = seatInfo.Extension; childRegionItem.ListRegionExtItems.Add(extItem); mListAllRegionExtItems.Add(extItem); } CurrentApp.WriteLog("LoadRegionExtItems", string.Format("Load end.\t{0}\t{1}", strRegionName, childRegionItem.ListRegionExtItems.Count)); } catch (Exception ex) { ShowException(ex.Message); } }