public JsonResult Fill(int PatientRegNo)
        {
            DataSet ds = new DataSet();
            List <DeathCertificate> Search = new List <DeathCertificate>();

            ds = bl_death.GetPatientRegNo(PatientRegNo);
            DeathCertificate deathcert = new DeathCertificate();

            deathcert.PatientDeathCertificateID = Convert.ToInt32(ds.Tables[0].Rows[0]["PatientDeathCertificateID"].ToString());
            deathcert.PatientName   = ds.Tables[0].Rows[0]["PatientName"].ToString();
            deathcert.PatientRegNo  = ds.Tables[0].Rows[0]["PatientRegNo"].ToString();
            deathcert.GuardianName  = ds.Tables[0].Rows[0]["GuardianName"].ToString();
            deathcert.DateOfDeath   = Convert.ToDateTime(ds.Tables[0].Rows[0]["DateOfDeath"]).ToString("yyyy-MM-dd");
            deathcert.TimeOfDeath   = Convert.ToDateTime(ds.Tables[0].Rows[0]["TimeOfDeath"]).ToString("hh:mm:ss tt");
            deathcert.DeathType     = ds.Tables[0].Rows[0]["DeathType"].ToString();
            deathcert.ReasonOfDeath = ds.Tables[0].Rows[0]["ReasonOfDeath"].ToString();
            deathcert.Address       = ds.Tables[0].Rows[0]["Address"].ToString();
            deathcert.ReferenceCode = ds.Tables[0].Rows[0]["ReferenceCode"].ToString();
            deathcert.Discription   = ds.Tables[0].Rows[0]["Discription"].ToString();
            deathcert.Mode          = "Edit";
            Search.Add(deathcert);

            return(new JsonResult {
                Data = Search, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            DeathCertificate deathCertificate = db.DeathCertificates.Find(id);

            db.DeathCertificates.Remove(deathCertificate);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
 public ActionResult Edit([Bind(Include = "DeathCertificatesID,RegistrationDate,ExpirationDate,DeathDate,PersonID")] DeathCertificate deathCertificate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(deathCertificate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PersonID = new SelectList(db.People, "PersonID", "PersonalNumber", deathCertificate.PersonID);
     return(View(deathCertificate));
 }
示例#4
0
        public bool Save(DeathCertificate death)
        {
            Connect();
            con.Open();
            SqlCommand cmd = new SqlCommand("IUPatientDeathCertificate", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
            cmd.Parameters.AddWithValue("@LocationID", LocationID);
            cmd.Parameters.AddWithValue("@PatientRegNo", death.PatientRegNo);
            if (death.PatientDeathCertificateID == 0)
            {
                cmd.Parameters.AddWithValue("@PatientDeathCertificateID", 0);

                cmd.Parameters["@PatientDeathCertificateID"].Direction = ParameterDirection.Output;

                cmd.Parameters.AddWithValue("Mode", "ADD");
            }
            else
            {
                cmd.Parameters.AddWithValue("@PatientDeathCertificateID", death.PatientDeathCertificateID);
                cmd.Parameters.AddWithValue("Mode", "Edit");
            }
            cmd.Parameters.AddWithValue("@ReferenceCode", ReffrenceCode());
            cmd.Parameters.AddWithValue("@DateOfDeath", death.DateOfDeath);
            //cmd.Parameters.AddWithValue("@DateOfDeath", DateTime.Parse(death.DateOfDeath));
            cmd.Parameters.AddWithValue("@DeathType", death.DeathType);
            cmd.Parameters.AddWithValue("@ReasonOfDeath", death.ReasonOfDeath);
            cmd.Parameters.AddWithValue("@TimeOfDeath", death.TimeOfDeath);

            if (death.Discription != null)
            {
                cmd.Parameters.AddWithValue("@Discription", death.Discription);
            }
            else
            {
                cmd.Parameters.AddWithValue("@Discription", "");
            }
            // cmd.Parameters.AddWithValue("@Address", death.Address);
            cmd.Parameters.AddWithValue("@CreationID", UserID);
            int i = cmd.ExecuteNonQuery();

            death.PatientDeathCertificateID = Convert.ToInt32(cmd.Parameters["@PatientDeathCertificateID"].Value);

            con.Close();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
        // GET: DeathCertificates/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DeathCertificate deathCertificate = db.DeathCertificates.Find(id);

            if (deathCertificate == null)
            {
                return(HttpNotFound());
            }
            return(View(deathCertificate));
        }
示例#6
0
        // GET: DeathCertificates/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DeathCertificate deathCertificate = db.DeathCertificates.Find(id);

            if (deathCertificate == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PersonID = new SelectList(db.People, "PersonID", "PersonalNumber", deathCertificate.PersonID);
            return(View(deathCertificate));
        }
        public ActionResult DeathCertificate(DeathCertificate cert)
        {
            try
            {
                string A = Request.Form["PatientRegNo"];
                TempData["Msg"] = "";
                if (Request.Form["PatientRegNo"] != null)
                {
                    if (cert.PatientDeathCertificateID > 0)
                    {
                        if (bl_death.Save(cert))
                        {
                            cert.PatientRegNo = "";
                            Session["PatientDeathCertificateID"] = cert.PatientDeathCertificateID;
                            return(RedirectToAction("RptDeathCertificate", "DeathCertificate"));
                            //TempData["Msg"] = "Update Successfully";
                            //ModelState.Clear();
                            //RedirectToAction("DeathCertificate", "DeathCertificate");
                        }


                        RedirectToAction("DeathCertificate", "DeathCertificate");
                    }

                    else
                    {
                        try
                        {
                            if (bl_death.Save(cert))
                            {
                                if (cert.PatientDeathCertificateID > 0)
                                {
                                    cert.PatientRegNo = "";
                                    Session["PatientDeathCertificateID"] = cert.PatientDeathCertificateID;
                                    return(RedirectToAction("RptDeathCertificate", "DeathCertificate"));
                                    //TempData["Msg"] = "Update Successfully";
                                    //ModelState.Clear();
                                    //RedirectToAction("DeathCertificate", "DeathCertificate");
                                }
                                //TempData["Msg"] = "Save Successfully";
                                Session["PatientDeathCertificateID"] = cert.PatientDeathCertificateID;
                                return(RedirectToAction("RptDeathCertificate", "DeathCertificate"));
                                //RedirectToAction("DeathCertificate", "DeathCertificate");
                            }
                        }

                        catch (Exception ex)
                        {
                            TempData["Msg"] = ex.Message;
                            RedirectToAction("DeathCertificate", "DeathCertificate");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TempData["Msg"] = ex.Message;
                return(RedirectToAction("DeathCertificate", "DeathCertificate"));
            }
            return(RedirectToAction("DeathCertificate", "DeathCertificate"));
        }