public ActionResult LoggedIn() { if (Session["UserID"] != null) { using (Datacontext db = new Datacontext()) { var id = Convert.ToInt32(Session["UserID"]); var usr = db.Users.Single(u => u.Id == id); var listPost = new PostController().OldPosts(id); var TotalContentList = new List <string[]>(); foreach (Posts post in listPost) { User Sender = db.Users.Find(post.SenderID); string name = Sender.Firstname + " " + Sender.Lastname; string[] totalContentArray = new string[2] { name, post.TextContent }; TotalContentList.Add(totalContentArray); } User user = db.Users.Find(id); if (user == null) { return(HttpNotFound()); } ViewBag.PostsForUser = TotalContentList; return(View(usr)); } } return(RedirectToAction("Index")); }
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); } } }
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"); }
public EquipmentController(IEquipmentRespositories IEquipmentRespositories, Datacontext Datacontext, IConfiguration IConfiguration, IAuthorizationService authorizationService) { _IEquipmentRespositories = IEquipmentRespositories; db = Datacontext; _config = IConfiguration; _authorizationService = authorizationService; }
/// <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); }
/// <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 JobController(IJobRespositories IJobRespositories, Datacontext Datacontext, IConfiguration IConfiguration, IAuthorizationService authorizationService) { _IJobRespositories = IJobRespositories; db = Datacontext; _config = IConfiguration; _authorizationService = authorizationService; }
public ActionResult EditProfilePic(editwrapper edit) { try { using (Datacontext db = new Datacontext()) { var id = int.Parse(Session["UserID"].ToString()); var usr = db.Users.Single(u => u.Id == id); if ((edit.ProfileURL.ProfileURL.EndsWith(".jpg") || edit.ProfileURL.ProfileURL.EndsWith(".png") || edit.ProfileURL.ProfileURL.EndsWith(".img")) && edit.ProfileURL.ProfileURL != null) { usr.PictureURL = edit.ProfileURL.ProfileURL; } else { ModelState.AddModelError("", "Must be a URL from the internet ending with .jpg, .png or .img"); } db.SaveChanges(); } } catch { ModelState.AddModelError("", "Something went wrong, please try again."); return(View("EditAccount")); } return(RedirectToAction("EditAccount")); }
public CardTypeController(ICardTypeRespositories ICardTypeRespositories, Datacontext Datacontext, IConfiguration IConfiguration, IAuthorizationService authorizationService) { _ICardTypeRespositories = ICardTypeRespositories; db = Datacontext; _config = IConfiguration; _authorizationService = authorizationService; }
public RoleController(IRoleRespositories IRoleRespositories, Datacontext datacontext ) { _IRoleRespositories = IRoleRespositories; db = datacontext; }
public KhachHangLogController(IKhachHangLogRespositories IKhachHangLogRespositories, Datacontext Datacontext, IConfiguration IConfiguration, IAuthorizationService authorizationService) { _IKhachHangLogRespositories = IKhachHangLogRespositories; db = Datacontext; _config = IConfiguration; _authorizationService = authorizationService; }
public Handler(Datacontext context, ILogger <List> logger, IMapper mapper, IUserAccessor userAccessor) { this._userAccessor = userAccessor; this._mapper = mapper; this._logger = logger; this._context = context; }
public FacilityController(IFacilityRespositories IFacilityRespositories, Datacontext Datacontext, IConfiguration IConfiguration, IAuthorizationService authorizationService) { _IFacilityRespositories = IFacilityRespositories; db = Datacontext; _config = IConfiguration; _authorizationService = authorizationService; }
public ActionResult DeclineFriend(int id) { var requester = id; var currentUser = Convert.ToInt32(Session["UserID"]); using (Datacontext db = new Datacontext()) { var AllFriendConnections = db.Friends.ToList(); var PendingFriends = new List <Friend>(); foreach (Friend friend in AllFriendConnections) { if (friend.Accepted == false) { PendingFriends.Add(friend); } } foreach (Friend friend in PendingFriends) { if (friend.Friend1 == id && friend.Friend2 == currentUser) { db.Friends.Remove(friend); } } db.SaveChanges(); return(RedirectToAction("Friends")); } }
static void Main(string[] args) { Datacontext context = new Datacontext(); // foreach (Patient in patientList) //{ //Console.WriteLine($"Name: {Patient.firstName}"); }
public KhachHangLogRespositories(Datacontext datacontext, IMapper mapper, IHostingEnvironment IHostingEnvironment, IHttpContextAccessor IHttpContextAccessor, IConfiguration IConfiguration) { this.db = datacontext; this.mp = mapper; _hostingEnvironment = IHostingEnvironment; _IHttpContextAccessor = IHttpContextAccessor; _IConfiguration = IConfiguration; }
public ActionResult LoggedIn() { using (Datacontext db = new Datacontext()) { var id = int.Parse(Session["UserID"].ToString()); var usr = db.Users.Single(u => u.Id == id); return(View(usr)); } }
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"); }
public StudentsController(Datacontext datacontext) { _datacontext = datacontext; if (_datacontext.Students.Count() == 0) { _datacontext.Students.Add(new Student { Name = "Huy", ClassId = 1, Address = "Ha Dong", Email = "*****@*****.**" }); _datacontext.SaveChanges(); } }
/// <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; } }
public ClassesController(Datacontext datacontext) { _datacontext = datacontext; if (_datacontext.Classes.Count() == 0) { _datacontext.Classes.Add(new Class { Name = "AT12" }); _datacontext.SaveChanges(); } }
public static void SeedData() { var db = new Datacontext(); if (!db.Books.Any()) { var InitialBooks = new List <Book>() { //10 default books, Sindri new Book { Title = "The Hitchhiker's Guide to the Galaxy", Author = "Douglas Adams", ReleaseYear = 1979, Genre = "SciFi", ISBN = "330258648", Price = 17.99, Stock = 10, TopSeller = false, OnSale = false, Discount = 0, Image = "https://images.penguinrandomhouse.com/cover/9781400052929" }, new Book { Title = "It", Author = "Stephen King", ReleaseYear = 1986, Genre = "Horror", ISBN = "670813028", Price = 23.99, Stock = 15, TopSeller = false, OnSale = false, Discount = 0, Image = "http://cdn.collider.com/wp-content/uploads/2017/09/it-book-cover.jpg" }, new Book { Title = "The Dark Knight Returns", Author = "Frank Miller", ReleaseYear = 1986, Genre = "Comics", ISBN = "1563893428", Price = 20.99, Stock = 25, TopSeller = false, OnSale = false, Discount = 0, Image = "https://upload.wikimedia.org/wikipedia/en/7/77/Dark_knight_returns.jpg" }, new Book { Title = "The Shining", Author = "Stephen King", ReleaseYear = 1977, Genre = "Horror", ISBN = "9780385121675", Price = 10.99, Stock = 20, TopSeller = false, OnSale = false, Discount = 0, Image = "https://upload.wikimedia.org/wikipedia/en/4/4c/Shiningnovel.jpg" }, new Book { Title = "Stars in My Pocket Like Grains of Sand", Author = "Samuel R. Delany", ReleaseYear = 1984, Genre = "SciFi", ISBN = "9780553050530", Price = 27.99, Stock = 10, TopSeller = false, OnSale = false, Discount = 0, Image = "https://upload.wikimedia.org/wikipedia/en/4/4d/Stars_in_my_pocket_like_grains_of_sand.jpg" }, new Book { Title = "The Grapes of Wrath", Author = "John Steinbeck", ReleaseYear = 1939, Genre = "Drama", ISBN = "9780143039433", Price = 11.49, Stock = 7, TopSeller = false, OnSale = false, Discount = 0, Image = "https://upload.wikimedia.org/wikipedia/en/1/1f/JohnSteinbeck_TheGrapesOfWrath.jpg" }, new Book { Title = "How to Compile C Code", Author = "Bjorgvin Karason", ReleaseYear = 2013, Genre = "Educational", ISBN = "9780446310001", Price = 44.29, Stock = 13, TopSeller = false, OnSale = false, Discount = 0, Image = "https://images-na.ssl-images-amazon.com/images/I/41gpxHEh2rL._SX403_BO1,204,203,200_.jpg" }, new Book { Title = "The Hobbit, or There and Back Again", Author = "J. R. R. Tolkien", ReleaseYear = 1937, Genre = "Fantasy", ISBN = "9780547928227", Price = 27.09, Stock = 50, TopSeller = false, OnSale = false, Discount = 0, Image = "http://media.bookbub.com/wp-content/uploads/2014/12/1937.jpg" }, new Book { Title = "To Kill a Mockingbird", Author = "Harper Lee", ReleaseYear = 1960, Genre = "Drama", ISBN = "9780446310789", Price = 23.99, Stock = 15, TopSeller = false, OnSale = false, Discount = 0, Image = "https://upload.wikimedia.org/wikipedia/en/7/79/To_Kill_a_Mockingbird.JPG" }, new Book { Title = "Foundation", Author = "Isaac Asimov", ReleaseYear = 1951, Genre = "SciFi", ISBN = "553293354", Price = 25.99, Stock = 30, TopSeller = false, OnSale = false, Discount = 0, Image = "https://static.squarespace.com/static/51b3dc8ee4b051b96ceb10de/51ce6099e4b0d911b4489b79/51ce6178e4b0d911b4495446/1317432124153/1000w/Isaac%20Asimov_1951_Foundation.jpg" } }; db.AddRange(InitialBooks); db.SaveChanges(); } }
/// <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; } } }
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 void NotifyCMEObjects(Dictionary <string, object> CMEObjects) { _datacontext = new Datacontext(); if (CMEObjects != null && CMEObjects.Count > 0) { if (CMEObjects.ContainsKey("voice.disposition.codes")) { _datacontext.VoiceDispositionCodes = (Dictionary <string, string>)CMEObjects["voice.disposition.codes"]; } if (CMEObjects.ContainsKey("email.disposition.codes")) { _datacontext.EmailDispositionCodes = (Dictionary <string, string>)CMEObjects["email.disposition.codes"]; } if (CMEObjects.ContainsKey("chat.disposition.codes")) { _datacontext.ChatDispositionCodes = (Dictionary <string, string>)CMEObjects["chat.disposition.codes"]; } if (CMEObjects.ContainsKey("voice.subdisposition.codes")) { _datacontext.VoiceSubDispositionCodes = (Dictionary <string, Dictionary <string, string> >)CMEObjects["voice.subdisposition.codes"]; } if (CMEObjects.ContainsKey("email.subdisposition.codes")) { _datacontext.EmailSubDispositionCodes = (Dictionary <string, Dictionary <string, string> >)CMEObjects["email.subdisposition.codes"]; } if (CMEObjects.ContainsKey("chat.subdisposition.codes")) { _datacontext.ChatSubDispositionCodes = (Dictionary <string, Dictionary <string, string> >)CMEObjects["chat.subdisposition.codes"]; } if (CMEObjects.ContainsKey("enable.multidisposition.enabled")) { _datacontext.IsMultiDispositionEnabled = (bool)CMEObjects["enable.multidisposition.enabled"]; //if(_datacontext.IsMultiDispositionEnabled) { _datacontext.SingleDispositionPanelVisibility = Visibility.Collapsed; _datacontext.MultiDispositionPanelVisibility = Visibility.Visible; } //else //{ // _datacontext.SingleDispositionPanelVisibility = Visibility.Visible; // _datacontext.MultiDispositionPanelVisibility = Visibility.Collapsed; //} } if (CMEObjects.ContainsKey("DispositionCodeKey"))//DispositionCode Name { _datacontext.DispositionCodeKey = CMEObjects["DispositionCodeKey"].ToString(); } if (CMEObjects.ContainsKey("DispositionName"))//First Transaction Object Name { _datacontext.DispositionName = CMEObjects["DispositionName"].ToString(); } } }
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 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(); }
public ActionResult AddFriend(int id) { using (Datacontext db = new Datacontext()) { Friend friend = new Friend(); friend.Friend1 = Convert.ToInt32(Session["UserID"]); friend.Friend2 = id; friend.Accepted = false; db.Friends.Add(friend); db.SaveChanges(); return(RedirectToAction("FriendProfile", new { id = id })); } }
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); }