// GET: Messege/Details/5 public ActionResult Details(int?id, int?p, int?d) { if (Session["Dologin"].ToString() == "" && Session["Palogin"].ToString() == "") { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Messege messege = db.Messeges.Find(id); if (messege == null) { return(HttpNotFound()); } if (((Models.Patient)Session["Pa"]).Id == p) { return(View(messege)); } if (((Models.Doctor)Session["Do"]).Id == d) { return(View(messege)); } return(RedirectToAction("PaLogin")); }
private void DistributionUserMessege(Messege newMsg) { for (int i = 0; i < userManager.GetActiveUsers.Count(); i++) { bf.Serialize(userManager.GetActiveUsers.ElementAt(i).GetTcpStream, (MsgUser)newMsg); } }
public ActionResult Create([Bind(Include = "Id,ProblemName,ProblemDate,Details")] Messege messege, HttpPostedFileBase File1, int p, int d) { messege.File1 = System.IO.Path.GetFileName(File1.FileName); //messege.File2 = System.IO.Path.GetFileName(File2.FileName); //messege.File3 = System.IO.Path.GetFileName(File3.FileName); //messege.File4 = System.IO.Path.GetFileName(File4.FileName); if (ModelState.IsValid) { messege.PatientId = p; messege.DoctorId = d; db.Messeges.Add(messege); db.SaveChanges(); string f1 = Server.MapPath("../Upload/File/File1/" + messege.Id.ToString() + "_" + messege.PatientId.ToString() + "_" + messege.File1); File1.SaveAs(f1); //string f2 = Server.MapPath("../Upload/File/File2/" + messege.Id.ToString() + "_" + messege.PatientId.ToString() + "_" + messege.File2); ////File2.SaveAs(f2); //string f3 = Server.MapPath("../Upload/File/File3/" + messege.Id.ToString() + "_" + messege.PatientId.ToString() + "_" + messege.File3); //File3.SaveAs(f3); //string f4 = Server.MapPath("../Upload/File/File4/" + messege.Id.ToString() + "_" + messege.PatientId.ToString() + "_" + messege.File4); //File4.SaveAs(f4); return(RedirectToAction("Index")); } return(View(messege)); }
private void Execute_edit_category(object o) { try { Messege messege = new Messege(); View_Model_Messege messege_view_Model = new View_Model_Messege(System.Windows.Visibility.Visible, System.Windows.Visibility.Visible, System.Windows.Visibility.Hidden); if (messege_view_Model._OK == null) { messege_view_Model._OK = new Action(messege.Close); } if (messege_view_Model._NO == null) { messege_view_Model._NO = new Action(messege.Close); } messege.DataContext = messege_view_Model; messege_view_Model.Messege = "Do you really want to change this category?"; messege_view_Model.Messeg_Titel = "Change category"; messege.ShowDialog(); if (messege_view_Model.is_ok && myProfile.Right.Level < 2) { Select_item_category.Name = name_category; myDB.SaveChanges(); list_category = myDB.Categories.ToList(); OnPropertyChanged(nameof(List_category)); OnPropertyChanged(nameof(List_product)); } else if (myProfile.Right.Level == 2) { OpenMessege("You do not have permission to edit the category.", "Error"); } }catch (Exception e) { OpenMessege(e.Message, "Error"); } }
// PUT api/<controller>/5 public IHttpActionResult Put([FromUri] int id, [FromBody] Messege messege) { messege.id = id; msgRep.Update(messege); linkGen(messege); return(Ok(messege)); }
internal MessegesManager(UserManager userManager, Messege newMsg, ChatContext context) { this.context = context; this.userManager = userManager; if (newMsg is MsgUser) { DistributionUserMessege((MsgUser)newMsg); AddUserMessegeToDb((MsgUser)newMsg); } else if (((MsgStatus)newMsg).GetStatusUserInMessege == Status.disconnected) { DistributionStatusMessege(newMsg); UpdateUserStatusAndLastSeenInDb((MsgStatus)newMsg); userManager.GetUser .UserStatus = Status.disconnected; statusUser = new StatusUserEventArgs(userManager.GetUser); } else { DistributionStatusMessege(newMsg); if (((MsgStatus)newMsg).GetSender.GetOperation != Operation.SingUp) { UpdateUserStatusAndLastSeenInDb((MsgStatus)newMsg); } } }
public void ReceiveMesseges() { ThreadPool.QueueUserWorkItem(o => { while (user.UserStatus == Status.connected) { try { Messege msg = (Messege)bf.Deserialize(tcpStream); ThreadPool.QueueUserWorkItem(p => { lock (locker) { ReceiveMessegeEventArgs newMessege = new ReceiveMessegeEventArgs(msg); if (receiveMessege != null) { receiveMessege(this, newMessege); } } }); } catch { tcpStream.Dispose(); return; } } }); }
public ActionResult DeleteConfirmed(int id) { Messege messege = db.Messeges.Find(id); db.Messeges.Remove(messege); db.SaveChanges(); return(RedirectToAction("Index")); }
// POST api/<controller> public IHttpActionResult Post([FromBody] Messege messege) { msgRep.Insert(messege); linkGen(messege); string url = Url.Link("GetMessegeById", new { id = messege.id }); return(Created(url, messege)); }
private void Execute_delete_product(object o) { try { Messege messege = new Messege(); View_Model_Messege messege_view_Model = new View_Model_Messege(System.Windows.Visibility.Visible, System.Windows.Visibility.Visible, System.Windows.Visibility.Hidden); if (messege_view_Model._OK == null) { messege_view_Model._OK = new Action(messege.Close); } if (messege_view_Model._NO == null) { messege_view_Model._NO = new Action(messege.Close); } messege.DataContext = messege_view_Model; messege_view_Model.Messege = "Are you sure you want to delete this product?"; messege_view_Model.Messeg_Titel = "Deleting product"; messege.ShowDialog(); if (messege_view_Model.is_ok && myProfile.Right.Level < 2) { Name_product = null; list_product.Remove(select_item_product); myDB.Products.Remove(select_item_product); Select_item_product = null; try { myDB.SaveChanges(); } catch (Exception e) { messege = new Messege(); messege_view_Model = new View_Model_Messege(System.Windows.Visibility.Visible, System.Windows.Visibility.Hidden, System.Windows.Visibility.Hidden); if (messege_view_Model._OK == null) { messege_view_Model._OK = new Action(messege.Close); } messege.DataContext = messege_view_Model; messege_view_Model.Messege = "With this product there is a connection of records with users.\nRemoval is not possible."; messege_view_Model.Messeg_Titel = "Error"; messege.ShowDialog(); } list_product = myDB.Products.ToList(); OnPropertyChanged(nameof(List_product)); } else if (myProfile.Right.Level == 2) { OpenMessege("You do not have the rights to delete the item.", "Error"); } }catch (Exception e) { OpenMessege(e.Message, "Error"); } }
public ActionResult Index(Messege m) { m.SenderId = Int32.Parse(Session["UserId"].ToString()); m.ReceiverId = Int32.Parse(Session["ContactId"].ToString()); m.CreatedAt = DateTime.Now; MessegeRepo.Insert(m); //return Content(m.SenderId.ToString()+" "+ m.ReceiverId.ToString() + " " + m.CreatedAt.ToString() + " " + m.Messege1.ToString()+" "+m.MessegeId.ToString()); return(RedirectToAction("Index")); }
private static void onLeft(object sender, PersonEventArgs e) { Console.WriteLine(); Console.WriteLine("[{0} ушел домой]", e.Person.Name); cameMessege -= new Messege(e.Person.Hello); leftMessege -= new Messege(e.Person.GoodBye); leftMessege?.Invoke(new PersonEventArgs() { Person = e.Person }); }
static void Main(string[] args) { Messege mess = new Messege(new VideoMessege()); mess.PrintType(); mess.Type = new SMSMessege(); mess.PrintType(); mess.Type = new AudioMessege(); mess.PrintType(); Console.ReadLine(); }
private static void onCame(object sender, PersonEventArgs e) { Console.WriteLine(); Console.WriteLine("[{0} пришел на работу в {1} часов]", e.Person.Name, e.Time); cameMessege?.Invoke(new PersonEventArgs() { Person = e.Person, Time = e.Time }); cameMessege += new Messege(e.Person.Hello); leftMessege += new Messege(e.Person.GoodBye); }
private void DistributionStatusMessege(Messege newMsg) { for (int i = 0; i < userManager.GetActiveUsers.Count(); i++) { try { bf.Serialize(userManager.GetActiveUsers.ElementAt(i).GetTcpStream, (MsgStatus)newMsg); } catch { return; } } }
public ActionResult Reply(Messege messege) { try { massRepo.Insert(messege); return(RedirectToAction("ViewEmail")); } catch { return(RedirectToAction("Reply")); } }
public ActionResult Edit([Bind(Include = "Id,DoctorId,PatientId,ProblemName,ProblemDate,Details,File1,File2,File3,File4")] Messege messege) { if (ModelState.IsValid) { db.Entry(messege).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DoctorId = new SelectList(db.Doctors, "Id", "Name", messege.DoctorId); ViewBag.PatientId = new SelectList(db.Patients, "Id", "Name", messege.PatientId); return(View(messege)); }
public void SendMessege(Messege msg) { try { bf.Serialize(tcpStream, msg); } catch { serverError = true; return; } }
public ActionResult Compose(Messege messege) { try { massRepo.Insert(messege); return(RedirectToAction("Index")); } catch { TempData["error"] = "Some Field is Blank!"; return(RedirectToAction("Compose")); } }
private void Execute_edit_product(object o) { try { Messege messege = new Messege(); View_Model_Messege messege_view_Model = new View_Model_Messege(System.Windows.Visibility.Visible, System.Windows.Visibility.Visible, System.Windows.Visibility.Hidden); if (messege_view_Model._OK == null) { messege_view_Model._OK = new Action(messege.Close); } if (messege_view_Model._NO == null) { messege_view_Model._NO = new Action(messege.Close); } messege.DataContext = messege_view_Model; messege_view_Model.Messege = "Do you really want to change this product?"; messege_view_Model.Messeg_Titel = "Change product"; messege.ShowDialog(); if (messege_view_Model.is_ok && myProfile.Right.Level < 2) { Select_item_product.Name = name_product; Select_item_product.Categories.Clear(); var List_final = from i in Category_list where i.IsSelected == true select i; foreach (var i in List_final) { Select_item_product.Categories.Add(i.Item); } Select_item_product = null; myDB.SaveChanges(); list_product.Clear(); List_product = myDB.Products.ToList(); SetNull(); } else if (myProfile.Right.Level == 2) { OpenMessege("You do not have permission to edit the products.", "Error"); } }catch (Exception e) { OpenMessege(e.Message, "Error"); } }
void messeges(string s) { try { Messege mes = new Messege(); View_Model_Messege_box view_mes = new View_Model_Messege_box(System.Windows.Visibility.Visible, System.Windows.Visibility.Hidden, System.Windows.Visibility.Hidden); view_mes._OK = mes.Close; view_mes.Messege = s; mes.DataContext = view_mes; mes.ShowDialog(); } catch (Exception e) { string j = e.Message; } }
public void SendMessege(Messege msg) { try { if (msg is MsgUser) { ((MsgUser)msg).TxtMessege = user.UserName + " said: " + ((MsgUser)msg).TxtMessege; } bf.Serialize(tcpStream, msg); } catch { serverError = true; return; } }
void OpenMessege(string s, string title) { Messege messege = new Messege(); View_Model_Messege messege_view_Model = new View_Model_Messege(System.Windows.Visibility.Visible, System.Windows.Visibility.Hidden, System.Windows.Visibility.Hidden); if (messege_view_Model._OK == null) { messege_view_Model._OK = new Action(messege.Close); } messege.DataContext = messege_view_Model; messege_view_Model.Messege = s; messege_view_Model.Messeg_Titel = title; messege.ShowDialog(); }
// GET: Messege/Delete/5 public ActionResult Delete(int?id, int?p) { if (Session["Palogin"].ToString() == "" || ((Models.Patient)Session["Pa"]).Id != p) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Messege messege = db.Messeges.Find(id); if (messege == null) { return(HttpNotFound()); } return(View(messege)); }
public ActionResult Create([Bind(Include = "Id,DoctorId,PatientId,ProblemName,Solution1, File1, File2, File3, File4")] Solution solution, int?dd, int p, int d) { if (ModelState.IsValid) { solution.DoctorId = d; solution.PatientId = p; db.Solutions.Add(solution); db.SaveChanges(); Messege messege = db.Messeges.Find(dd); db.Messeges.Remove(messege); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(solution)); }
public long Update(Messege buider) { var bd = db.Messeges.Find(buider.ID); bd.ProcessID = buider.ProcessID; bd.UsersRead = buider.UsersRead; //bd.CreateBy = buider.CreateBy; //bd.CreateDate = buider.CreateDate; bd.Description = buider.Description; bd.ModifiedBy = buider.ModifiedBy; bd.ModifiedDate = buider.ModifiedDate; db.SaveChanges(); return(buider.ID); }
internal MessegesManager(UserManager userManager, Messege newMsg) { this.userManager = userManager; if (newMsg is MsgUser) { DistributionUserMessege(newMsg); } else if (((MsgStatus)newMsg).GetStatusUserInMessege == Status.disconnected) { DistributionStatusMessege(newMsg); userManager.GetUser.UserStatus = Status.disconnected; statusUser = new StatusUserEventArgs(userManager.GetUser); } else { DistributionStatusMessege(newMsg); } }
// GET: Messege/Edit/5 public ActionResult Edit(int?id, int?p) { if (Session["Adlogin"].ToString() == "") { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Messege messege = db.Messeges.Find(id); if (messege == null) { return(HttpNotFound()); } ViewBag.DoctorId = new SelectList(db.Doctors, "Id", "Name", messege.DoctorId); ViewBag.PatientId = new SelectList(db.Patients, "Id", "Name", messege.PatientId); return(View(messege)); }
static void Main(string[] args) { Messege messege = new Messege(ConsoleMessege); Person person = new Person("Jone"); person.CameInOffice(new DateTime(2018, 4, 2, 11, 30, 0)); Person person2 = new Person("Nina"); person2.CameInOffice(new DateTime(2018, 4, 2, 11, 58, 0)); Person person3 = new Person("Ivan"); person3.CameInOffice(DateTime.Now); person.LeftFromOffice(); Person person4 = new Person("Alex"); person4.CameInOffice(DateTime.Now); person2.LeftFromOffice(); person3.LeftFromOffice(); person.CameInOffice(DateTime.Now); Console.ReadKey(); }
public static void Main(string[] args) { ApiManager apiManager = new ApiManager(); MessageBuilder builder = new VoiceMessageBuilder(); Messege voiceMessage = apiManager.Record(builder); Console.WriteLine(voiceMessage.ToString()); builder = new SimpleMessageBuilder(); Messege SimpleMessage = apiManager.Record(builder); Console.WriteLine(SimpleMessage.ToString()); builder = new VideoMessageBuilder(); Messege videoMessage = apiManager.Record(builder); Console.WriteLine(videoMessage.ToString()); Console.Read(); }