Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.AddFlags(WindowManagerFlags.KeepScreenOn);

            // Create your application here
            SetContentView(Resource.Layout.Contract);

            FindViewById <Button>(Resource.Id.caCloseB).Click += (s, e) => {
                Finish();
            };

            var pharmacyUUID = Intent.GetStringExtra(C_PHARMACY_UUID);

            if (string.IsNullOrEmpty(pharmacyUUID))
            {
                return;
            }

            Pharmacy = MainDatabase.GetPharmacy(pharmacyUUID);

            FindViewById <TextView>(Resource.Id.caInfoTV).Text = "КОНТРАКТЫ АПТЕКИ: " + Pharmacy.GetName();

            ContractTable = FindViewById <ListView>(Resource.Id.caContractTable);

            var header = LayoutInflater.Inflate(Resource.Layout.ContractTableHeader, ContractTable, false);

            ContractTable.AddHeaderView(header);
        }
Exemplo n.º 2
0
 private bool EditAccount()
 {
     if (!GetAllPharmacies().Where(p => p.PharmacyID != Authenticator.CurrentUser.PharmacyID).Contains(Pharmacy))
     {
         if (Pharmacy.IsValid())
         {
             _uow.PharmacyRepo.Edit(Pharmacy);
             int ok = _uow.Save();
             if (ok > 0)
             {
                 Authenticator.CurrentUser = Pharmacy;
                 return(true);
             }
             MessageBox.Show("Er is iets misgegaan bij het wijzigen van je profiel!", "Foutmelding",
                             MessageBoxButton.OK, MessageBoxImage.Error);
             return(false);
         }
         else
         {
             MessageBox.Show(Pharmacy.Error, "Foutmelding", MessageBoxButton.OK, MessageBoxImage.Error);
             return(false);
         }
     }
     MessageBox.Show("Deze gebruikersnaam bestaat al!", "Foutmelding", MessageBoxButton.OK, MessageBoxImage.Error);
     return(false);
 }
Exemplo n.º 3
0
        public void SavePharmacy(Pharmacy pharmacy, string connectionString, string sessionTicket, out TransactionalInformation transaction)
        {
            var request = HttpContext.Current.Request;
            var method  = MethodInfo.GetCurrentMethod();
            var ipInfo  = Util.GetIPInfo(request);

            transaction = new TransactionalInformation();
            var userSecurityTicket = VerifySessionToken(sessionTicket);

            try
            {
                cls_Save_Pharmacy.Invoke(connectionString, new P_PH_SP_1124
                {
                    Pharmacy = pharmacy
                }, userSecurityTicket);

                Logger.LogInfo(new LogEntry(ipInfo.address, ipInfo.agent, connectionString, method, userSecurityTicket, pharmacy));
            }
            catch (Exception ex)
            {
                Logger.LogInfo(new LogEntry(ipInfo.address, ipInfo.agent, connectionString, method, userSecurityTicket, ex));

                transaction.ReturnMessage = new List <string>();
                string errorMessage = ex.Message;
                transaction.ReturnStatus = false;
                transaction.ReturnMessage.Add(errorMessage);
                transaction.IsAuthenicated = true;
                transaction.IsException    = true;
            }
        }
