Пример #1
0
        void UpdateRow()
        {
            try
            {
                HospitalEntities db = new HospitalEntities();
                tblUser = db.tblUsers.Find(tblUser.UserID);

                if (tblUser == null)
                {
                    FarsiMessagbox.Show(ClsMessage.ErrNotFound, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
                    return;
                }

                var Query = from a in db.tblUsers
                            where a.UserName == txtUserName_.Text && a.UserID != tblUser.UserID
                            select a;

                if (Query.Count() != 0)
                {
                    FarsiMessagbox.Show(ClsMessage.ErrRepeat + "\n" + "نام کاربری تکراری می باشد", "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
                    return;
                }

                tblUser.Name     = txtName_.Text;
                tblUser.LastName = txtLastName_.Text;
                tblUser.UserName = txtUserName_.Text;
                tblUser.PassWord = txtPassWord_.Text;

                db.Entry(tblUser).State = EntityState.Modified;
                //db.Entry(tblPersonnel).Property(x => x).IsModified = true;
                db.Entry(tblUser).Property(x => x.Active).IsModified = false;

                db.SaveChanges();


                New();
            }
            catch (DbEntityValidationException ex)
            {
                var errorMessages    = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage);
                var fullErrorMessage = string.Join("\n", errorMessages);
                var exceptionMessage = string.Concat(ClsMessage.Error, ex.Message, " The validation errors are: ", fullErrorMessage);
                FarsiMessagbox.Show(exceptionMessage, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
            catch (DbUpdateException ex)
            {
                FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
        }
Пример #2
0
        public IHttpActionResult PutMedicos(int id, Medicos medicos)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != medicos.Cod_Identificacion)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public IHttpActionResult PutPaciente(string id, Paciente paciente)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != paciente.Curp)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // PUT api/MedQuantityTypeApi/5
        public async Task <IHttpActionResult> PutMed_quantity_type(int id, Med_quantity_type med_quantity_type)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != med_quantity_type.Med_quan_typeId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #5
0
        public IHttpActionResult PutDoctor(int id, Doctor doctor)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #6
0
        public ActionResult Edit(int?id, string[] SelectedCon, string[] NotSelectedCon)
        {
            var patientToUpdate = db.Patients
                                  .Include(p => p.Conditions)
                                  .Where(i => i.ID == id)
                                  .Single();

            if (TryUpdateModel(patientToUpdate, "", new string[] {
                "ID",
                "TB",
                "FirstName",
                "LastName",
                "DoB",
                "YrVisits",
                "DoctorID"
            }))
            {
                if (ModelState.IsValid)
                {
                    UpdateConditions(SelectedCon, patientToUpdate);
                    db.Entry(patientToUpdate).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            PopulateAssignedCondition(patientToUpdate);
            PopulateDropDownList(patientToUpdate.DoctorID);
            return(View(patientToUpdate));
        }
Пример #7
0
        void UpdateRow()
        {
            try
            {
                HospitalEntities db = new HospitalEntities();
                tblPaziresh = db.tblPazireshes.Find(tblPaziresh.PazireshID);

                if (tblPaziresh == null)
                {
                    FarsiMessagbox.Show(ClsMessage.ErrNotFound, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
                    return;
                }

                tblPaziresh.NameBimar      = txtName_.Text;
                tblPaziresh.LastNameBimar  = txtLastName_.Text;
                tblPaziresh.CodeMelliBimar = txtCodeMelli_.Text;
                tblPaziresh.CodeBimeBimar  = txtCodeBime.Text;
                tblPaziresh.PezeshkID      = (int)cmbPezeshk_.SelectedValue;
                tblPaziresh.OtaghID        = (int)cmbOtagh_.SelectedValue;

                db.Entry(tblPaziresh).State = EntityState.Modified;
                //db.Entry(tblPersonnel).Property(x => x).IsModified = true;
                db.Entry(tblPaziresh).Property(x => x.TarikhPaziresh).IsModified = false;

                db.SaveChanges();

                New();
            }
            catch (DbEntityValidationException ex)
            {
                var errorMessages    = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage);
                var fullErrorMessage = string.Join("\n", errorMessages);
                var exceptionMessage = string.Concat(ClsMessage.Error, ex.Message, " The validation errors are: ", fullErrorMessage);
                FarsiMessagbox.Show(exceptionMessage, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
            catch (DbUpdateException ex)
            {
                FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
        }
Пример #8
0
 public async Task<ActionResult > Edit([Bind(Include = "Med_quan_typeId,Med_quan_type,Med_quantity")] Med_quantity_type med_quantity_type)
 {
     if (ModelState.IsValid)
     {
       db.Entry(med_quantity_type).State = EntityState.Modified;
       await db.SaveChangesAsync();
      return RedirectToAction("Index");
     }
     return View(med_quantity_type);
 }
 public ActionResult Edit([Bind(Include = "Id,Address,Email,Phone,WorkHours")] Settings settings)
 {
     if (ModelState.IsValid)
     {
         db.Entry(settings).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(settings));
 }
Пример #10
0
 public ActionResult Edit([Bind(Include = "ID,ConditionName")] Condition condition)
 {
     if (ModelState.IsValid)
     {
         db.Entry(condition).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(condition));
 }
Пример #11
0
 public ActionResult Edit([Bind(Include = "AseguradoNº,Nombre,Apellido,Domicilio,Ciudad,Telefono,Nº_HistorialClinico,Sexo")] Pacientes pacientes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pacientes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pacientes));
 }
Пример #12
0
 public ActionResult Edit([Bind(Include = "Id,Name,Surname,Phone,Address,Birthday,InspectionDate,Payment")] Patients patients)
 {
     if (ModelState.IsValid)
     {
         db.Entry(patients).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(patients));
 }
Пример #13
0
 public ActionResult Edit([Bind(Include = "idMedico,nombre,exequater,especialidad")] Medicos medicos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(medicos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(medicos));
 }
 public ActionResult Edit([Bind(Include = "ID,FirstName,LastName")] Doctor doctor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doctor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(doctor));
 }
Пример #15
0
 public ActionResult Edit([Bind(Include = "NumIngreso,NumeroHistorial,FechaIngreso,CodIdentificacion,NumSala,NumCama,EnfermedadBase")] Ingreso ingreso)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ingreso).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ingreso));
 }
 public ActionResult Edit([Bind(Include = "idPaciente,cedula,nombre,asegurado")] Pacientes pacientes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pacientes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pacientes));
 }
