public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Datacontext _dataContext = Datacontext.GetInstance(); string statType = values[0] as string; string statName = values[1] as string; if (statType == "Queue" || statType == "GroupPlaces") { if (statName == (_dataContext.AnnexStatValues.ContainsKey("acd-calls-waiting") == true ? _dataContext.AnnexStatValues["acd-calls-waiting"] : string.Empty)) { return((System.Windows.Media.Brush) new BrushConverter().ConvertFromString("#5CB3FF")); } else if (statName == (_dataContext.AnnexStatValues.ContainsKey("dn-calls-waiting") == true ? _dataContext.AnnexStatValues["dn-calls-waiting"] : string.Empty)) { return((System.Windows.Media.Brush) new BrushConverter().ConvertFromString("#82CAFA")); } else if (statName == (_dataContext.AnnexStatValues.ContainsKey("vq-calls-in-queue") == true ? _dataContext.AnnexStatValues["vq-calls-in-queue"] : string.Empty)) { return((System.Windows.Media.Brush) new BrushConverter().ConvertFromString("#98AFC7")); } else { return(DependencyProperty.UnsetValue); } } else { return(DependencyProperty.UnsetValue); } }
/// <summary> /// Initializes a new instance of the <see cref="MessageBox"/> class. /// </summary> /// <param name="Msgbox_typename">The msgbox_typename.</param> /// <param name="content">The content.</param> /// <param name="btnleft_content">The btnleft_content.</param> /// <param name="btnright_content">The btnright_content.</param> /// <param name="isUsedForForward">if set to <c>true</c> [is used for forward].</param> public MessageBox(string Msgbox_typename, string content, string btnleft_content, string btnright_content) { btnleft_Content = btnleft_content; btnright_Content = btnright_content; InitializeComponent(); this.DataContext = Datacontext.GetInstance(); if (Msgbox_typename == "close") { this.DialogResult = true; this.Close(); } lblTitle.Content = Msgbox_typename + " - Agent Interaction Desktop"; txtblockContent.Text = content; if (!string.IsNullOrEmpty(btnleft_content)) { btn_left.Content = btnleft_content; } else { btn_left.Visibility = System.Windows.Visibility.Hidden; } btn_right.Content = btnright_content; ShadowEffect.ShadowDepth = 0; ShadowEffect.Opacity = 0.5; ShadowEffect.Softness = 0.5; ShadowEffect.Color = (Color)ColorConverter.ConvertFromString("#003660"); }
/// <summary> /// Updates the XML data. /// </summary> /// <param name="dtRow">The dt row.</param> /// <param name="uniqueIdentity">The unique identity.</param> /// <param name="type">The type.</param> /// <returns></returns> public int UpdateXmlData(DataRow dtRow, string uniqueIdentity, string type) { try { System.Xml.Linq.XDocument resultsDoc = System.Xml.Linq.XDocument.Parse((System.Xml.Linq.XDocument.Load(Datacontext.GetInstance().CorporateFavoriteFile)).ToString()); var query = resultsDoc.Root.Descendants("Favorites"); foreach (System.Xml.Linq.XElement e in query) { if (e.Element("UniqueIdentity").Value.ToString() == uniqueIdentity && e.Element("Type").Value.ToString() == type) { e.Element("Category").Value = dtRow["Category"].ToString(); e.Element("DisplayName").Value = dtRow["DisplayName"].ToString(); e.Element("FirstName").Value = dtRow["FirstName"].ToString(); e.Element("LastName").Value = dtRow["LastName"].ToString(); e.Element("PhoneNumber").Value = dtRow["PhoneNumber"].ToString(); e.Element("EmailAddress").Value = dtRow["EmailAddress"].ToString(); e.Element("Type").Value = dtRow["Type"].ToString(); } } resultsDoc.Save(Datacontext.GetInstance().CorporateFavoriteFile); } catch (Exception error) { _logger.Error("Error in updating favorite XMLdata : " + error.Message.ToString()); } return(0); }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Datacontext _dataContext = Datacontext.GetInstance(); string input = values[0] as string; string number = values[1] as string; if (number.ToString().Length > _dataContext.ConsultDialDigits && _dataContext.isOnCall) { return((Brush) new BrushConverter().ConvertFromString("#888")); } else { if (input == "11") { return(Brushes.Red); } else if (input == "12") { return(Brushes.Blue); } else if (input == "13") { return(Brushes.Green); } else { return(DependencyProperty.UnsetValue); } } }
/// <summary> /// Creates the XML data. /// </summary> /// <param name="dtRow">The dt row.</param> /// <returns></returns> public int CreateXMLData(DataRow dtRow) { try { if (File.Exists(Datacontext.GetInstance().CorporateFavoriteFile)) { System.Xml.Linq.XDocument resultsDoc = System.Xml.Linq.XDocument.Parse((System.Xml.Linq.XDocument.Load(Datacontext.GetInstance().CorporateFavoriteFile)).ToString()); var query = resultsDoc.Root; query.Add(new System.Xml.Linq.XElement("Favorites", (new System.Xml.Linq.XElement("Category", dtRow["Category"].ToString())), (new System.Xml.Linq.XElement("DisplayName", dtRow["DisplayName"])), (new System.Xml.Linq.XElement("UniqueIdentity", dtRow["UniqueIdentity"])), (new System.Xml.Linq.XElement("FirstName", dtRow["FirstName"])), (new System.Xml.Linq.XElement("LastName", dtRow["LastName"])), (new System.Xml.Linq.XElement("PhoneNumber", dtRow["PhoneNumber"])), (new System.Xml.Linq.XElement("EmailAddress", dtRow["EmailAddress"])), (new System.Xml.Linq.XElement("Type", dtRow["Type"])))); resultsDoc.Save(Datacontext.GetInstance().CorporateFavoriteFile); return(1); } } catch (Exception ex) { _logger.Error("Error in creating favorite XML Data : " + ex.Message.ToString()); } return(0); }
public OutboundScreenPop() { _datacontext = Datacontext.GetInstance(); InitializeComponent(); this.DataContext = _datacontext; ShadowEffect.ShadowDepth = 0; ShadowEffect.Opacity = 0.5; ShadowEffect.Softness = 0.5; ShadowEffect.Color = (Color)ColorConverter.ConvertFromString("#003660"); }
/// <summary> /// Initializes a new instance of the <see cref="LogonInfo"/> class. /// </summary> public LogonInfo() { InitializeComponent(); this.DataContext = Datacontext.GetInstance(); var window = IsWindowOpen <Window>("SoftphoneBar"); if (window != null) { _view = (SoftPhoneBar)window; } }
/// <summary> /// Initializes a new instance of the <see cref="Notifier"/> class. /// </summary> public Notifier() { InitializeComponent(); mediaPlayer = new System.Windows.Media.MediaPlayer(); mediaPlayer.MediaEnded += mediaPlayer_MediaEnded; bool isEnableCallReject = false; bool isEnableCallAccept = false; EventManager.RegisterClassHandler(typeof(UIElement), AccessKeyManager.AccessKeyPressedEvent, new AccessKeyPressedEventHandler(OnAccessKeyPressed)); this.DataContext = Datacontext.GetInstance(); _dataContext.ErrorRowHeight = new GridLength(0); if (_configContainer.AllKeys.Contains("voice.enable.call-notify-reject") && ((string)_configContainer.GetValue("voice.enable.call-notify-reject")).ToLower().Equals("true")) { isEnableCallReject = true; } if ((_configContainer.AllKeys.Contains("voice.enable.call-notify-accept") && ((string)_configContainer.GetValue("voice.enable.call-notify-accept")).ToLower().Equals("true"))) { isEnableCallAccept = true; } if (!isEnableCallReject && isEnableCallAccept) { btnLeft.Visibility = System.Windows.Visibility.Hidden; btnRight.Content = "_Accept"; btnRight.Style = (Style)FindResource("CallButton"); } if (isEnableCallReject && !isEnableCallAccept) { btnLeft.Visibility = System.Windows.Visibility.Hidden; btnRight.Content = "_Reject"; btnRight.Style = (Style)FindResource("RejectButton"); } if (isEnableCallReject && isEnableCallAccept) { btnLeft.Visibility = System.Windows.Visibility.Visible; btnLeft.Content = "_Accept"; btnRight.Content = "_Reject"; btnRight.Style = (Style)FindResource("RejectButton"); } if (btnRight.Content == "_Reject") { if (string.IsNullOrEmpty(_dataContext.ThridpartyDN) || !_configContainer.AllKeys.Contains("voice.requeue.route-dn") || string.IsNullOrEmpty(_configContainer.GetValue("voice.requeue.route-dn"))) { btnRight.Visibility = System.Windows.Visibility.Hidden; } } }
public ChangePassword() { InitializeComponent(); this.DataContext = Datacontext.GetInstance(); _shadowEffect.ShadowDepth = 0; _shadowEffect.Opacity = 0.5; _shadowEffect.Softness = 0.5; _shadowEffect.Color = (Color)ColorConverter.ConvertFromString("#003660"); _dataContext.CSErrorMessage = string.Empty; _dataContext.CSErrorRowHeight = new GridLength(0); txtOldPass.Focus(); }
internal static OutputValues DeleteSkillFromAgent(string userName, string skillName) { OutputValues output = new OutputValues(); try { CfgPersonQuery queryPerson = new CfgPersonQuery(); queryPerson.UserName = userName; queryPerson.TenantDbid = _configContainer.TenantDbId; CfgPerson person = _configContainer.ConfServiceObject.RetrieveObject <CfgPerson>(queryPerson); if (person != null) { ICollection <CfgSkillLevel> agentSkills = person.AgentInfo.SkillLevels; foreach (CfgSkillLevel skillToRemove in person.AgentInfo.SkillLevels) { if (skillToRemove.Skill.Name == skillName) { person.AgentInfo.SkillLevels.Remove(skillToRemove); person.Save(); break; } } } output.MessageCode = "200"; output.Message = "Skill deleted Successfully."; person = _configContainer.ConfServiceObject.RetrieveObject <CfgPerson>(queryPerson); if (person != null) { //Update the skill level to MySkills if (person.AgentInfo.SkillLevels != null && person.AgentInfo.SkillLevels.Count > 0) { Datacontext.GetInstance().MySkills.Clear(); foreach (CfgSkillLevel skillLevel in person.AgentInfo.SkillLevels) { Datacontext.GetInstance().MySkills.Add(new Agent.Interaction.Desktop.Helpers.MySkills(skillLevel.Skill.Name.ToString(), skillLevel.Level)); } } else { Datacontext.GetInstance().MySkills.Clear(); } } } catch (Exception commonException) { output.MessageCode = "2001"; output.Message = (commonException.InnerException == null ? commonException.Message : commonException.InnerException.Message); } return(output); }
public CaseWindow() { InitializeComponent(); this.DataContext = Datacontext.GetInstance(); this._configContainer = ConfigContainer.Instance(); ShadowEffect.ShadowDepth = 0; ShadowEffect.Opacity = 0.5; ShadowEffect.Softness = 0.5; ShadowEffect.Color = (Color)ColorConverter.ConvertFromString("#003660"); //webBrowser.Visibility = System.Windows.Visibility.Visible; //webBrowser.Navigate(new Uri("https://www.google.com")); }
public List <RequeueSkills> RetrieveRequeueSkillSet(string businessAttributeFullPath) { var _dataContext = Datacontext.GetInstance(); var listRequeueSkills = new List <RequeueSkills>(); if (businessAttributeFullPath == "$AllSkills$") { foreach (var item in _dataContext.LoadAllSkills) { listRequeueSkills.Add(new RequeueSkills() { Skill = item, Value = item }); } } else if (!string.IsNullOrEmpty(businessAttributeFullPath) && businessAttributeFullPath.Contains("/")) { string[] attribName = businessAttributeFullPath.Split('/'); if (attribName.Length == 2) { ConfigManager objConfigManager = new ConfigManager(); CfgEnumeratorValue objBusinessAttribute = objConfigManager.GetBusinessAttribute(attribName[0], attribName[1]); if (objBusinessAttribute != null && objBusinessAttribute.UserProperties != null) { foreach (var item in objBusinessAttribute.UserProperties.AllKeys) { var conditionData = objBusinessAttribute.UserProperties.GetAsKeyValueCollection(item.ToString()); foreach (var key in conditionData.AllKeys) { var requeueSkills = new RequeueSkills(); requeueSkills.Category = item.ToString(); requeueSkills.Value = key.ToString(); requeueSkills.Skill = conditionData[key].ToString(); listRequeueSkills.Add(requeueSkills); } } //return listRequeueSkills; } } } if (listRequeueSkills.Count == 0) { listRequeueSkills.Add(new RequeueSkills() { Skill = "None", Value = "None", Category = "None" }); } return(listRequeueSkills); }
/// <summary> /// Initializes a new instance of the <see cref="MyMessageSummary"/> class. /// </summary> /// <param name="owner">The owner.</param> public MyMessageSummary(Window owner) { EventManager.RegisterClassHandler(typeof(UIElement), AccessKeyManager.AccessKeyPressedEvent, new AccessKeyPressedEventHandler(OnAccessKeyPressed)); if (owner is SoftPhoneBar) { bottom = owner as SoftPhoneBar; } InitializeComponent(); this.DataContext = Datacontext.GetInstance(); ShadowEffect.ShadowDepth = 0; ShadowEffect.Opacity = 0.5; ShadowEffect.Softness = 0.5; ShadowEffect.Color = (Color)ColorConverter.ConvertFromString("#003660"); }
internal static void GetSwitchType() { if (_configContainer.AllKeys.Contains("switch-type") && _configContainer.GetValue("switch-type") != null) { var _switchQuery = new CfgSwitchQuery(); _switchQuery.TenantDbid = _configContainer.TenantDbId; _switchQuery.Name = _configContainer.GetValue("switch-type"); try { var _switch = _configContainer.ConfServiceObject.RetrieveObject <CfgSwitch>(_switchQuery); if (_switch != null) { Datacontext.GetInstance().SwitchType = _switch; } else { _switchQuery = new CfgSwitchQuery(); _switchQuery.TenantDbid = _configContainer.TenantDbId; var _switchICollection = _configContainer.ConfServiceObject.RetrieveMultipleObjects <CfgSwitch>(_switchQuery); foreach (CfgSwitch item in _switchICollection) { Datacontext.GetInstance().SwitchType = item; } } } catch { _switchQuery = new CfgSwitchQuery(); _switchQuery.TenantDbid = _configContainer.TenantDbId; var _switchICollection = _configContainer.ConfServiceObject.RetrieveMultipleObjects <CfgSwitch>(_switchQuery); foreach (CfgSwitch item in _switchICollection) { Datacontext.GetInstance().SwitchType = item; } } finally { if (Datacontext.GetInstance().SwitchType != null) { _logger.Info("T-server switch type: " + Datacontext.GetInstance().SwitchType.Type.ToString()); Datacontext.GetInstance().SwitchName = Datacontext.GetInstance().SwitchType.Type == CfgSwitchType.CFGLucentDefinityG3 ? "avaya" : ((Datacontext.GetInstance().SwitchType.Type == CfgSwitchType.CFGNortelDMS100 || Datacontext.GetInstance().SwitchType.Type == CfgSwitchType.CFGNortelMeridianCallCenter) ? "nortel" : "avaya"); } } } }
public CallDataPopup(string position, string size) { InitializeComponent(); WindowResizer winResize = new WindowResizer(this); winResize.addResizerDown(BottomSideRect); winResize.addResizerRight(RightSideRect); winResize.addResizerRightDown(RightbottomSideRect); winResize = null; DataContext = Datacontext.GetInstance(); ShadowEffect.ShadowDepth = 0; ShadowEffect.Opacity = 0.5; ShadowEffect.Softness = 0.5; ShadowEffect.Color = (Color)ColorConverter.ConvertFromString("#003660"); imgPinClose.Source = new BitmapImage(new Uri("/Agent.Interaction.Desktop;component/Images/Pin.Open.png", UriKind.Relative)); imgPin_EnterClose.Source = new BitmapImage(new Uri("/Agent.Interaction.Desktop;component/Images/Pin.Open.Selected.png", UriKind.Relative)); imgPinClose.Width = 18; imgPinClose.Height = 18; imgPin_EnterClose.Width = 18; imgPin_EnterClose.Height = 18; imgPinOpen.Source = new BitmapImage(new Uri("/Agent.Interaction.Desktop;component/Images/Pin.Close.png", UriKind.Relative)); imgPin_EnterOpen.Source = new BitmapImage(new Uri("/Agent.Interaction.Desktop;component/Images/Pin.Close.Selected.png", UriKind.Relative)); imgPinOpen.Width = 18; imgPinOpen.Height = 18; imgPin_EnterOpen.Width = 18; imgPin_EnterOpen.Height = 18; btnPin.Content = imgPinOpen; BindGrid(); var _posi = position.Split(','); var _size = size.Split(','); if (_posi.Count() > 1) { _left = double.Parse(_posi[0]); _top = double.Parse(_posi[1]); } if (_size.Count() > 1) { _height = double.Parse(_size[0]); _width = double.Parse(_size[1]); } }
/// <summary> /// Handles the Loaded event of the UserCallInfo control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void Window_Loaded(object sender, RoutedEventArgs e) { var hwnd = new WindowInteropHelper(this).Handle; SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU); _dataContext = Datacontext.GetInstance(); HwndSource source = PresentationSource.FromVisual(this) as HwndSource; source.AddHook(WndProc); SystemMenu = GetSystemMenu(new WindowInteropHelper(this).Handle, false); //EnableMenuItem(SystemMenu, SC_Minimize, (uint)(MF_ENABLED | (true ? MF_ENABLED : MF_GRAYED))); DeleteMenu(SystemMenu, SC_Move, MF_BYCOMMAND); DeleteMenu(SystemMenu, SC_Size, MF_BYCOMMAND); DeleteMenu(SystemMenu, SC_Minimize, MF_BYCOMMAND); DeleteMenu(SystemMenu, SC_Maximize, MF_BYCOMMAND); DeleteMenu(SystemMenu, SC_Restore, MF_BYCOMMAND); InsertMenu(SystemMenu, 0, MF_BYPOSITION, CU_Minimize, "Minimize"); InsertMenu(SystemMenu, 0, MF_BYPOSITION, CU_TopMost, "Topmost"); }
public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) { Datacontext _dataContext = Datacontext.GetInstance(); if (value == null) { return(Brushes.Black); } var color = new SolidColorBrush((System.Windows.Media.Color)ColorConverter.ConvertFromString(_dataContext.BroadCastAttributes[value.ToString()])); return(color); //var dValue = System.Convert.ToDecimal(value); //if (dValue < 0) // return new SolidColorBrush(_dataContext.BroadCastForegroundBrush); //else // return new SolidColorBrush(_dataContext.BroadCastForegroundBrush); }
/// <summary> /// Handles the Click event of the CallDataAddMenuitem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> public void CallDataAddMenuitem1_Click(object sender, RoutedEventArgs e) { try { MenuItem menuitem = sender as MenuItem; DGAttachData.UpdateLayout(); if (DGAttachData.Items.Count > 2) { DGAttachData.ScrollIntoView(DGAttachData.Items[DGAttachData.Items.Count - 2]); } int rowIndex = Datacontext.GetInstance() .NotifyCallData.IndexOf( Datacontext.GetInstance() .NotifyCallData.Where(p => p.Key == menuitem.Header.ToString()) .FirstOrDefault()); var dataGridCellInfo = new Microsoft.Windows.Controls.DataGridCellInfo(DGAttachData.Items[rowIndex], DGAttachData.Columns[1]); var cell = TryToFindGridCell(DGAttachData, dataGridCellInfo); if (cell == null) { return; } cell.Focus(); _isCaseDataManualBeginEdit = true; DGAttachData.BeginEdit(); if (_dataContext.NotifyCallData.Count <= 0) { DGAttachData.Visibility = Visibility.Collapsed; txtAttachDataInfo.Visibility = Visibility.Visible; } else { DGAttachData.Visibility = Visibility.Visible; txtAttachDataInfo.Visibility = Visibility.Collapsed; } } catch (Exception commonException) { _logger.Error("CallDataAddMenuitem_Click: " + commonException.Message.ToString()); } }
/// <summary> /// Binds the grid. /// </summary> public void BindGrid() { try { if (_dataContext.userAttachData.Count != 0) { _dataContext.NotifyCallData.Clear(); foreach (var pair in _dataContext.userAttachData) { //commented by vinoth on 06th Nov, but need to check //if (pair.Key == "ANI" || pair.Key == "OtherDN") //_dataContext.TitleText = pair.Value + " - Agent Interaction Desktop"; //end if (_dataContext.NotifyCallData.Count(p => p.Key == pair.Key) == 0) { Datacontext.GetInstance() .NotifyCallData.Add(new CallData(pair.Key, pair.Value, _dataContext.KeyFontFamily, _dataContext.KeyFontWeight)); } } _dataContext.NotifyCallData = new ObservableCollection <ICallData>(_dataContext.NotifyCallData.OrderBy(callData => callData.Key)); } if (_dataContext.NotifyCallData.Count <= 0) { DGAttachData.Visibility = Visibility.Collapsed; txtAttachDataInfo.Visibility = Visibility.Visible; } else { DGAttachData.Visibility = Visibility.Visible; txtAttachDataInfo.Visibility = Visibility.Collapsed; } } catch (Exception ex) { _logger.Error("Error occurred as " + ex.Message); } }
/// <summary> /// Reads the favorite fields. /// </summary> public void ReadFavoriteFields() { try { if (Datacontext.GetInstance().CorporateFavoriteFile == string.Empty) { return; } if (!File.Exists(Datacontext.GetInstance().CorporateFavoriteFile)) { return; } System.Xml.Linq.XDocument resultsDoc = System.Xml.Linq.XDocument.Parse((System.Xml.Linq.XDocument.Load(Datacontext.GetInstance().CorporateFavoriteFile)).ToString()); var query = resultsDoc.Root.Descendants("Favorites"); foreach (System.Xml.Linq.XElement elements in query) { DataRow dtRow = Datacontext.GetInstance().dtFavorites.NewRow(); dtRow["Category"] = elements.Element("Category").Value; dtRow["DisplayName"] = elements.Element("DisplayName").Value; dtRow["UniqueIdentity"] = elements.Element("UniqueIdentity").Value; dtRow["FirstName"] = elements.Element("FirstName").Value; dtRow["LastName"] = elements.Element("LastName").Value; dtRow["PhoneNumber"] = elements.Element("PhoneNumber").Value; dtRow["EmailAddress"] = elements.Element("EmailAddress").Value; dtRow["Type"] = elements.Element("Type").Value; Datacontext.GetInstance().dtFavorites.Rows.Add(dtRow); if (dtRow["Category"] as string != null && !string.IsNullOrEmpty((dtRow["Category"] as string).Trim()) && !Datacontext.GetInstance().CategoryNamesList.Contains(dtRow["Category"].ToString())) { Datacontext.GetInstance().CategoryNamesList.Add(dtRow["Category"].ToString()); } } } catch (Exception ex) { _logger.Error("Error in reading favorite XMLFile : " + ex.Message.ToString()); } }
/// <summary> /// Creates the XML file. /// </summary> public void CreateXMLFile() { try { if (!Directory.Exists(Path.GetDirectoryName(Datacontext.GetInstance().CorporateFavoriteFile))) { Directory.CreateDirectory(Path.GetDirectoryName(Datacontext.GetInstance().CorporateFavoriteFile)); } if (!File.Exists(Datacontext.GetInstance().CorporateFavoriteFile)) { _logger.Warn("Corporate Favorite File Not Found"); XDocument config = new XDocument( new XDeclaration("1.0", "utf-8", ""), new XElement("UserFavorites")); config.Save(@Datacontext.GetInstance().CorporateFavoriteFile); } } catch (Exception ex) { _logger.Error("Error in creating favorite XMLFile : " + ex.Message.ToString()); } }
public int RemoveFavorite(string uniqueIdentity, string type) { try { System.Xml.Linq.XDocument resultsDoc = System.Xml.Linq.XDocument.Parse((System.Xml.Linq.XDocument.Load(Datacontext.GetInstance().CorporateFavoriteFile)).ToString()); var query = resultsDoc.Root.Descendants("Favorites"); foreach (System.Xml.Linq.XElement e in query) { if (e.Element("UniqueIdentity").Value.ToString() == uniqueIdentity && e.Element("Type").Value.ToString() == type) { var collection = resultsDoc.DescendantNodes(); e.Remove(); resultsDoc.Save(Datacontext.GetInstance().CorporateFavoriteFile); return(1); } } } catch (Exception ex) { _logger.Error("Error in creating removing XMLFile : " + ex.Message.ToString()); } return(0); }
/// <summary> /// Initializes a new instance of the <see cref="About"/> class. /// </summary> #region Constructor public About() { InitializeComponent(); this.DataContext = Datacontext.GetInstance(); MainBorder.BorderBrush = new SolidColorBrush((Color)(ColorConverter.ConvertFromString("#0070C5"))); MainBorder.BitmapEffect = ShadowEffect; RenderOptions.SetCachingHint(MainBorder.BorderBrush, CachingHint.Cache); RenderOptions.SetBitmapScalingMode(MainBorder.BorderBrush, BitmapScalingMode.LowQuality); ShadowEffect.ShadowDepth = 0; ShadowEffect.Opacity = 0.5; ShadowEffect.Softness = 0.5; ShadowEffect.Color = (Color)ColorConverter.ConvertFromString("#003660"); if (ApplicationDeployment.IsNetworkDeployed) { if (ConfigurationManager.AppSettings.AllKeys.Contains("application.version")) { if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["application.version"])) { Version.Content = "V " + ConfigurationManager.AppSettings["application.version"].ToString(); } } } }
private void StatisticsConnectionManager_Opened(object sender, System.EventArgs e) { Datacontext.GetInstance().IsStatAlive = true; _listener.NotifyStatServerStatus("ServerStarted"); }
/// <summary> /// Modifies the XML data. /// </summary> /// <param name="dtRow">The dt row.</param> /// <param name="uniqueIdentity">The unique identity.</param> /// <param name="type">The type.</param> /// <returns></returns> public int ModifyXmlData(DataRow dtRow, string uniqueIdentity, string type) { try { CreateXMLFile(); System.Xml.Linq.XDocument resultsDoc = System.Xml.Linq.XDocument.Parse((System.Xml.Linq.XDocument.Load(Datacontext.GetInstance().CorporateFavoriteFile)).ToString()); string query = resultsDoc.Root.Descendants("Favorites").Where(x => x.Element("UniqueIdentity").Value.ToString() == uniqueIdentity && x.Element("Type").Value.ToString() == type ).Select(i => i.Element("UniqueIdentity").Value.ToString()).FirstOrDefault(); if (query == null) { return(CreateXMLData(dtRow)); } else { return(UpdateXmlData(dtRow, uniqueIdentity, type)); } } catch (Exception error) { _logger.Error("Error in modifying favorite XML data : " + error.Message.ToString()); } return(0); }
//private static void NamedPipeDataTransfer(StatRequest request) //{ // Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); // NamedPipeClientStream namedPipeClient = null; // Datacontext _dataContext = Datacontext.GetInstance(); // bool sendData = true; // try // { // if (request == StatRequest.Show || request == StatRequest.Open) // { // var statprocess = Process.GetProcessesByName("StatTickerFive"); // if (statprocess == null || statprocess.Length == 0 || (statprocess != null && statprocess.Length != 0 && !statprocess.Any(x => x.Id.ToString().Trim().Contains(_dataContext.StatProcessId.ToString())))) // { // string[] args = { "UserName:"******"Password:"******"AppName:" + _dataContext.ApplicationName, // "Host:" + (string.IsNullOrEmpty(_dataContext.HostNameSelectedValue) ? _dataContext.HostNameText : _dataContext.HostNameSelectedValue), // "Port:" + (string.IsNullOrEmpty(_dataContext.PortSelectedValue) ? _dataContext.PortText : _dataContext.PortSelectedValue), // "Place:" + _dataContext.Place }; // var statProcess = Process.Start(Environment.CurrentDirectory + @"\StatTickerFive.exe", string.Join(",", args)); // //var statProcess = Process.Start(@"C:\Program Files\Pointel Inc.,\Agent Interaction Desktop V5.0.3.11\StatTickerFive.exe", string.Join(",", args)); // _dataContext.StatProcessId = statProcess.Id; // sendData = false; // } // } // if (sendData) // { // namedPipeClient = new NamedPipeClientStream(".", "AIDPipe_" + _dataContext.UserName, PipeDirection.Out, PipeOptions.Asynchronous); // namedPipeClient.Connect(1000); // if (namedPipeClient.IsConnected) // { // byte[] msgBuff = System.Text.Encoding.UTF8.GetBytes(((int)request).ToString()); // namedPipeClient.Write(msgBuff, 0, msgBuff.Length); // namedPipeClient.Flush(); // namedPipeClient.Close(); // namedPipeClient.Dispose(); // } // } // } // catch (Exception generalException) // { // //System.Windows.MessageBox.Show("Stat Request : " + request.ToString() + "Error occurred as " + generalException.Message); // logger.Error("Error occurred as " + generalException.Message); // } // finally // { // if (namedPipeClient != null) // { // if (namedPipeClient.IsConnected) // { // namedPipeClient.Close(); // } // namedPipeClient.Dispose(); // namedPipeClient = null; // } // logger = null; // } //} private static void NamedPipeDataTransfer(StatRequest request) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); NamedPipeClientStream namedPipeClient = null; Datacontext _dataContext = Datacontext.GetInstance(); bool sendData = true; try { if (request == StatRequest.Show || request == StatRequest.Open) { var statprocess = Process.GetProcessesByName("StatTickerFive"); if (statprocess == null || statprocess.Length == 0 || (statprocess != null && statprocess.Length != 0 && !statprocess.Any(x => x.Id.ToString().Trim().Contains(_dataContext.StatProcessId.ToString())))) { //string isGadgetShow = "true"; //if (request == StatRequest.QueueConfig) // isGadgetShow = "false"; string[] args = { "UserName:"******"Password:"******"AppName:" + _dataContext.ApplicationName, "Host:" + (string.IsNullOrEmpty(_dataContext.HostNameSelectedValue) ? _dataContext.HostNameText : _dataContext.HostNameSelectedValue), "Port:" + (string.IsNullOrEmpty(_dataContext.PortSelectedValue) ? _dataContext.PortText : _dataContext.PortSelectedValue), "Place:" + _dataContext.Place, "AddpServerTimeOut:" + 0, "AddpClientTimeOut:" + 0, "IsConfigQueue:" + false, "IsGadgetShow:" + true }; var statProcess = Process.Start(Environment.CurrentDirectory + @"\StatTickerFive.exe", string.Join(",", args)); //var statProcess = Process.Start(@"C:\Program Files\Pointel Inc.,\Agent Interaction Desktop V5.0.3.11\StatTickerFive.exe", string.Join(",", args)); _dataContext.StatProcessId = statProcess.Id; sendData = false; } } if (sendData) { namedPipeClient = new NamedPipeClientStream(".", "AIDPipe_" + _dataContext.UserName, PipeDirection.Out, PipeOptions.Asynchronous); namedPipeClient.Connect(); if (namedPipeClient.IsConnected) { byte[] msgBuff = System.Text.Encoding.UTF8.GetBytes(((int)request).ToString()); namedPipeClient.Write(msgBuff, 0, msgBuff.Length); namedPipeClient.Flush(); namedPipeClient.Close(); namedPipeClient.Dispose(); } } } catch (Exception generalException) { //System.Windows.MessageBox.Show("Stat Request : " + request.ToString() + "Error occurred as " + generalException.Message); logger.Error("Error occurred as " + generalException.Message); } finally { //if (namedPipeClient != null) //{ // if (namedPipeClient.IsConnected) // { // namedPipeClient.Close(); // } // namedPipeClient.Dispose(); // namedPipeClient = null; //} logger = null; } }
internal static OutputValues AddUpdateSkillToAgent(string operationType, string userName, string skillName, Int32 skillLevel) { OutputValues output = new OutputValues(); try { CfgPersonQuery queryPerson = new CfgPersonQuery(); queryPerson.UserName = userName; queryPerson.TenantDbid = _configContainer.TenantDbId; CfgPerson person = _configContainer.ConfServiceObject.RetrieveObject <CfgPerson>(queryPerson); if (operationType == "Add") { if (person != null) { ICollection <CfgSkillLevel> agentSkills = person.AgentInfo.SkillLevels; bool flag = false; foreach (CfgSkillLevel checkSkill in agentSkills) { if (checkSkill.Skill.Name == skillName) { flag = true; break; } } if (!flag) { CfgSkillQuery querySkill = new CfgSkillQuery(); querySkill.TenantDbid = _configContainer.TenantDbId; querySkill.Name = skillName; CfgSkill skill = _configContainer.ConfServiceObject.RetrieveObject <CfgSkill>(querySkill); CfgSkillLevel skillToAdd = new CfgSkillLevel(_configContainer.ConfServiceObject, person); skillToAdd.Skill = skill; skillToAdd.Level = Convert.ToInt32(skillLevel); person.AgentInfo.SkillLevels.Add(skillToAdd); person.Save(); } } } else if (operationType == "Edit") { if (person != null) { ICollection <CfgSkillLevel> agentSkills = person.AgentInfo.SkillLevels; foreach (CfgSkillLevel editingSkill in agentSkills) { if (editingSkill.Skill.Name == skillName) { editingSkill.Level = Convert.ToInt32(skillLevel); person.Save(); break; } } } } output.MessageCode = "200"; output.Message = "Skill " + operationType + "ed Successfully."; person = _configContainer.ConfServiceObject.RetrieveObject <CfgPerson>(queryPerson); if (person != null) { //Update the skill level to MySkills if (person.AgentInfo.SkillLevels != null && person.AgentInfo.SkillLevels.Count > 0) { Datacontext.GetInstance().MySkills.Clear(); foreach (CfgSkillLevel skill in person.AgentInfo.SkillLevels) { Datacontext.GetInstance().MySkills.Add(new Agent.Interaction.Desktop.Helpers.MySkills(skill.Skill.Name.ToString(), skill.Level)); } } else { Datacontext.GetInstance().MySkills.Clear(); } } } catch (Exception commonException) { output.MessageCode = "2001"; output.Message = (commonException.InnerException == null ? commonException.Message : commonException.InnerException.Message); } return(output); }
public bool ConnectStatServer(string primaryHostName, string primaryPort, string secondaryHostName, string secondaryPort, int addpServerTimeOut, int addpClientTimeOut, int warmStandbyTimeout, short warmStandbyAttempts) { //StatServerConfiguration _statServerConfiguration = new StatServerConfiguration(Datacontext.GetInstance().StatServerName); //if (Datacontext.GetInstance().ProtocolManager != null) // Datacontext.GetInstance().ProtocolManager = null; //EventBrokerService _eventBrokerService = null; try { //_statServerConfiguration.Uri = new System.Uri("tcp://" + primaryHostName + ":" + primaryPort); //_statServerConfiguration.ClientName = Datacontext.GetInstance().StatServerName + "_" + Datacontext.GetInstance().UserName; //_statServerConfiguration.FaultTolerance = new FaultToleranceMode?(FaultToleranceMode.WarmStandby); //_statServerConfiguration.WarmStandbyTimeout = new int?(warmStandbyTimeout); //_statServerConfiguration.WarmStandbyAttempts = new short?(warmStandbyAttempts); //_statServerConfiguration.WarmStandbyUri = new System.Uri("tcp://" + secondaryHostName + ":" + secondaryPort); //_statServerConfiguration.UseAddp = new bool?(true); //_statServerConfiguration.AddpServerTimeout = new int?(addpServerTimeOut); //_statServerConfiguration.AddpClientTimeout = new int?(addpClientTimeOut); //_statServerConfiguration.AddpTrace = "both"; //Datacontext.GetInstance().ProtocolManager.Register(_statServerConfiguration); //_eventBrokerService = new EventBrokerService(Datacontext.GetInstance().ProtocolManager.Receiver); //_eventBrokerService.Activate(); //_eventBrokerService.Register(Listener.Listener.ReportingSuccessMessage); //Datacontext.GetInstance().ProtocolManager[Datacontext.GetInstance().StatServerName].Opened += new EventHandler(StatServerOpened); //Datacontext.GetInstance().ProtocolManager[Datacontext.GetInstance().StatServerName].Closed +=new EventHandler(StatServerClosed); //Datacontext.GetInstance().ProtocolManager[Datacontext.GetInstance().StatServerName].Open(); StatServerConfProperties _statServerProperties = new StatServerConfProperties(); _statServerProperties.Create(new Uri("tcp://" + primaryHostName + ":" + primaryPort), Datacontext.GetInstance().UserName, new Uri("tcp://" + secondaryHostName + ":" + secondaryPort), warmStandbyTimeout, warmStandbyAttempts, addpServerTimeOut, addpClientTimeOut, Genesyslab.Platform.Commons.Connection.Configuration.AddpTraceMode.Both); try { ProtocolManagers.Instance().ProtocolManager.Unregister(ServerType.Statisticsserver.ToString()); _logger.Warn("Protocol configuration is already registered, clear existing configurations"); } catch (Exception ex) { _logger.Warn("Try to remove existing protocol configurations throws exception"); } string error = ""; if (!ProtocolManagers.Instance().ConnectServer(_statServerProperties.Protocolconfiguration, out error)) { _logger.Error("Statserver protocol is not opened due to, " + error); return(false); } Listener _listener = new Listener(); ((StatServerProtocol)ProtocolManagers.Instance().ProtocolManager[ServerType.Statisticsserver.ToString()]).Received += _listener.ReportingSuccessMessage; if (ProtocolManagers.Instance().ProtocolManager[ServerType.Statisticsserver.ToString()].State == Genesyslab.Platform.Commons.Protocols.ChannelState.Opened) { _logger.Info("Stat server connection opened"); Datacontext.GetInstance().IsStatAlive = true; ProtocolManagers.Instance().ProtocolManager[ServerType.Statisticsserver.ToString()].Opened += new EventHandler(StatisticsConnectionManager_Opened); ProtocolManagers.Instance().ProtocolManager[ServerType.Statisticsserver.ToString()].Closed += new EventHandler(StatisticsConnectionManager_Closed); return(true); } else { _logger.Info("Stat server connection not opened"); Datacontext.GetInstance().IsStatAlive = false; return(false); } } catch (Exception ex) { _logger.Error("Error occurred while connecting statistics server : " + ((ex.InnerException == null) ? ex.Message : ex.InnerException.ToString())); return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="BroadCastNotifier"/> class. /// </summary> public BroadCastNotifier() { InitializeComponent(); this.DataContext = Datacontext.GetInstance(); }
/// <summary> /// Initializes a new instance of the <see cref="MessageBox"/> class. /// </summary> /// <param name="Msgbox_typename">The msgbox_typename.</param> /// <param name="content">The content.</param> /// <param name="btnleft_content">The btnleft_content.</param> /// <param name="btnright_content">The btnright_content.</param> /// <param name="isUsedForForward">if set to <c>true</c> [is used for forward].</param> public MessageBox(string Msgbox_typename, string content, string btnleft_content, string btnright_content, bool isUsedForForward) { btnleft_Content = btnleft_content; btnright_Content = btnright_content; IsUsedForForward = isUsedForForward; InitializeComponent(); this.DataContext = Datacontext.GetInstance(); ForwardError.Visibility = System.Windows.Visibility.Hidden; ForwardError.Content = ""; if (Msgbox_typename == "close") { this.DialogResult = true; this.Close(); } if (IsUsedForForward) { growFwd.Height = GridLength.Auto; btn_left.IsEnabled = false; } else { growFwd.Height = new GridLength(0); } if (IsUsedForForward) { if (Msgbox_typename.Contains("Cancel")) { lblTitle.Content = Msgbox_typename; txtForward.Visibility = System.Windows.Visibility.Hidden; lblForward.Visibility = System.Windows.Visibility.Hidden; btn_left.IsEnabled = true; } else { lblTitle.Content = Msgbox_typename; txtForward.Focus(); lblForward.Visibility = System.Windows.Visibility.Visible; txtForward.Visibility = System.Windows.Visibility.Visible; } } else { lblTitle.Content = Msgbox_typename + " - Agent Interaction Desktop"; } txtblockContent.Text = content; if (!string.IsNullOrEmpty(btnleft_content)) { btn_left.Content = btnleft_content; } else { btn_left.Visibility = System.Windows.Visibility.Hidden; } btn_right.Content = btnright_content; ShadowEffect.ShadowDepth = 0; ShadowEffect.Opacity = 0.5; ShadowEffect.Softness = 0.5; ShadowEffect.Color = (Color)ColorConverter.ConvertFromString("#003660"); ContentValue = content; }