public IHttpActionResult PutOpdRegister(int id, OpdRegister opdRegister)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != opdRegister.Id)
            {
                return(BadRequest());
            }

            db.Entry(opdRegister).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OpdRegisterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutComplaint(int id, Complaint complaint)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != complaint.Id)
            {
                return(BadRequest());
            }

            db.Entry(complaint).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ComplaintExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public int Register(TheatrePatientBioData theatrePatientBio)
        {
            if (ModelState.IsValid)
            {
                theatrePatientBio.CreatedUTC = DateTime.Now;

                if (theatrePatientBio.Id != null && theatrePatientBio.Id > 0)
                {
                    var pat = db.TheatrePatientBioDatas.FirstOrDefault(e => e.PatientOPDIPD == theatrePatientBio.PatientOPDIPD);
                    pat.HIV             = theatrePatientBio.HIV;
                    pat.DepartmentId    = theatrePatientBio.DepartmentId;
                    pat.AppointmentDate = theatrePatientBio.AppointmentDate;
                    pat.RegStatus       = theatrePatientBio.RegStatus;
                    pat.UserId          = (int)Session["UserId"];

                    db.Entry(pat).State = EntityState.Modified;

                    db.SaveChanges();
                    return(pat.Id);
                }
                else
                {
                    theatrePatientBio.UserId = (int)Session["UserId"];
                    db.TheatrePatientBioDatas.Add(theatrePatientBio);
                }

                db.SaveChanges();
                return(theatrePatientBio.Id);
            }

            return(0);
        }
        public async Task <IHttpActionResult> PutService(int id, Service service)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != service.Id)
            {
                return(BadRequest());
            }

            db.Entry(service).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult EditRole(UserRole userRole)
        {
            ViewBag.Departments      = db.Departments;
            db.Entry(userRole).State = EntityState.Modified;
            db.SaveChanges();

            return(View(db.UserRoles.Find(userRole.Id)));
        }
 public ActionResult Edit([Bind(Include = "Id,CategoryName,UserId,BranchId,TimeAdded")] SystemExamCategory systemExamCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(systemExamCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(systemExamCategory));
 }
 public ActionResult Edit([Bind(Include = "Id,MainCategory,SubCategory,salutation,FName,MName,LName,Gender,DOB,Religion,CorporateCompany,CorporateEmployeeId,ImageURL,ThumbNailURL,StreetAddress,Country,County,SubCounty,Village,NationalId,KinInitial,KinName,KinMobile,Email,BloodGroup,MaritalStatus,RegDate,RegTime,BranchId,Timestamp,RegNumber")] Patient patient)
 {
     if (ModelState.IsValid)
     {
         db.Entry(patient).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(patient));
 }
Exemplo n.º 8
0
 public ActionResult Edit([Bind(Include = "Id,TableName,Field,Required")] FieldMeta fieldMeta)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fieldMeta).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(fieldMeta));
 }
Exemplo n.º 9
0
 public ActionResult Edit([Bind(Include = "Id,MedicalHistoryQuestionName,BranchId,UserId,TimeAdded")] MedicalHistoryQuestion medicalHistoryQuestion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(medicalHistoryQuestion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(medicalHistoryQuestion));
 }
 public ActionResult Edit([Bind(Include = "Id,CategoryId,ParticularName,BranchId,UserId,TimeAdded")] SystemExamParticular systemExamParticular)
 {
     if (ModelState.IsValid)
     {
         db.Entry(systemExamParticular).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.SystemExamCategories, "Id", "CategoryName", systemExamParticular.CategoryId);
     return(View(systemExamParticular));
 }
Exemplo n.º 11
0
 public ActionResult Edit([Bind(Include = "Id,TariffName,CompanyId,DateAdded")] Tariff tariff)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tariff).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CompanyId = new SelectList(db.Companies, "Id", "CompanyName", tariff.CompanyId);
     return(View(tariff));
 }
