Exemplo n.º 1
0
        public static void AddNewSkladStorage(string NameFaction)
        {
            const int Pistols  = 1000;
            const int Rifle    = 1000;
            const int SMG      = 1500;
            const int Shotgun  = 2500;
            const int Melee    = 2500;
            const int Armor    = 2500;
            const int Medicals = 2500;

            switch (NameFaction)
            {
            case "Start":

                Dictionary <string, string> parametersStatr = new Dictionary <string, string>
                {
                    { "@NameFaction", NameFaction },
                    { "@Pistols", Pistols.ToString() },
                    { "@Rifle", Rifle.ToString() },
                    { "@SMG", SMG.ToString() },
                    { "@Shotgun", Shotgun.ToString() },
                    { "@Melee", Melee.ToString() },
                    { "@Armor", Armor.ToString() },
                    { "@Medicals", Medicals.ToString() }
                };

                DataTable resultStatr = Database.ExecutePreparedStatement("INSERT INTO sklad_faction_storages (NameFaction, Pistols, Rifle, SMG, Shotgun, Melee, Armor, Medicals) " +
                                                                          DatabaseValues, parametersStatr);

                break;
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Medicals medicals = await db.Medicals.FindAsync(id);

            db.Medicals.Remove(medicals);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Create([Bind(Include = "Mid,ApplicationNo,Date,HospitalName,BookedBy,Note")] Medicals medicals)
        {
            if (ModelState.IsValid)
            {
                db.Medicals.Add(medicals);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(medicals));
        }
        public async Task <IActionResult> Edit(Medicals medical)
        {
            var oldMedical = await imedicalsResponsitory.GetById(medical.Id);

            if (ModelState.IsValid)
            {
                await imedicalsResponsitory.Update(medical.Id, medical);

                return(RedirectToAction("index", "medicals"));
            }
            ViewBag.hospitals = ihospitalsResponsitory.GetAll().OrderBy(p => p.HospitalName).ToList();
            ViewBag.companies = icompanyDetailsResponsitory.GetAll().OrderBy(p => p.CompanyName).ToList();
            return(View("detail", medical));
        }
Exemplo n.º 5
0
        public async Task <ActionResult> Edit([Bind(Include = "Mid,ApplicationNo,Date,HospitalName,BookedBy,Note,Files")] Medicals medicals, HttpPostedFileBase file, Helper help)
        {
            if (ModelState.IsValid)
            {
                medicals.Files = file != null?help.uploadfile(file) : img;

                db.Entry(medicals).State = EntityState.Modified;
                await db.SaveChangesAsync();

                TempData["Success"] = "Medical Updated Successfully";
                return(RedirectToAction("Dashboard", "Processing", new { id = medicals.ApplicationNo }));
            }
            return(View(medicals));
        }
Exemplo n.º 6
0
        // GET: Medicals/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Medicals medicals = await db.Medicals.FindAsync(id);

            if (medicals == null)
            {
                return(HttpNotFound());
            }
            return(View(medicals));
        }
        public ActionResult Medical([Bind(Include = "Date,HospitalName,BookedBy,ApplicationNo,Note,Sms,Email,Show")] Medicals Med, Helper help)
        {
            using (var transaction = db.Database.BeginTransaction())
            {
                try
                {
                    Medicals mm = db.Medicals.FirstOrDefault(x => x.ApplicationNo == Med.ApplicationNo);
                    if (mm == null)
                    {
                        var    inquiryid = db.Applications.FirstOrDefault(x => x.ApplicationNo == Med.ApplicationNo).InquiryId;
                        online onlines   = db.onlines.FirstOrDefault(x => x.inquiryid == inquiryid);
                        Med.BookedBy = help.Teacher();
                        Med.Date     = System.DateTime.Now;
                        db.Medicals.Add(Med);
                        db.SaveChanges();
                        Process pr = db.Process.FirstOrDefault(x => x.ApplicationNo == Med.ApplicationNo);
                        if (pr.Medical == false)
                        {
                            var Process = db.Process.SingleOrDefault(x => x.ApplicationNo == Med.ApplicationNo);
                            if (Process != null)
                            {
                                Process.Medical = true;

                                db.SaveChanges();
                            }
                        }

                        transaction.Commit();
                        if (Med.Sms == true)
                        {
                            help.sendsms(onlines.Mobile, "Hello," + onlines.Name + " your Medical Registerd Sucessfully ");
                        }
                        return(Json(Med, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        TempData["danger"] = "Sorry Medical Already Booked";
                        return(Json(Med, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception e)
                {
                    transaction.Rollback();

                    throw;
                }
                return(View());
            }
        }
        public async Task <IActionResult> PostCreate(Medicals medical)
        {
            if (ModelState.IsValid)
            {
                await imedicalsResponsitory.Create(medical);

                return(RedirectToAction("index", "medicals"));
            }
            foreach (var modelStateKey in ModelState.Keys)
            {
                var modelStateVal = ModelState[modelStateKey];
                foreach (var error in modelStateVal.Errors)
                {
                    var key          = modelStateKey;
                    var errorMessage = error.ErrorMessage;
                    Debug.WriteLine(key);
                    Debug.WriteLine(errorMessage);
                }
            }
            Debug.WriteLine("LOI");
            ViewBag.hospitals = ihospitalsResponsitory.GetAll().OrderBy(p => p.HospitalName).ToList();
            ViewBag.companies = icompanyDetailsResponsitory.GetAll().OrderBy(p => p.CompanyName).ToList();
            return(View("create"));
        }