public void PostStatusPharmacist(int PatientId, int PharmacistId, string success) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); try { if (success == "S") { Utility.UpdateStausDoctorPatient(PharmacistId, PatientId, 2); } else { Utility.UpdateStausDoctorPatient(PharmacistId, PatientId, 1); } Pharmacist pharmacist = GetPharmacistDetails(PharmacistId); SendDataofPatient(pharmacist.EmailId, success, PatientId); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } stopwatch.Stop(); Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed); }
public Pharmacist GetPharmacistDetails(int id) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Pharmacist pharmacist = new Pharmacist(); try { using (SqlConnection connection = new SqlConnection(conn)) using (SqlCommand command = new SqlCommand("select * from pharmacist where id=@id", connection)) { connection.Open(); command.Parameters.AddWithValue("@id", id); using (SqlDataReader reader = command.ExecuteReader()) { if (reader.Read()) { pharmacist = new Pharmacist { Id = reader.GetInt32(0), FirstName = reader.GetString(1), LastName = reader.GetString(2), EmailId = reader.GetString(3), PhoneNumber = reader.GetString(4) }; } } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } stopwatch.Stop(); Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed); return(pharmacist); }
public Form1() { InitializeComponent(); //Main Grid Default_Grid_Update(); ResetBranchLabels(); ResetWorkerLabels(); //Branches ListBox List <Branch> branches_list = mainContext.Branches.Include(b => b.Practises).ToList <Branch>(); Branch all_branches_option = new Branch("Apteka", "All_Branches"); all_branches_option.IdBranch = -1; branches_list.Insert(0, all_branches_option); BranchesComboBox.DataSource = branches_list; BranchesComboBox.DisplayMember = "Address"; current_Branch = all_branches_option; //Worker ComboBox List <Worker> workers_list = mainContext.Workers.Include(b => b.Practises).ToList <Worker>(); Worker all_workers_option = new Pharmacist("All Workers", "", DateTime.Now, 0, 0); all_workers_option.IdWorker = -1; workers_list.Insert(0, all_workers_option); WorkerComboBox.DataSource = workers_list; WorkerComboBox.DisplayMember = "Name"; current_Worker = all_workers_option; //Buttons Reset_Buttons(); }
public static void main_t() { Console.WriteLine("Tests"); using (var db = new MyContext()) { //Kwal Pharmacist p1 = db.Workers.OfType <Pharmacist>().First(); Console.WriteLine("Kwalifikowana "); Certificate c1 = new Certificate("Bezpiecienstwo", "BZP"); p1.AddCertificate(c1); Console.WriteLine(p1.GetCertificate(c1.IdCertificate).ToString()); Console.WriteLine("-------------"); //Comp Branch b1 = db.Branches.First(); Medicine m1 = new Medicine("Med1", 15, 10, true); Wholesaler ws1 = new Wholesaler("*****@*****.**", 10, 3); Wholesale_Purchase wp1 = new Wholesale_Purchase(DateTime.Now, 50, ws1); Order o1 = new Order(DateTime.Now, b1); o1.Create_Batch(db.Batches.ToList(), DateTime.Now.AddYears(5), 10, m1, wp1); Console.WriteLine(o1.Batches.First().ToString()); //Dynamic Console.WriteLine(o1); o1.Complete_Order(DateTime.Now); Console.WriteLine(o1); } }
public async Task <IActionResult> Edit(long id, [Bind("PharmacistId,PharmacistName,HiredBy,HiredDate,Pwd")] Pharmacist pharmacist) { if (id != pharmacist.PharmacistId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pharmacist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PharmacistExists(pharmacist.PharmacistId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["HiredBy"] = new SelectList(_context.Manager, "ManagerId", "ManagerName", pharmacist.HiredBy); return(View(pharmacist)); }
public ActionResult AddPharmacist(int PharmacyCode, string FirstName, string LastName, string Email, string Phone, bool IsAdmin = false, bool IsActive = false) { using (var service = new PharmacistService()) { Phone = Regex.Replace(Phone, @"[^A-Za-z0-9]+", ""); if (Phone.Length == 10) { Phone = "1" + Phone; } Pharmacist p = service.GetWhere(PharmacistService.EmailCol == Email).FirstOrDefault(); if (p == null) { p = new Pharmacist(FirstName, LastName, Email, Phone, new byte[] { 0 }, new byte[] { 0 }); service.Create(p); } Pharmacy pharm; using (var pharmservice = new PharmacyService()) { pharm = pharmservice.Get(PharmacyCode); } using (var jobservice = new JobService()) { Job j = new Job(pharm, p, IsActive, IsAdmin); jobservice.Create(j); } } using (var service = new EmailService()) { service.SendEmail(Email, newAccountEmailSubject, newAccountEmailBody); } return(RedirectToAction("SinglePharmacy", new RouteValueDictionary( new { controller = "SystemAdmin", action = "SinglePharmacy", Id = PharmacyCode }))); }
public ActionResult EditPharmacist(int PharmacistCode, int PharmacyCode, string FirstName, string LastName, string Email, string Phone, bool IsAdmin = false, bool IsActive = false) { Phone = Regex.Replace(Phone, @"[^A-Za-z0-9]+", ""); if (Phone.Length == 10) { Phone = "1" + Phone; } using (var service = new PharmacistService()) { Pharmacist p = service.Get(PharmacistCode); if (p != null) { p.FirstName = FirstName; p.LastName = LastName; p.Phone = Phone; p.Email = Email; var temp1 = p.AllJobs.Where(x => x.Pharmacy.Code == PharmacyCode).FirstOrDefault(); using (var serviceJob = new JobService()) { var j = serviceJob.GetWhere(JobService.CodeCol == temp1.Code).FirstOrDefault(); j.IsActive = IsActive; j.IsAdmin = IsAdmin; serviceJob.Update(j); } service.Update(p); } return(RedirectToAction("SinglePharmacy", new RouteValueDictionary( new { controller = "SystemAdmin", action = "SinglePharmacy", Id = PharmacyCode }))); } }
public User CreateUser(UserType?type) { User user = null; if (type == null) { user = new User(); } else if (type == UserType.PATIENT) { user = new Patient(); } else if (type == UserType.DOCTOR) { user = new Doctor(); } else if (type == UserType.PHARMACIST) { user = new Pharmacist(); } else if (type == UserType.LAB_TECHNICIAN) { user = new LabTechnician(); } return(user); }
public async Task <IActionResult> Edit(int id, [Bind("Pharmacistid,Firstname,Lastname,Salary,Birthday")] Pharmacist pharmacist) { if (id != pharmacist.Pharmacistid) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pharmacist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PharmacistExists(pharmacist.Pharmacistid)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pharmacist)); }
public static void UpdateInactive(Pharmacist pharmacist) { using (var db = DatabaseService.Connection) { Dapper.SqlMapper.SetTypeMap(typeof(Pharmacist), new ColumnAttributeTypeMapper <Pharmacist>()); db.Execute(ScriptService.Scripts["pharmacist_update_inactive"], pharmacist); } }
public ActionResult GetUserFormularia(int userId) { User user = null; Pharmacist pharmacist = null; if (Library.DomainModel.Administration.User.Exists(userId)) { user = Library.DomainModel.Administration.User.GetUser(userId); } if (user.IsPharmacist) { pharmacist = Pharmacist.GetPharmacistByUserId(userId); } // if user is not a pharmacist, return an empty formularia list // otherwise return the formularia list for the pharmacist user if (pharmacist == null) { return(this.Direct(new {})); } else { return(this.Direct(pharmacist.FormulariumList)); } }
public static long Insert(Pharmacist pharmacist) { using (var db = DatabaseService.Connection) { Dapper.SqlMapper.SetTypeMap(typeof(Pharmacist), new ColumnAttributeTypeMapper <Pharmacist>()); return(db.Query <long>(ScriptService.Scripts["pharmacist_insert"], pharmacist).Single()); } }
public PharmacistModel(Pharmacist p) { Code = p.Code; FirstName = p.FirstName; LastName = p.LastName; Email = p.Email; Phone = p.Phone; PharmacyName = ""; foreach (var j in p.Jobs) { PharmacyName += j.Pharmacy.Name + ","; } PharmacyName = PharmacyName.TrimEnd(','); int jobCount = p.Jobs.Count(); if (jobCount == 1) { PharmacyPhone = p.Jobs.FirstOrDefault().Pharmacy.Phone; PharmacyAddress = p.Jobs.FirstOrDefault().Pharmacy.Address; } else { PharmacyPhone = "N/A"; PharmacyAddress = "N/A"; } //below doesnt work for some reason, i believe because it still tries to evaluate the p.jobs stuff regardless //PharmacyPhone = jobCount > 1 ? "N/A" : p.Jobs.FirstOrDefault().Pharmacy.Phone; //PharmacyAddress = jobCount > 1 ? "N/A" : p.Jobs.FirstOrDefault().Pharmacy.Address; }
public async Task <IActionResult> Edit(string id, [Bind("pharmacistId,storeName,drugeLicence,pharmacistPhoneNumber,storeAddress,pharmacistPassword")] Pharmacist pharmacist) { if (id != pharmacist.pharmacistId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pharmacist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PharmacistExists(pharmacist.pharmacistId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pharmacist)); }
public ActionResult SavePharmacist(Pharmacist m, String command) { // if id's are default, get actual id's for the (new) pharmacist // use sql to save pharmacist to db if (m.PharmacistId == 0) { m.Type = Models.User.UserType.Pharmacist; var phid = DatabaseUserService.Insert(m); m.UserId = phid; m.PharmacistId = DatabasePharmacistService.Insert(m); var login = new Login(); login.LoginToken = ""; login.UserId = m.UserId; login.SetPassword(Login.GetUniqueKey(32)); DatabaseLoginService.Insert(login); EmailService.SendReset(m); } else { DatabaseUserService.Update(m); DatabasePharmacistService.Update(m); } if (DatabaseUserService.GetById((long)Session["user_id"]).Type == Models.User.UserType.PPOkAdmin) { return(RedirectToAction("AddorEditPharmacy", "PpokAdmin", new { id = m.PharmacyId })); } return(RedirectToAction("Admin", "Pharmacy")); }
public PPOKPrincipal(Pharmacist pharmacist, int pharmacyCode) : base() { Identity = new GenericIdentity(pharmacist.Email); Code = pharmacist.Code; FirstName = pharmacist.FirstName; LastName = pharmacist.LastName; Phone = pharmacist.Phone; Email = pharmacist.Email; using (var service = new PharmacyService()) { Pharmacy = service.Get(pharmacyCode); } Type = AccountTypes.Pharmacist; foreach (var job in pharmacist.Jobs.Where(x => x.Pharmacy.Code == Pharmacy.Code)) { if (job.IsActive) { if (job.IsAdmin) { addRole("Admin"); Type = AccountTypes.Admin; } addRole("Pharmacist"); } } }
public ActionResult AddPharmacist(string FirstName, string LastName, string Email, string Phone, bool IsActive = false, bool IsAdmin = false) { Phone = Regex.Replace(Phone, @"[^A-Za-z0-9]+", ""); if (Phone.Length == 10) { Phone = "1" + Phone; } using (var service = new PharmacistService()) { Pharmacist p = service.GetWhere(PharmacistService.EmailCol == Email).FirstOrDefault(); if (p == null) { new Pharmacist(FirstName, LastName, Email, Phone, new byte[] { 0 }, new byte[] { 0 }); service.Create(p); } Pharmacy pharm; using (var pharmservice = new PharmacyService()) { pharm = pharmservice.Get(User.getPharmacy().Code); } using (var jobservice = new JobService()) { //these get the value, not the checked value Job j = new Job(pharm, p, IsActive, IsAdmin); jobservice.Create(j); } return(RedirectToAction("Pharmacy", new RouteValueDictionary( new { controller = "ManagePharmacist", action = "Pharmacy", Id = User.Pharmacy.Code }))); } }
public ActionResult EditPharmacist(int Code, int PharmacyCode, string FirstName, string LastName, string Email, string Phone, bool IsActive = false, bool IsAdmin = false) { Phone = Regex.Replace(Phone, @"[^A-Za-z0-9]+", ""); if (Phone.Length == 10) { Phone = "1" + Phone; } using (var service = new PharmacistService()) { Pharmacist p = service.Get(Code); if (p != null) { p.FirstName = FirstName; p.LastName = LastName; p.Phone = Phone; p.Email = Email; service.Update(p); using (var jobservice = new JobService()) { //these get the value, not the checked value var job = jobservice.GetWhere(JobService.PharmacistCodeCol == p.Code & JobService.PharmacyCodeCol == PharmacyCode).FirstOrDefault(); job.IsActive = IsActive; job.IsAdmin = IsAdmin; jobservice.Update(job); } } return(RedirectToAction("Pharmacy", new RouteValueDictionary( new { controller = "ManagePharmacist", action = "Pharmacy" }))); } }
public void UpdatePharmacist(Pharmacist p) { Pharmacist updatedPharmacist = database.Pharmacists.FirstOrDefault(X => X.PharmacistId == p.PharmacistId); database.Entry(updatedPharmacist).CurrentValues.SetValues(updatedPharmacist); database.Entry(updatedPharmacist).State = EntityState.Modified; }
public static byte[] HashUserText(Pharmacist pharmacist, string text) { using (var service = new PharmacistService()) { var salt = service.Get(pharmacist.Code).PasswordSalt; return(GenerateSaltedHash(Encoding.ASCII.GetBytes(text.ToLower()), salt)); } }
public ActionResult DeleteConfirmed(int id) { Pharmacist pharmacist = db.pharmacists.Find(id); db.pharmacists.Remove(pharmacist); db.SaveChanges(); return(RedirectToAction("Index")); }
public IHttpActionResult Save(Pharmacist request) { //request.OrgId = SecurityHelper.CurrentPrincipal.OrgId; request.CreateBy = "01"; //SecurityHelper.CurrentPrincipal.EmpNo; request.CreateDate = DateTime.Now; var response = socialWorkerService.SavePharmacist(request); return(Ok(response)); }
public ActionResult Edit([Bind(Include = "id,Username,Password,Firstname,Lastname,Email")] Pharmacist pharmacist) { if (ModelState.IsValid) { db.Entry(pharmacist).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pharmacist)); }
public bool AddPharmacist(Pharmacist pharmacist) { if (pharmacistManagement.AddPharmacist(pharmacist)) { return(true); } else { return(false); } }
public ActionResult Create([Bind(Include = "id,Username,Password,Firstname,Lastname,Email")] Pharmacist pharmacist) { if (ModelState.IsValid) { db.pharmacists.Add(pharmacist); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pharmacist)); }
public bool isNullPatient(Pharmacist pharmacist) { if (!string.IsNullOrWhiteSpace(pharmacist.PharmacistFirstName) && !string.IsNullOrWhiteSpace(pharmacist.PharmacistLastName)) { return(false); } else { return(true); } }
public ActionResult Index(Pharmacist obj) { if (ModelState.IsValid) { MyDBContext db = new MyDBContext(); db.pharmacists.Add(obj); db.SaveChanges(); } return(View(obj)); }
public async Task <IActionResult> Create([Bind("pharmacistId,storeName,drugeLicence,pharmacistPhoneNumber,storeAddress,pharmacistPassword")] Pharmacist pharmacist) { if (ModelState.IsValid) { _context.Add(pharmacist); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(pharmacist)); }
public async Task <IActionResult> Create([Bind("Pharmacistid,Firstname,Lastname,Salary,Birthday")] Pharmacist pharmacist) { if (ModelState.IsValid) { _context.Add(pharmacist); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(pharmacist)); }
public static byte[] HashPassword(Pharmacist pharmacist, string password) { using (var service = new PharmacistService()) { var salt = CreateSalt(32); pharmacist.PasswordSalt = salt; pharmacist.PasswordHash = GenerateSaltedHash(Encoding.ASCII.GetBytes(password), pharmacist.PasswordSalt); service.Update(pharmacist); return(pharmacist.PasswordHash); } }