Exemplo n.º 12
0
 public ActionResult Edit([Bind(Include = "Id,DepartmentName,DateAdded,DepartmentType")] Department department)
 {
     if (ModelState.IsValid)
     {
         db.Entry(department).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentType = new SelectList(db.DepartmentTypes, "Id", "DepartmnetType", department.DepartmentType);
     return(View(department));
 }
Exemplo n.º 13
0
 public ActionResult Edit([Bind(Include = "Id,ServiceName,DepartmentId,CashPrice,DateAdded,ServiceGroupId")] Service service)
 {
     if (ModelState.IsValid)
     {
         db.Entry(service).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Create"));
     }
     ViewBag.DepartmentId   = new SelectList(db.Departments.Where(e => e.DepartmentType1.DepartmnetType.ToLower() == "revenue"), "Id", "DepartmentName", service.DepartmentId);
     ViewBag.ServiceGroupId = new SelectList(db.ServiceGroups, "Id", "ServiceGroupName", service.ServiceGroupId);
     return(View(service));
 }
Exemplo n.º 14
0
 public ActionResult Edit([Bind(Include = "Id,TariffId,ServiceId,Award,AwardUnit,DoctorFee,DoctorFeeUnit")] ServicesPrice servicesPrice)
 {
     if (ModelState.IsValid)
     {
         db.Entry(servicesPrice).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ServiceId = new SelectList(db.Services, "Id", "ServiceName", servicesPrice.ServiceId);
     ViewBag.TariffId  = new SelectList(db.Tariffs, "Id", "TariffName", servicesPrice.TariffId);
     return(View(servicesPrice));
 }
        // PUT: api/Patients/5
        public HttpResponseMessage PutApplicant(int id, [FromBody] HRApplicant applicant)
        {
            if (applicant == null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "no data sent"));
            }
            applicant.Id = id;

            db.Entry(applicant).State = EntityState.Modified;

            db.SaveChanges();

            return(Request.CreateResponse(HttpStatusCode.OK, applicant));
        }
        public ActionResult ApproveSpecificInvoice(int id)
        {
            var loggedInUser = db.Users.Find(Session["UserId"]);
            var UserName     = loggedInUser.Username;


            var invoice = db2.Invoices.Where(p => p.Id == id).FirstOrDefault();

            invoice.ApprovedBy    = UserName;
            invoice.FinalApproval = true;

            db.Entry(invoice).State = EntityState.Modified;
            db.SaveChanges();

            List <ProcurementDataAccess.Invoice> invoices = new List <ProcurementDataAccess.Invoice>();

            var todaysDate = DateTime.Now.Date;

            ProcurementDataAccess.ItemMaster itemMaster;

            List <ProcurementDataAccess.ItemMaster> lstItemsToBeAdded = new List <ProcurementDataAccess.ItemMaster>();
            var approvedItems = db2.InvoiceDetails.Where(p => p.InvoiceNo == id).ToList();

            //Add items in invoice to item master table
            foreach (var item in approvedItems)
            {
                var drug = db2.Drugs.Where(p => p.Id == item.DrugId).FirstOrDefault();

                itemMaster = new ProcurementDataAccess.ItemMaster();

                itemMaster.ItemName        = drug.Name;
                itemMaster.BatchNo         = item.BatchNo;
                itemMaster.GenericDrugName = drug.GenericDrugName?.Name ?? "";
                itemMaster.MfgCoName       = item.MfgCoNm;
                itemMaster.Supplier        = invoice.SupplierName;
                itemMaster.CurrentStock    = item.Units;
                itemMaster.MfgDate         = item.MfgDate.ToString();
                itemMaster.ReorderLevel    = drug.ReorderLevel;
                itemMaster.UnitsPack       = drug.UnitsPack;
                itemMaster.CostPriceUnit   = item.CostPrice;
                itemMaster.ExpiryStatus    = item.ExpiryStatus;
                itemMaster.PurchaseDate    = item.ReceviedDate.ToString();
                itemMaster.barCode         = "";
                itemMaster.CasePackRate    = item.CasePackRate;
                itemMaster.StoreName       = item.StoreFlag;

                lstItemsToBeAdded.Add(itemMaster);
            }

            db2.ItemMasters.AddRange(lstItemsToBeAdded);
            db.SaveChanges();

            if (Session["StartDate"] != null && Session["ToDate"] != null)
            {
                DateTime fromDate = (DateTime)Session["StartDate"];
                DateTime toDate   = (DateTime)Session["ToDate"];

                invoices = db2.Invoices.Where(x => x.InvoiceDate >= fromDate && x.InvoiceDate <= toDate)
                           .OrderByDescending(p => p.Id)
                           .ToList();
                ViewBag.SearchDates = true;
            }
            else if (Session["SupplierName"] != null)
            {
                var supplierName = Session["SupplierName"].ToString();

                invoices = db2.Invoices.Where(x => x.SupplierName.Contains(supplierName))
                           .OrderByDescending(p => p.Id)
                           .ToList();
            }
            else
            {
                invoices = db2.Invoices.Where(x => x.InvoiceDate == todaysDate)
                           .OrderByDescending(p => p.Id)
                           .ToList();
            }

            int?page      = 1;
            int pageSize  = 10;
            int pageIndex = 1;

            pageIndex = page.HasValue ? Convert.ToInt32(page) : 1;


            return(PartialView("~/Areas/Accounting/Views/Home/_ApproveBills.cshtml", invoices.ToPagedList(pageIndex, pageSize)));
        }