Exemplo n.º 4
0
        public ActionResult SavePharmacy(string massage, Pharmacy pharmacy)
        {
            if (!ModelState.IsValid)
            {
                return(View("NewPharmacy", pharmacy));
            }

            if (pharmacy.Id == 0)
            {
                if (User.IsInRole(UserRoles.CanApproveAndDeleteRecord))
                {
                    pharmacy.IsApproved = true;
                }

                _context.Pharmacies.Add(pharmacy);
            }
            else
            {
                var pharmacyInDb = _context.Pharmacies.SingleOrDefault(p => p.Id == pharmacy.Id);
                Mapper.Map(pharmacy, pharmacyInDb);
            }

            _context.SaveChanges();

            return(RedirectToAction("Index", new { massage = massage }));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("PharmID,PharmName,PharmAddress,PharmPhone,Time_at")] Pharmacy pharmacy)
        {
            if (id != pharmacy.PharmID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pharmacy);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PharmacyExists(pharmacy.PharmID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pharmacy));
        }
        //Excel reader
        private bool ReadPharmaciesFromExcel(string Path)
        {
            string path = Directory.GetCurrentDirectory() + @"\ExcellDocs\1.xlsx";

            FileInfo fileInfo = new FileInfo(path);

            if (fileInfo != null)
            {
                using (var package = new ExcelPackage(fileInfo))
                {
                    var Sheet = package.Workbook.Worksheets.First();
                    //var table = Sheet.Tables.First();
                    int rowCount = Sheet.Dimension.End.Row;
                    for (int i = 2; i < rowCount; ++i)
                    {
                        //Console.WriteLine();
                        Pharmacy pharmacy = new Pharmacy()
                        {
                            Name        = Sheet.Cells[i, 2].Value.ToString(),
                            Address     = Sheet.Cells[i, 3].Value.ToString(),
                            Location    = Sheet.Cells[i, 4].Value.ToString(),
                            WorkAllTime = false
                        };
                        _service.AddPharmacy(pharmacy);
                    }
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 7
0
        public ActionResult Edit(Pharmacy pharmacy, String NewName)
        {
            var action = new CheckController().CheckStatus("Pharmacy_Info");

            if (action != null)
            {
                return(action);
            }
            if (_Info.Get() != null)
            {
                if (!String.IsNullOrEmpty(NewName))
                {
                    Pharmacy ph = new Pharmacy()
                    {
                        Name = NewName, Email = pharmacy.Email, Address = pharmacy.Address, Phone = pharmacy.Phone
                    };
                    _Info.NewName(ph);
                }
                else
                {
                    _Info.Update(pharmacy);
                }
                Config.CheckData();
            }
            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 8
0
        public static Pharmacy citireTastatura()
        {
            Console.WriteLine("Introduceti numele medicamentului pe care doriti sa-l inserati in baza de date:");
            string nume = Console.ReadLine();

            Console.WriteLine("Introduceti pretul:");
            int pret = Int32.Parse(Console.ReadLine());

            Console.WriteLine("Introduceti locatia unde se poate gasi:");
            string locatie = Console.ReadLine();


            Pharmacy m = new Pharmacy(nume, pret, locatie);

            Console.WriteLine("Introduceti daca medicamentul este Valabilitate. [1-Valabilitate] [2-nevalabil] [3-necunoscut]");
            m.Valabilitate = (valability)Int32.Parse(Console.ReadLine());
            Console.WriteLine("Introduceti tipul medicamentului :");
            Console.WriteLine("1.Analgezic");
            Console.WriteLine("2.Pilula");
            Console.WriteLine("3.Sirop");
            Console.WriteLine("4.Unguesnt");
            Console.WriteLine("5.Injectie");
            Console.WriteLine("6.Nu se stie tipul");
            m.Tip = (tip)Int32.Parse(Console.ReadLine());


            return(m);
        }
Exemplo n.º 9
0
        public ActionResult Create([Bind(Include = "Id,PharmacyName,Description,Latitude,Longitude,Email,Address,FK_Category,Phone,Image,FK_AreaId,Website")] Pharmacy pharmacy, HttpPostedFileBase img)
        {
            if (ModelState.IsValid)
            {
                string file_name = "";
                if (img != null && img.ContentLength > 0)
                {
                    try
                    {
                        file_name = Guid.NewGuid() + Path.GetFileName(img.FileName);
                        string path = Path.Combine(Server.MapPath("~/images"),
                                                   file_name);
                        img.SaveAs(path);
                    }
                    catch (Exception ex)
                    {
                        ViewBag.Message = "ERROR:" + ex.Message.ToString();
                    }
                }
                pharmacy.Image = file_name;

                db.Pharmacies.Add(pharmacy);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.FK_AreaId   = new SelectList(db.Areas, "Id", "AreaName", pharmacy.FK_AreaId);
            ViewBag.FK_Category = new SelectList(db.Categories, "Id", "CategoryName", pharmacy.FK_Category);
            return(View(pharmacy));
        }
Exemplo n.º 10
0
 public IActionResult Signup(SignupViewModel createAccount)
 {
     if (ModelState.IsValid)
     {
         var isNameAlreadyExists = context.Pharmacies.Any(X => X.PharmacyName == createAccount.PharmacyName);
         var isPasswordAlredyExists = context.Pharmacies.Any(x => x.Password == createAccount.Password);
         var isDEANumberAlredyExists = context.Pharmacies.Any(x => x.DEANumber == createAccount.DEANumber);
         if (isNameAlreadyExists && isPasswordAlredyExists && isDEANumberAlredyExists)
         {
             ModelState.AddModelError("", "User with this Account already exists so plase go to signin");
             return View(createAccount);
         }
         Pharmacy newPharmacy = new Pharmacy
         {
             PharmacyName = createAccount.PharmacyName,
             Email = createAccount.Email,
             Password = createAccount.Password,
             DEANumber = createAccount.DEANumber,
             NPINumber = createAccount.NPINumber,
             StreetNumberAndName = createAccount.StreetNumberAndName,
             City = createAccount.City,
             State = createAccount.State,
             ZipCode = createAccount.ZipCode
         };
         context.Pharmacies.Add(newPharmacy);
         context.SaveChanges();
         return Redirect("/Account/Signin");
     }
     return View(createAccount);
 }
 public static long Insert(Pharmacy pharmacy)
 {
     using (var db = DatabaseService.Connection) {
         Dapper.SqlMapper.SetTypeMap(typeof(Pharmacy), new ColumnAttributeTypeMapper <Pharmacy>());
         return(db.Query <long>(ScriptService.Scripts["pharmacy_insert"], pharmacy).Single());
     }
 }
 public static void InsertOrUpdate(Pharmacy pharmacy)
 {
     using (var db = DatabaseService.Connection) {
         Dapper.SqlMapper.SetTypeMap(typeof(Pharmacy), new ColumnAttributeTypeMapper <Pharmacy>());
         db.Execute(ScriptService.Scripts["pharmacy_insert_or_update"], pharmacy);
     }
 }
        public List <Pharmacy> GetStudenti()
        {
            List <Pharmacy> medicamente = new List <Pharmacy>();

            try
            {
                // instructiunea 'using' va apela sr.Close()
                using (StreamReader sr = new StreamReader(NumeFisier))
                {
                    string line;

                    //citeste cate o linie si creaza un obiect de tip Student pe baza datelor din linia citita
                    while ((line = sr.ReadLine()) != null)
                    {
                        Pharmacy s = new Pharmacy(line);
                        medicamente.Add(s);
                    }
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }

            return(medicamente);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.PharmacyRegister);
            // Create your application here
            EditText pharmacyName = FindViewById<EditText>(Resource.Id.pharmacyText);
            EditText zipcode = FindViewById<EditText>(Resource.Id.pharmacyZipcodeText);
            EditText address = FindViewById<EditText>(Resource.Id.pharmacyAddressText);
            EditText state = FindViewById<EditText>(Resource.Id.stateText);
            Button button = FindViewById<Button>(Resource.Id.resgisterPharmacy);

            button.Click += delegate
            {
                Pharmacy pharmacy = new Pharmacy();
                Location location = new Location();
                pharmacy.PharmacyName = pharmacyName.Text.ToString();
                int zip;
                int.TryParse(zipcode.Text.ToString(), out zip);
                location.Zipcode = zip;
                location.AddressLine1 = address.Text.ToString();
                location.State = state.Text.ToString();
              //  location.LocationID = 1;
                LocationLibrary locationLib = new LocationLibrary();
                locationLib.AddLocation(location, pharmacy);

                PharmacyLibrary pharmacyLib = new PharmacyLibrary();
                pharmacyLib.AddPharmacy(pharmacy);
            };

        }
Exemplo n.º 15
0
 /// <summary>
 ///  AddLocation will accept a Location object and creates an Item on Amazon DynamoDB
 /// </summary>
 /// <param name="pharmacy"></param>
 public async void AddPharmacy(Pharmacy pharmacy)
 {
     Task<int> idTask = _dynamoDBService.GetAllPharmacy<Pharmacy>("Pharmacy");
     int id = await idTask;
     pharmacy.PharmacyID = id;
     _dynamoDBService.Store(pharmacy);
 }
Exemplo n.º 16
0
        private async Task TryAddProduct(Pharmacy pharmacy, TransactionProductDTO dto, Transaction transaction)
        {
            var productInPharmacy = pharmacy.Products.FirstOrDefault(pb => pb.Id == dto.ProductBalanceId);

            if (productInPharmacy == null)
            {
                throw new ResourceNotFoundException("productBalance");
            }
            if (productInPharmacy.Amount < dto.Amount)
            {
                throw new ArgumentException("amount");
            }

            productInPharmacy.Amount -= dto.Amount;

            var requiredAmount = pharmacy.RequiredMedicamentAmounts
                                 .FirstOrDefault(rma => rma.MedicamentId == productInPharmacy.MedicamentId);

            if (IsRestockRequired(requiredAmount, productInPharmacy))
            {
                await Restock(pharmacy, requiredAmount, productInPharmacy);
            }

            transaction.AddProduct(productInPharmacy, dto.Amount);
        }
Exemplo n.º 17
0
 public ActionResult Create(Pharmacy pharmacy)
 {
     try
     {
         if (String.IsNullOrEmpty(pharmacy.Name) ||
             String.IsNullOrWhiteSpace(pharmacy.Name))
         {
             throw new Exception($"Cannot Create Pharmacy By Empty Name");
         }
         if (_Info.Get() == null)
         {
             _Info.Add(pharmacy);
             return(RedirectToAction("Edit"));
         }
         var action = new CheckController().CheckStatus("Pharmacy_Info");
         if (action != null)
         {
             return(action);
         }
         throw new Exception();
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", ex.Message);
         return(View(pharmacy));
     }
 }
Exemplo n.º 18
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Eik,PharmacyLicense,DrugsLicense,CityId,Address,Manager,Telefon,Email")] Pharmacy pharmacy)
        {
            if (id != pharmacy.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pharmacy);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PharmacyExists(pharmacy.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.Cities, "Id", "Id", pharmacy.CityId);
            return(View(pharmacy));
        }
Exemplo n.º 19
0
        public async Task <ActionResult <Pharmacy> > PostPharmacy(Pharmacy pharmacy)
        {
            _context.Pharmacies.Add(pharmacy);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPharmacy", new { id = pharmacy.Id }, pharmacy));
        }
Exemplo n.º 20
0
        public async Task <IActionResult> PutPharmacy([FromRoute] int id, [FromBody] Pharmacy pharmacy)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pharmacy.PharmacyId)
            {
                return(BadRequest());
            }

            _context.PharmacyContext().Entry(pharmacy).State = EntityState.Modified;

            try
            {
                await _context.PharmacyContext().SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PharmacyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public List <Pharmacy> GetMedicamente()
        {
            List <Pharmacy> medicamente = new List <Pharmacy>();

            try
            {
                using (StreamReader sr = new StreamReader(NumeFisier))
                {
                    string line;

                    while ((line = sr.ReadLine()) != null)
                    {
                        Pharmacy s = new Pharmacy(line);
                        medicamente.Add(s);
                    }
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }

            return(medicamente);
        }
Exemplo n.º 22
0
        private async void btnSave_Clicked(object sender, EventArgs e)
        {
            try
            {
                GC.Collect();
                overlay.IsVisible = true;
                Pharmacy objPharmacy = await App.TodoManager.PharmacyPlaceOrder(_Pharmacy.data.id);

                if (objPharmacy.status == "success")
                {
                    await DisplayAlert("Order successfully placed", "Our partner retailer/pharmacist will contact you shortly to verify your order and update you with the relevant  information. Once confirmed , you will receive a formal order confirmation along with an estimated delivery time ", "OK");

                    App.SetupRedirection(new Wellogo.Tabbedpage.TabbedPage1());
                    App.Current.MainPage = App.MasterDetailPage;
                }
                else
                {
                    DependencyService.Get <IMessage>().LongAlert(objPharmacy.message);
                }


                overlay.IsVisible = false;
            }
            catch (Exception ex)
            {
                overlay.IsVisible = false;
                DependencyService.Get <IMessage>().LongAlert();
            }
        }
        private int GetId()
        {
            int IdStudent = 1;

            try
            {
                // instructiunea 'using' va apela sr.Close()
                using (StreamReader sr = new StreamReader(NumeFisier))
                {
                    string line;

                    //citeste cate o linie si creaza un obiect de tip Student pe baza datelor din linia citita
                    while ((line = sr.ReadLine()) != null)
                    {
                        Pharmacy s = new Pharmacy(line);
                        IdStudent = s.IdMedicament + INCREMENT;
                    }
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }
            return(IdStudent);
        }
        public Pharmacy[] GetM(out int nr)
        {
            Pharmacy[] medicamente = new Pharmacy[PAS_ALOCARE];

            try
            {
                using (StreamReader sr = new StreamReader("Medicamente.txt"))
                {
                    string line;
                    nr = 0;


                    while ((line = sr.ReadLine()) != null)
                    {
                        medicamente[nr++] = new Pharmacy(line);
                        if (nr == PAS_ALOCARE)
                        {
                            Array.Resize(ref medicamente, nr + PAS_ALOCARE);
                        }
                    }
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }
            return(medicamente);
        }
Exemplo n.º 25
0
 ///<summary>Inserts one Pharmacy into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(Pharmacy pharmacy,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         pharmacy.PharmacyNum=ReplicationServers.GetKey("pharmacy","PharmacyNum");
     }
     string command="INSERT INTO pharmacy (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="PharmacyNum,";
     }
     command+="PharmID,StoreName,Phone,Fax,Address,Address2,City,State,Zip,Note) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(pharmacy.PharmacyNum)+",";
     }
     command+=
          "'"+POut.String(pharmacy.PharmID)+"',"
         +"'"+POut.String(pharmacy.StoreName)+"',"
         +"'"+POut.String(pharmacy.Phone)+"',"
         +"'"+POut.String(pharmacy.Fax)+"',"
         +"'"+POut.String(pharmacy.Address)+"',"
         +"'"+POut.String(pharmacy.Address2)+"',"
         +"'"+POut.String(pharmacy.City)+"',"
         +"'"+POut.String(pharmacy.State)+"',"
         +"'"+POut.String(pharmacy.Zip)+"',"
         +"'"+POut.String(pharmacy.Note)+"')";
         //DateTStamp can only be set by MySQL
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         pharmacy.PharmacyNum=Db.NonQ(command,true);
     }
     return pharmacy.PharmacyNum;
 }
Exemplo n.º 26
0
        public async Task <IActionResult> PutPharmacy(int id, Pharmacy pharmacy)
        {
            if (id != pharmacy.Id)
            {
                return(BadRequest());
            }

            _context.Entry(pharmacy).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PharmacyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        //update new Pharmacy
        public Boolean UpdatePharmacy(Pharmacy pharmacy) {
            var result = false;
            var l = new LoginRequest();

            PHARMACIST updatePHARMACIST = new PHARMACIST();
            string strID = pharmacy.id;
            LinqToSQL.updatePHARMACIST(strID, updatePHARMACIST);

            listp.ForEach(c =>
            {
                if (c.userName == pharmacy.userName)
                {
                    listp.Insert(listp.IndexOf(c), pharmacy);
                    result = true;
                }
            });
            login.ForEach(c =>
            {
                if (c.userName == pharmacy.userName)
                {
                    l.userName = c.userName;
                    l.password = c.password;
                    login.Insert(login.IndexOf(c), l);
                }
            });
            return result;
        }
Exemplo n.º 28
0
 ///<summary>Inserts one Pharmacy into the database.  Returns the new priKey.</summary>
 internal static long Insert(Pharmacy pharmacy)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         pharmacy.PharmacyNum=DbHelper.GetNextOracleKey("pharmacy","PharmacyNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(pharmacy,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     pharmacy.PharmacyNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(pharmacy,false);
     }
 }
Exemplo n.º 29
0
        public void NewName(Pharmacy pharmacy)
        {
            Pharmacy org = Get();

            Add(pharmacy);
            Remove(org);
        }
Exemplo n.º 30
0
        private List <Pharmacy> ParseList(string html)
        {
            List <Pharmacy> pharmacies = new List <Pharmacy>();

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(html);

            var divs = doc.DocumentNode.SelectNodes("//div[@class='panel panel-default']");

            if (divs.Count == 0)
            {
                return(pharmacies);
            }
            foreach (var div in divs)
            {
                Pharmacy pharmacy = new Pharmacy();
                pharmacy.Name = div.SelectSingleNode(".//div[@class='panel-heading']").InnerText.Trim().SoftClearText();
                if (string.IsNullOrEmpty(pharmacy.Name))
                {
                    continue;
                }
                string body = div.SelectSingleNode(".//div[@class='panel-body pharmacyonduty']").InnerHtml;
                body             = body.Substring(body.IndexOf("</b>") + 4);
                pharmacy.Address = body.Substring(body.IndexOf("<br>")).Replace("<br>", "");
                pharmacy.Address = pharmacy.Address.Substring(0, pharmacy.Address.IndexOf("<b>")).Replace("<b>", "");
                pharmacy.Phone   = body.Substring(body.IndexOf("</b>")).Replace("</b>", "");
                pharmacy.Phone   = pharmacy.Phone.Replace(":", "").Replace("<br>", "").Trim();
                pharmacies.Add(pharmacy);
            }

            return(pharmacies);
        }
Exemplo n.º 31
0
 public Delete(Pharmacy p, DataGridView d)
 {
     InitializeComponent();
     pharmacy = p;
     dgv      = d;
     cmbMedicine.DataSource = pharmacy.GetMedicines();
 }
Exemplo n.º 32
0
 ///<summary>Inserts one Pharmacy into the database.  Returns the new priKey.</summary>
 internal static long Insert(Pharmacy pharmacy)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         pharmacy.PharmacyNum = DbHelper.GetNextOracleKey("pharmacy", "PharmacyNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(pharmacy, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     pharmacy.PharmacyNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(pharmacy, false));
     }
 }
 public UploadPrescription(Pharmacy _Pharmacy = null)
 {
     InitializeComponent();
     try
     {
         //if (Device.RuntimePlatform == "iOS")
         //{
         //    ToolbarItems.Add(new ToolbarItem("Back", "", () => { App.SetupRedirection(new index()); App.Current.MainPage = App.MasterDetailPage; }));
         //}
         //if (Device.RuntimePlatform == "Android")
         //{
         //    ToolbarItems.Add(new ToolbarItem("Home", "back.png", () => { App.SetupRedirection(new index()); App.Current.MainPage = App.MasterDetailPage; }));
         //}
         objPharmacy = _Pharmacy;
         if (objPharmacy != null)
         {
             if (objPharmacy.data.photos.Count >= 4)
             {
                 btnUpload.IsEnabled = false;
             }
             else
             {
                 btnUpload.IsEnabled = true;
             }
         }
         var tgr = new TapGestureRecognizer();
         tgr.Tapped += Tgr_Tapped;
         lblschedule.GestureRecognizers.Add(tgr);
     }
     catch (Exception ex)
     {
         DependencyService.Get <IMessage>().LongAlert();
     }
 }
        public Pharmacy GetStudent(string nume)
        {
            try
            {
                // instructiunea 'using' va apela sr.Close()
                using (StreamReader sr = new StreamReader(NumeFisier))
                {
                    string line;

                    //citeste cate o linie si creaza un obiect de tip Student pe baza datelor din linia citita
                    while ((line = sr.ReadLine()) != null)
                    {
                        Pharmacy p = new Pharmacy(line);
                        if (p.Nume.Equals(nume))
                        {
                            return(p);
                        }
                    }
                }
            }
            catch (IOException eIO)
            {
                throw new Exception("Eroare la deschiderea fisierului. Mesaj: " + eIO.Message);
            }
            catch (Exception eGen)
            {
                throw new Exception("Eroare generica. Mesaj: " + eGen.Message);
            }
            return(null);
        }
Exemplo n.º 35
0
 public int InsertTonKho(Pharmacy.QuanLy.Info.TonkhoInfo info)
 {
     int id = 0;
     try
     {
         id = cn.ExecuteInsert("sp_InsertTONKHO",
             new string[] { "@MAKHO", "@NGAY", "@TINHTRANG"},
            new object[] { info.MAKHO, info.NGAY, info.TINHTRANG});
         return id;
     }
     catch (Exception ex)
     {
         //ghi log
         return id;
     }
 }
Exemplo n.º 36
0
 public int InsertCTTonKho(Pharmacy.QuanLy.Info.CTTonkhoInfo info)
 {
     int id = 0;
     try
     {
         id = cn.ExecuteInsert("sp_InsertCT_TonKho",
             new string[] { "@MAHH", "@MATONKHO", "@SOLUONGTON", "@TINHTRANG" },
            new object[] { info.Mahh, info.Matonkho, info.Soluongton,1 });
         return id;
     }
     catch (Exception ex)
     {
         //ghi log
         return id;
     }
 }
Exemplo n.º 37
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<Pharmacy> TableToList(DataTable table){
			List<Pharmacy> retVal=new List<Pharmacy>();
			Pharmacy pharmacy;
			for(int i=0;i<table.Rows.Count;i++) {
				pharmacy=new Pharmacy();
				pharmacy.PharmacyNum= PIn.Long  (table.Rows[i]["PharmacyNum"].ToString());
				pharmacy.PharmID    = PIn.String(table.Rows[i]["PharmID"].ToString());
				pharmacy.StoreName  = PIn.String(table.Rows[i]["StoreName"].ToString());
				pharmacy.Phone      = PIn.String(table.Rows[i]["Phone"].ToString());
				pharmacy.Fax        = PIn.String(table.Rows[i]["Fax"].ToString());
				pharmacy.Address    = PIn.String(table.Rows[i]["Address"].ToString());
				pharmacy.Address2   = PIn.String(table.Rows[i]["Address2"].ToString());
				pharmacy.City       = PIn.String(table.Rows[i]["City"].ToString());
				pharmacy.State      = PIn.String(table.Rows[i]["State"].ToString());
				pharmacy.Zip        = PIn.String(table.Rows[i]["Zip"].ToString());
				pharmacy.Note       = PIn.String(table.Rows[i]["Note"].ToString());
				pharmacy.DateTStamp = PIn.DateT (table.Rows[i]["DateTStamp"].ToString());
				retVal.Add(pharmacy);
			}
			return retVal;
		}
Exemplo n.º 38
0
    /// <summary>
    /// 
    /// </summary>
    public static void FillPharmacyDropdown(DropDownList ddPharmacy)
    {
        Pharmacy pharmacy = new Pharmacy();

        DataSet dsPharmacy = pharmacy.GetPharmacyList();
        ddPharmacy.DataSource = dsPharmacy;
        ddPharmacy.DataTextField = "PharmacyName";
        ddPharmacy.DataValueField = "PharmacyID";
        ddPharmacy.DataBind();
        ListItem itemPharmacy = new ListItem();
        itemPharmacy.Value = "0";
        itemPharmacy.Text = "-Select Pharmacy -";
        ddPharmacy.Items.Insert(0, itemPharmacy);
    }
Exemplo n.º 39
0
 ///<summary>Updates one Pharmacy in the database.</summary>
 internal static void Update(Pharmacy pharmacy)
 {
     string command="UPDATE pharmacy SET "
         +"PharmID    = '"+POut.String(pharmacy.PharmID)+"', "
         +"StoreName  = '"+POut.String(pharmacy.StoreName)+"', "
         +"Phone      = '"+POut.String(pharmacy.Phone)+"', "
         +"Fax        = '"+POut.String(pharmacy.Fax)+"', "
         +"Address    = '"+POut.String(pharmacy.Address)+"', "
         +"Address2   = '"+POut.String(pharmacy.Address2)+"', "
         +"City       = '"+POut.String(pharmacy.City)+"', "
         +"State      = '"+POut.String(pharmacy.State)+"', "
         +"Zip        = '"+POut.String(pharmacy.Zip)+"', "
         +"Note       = '"+POut.String(pharmacy.Note)+"' "
         //DateTStamp can only be set by MySQL
         +"WHERE PharmacyNum = "+POut.Long(pharmacy.PharmacyNum);
     Db.NonQ(command);
 }
Exemplo n.º 40
0
		///<summary>Converts one Pharmacy object to its mobile equivalent.  Warning! CustomerNum will always be 0.</summary>
		internal static Pharmacym ConvertToM(Pharmacy pharmacy){
			Pharmacym pharmacym=new Pharmacym();
			//CustomerNum cannot be set.  Remains 0.
			pharmacym.PharmacyNum=pharmacy.PharmacyNum;
			pharmacym.StoreName  =pharmacy.StoreName;
			pharmacym.Phone      =pharmacy.Phone;
			pharmacym.Fax        =pharmacy.Fax;
			pharmacym.Address    =pharmacy.Address;
			pharmacym.Address2   =pharmacy.Address2;
			pharmacym.City       =pharmacy.City;
			pharmacym.State      =pharmacy.State;
			pharmacym.Zip        =pharmacy.Zip;
			pharmacym.Note       =pharmacy.Note;
			return pharmacym;
		}
Exemplo n.º 41
0
 ///<summary>Updates one Pharmacy in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
 internal static void Update(Pharmacy pharmacy,Pharmacy oldPharmacy)
 {
     string command="";
     if(pharmacy.PharmID != oldPharmacy.PharmID) {
         if(command!=""){ command+=",";}
         command+="PharmID = '"+POut.String(pharmacy.PharmID)+"'";
     }
     if(pharmacy.StoreName != oldPharmacy.StoreName) {
         if(command!=""){ command+=",";}
         command+="StoreName = '"+POut.String(pharmacy.StoreName)+"'";
     }
     if(pharmacy.Phone != oldPharmacy.Phone) {
         if(command!=""){ command+=",";}
         command+="Phone = '"+POut.String(pharmacy.Phone)+"'";
     }
     if(pharmacy.Fax != oldPharmacy.Fax) {
         if(command!=""){ command+=",";}
         command+="Fax = '"+POut.String(pharmacy.Fax)+"'";
     }
     if(pharmacy.Address != oldPharmacy.Address) {
         if(command!=""){ command+=",";}
         command+="Address = '"+POut.String(pharmacy.Address)+"'";
     }
     if(pharmacy.Address2 != oldPharmacy.Address2) {
         if(command!=""){ command+=",";}
         command+="Address2 = '"+POut.String(pharmacy.Address2)+"'";
     }
     if(pharmacy.City != oldPharmacy.City) {
         if(command!=""){ command+=",";}
         command+="City = '"+POut.String(pharmacy.City)+"'";
     }
     if(pharmacy.State != oldPharmacy.State) {
         if(command!=""){ command+=",";}
         command+="State = '"+POut.String(pharmacy.State)+"'";
     }
     if(pharmacy.Zip != oldPharmacy.Zip) {
         if(command!=""){ command+=",";}
         command+="Zip = '"+POut.String(pharmacy.Zip)+"'";
     }
     if(pharmacy.Note != oldPharmacy.Note) {
         if(command!=""){ command+=",";}
         command+="Note = '"+POut.String(pharmacy.Note)+"'";
     }
     //DateTStamp can only be set by MySQL
     if(command==""){
         return;
     }
     command="UPDATE pharmacy SET "+command
         +" WHERE PharmacyNum = "+POut.Long(pharmacy.PharmacyNum);
     Db.NonQ(command);
 }