public JsonResult Get(int pageIndex, int pageSize, string pageOrder, string name) { var list = Colleagues.Get(pageIndex, pageSize, pageOrder, name); int total = Colleagues.Count(name); int totalPage = (int)Math.Ceiling((decimal)total / pageSize); if (pageSize > total) { pageSize = total; } if (list.Count < pageSize) { pageSize = list.Count; } JsonResult result = new JsonResult() { Data = new { TotalPages = totalPage, PageIndex = pageIndex, PageSize = pageSize, Rows = list }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; return(result); }
void svc_GetUserColleaguesCompleted(object sender, GetUserColleaguesCompletedEventArgs e) { if (e.Error == null) { Deployment.Current.Dispatcher.BeginInvoke(() => { Colleagues.Clear(); foreach (ContactData contactData in e.Result.ToList()) { Colleagues.Add(new ColleagueViewModel() { AccountName = contactData.AccountName, FullName = contactData.Name, Title = contactData.Title, EMail = contactData.Email, PersonalUrl = contactData.Url }); } }); Debug.WriteLine("Colleagues: {0}", Colleagues.Count); } else { Debug.WriteLine("Error: {0}", e.Error.Message); } }
/// <summary> /// 根据指定的接收者和 <c>Intent</c> 对象传递并执行任务 /// </summary> /// <param name="receiver"></param> /// <param name="intent"></param> private void Execute(string receiver, Intent intent) { if (Colleagues.ContainsKey(receiver)) { IWorker worker = Colleagues[receiver] as IWorker; if (worker != null) { worker.Trigger(intent); } } }
public override void Send(string message, Colleague colleague) { // Send message to all colleagues, except sender, in the same group Colleagues // Exclude sender from message receivers .Except(new List <Colleague> { colleague }) .Where(item => item.GroupName == colleague.GroupName).ToList() .ForEach(item => item.Receive(message)); }
private async Task <DialogTurnResult> PromptNotifyColleaguesAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var notificationOfIllnessDetails = (NotificationOfIllnessDetails)stepContext.Options; var colleagues = new Colleagues(notificationOfIllnessDetails.TokenResponse); var colleagueNames = await colleagues.GetMyColleaguesName(); var messageText = $"Soll ich Deine Kollegen {string.Join(", ", colleagueNames)} bescheid geben?"; var promptMessage = MessageFactory.Text(messageText, messageText, InputHints.ExpectingInput); return(await stepContext.PromptAsync(nameof(ConfirmPrompt), new PromptOptions { Prompt = promptMessage }, cancellationToken)); }
public async Task <ActionResult> Index() { dataTable.Columns.Add(new DataColumn("Employee Number", typeof(string))); dataTable.Columns.Add(new DataColumn("First Name", typeof(string))); dataTable.Columns.Add(new DataColumn("Last Name", typeof(string))); dataTable.Columns.Add(new DataColumn("Email", typeof(string))); dataTable.Columns.Add(new DataColumn("Cell Number", typeof(string))); dataTable.Columns.Add(new DataColumn("Skill", typeof(string))); //creates connection 3to firebase IFirebaseConfig config = new FirebaseConfig { AuthSecret = "3JjYU2MerFoAvR5N5yMOaQv3YdH5orw8skiMdXeW", BasePath = "https://troye-computer-systems.firebaseio.com/" }; IFirebaseClient client; client = new FireSharp.FirebaseClient(config); int counter = 0; int i = 0; FirebaseResponse response = await client.GetTaskAsync("Counter/node"); Colleagues obj = response.ResultAs <Colleagues>(); //this finds out the size of the database with a counter in the table called counter node cnt counter = Convert.ToInt32(obj.cnt); //change 20 based on the number of people in the table while (i < 20) { i++; try { //get data from specified table and increment through each of the employees FirebaseResponse resp2 = await client.GetTaskAsync("Employees/" + i); Colleagues obj2 = resp2.ResultAs <Colleagues>(); DataRow row = dataTable.NewRow(); //addeds the employees data to each row with new data and row each time it goes through the while loop //make sure the getters and setters names are the same as in the table or a problem will arise row["Employee Number"] = obj2.EmployeeNumber; row["First Name"] = obj2.FirstName; row["Last Name"] = obj2.LastName; row["Email"] = obj2.Email; row["Cell Number"] = obj2.CellNumber; row["Skill"] = obj2.Skill; dataTable.Rows.Add(row); } catch { Debug.Write("Fail, You are going to far and their is no more data! "); } } return(View("ColleaguesView", dataTable)); }
private void TransformGraphDataToDto(IUserPeopleCollectionPage data) { var items = data.ToList(); foreach (var item in items) { var colleague = new Colleague { Name = item?.GivenName, Department = item?.Department, EmailAddress = item?.ScoredEmailAddresses.FirstOrDefault().Address, Title = item.JobTitle }; Colleagues.Add(colleague); } }
public JsonResult SendRequest(Colleague colleague) { var jsonSuccessResult = new JsonSuccessResult(); try { Colleagues.Insert(colleague); string fullName = colleague.FirstName + " " + colleague.LastName; // اطلاع رسانی به مدیر #region Apprise Admin string body = "مدیریت محترم، در بخش همکاری با ما، پیام جدیدی ثبت شد:"; body += "<br/>"; body += String.Format("نام و نام خانوادگی: {0} <br/> زمینه همکاری: {1} <br/> شماره همراه: {2} <br/> پست الکترونیک: {3}", fullName, colleague.CooperationDescription, colleague.Mobile, colleague.Email); EmailServices.NotifyAdminsByEmail(AdminEmailType.NewColleague, body, null); #endregion Apprise Admin EmailServices.DeliveryColleagueRequest(colleague.Email, fullName, UserID); jsonSuccessResult.Success = true; } catch (DbException ex) { jsonSuccessResult.Errors = ex.Errors.ToArray(); jsonSuccessResult.Success = false; } catch (Exception ex) { jsonSuccessResult.Errors = new string[] { ex.Message }; jsonSuccessResult.Success = false; } return(new JsonResult() { Data = jsonSuccessResult }); }
public ActionResult Edit(Colleague colleague) { try { colleague.LastUpdate = DateTime.Now; ViewBag.Success = true; Colleagues.Update(colleague); } catch (Exception ex) { SetErrors(ex); } return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { Colleague colleague; colleague = Colleagues.GetByID(id); if (colleague.CooperationDescription != null) { colleague.CooperationDescription = colleague.CooperationDescription.Replace("\r\n", "<br/>"); } if (colleague.Text != null) { colleague.Text = colleague.Text.Replace("\r\n", "<br/>"); } return(View(model: colleague)); }
public ActionResult Index() { HttpClient apiClient = new HttpClient(); apiClient.BaseAddress = new Uri(baseurl); apiClient.DefaultRequestHeaders.Clear(); //Define request data format apiClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); Colleagues images = new Colleagues(); try { Task <HttpResponseMessage> responseMessage = apiClient.GetAsync(url); if (responseMessage.Result.IsSuccessStatusCode) { List <Colleague> colleagueImages = new List <Colleague>(); var responseData = responseMessage.Result.Content; using (var reader = new StreamReader(responseData.ReadAsStreamAsync().Result)) { using (var jtr = new JsonTextReader(reader)) { dynamic colleagues = new JsonSerializer().Deserialize(jtr); ViewBag.nameSought = colleagues.nameToID; images.nameToId = colleagues.nameToId; images.slugToId = colleagues.slugToId; //convert dynamic object instance to a strongly typed instance. colleagueImages = colleagues.displayPersons.ToObject <List <Colleague> >(); images.colleagues = colleagueImages; } } images.slugToId = images.colleagues.Single(s => s.Name == images.nameToId).slug; return(View(images)); } return(View("Error")); } catch (Exception ex) { // log exception return(View("Error")); } }
async Task ExecuteLoadItemsCommand() { IsBusy = true; try { Colleagues.Clear(); var data = await LoadGraphData(); TransformGraphDataToDto(data); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private async Task <DialogTurnResult> NotifyColleaguesAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var notificationOfIllnessDetails = (NotificationOfIllnessDetails)stepContext.Options; var sendNotificationToColleagues = (bool)stepContext.Result; if (sendNotificationToColleagues) { var colleagues = new Colleagues(notificationOfIllnessDetails.TokenResponse); var colleagueMailAddresses = await colleagues.GetMyColleaguesMailAddresses(); var mailClient = new ExchangeMailClient(notificationOfIllnessDetails.TokenResponse, m_ExchangeSettings); var message = $"Dies ist eine automatisch generierte Nachricht. {notificationOfIllnessDetails.TokenResponse.GetNameClaim()?.Value} ist bis zum {notificationOfIllnessDetails.SickUntil.GetValueOrDefault():dd.MM.yyyy} krank und ist nicht im Büro."; mailClient.SendMail(colleagueMailAddresses, "Krankmeldung", message); var msg = $"Ich habe Deine Kollegen eine Mail gesendet, daß Du bis zum {notificationOfIllnessDetails.SickUntil?.ToString("dd.MM.yyyy")} krank bist."; await stepContext.Context.SendActivityAsync(MessageFactory.Text(msg, msg, InputHints.IgnoringInput), cancellationToken); } return(await stepContext.NextAsync(notificationOfIllnessDetails, cancellationToken)); }
public JsonResult Delete(int id) { var jsonSuccessResult = new JsonSuccessResult(); try { Colleagues.Delete(id); jsonSuccessResult.Success = true; } catch (Exception ex) { jsonSuccessResult.Errors = new string[] { ex.Message }; jsonSuccessResult.Success = false; } return(new JsonResult() { Data = jsonSuccessResult }); }
private void TransformGraphDataToDto(string data) { var extractedData = JObject.Parse(data); var colleagues = extractedData["value"]; foreach (var colleague in colleagues) { var newColleague = new Colleague { Name = colleague["displayName"].ToString(), Department = colleague["department"].ToString(), EmailAddress = colleague["scoredEmailAddresses"][0]["address"].ToString(), Title = colleague["jobTitle"].ToString() }; if (newColleague.Name.Equals("All Company", StringComparison.OrdinalIgnoreCase)) { continue; } Colleagues.Add(newColleague); } }
public async Task <ActionResult> postusingparameters(string Name, string Password) { Models.Login s = new Models.Login(); s.Username = Name; s.Password = Password; String sName = s.Username; Debug.Write("sdddddddddddddddddddddddddddddddddddddddddddddddddddd" + sName + " " + s.Password); //add error checking //return Content("<script language='javascript' type='text/javascript'>alert ('Email successfully sent I will be in contact with you as soon as possible! ');</script>"); dataTable.Columns.Add(new DataColumn("Admin", typeof(string))); dataTable.Columns.Add(new DataColumn("EmployeeID", typeof(string))); dataTable.Columns.Add(new DataColumn("Name", typeof(string))); dataTable.Columns.Add(new DataColumn("Password", typeof(string))); dataTable.Columns.Add(new DataColumn("Username", typeof(string))); //creates connection 3to firebase IFirebaseConfig config = new FirebaseConfig { AuthSecret = "3JjYU2MerFoAvR5N5yMOaQv3YdH5orw8skiMdXeW", BasePath = "https://troye-computer-systems.firebaseio.com/" }; IFirebaseClient client; client = new FireSharp.FirebaseClient(config); int counter = 0; int i = 0; FirebaseResponse response = await client.GetTaskAsync("Counter/node"); Colleagues obj = response.ResultAs <Colleagues>(); //this finds out the size of the database with a counter in the table called counter node cnt counter = Convert.ToInt32(obj.cnt); //change 20 based on the number of people in the table while (i < 20) { i++; try { //get data from specified table and increment through each of the employees FirebaseResponse resp2 = await client.GetTaskAsync("LoginDetails/" + i); Login obj2 = resp2.ResultAs <Login>(); DataRow row = dataTable.NewRow(); //addeds the employees data to each row with new data and row each time it goes through the while loop //make sure the getters and setters names are the same as in the table or a problem will arise row["Admin"] = obj2.Admin; row["EmployeeID"] = obj2.EmployeeID; row["Name"] = obj2.Name; row["Password"] = obj2.Password; row["Username"] = obj2.Username; dataTable.Rows.Add(row); Debug.Write("essss ******************" + obj2.Admin); if (obj2.Username == s.Username && obj2.Password == s.Password && obj2.Admin.Equals("yes")) { Debug.Write("Correct **************************"); return(RedirectToAction("Index", "CommunicationAdmin")); } else if (obj2.Username == s.Username && obj2.Password == s.Password) { Debug.Write("correct customer ************************"); return(RedirectToAction("Index", "Communication")); } else { Debug.Write("Incorrect ************************"); } } catch { Debug.Write("Fail, You are going to far and their is no more data! "); } } return(RedirectToAction("Index", "Login")); }
/// <summary> /// Find the potential colleagues for a star and write them to the database. /// (They need to be stored in the database in case the NCBI web search /// fails due to an error -- that way the publications can be re-retrieved.) /// </summary> /// <param name="Star">Star to search for</param> /// <param name="Colleagues">Colleagues to return</param> /// <returns>An array of colleagues, or null if none were found</returns> public Person[] FindPotentialColleagues(Person Star) { // Keep an array of found Setnbs, so each colleague is only found once ArrayList FoundSetnbs = new ArrayList(); // Create the new set of colleagues Person[] Colleagues = null; // Get all of the star's publications and look through the author lists for matches // This will throw an error if there are no publications for the person Publications pubs; try { if (String.IsNullOrEmpty(AlternateTableName)) { pubs = new Publications(DB, Star, true); } else { pubs = new Publications(DB, Star, AlternateTableName, true); } } catch { pubs = null; } if (pubs != null && pubs.PublicationList != null) { foreach (Publication pub in pubs.PublicationList) { foreach (string name in pub.Authors) { // TODO: This only retunrs one person. What if there are two people // who match that name? It should return multiple people, and // add each of them as a potential colleague. Person[] colleagues = roster.FindPerson(name); // If FindPerson returned colleagues (that's not the star), // we have a match if (colleagues != null) { // FindPerson could return several colleagues whose names match. foreach (Person colleague in colleagues) { // Each of the matches needs to be added as a colleague. if (colleague.Setnb != Star.Setnb) { // Always add it to ColleagueMatches ArrayList Parameters = new ArrayList(); Parameters.Add(Database.Parameter(colleague.Setnb)); Parameters.Add(Database.Parameter(Star.Setnb)); Parameters.Add(Database.Parameter(pub.PMID)); Parameters.Add(Database.Parameter(name)); DB.ExecuteNonQuery(@"INSERT INTO ColleagueMatches (Setnb, StarSetnb, PMID, MatchName) VALUES ( ? , ? , ? , ? )", Parameters); // If the colleague hasn't already been added, add it to the array // and write it to the database if (!FoundSetnbs.Contains(colleague.Setnb)) { FoundSetnbs.Add(colleague.Setnb); if (Colleagues == null) { Colleagues = new Person[1]; } else { Array.Resize(ref Colleagues, Colleagues.Length + 1); } Colleagues[Colleagues.GetUpperBound(0)] = colleague; WriteColleagueToDB(DB, Star, colleague); } } } } } } } return(Colleagues); }