Exemplo n.º 17
0
        public ActionResult SavePatient(Patient patient)
        {
            patient.UserId = (int)Session["UserId"];
            var filetype = "new";

            if (patient.RegNumber != null)
            {
                //Old file registration/ Do not produce a new reg number
                filetype = "old";
            }
            else if (patient.Id > 0)
            {
                filetype = "revisit";
            }

            if (filetype == "revisit")
            {
                //update and proceed to opd
                var file = db.Patients.Find(patient.Id);
                if (file != null)
                {
                    db.Entry(patient).State = EntityState.Modified;

                    db.SaveChanges();
                    return(Json(new { Status = "Success", RegNumber = patient.RegNumber, ApplicantName = patient.Salutation + " " + patient.FName + " " + patient.MName + " " + patient.LName, PatientId = patient.Id, Username = patient.RegNumber, Password = patient.Password }));
                }
            }

            //if (patient.Mobile !=null && db.Patients.Where(e => e.Mobile == patient.Mobile).ToList().Count>0)
            //{
            //    return Json(new { Status = "Error", Message = "The Mobile Number you provided is associated with another patient" });
            //}
            if (patient.NationalId != null && db.Patients.Where(e => e.NationalId == patient.NationalId).ToList().Count > 0)
            {
                return(Json(new { Status = "Error", Message = "The National Id Number you provided is associated with another patient" }));
            }
            if (patient.Email != null && db.Patients.Where(e => e.Email == patient.Email).ToList().Count > 0)
            {
                return(Json(new { Status = "Error", Message = "The Email Address you provided is associated with another patient" }));
            }
            patient.Timestamp = DateTime.Now;
            db.Patients.Add(patient);
            db.SaveChanges();

            if (filetype == "new")
            {
                var facilityinitial = db.KeyValuePairs.FirstOrDefault(e => e.Key_ == "facilityinittials").Value;
                var year            = DateTime.Now.ToString("yy");
                var prefix          = "00";
                if (patient.Id > 9)
                {
                    prefix = "0";
                }
                else if (patient.Id > 99)
                {
                    prefix = "";
                }
                //var branchid = db.KeyValuePairs.FirstOrDefault(e => e.Key_ == "branchid").Value; //TODO pick from logged in user

                var branchid  = (int)Session["UserBranchId"];
                var regnumber = facilityinitial + "/" + branchid + "/" + prefix + patient.Id + "/" + year;
                patient.RegNumber = regnumber;
            }
            var password = "******" + patient.Id.ToString();

            if (patient.FName != null && patient.MName != null)
            {
                char[] fnameArr = patient.FName.ToCharArray();
                char[] mnameArr = patient.MName.ToCharArray();
                password = fnameArr[0].ToString() + fnameArr[1].ToString() + mnameArr[0].ToString() + mnameArr[1].ToString() + DateTime.Now.ToString("dd");
            }



            patient.Password = password.ToLower();
            db.SaveChanges();

            return(Json(new { Status = "Success", RegNumber = patient.RegNumber, ApplicantName = patient.Salutation + " " + patient.FName + " " + patient.MName + " " + patient.LName, PatientId = patient.Id, Username = patient.RegNumber, Password = patient.Password }));
        }