private void LoadAllStateInfos() { try { mListAllStateInfos.Clear(); WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4410Codes.GetAgentStateList; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add("0"); 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; } int count = webReturn.ListData.Count; OperationReturn optReturn; for (int i = 0; i < count; i++) { string strInfo = webReturn.ListData[i]; optReturn = XMLHelper.DeserializeObject <AgentStateInfo>(strInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } AgentStateInfo info = optReturn.Data as AgentStateInfo; if (info == null) { ShowException(string.Format("Fail.\tAgentStateInfo is null")); return; } mListAllStateInfos.Add(info); } CurrentApp.WriteLog("LoadAllStateInfos", string.Format("Load end.\t{0}", mListAllStateInfos.Count)); } catch (Exception ex) { ShowException(ex.Message); } }
private void InitStateSeatItems() { try { mListStateSeatItems.Clear(); if (ListAllSeatInfos == null) { return; } if (ListAllStateInfos == null) { return; } for (int i = 0; i < mListRegionSeats.Count; i++) { var regionSeat = mListRegionSeats[i]; SeatInfo seatInfo = ListAllSeatInfos.FirstOrDefault(s => s.ObjID == regionSeat.SeatID); if (seatInfo == null) { continue; } for (int j = 0; j < ListAllStateInfos.Count; j++) { AgentStateInfo stateInfo = ListAllStateInfos[j]; int stateNumber = stateInfo.Number; AgentStateItem stateItem = mListAgentStateItems.FirstOrDefault(s => s.Number == stateNumber); StateSeatItem item = new StateSeatItem(); item.Info = regionSeat; item.SeatInfo = seatInfo; item.StateItem = stateItem; item.ObjID = regionSeat.SeatID; item.SeatName = seatInfo.Name; item.Extension = seatInfo.Extension; item.Number = stateNumber; item.Description = string.Empty; mListStateSeatItems.Add(item); } } } catch (Exception ex) { ShowException(ex.Message); } }
public AgentStateInfoWrapper(AgentStateInfo info) { this.GroupName = string.IsNullOrEmpty(info.groupName) ? LanguageResource.FindResourceMessageByKey("agentinfo_nogroup") : info.groupName; this.WorkNo = info.workno; this.status = info.status; this.Name = info.name; this.Content = LanguageResource.FindResourceMessageByKey("agentinfo_id") + info.workno; if (TALK_STATUS.Equals(info.status)) { Url = (info.ctiStatus != null && m_talkStatusPicDic.ContainsKey(info.ctiStatus)) ? m_talkStatusPicDic[info.ctiStatus] : "/QuickAgent;component/Resource/Images/icon2-_201.png"; } else { Url = m_agentStatusPicDict.ContainsKey(info.status) ? m_agentStatusPicDict[info.status] : "/QuickAgent;component/Resource/Images/icon2-_117.png"; } }
public void OK_Click(object sender, RoutedEventArgs e) { try { AgentStateInfo statusInfo = agentInfoCtrl.SelectedAgent; if (null == statusInfo) { return; } if (string.Compare(MainWindow.Instance().AgentInfo.AgentId, statusInfo.workno, true) == 0) { MessageBox.Show(LanguageResource.FindResourceMessageByKey("innercall_choseselef")); return; } string result = BusinessAdapter.GetBusinessInstance().CallInnerEx(statusInfo.workno, OCX_MEDIA_TYPE); Log4NetHelper.ActionLog("Common", "Vc_CallInner", result); if (result != null) { if (!result.Equals(AGWErrorCode.OK)) { MessageBox.Show(LanguageResource.FindResourceMessageByKey("internalcall_fail")); } else { if (BusinessAdapter.CurrentBusinessType == BusinessType.AgentGateway) { MainWindow.Instance().TalkStatus = MainWindow.AgentStatus.InternaCall; } } } this.DialogResult = true; } catch (Exception exc) { Log4NetHelper.ExcepLog("Sys", "InnerCall", exc.Message); } }
private void Init() { try { mStateIcon = string.Empty; ComboStateTypes.ItemsSource = mListStateTypeItems; InitStateTypeItems(); if (IsModify) { if (StateItem == null) { return; } var stateInfo = StateItem.Data as AgentStateInfo; mStateInfo = stateInfo; if (mStateInfo == null) { return; } TxtName.Text = mStateInfo.Name; var typeItem = mListStateTypeItems.FirstOrDefault(t => t.Value == mStateInfo.Type); ComboStateTypes.SelectedItem = typeItem; RadioStateEnable.IsChecked = mStateInfo.State == 1; RadioStateDisable.IsChecked = mStateInfo.State != 1; TxtColor.SelectedColor = GetColorFromString(mStateInfo.Color); string strIcon = mStateInfo.Icon; if (!string.IsNullOrEmpty(strIcon)) { //string strUrl = string.Format("{0}://{1}:{2}/{3}/UMPS4414/{4}", // CurrentApp.Session.AppServerInfo.Protocol, // CurrentApp.Session.AppServerInfo.Address, // CurrentApp.Session.AppServerInfo.Port, // ConstValue.TEMP_DIR_UPLOADFILES, // strIcon); //BitmapImage image = new BitmapImage(); //image.BeginInit(); //image.UriSource = new Uri(strUrl, UriKind.Absolute); //image.EndInit(); //ImageIcon.Source = image; //Image imgTip = new Image(); //imgTip.Source = new BitmapImage(new Uri(strUrl, UriKind.Absolute)); //imgTip.Stretch = Stretch.Uniform; //ImageIcon.ToolTip = imgTip; } //RadioIsWorkTimeYes.IsChecked = mStateInfo.IsWorkTime; TxtValue.Text = mStateInfo.Value.ToString(); //RadioIsWorkTimeNo.IsChecked = !mStateInfo.IsWorkTime; TxtDescription.Text = mStateInfo.Description; } else { TxtName.Text = string.Empty; var typeItem = mListStateTypeItems.FirstOrDefault(); ComboStateTypes.SelectedItem = typeItem; RadioStateEnable.IsChecked = true; RadioStateDisable.IsChecked = false; TxtColor.SelectedColor = Brushes.Transparent.Color; //RadioIsWorkTimeYes.IsChecked = true; TxtValue.Text = "0"; //RadioIsWorkTimeNo.IsChecked = false; TxtDescription.Text = string.Empty; } ChangeLanguage(); } catch (Exception ex) { ShowException(ex.Message); } }
private void AddAgentState() { try { AgentStateInfo stateInfo = new AgentStateInfo(); if (ListAllStateInfos == null) { return; } int number = 10; //自定义的状态的编码从10开始累加 for (int i = 0; i < ListAllStateInfos.Count; i++) { var info = ListAllStateInfos[i]; number = Math.Max(info.Number, number); } number++; stateInfo.Number = number; string strName = TxtName.Text; if (string.IsNullOrEmpty(strName)) { ShowException(CurrentApp.GetLanguageInfo("4414N003", string.Format("Name can not be empty."))); return; } stateInfo.Name = strName; var typeItem = ComboStateTypes.SelectedItem as StateTypeItem; if (typeItem != null) { stateInfo.Type = typeItem.Value; } else { stateInfo.Type = S4410Consts.STATE_TYPE_UNKOWN; } string strValue = TxtValue.Text; int intValue; if (!int.TryParse(strValue, out intValue) || intValue < 0) { ShowException(CurrentApp.GetLanguageInfo("4414N004", string.Format("Value invalid"))); return; } stateInfo.Value = intValue; stateInfo.State = RadioStateEnable.IsChecked == true ? 1 : 0; stateInfo.Color = TxtColor.SelectedColor.ToString(); stateInfo.Icon = mStateIcon; //stateInfo.IsWorkTime = RadioIsWorkTimeYes.IsChecked == true; stateInfo.IsWorkTime = true; stateInfo.Description = TxtDescription.Text; stateInfo.Creator = CurrentApp.Session.UserID; stateInfo.CreateTime = DateTime.Now.ToUniversalTime(); stateInfo.Modifier = CurrentApp.Session.UserID; stateInfo.ModifyTime = DateTime.Now.ToUniversalTime(); OperationReturn optReturn; optReturn = XMLHelper.SeriallizeObject(stateInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } string strInfo = optReturn.Data.ToString(); bool isSuccess = false; string strMsg = string.Empty; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (s, de) => { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S4410Codes.SaveAgentStateInfo; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add("0"); webRequest.ListData.Add("1");//拷贝图标文件 webRequest.ListData.Add("1"); webRequest.ListData.Add(strInfo); Service44101Client client = new Service44101Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service44101")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { strMsg = string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message); return; } if (webReturn.ListData != null) { for (int i = 0; i < webReturn.ListData.Count; i++) { CurrentApp.WriteLog("DeleteAgentState", string.Format("{0}", webReturn.ListData[i])); } } isSuccess = true; } catch (Exception ex) { strMsg = ex.Message; } }; worker.RunWorkerCompleted += (s, re) => { worker.Dispose(); try { if (isSuccess) { ShowInformation(CurrentApp.GetLanguageInfo("4414N005", string.Format("Add AgentState end"))); var parent = Parent as PopupPanel; if (parent != null) { parent.IsOpen = false; } if (PageParent != null) { PageParent.ReloadData(); } } else { ShowException(strMsg); } } catch (Exception ex) { ShowException(ex.Message); } }; worker.RunWorkerAsync(); } catch (Exception ex) { ShowException(ex.Message); } }