示例#1
0
 public ActionResult DeleteConfirmed(int id)
 {
     DoctorEntry doctorEntry = db.DoctorEntrie.Find(id);
     db.DoctorEntrie.Remove(doctorEntry);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
示例#2
0
        public List <DoctorEntry> LoadDoctor(string center, string thana, string district)
        {
            int centerID   = aMedicineGateway.GetIDByCenterName(center);
            int thanaID    = aMedicineGateway.GetIDByThanaName(thana);
            int districtID = aMedicineGateway.GetIDByDistrictName(district);

            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "select * from tbl_DoctorEntry where CenterID = '" + centerID + "' and ThanaID = '" + thanaID + "' and DistrictID = '" + districtID + "'";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            List <DoctorEntry> doctorList = new List <DoctorEntry>();
            SqlDataReader      reader     = command.ExecuteReader();

            while (reader.Read())
            {
                DoctorEntry aDoctorEntry = new DoctorEntry();
                aDoctorEntry.ID   = int.Parse(reader["ID"].ToString());
                aDoctorEntry.Name = reader["Name"].ToString();
                doctorList.Add(aDoctorEntry);
            }
            reader.Close();
            connection.Close();
            return(doctorList);
        }
 public ActionResult Edit([Bind(Include = "DoctorId,Name,Degree,Specialization")] DoctorEntry doctorentry)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doctorentry).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(doctorentry));
 }
        public ActionResult Create([Bind(Include = "DoctorId,Name,Degree,Specialization")] DoctorEntry doctorentry)
        {
            if (ModelState.IsValid)
            {
                db.Doctors.Add(doctorentry);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(doctorentry));
        }
 public string SaveDoctor(DoctorEntry aDoctorEntry)
 {
     if (aDoctorEntryGateway.SaveDoctor(aDoctorEntry) > 0)
     {
         return("Doctor saved successfully.");
     }
     else
     {
         return("Doctor not saved.");
     }
 }
示例#6
0
        public int SaveDoctor(DoctorEntry aDoctorEntry)
        {
            SqlConnection connection = new SqlConnection(connectionstring);
            string        query      = "insert into tbl_DoctorEntry values ('" + aDoctorEntry.Name + "','" + aDoctorEntry.Degeree + "','" + aDoctorEntry.Specialization + "','" + aDoctorEntry.CenterID + "','" + aDoctorEntry.ThanaID + "','" + aDoctorEntry.DistrictID + "')";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            int rowAffected = command.ExecuteNonQuery();

            connection.Close();
            return(rowAffected);
        }
示例#7
0
 // GET: DoctorEntries/Edit/5
 public ActionResult Edit(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     DoctorEntry doctorEntry = db.DoctorEntrie.Find(id);
     if (doctorEntry == null)
     {
         return HttpNotFound();
     }
     return View(doctorEntry);
 }
        // GET: /DoctorEntry/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DoctorEntry doctorentry = db.Doctors.Find(id);

            if (doctorentry == null)
            {
                return(HttpNotFound());
            }
            return(View(doctorentry));
        }
示例#9
0
        public ActionResult Create([Bind(Include = "DoctorEntryId,Name,Degree,Specialization,CenterId")] DoctorEntry doctorEntry)
        {
           
                NewCenter aCenter = (NewCenter) base.Session["NewCenter"];

                var centerCode = aCenter.CenterCode;
           
            if (ModelState.IsValid)
            {
                doctorEntry.CenterId = centerCode;
                db.DoctorEntrie.Add(doctorEntry);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(doctorEntry);
        }