Пример #17
0
 public ActionResult Edit([Bind(Include = "Id,NameAz,NameEng")] Allergies allergies)
 {
     if (ModelState.IsValid)
     {
         db.Entry(allergies).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(allergies));
 }
 public ActionResult Edit([Bind(Include = "Id,Name")] Vaccines vaccines)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vaccines).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vaccines));
 }
Пример #19
0
        public async Task <ActionResult> Edit([Bind(Include = "PatientId,FirstName,LastName,IdNumber")] Patient patient)
        {
            if (ModelState.IsValid)
            {
                db.Entry(patient).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(patient));
        }
 public ActionResult Edit([Bind(Include = "idHabitacion,idTipo,numero")] Habitaciones habitaciones)
 {
     if (ModelState.IsValid)
     {
         db.Entry(habitaciones).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idTipo = new SelectList(db.Tipos, "idTipo", "descripcion", habitaciones.idTipo);
     return(View(habitaciones));
 }
Пример #21
0
 public ActionResult Edit([Bind(Include = "LoginSKey,StaffSKey,Password")] UserLogin userLogin)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userLogin).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StaffSKey = new SelectList(db.Staffs, "StaffSKey", "StaffName", userLogin.StaffSKey);
     return(View(userLogin));
 }
        public async Task <ActionResult> Edit([Bind(Include = "InvoiceId,InvoiceDateTime,PatientId,InvoiceTotal")] Invoice invoice)
        {
            if (ModelState.IsValid)
            {
                db.Entry(invoice).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.PatientId = new SelectList(db.Patients, "PatientId", "FirstName", invoice.PatientId);
            return(View(invoice));
        }
Пример #23
0
 public ActionResult Edit([Bind(Include = "idIngreso,idPaciente,idHabitacion,fecha")] Ingresos ingresos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ingresos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idPaciente   = new SelectList(db.Pacientes, "idPaciente", "cedula", ingresos.idPaciente);
     ViewBag.idHabitacion = new SelectList(db.Habitaciones, "idHabitacion", "idHabitacion", ingresos.idHabitacion);
     return(View(ingresos));
 }
Пример #24
0
 public ActionResult Edit([Bind(Include = "idCita,idMedico,idPaciente,fecha,hora")] Citas citas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(citas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idMedico   = new SelectList(db.Medicos, "idMedico", "nombre", citas.idMedico);
     ViewBag.idPaciente = new SelectList(db.Pacientes, "idPaciente", "cedula", citas.idPaciente);
     return(View(citas));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Surname,Phone,Address,WorkHours,Salary,DoctorId,DepartmentId")] Nurses nurses)
 {
     if (ModelState.IsValid)
     {
         db.Entry(nurses).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "NameAz", nurses.DepartmentId);
     ViewBag.DoctorId     = new SelectList(db.Doctors, "Id", "Name", nurses.DoctorId);
     return(View(nurses));
 }
Пример #26
0
        public async Task <ActionResult> Edit([Bind(Include = "InvoiceLineId,InvoiceId,Qty,Code,Description,LineTotal")] InvoiceLine invoiceLine)
        {
            if (ModelState.IsValid)
            {
                db.Entry(invoiceLine).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.InvoiceId = new SelectList(db.Invoices, "InvoiceId", "InvoiceId", invoiceLine.InvoiceId);
            return(View(invoiceLine));
        }
Пример #27
0
 public ActionResult Edit([Bind(Include = "idAlta,idIngreso,idPaciente,idHabitacion,fechaIngreso,fechaSalida,monto")] AltaMedica altaMedica)
 {
     if (ModelState.IsValid)
     {
         db.Entry(altaMedica).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idHabitacion = new SelectList(db.Habitaciones, "idHabitacion", "idHabitacion", altaMedica.idHabitacion);
     ViewBag.idIngreso    = new SelectList(db.Ingresos, "idIngreso", "idIngreso", altaMedica.idIngreso);
     ViewBag.idPaciente   = new SelectList(db.Pacientes, "idPaciente", "cedula", altaMedica.idPaciente);
     return(View(altaMedica));
 }
        public ActionResult Edit([Bind(Include = "Id,NameAz,NameEng,Icon,Photo,DesAz,DesEng")] Departments departments, HttpPostedFileBase Photo)
        {
            string image     = "";
            string photoName = DateTime.Now.ToString("yyyyMMddhhmmssfff") + Photo.FileName;

            if (ModelState.IsValid)
            {
                image = Path.Combine(Server.MapPath("~/Uploads/Departments"), photoName);
                Photo.SaveAs(image);
                departments.Photo           = photoName;
                db.Entry(departments).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(departments));
        }
Пример #29
0
        void ChangeStatusRow()
        {
            try
            {
                HospitalEntities db = new HospitalEntities();
                tblUser = db.tblUsers.Find(tblUser.UserID);

                if (tblUser == null)
                {
                    FarsiMessagbox.Show(ClsMessage.ErrNotFound, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
                    return;
                }

                if (tblUser.Active == 1)
                {
                    tblUser.Active = 0;
                }
                else
                {
                    tblUser.Active = 1;
                }


                db.tblUsers.Attach(tblUser);

                db.Entry(tblUser).Property(x => x.Active).IsModified = true; // $('#txtGoodsCode').val(),

                db.SaveChanges();

                New();
            }
            catch (DbEntityValidationException ex)
            {
                var errorMessages    = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage);
                var fullErrorMessage = string.Join("\n", errorMessages);
                var exceptionMessage = string.Concat(ClsMessage.Error, ex.Message, " The validation errors are: ", fullErrorMessage);
                FarsiMessagbox.Show(exceptionMessage, "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
            catch (DbUpdateException ex)
            {
                FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                FarsiMessagbox.Show(ClsMessage.Error + "\n" + ex.Message.ToString(), "خطا", FMessageBoxButtons.Ok, FMessageBoxIcon.Error);
            }
        }
        public ActionResult Edit([Bind(Include = "Id,Name,Surname,Phone,Address,WorkHours,Salary,DepartmentId,DesAz,DesEng,Photo")] Doctors doctors, HttpPostedFileBase Photo)
        {
            string image     = "";
            string photoName = DateTime.Now.ToString("yyyyMMddhhmmssfff") + Photo.FileName;

            if (ModelState.IsValid)
            {
                image = Path.Combine(Server.MapPath("~/Uploads/Doctors"), photoName);
                Photo.SaveAs(image);
                doctors.Photo           = photoName;
                db.Entry(doctors).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "NameAz", doctors.DepartmentId);
            return(View(doctors));
        }