Exemplo n.º 1
0
        protected void Page_Init(object sender, EventArgs e)
        {
            DoctorClass ac = new DoctorClass();

            if (Session["EditDrId"] == null)
            {
                Server.Transfer("AdminViewDoctor.aspx");
            }

            d           = ac.getDoctor(Int32.Parse(Session["EditDrId"].ToString()));
            ErrorL.Text = Session["EditDrId"].ToString();
            //Set PresentValues
            //Copy paste from DoctorEditProfile
            if (!this.IsPostBack)
            {
                dob.Text           = d.dob.ToString("dd-MM-yyyy");
                Salary.Text        = d.salary.ToString();
                first_name_tb.Text = d.name;
                Email_tb.Text      = d.email;
                phoneno_tb.Text    = d.phoneno;
                Address_tb.Text    = d.address;
                Field.Text         = d.field;
                Qualification.Text = d.qualification;
            }
        }
        protected void login_btn_Click(object sender, EventArgs e)
        {
            if (email_tb.Text == "admin" && password_tb.Text == "admin")
            {
                Session["admin"] = 1;
                Response.Redirect("AdminHome.aspx");
            }
            DoctorClass            cm = new DoctorClass();
            DataClassesDataContext dc = new DataClassesDataContext();
            doctor p = new doctor();

            p.email    = email_tb.Text;
            p.password = password_tb.Text;
            bool b = cm.login(p);

            if (b)
            {
                var q = from doctor in dc.GetTable <doctor>() where doctor.email == email_tb.Text && doctor.password == password_tb.Text select doctor;
                foreach (var a in q)
                {
                    Session["doctorname"] = a.name;
                    Session["doctorId"]   = a.doctorid;
                }

                //  Session["username"] = email_tb.Text;
                Response.Redirect("DoctorHome.aspx");
            }
            else
            {
                error.Text = "email or password is incorrect";
                //Response.Redirect("login.aspx");
            }
        }
        public ActionResult InsertToAddDoctor(DoctorClass obj)
        {
            if (con.State == System.Data.ConnectionState.Closed)
            {
                con.Open();
            }

            SqlCommand cmd = new SqlCommand("pInsertDoctorMaster", con);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@EmployeeCode", obj.EmployeeCode);
            cmd.Parameters.AddWithValue("@DoctorName", obj.DoctorName);
            cmd.Parameters.AddWithValue("@HospitalId", obj.HospitalId);
            cmd.Parameters.AddWithValue("@DoctorSpecialization", obj.DoctorSpecialization);
            cmd.Parameters.AddWithValue("@DoctorDegree", obj.DoctorDegree);
            cmd.Parameters.AddWithValue("@DoctorPhone", obj.DoctorPhone);
            cmd.Parameters.AddWithValue("@DoctorEmail", obj.DoctorEmail);
            cmd.Parameters.AddWithValue("@DoctorCity", obj.DoctorCity);
            cmd.Parameters.AddWithValue("@DoctorState", obj.DoctorState);
            cmd.Parameters.AddWithValue("@DoctorCountry", obj.DoctorCountry);
            cmd.Parameters.AddWithValue("@IsActive", obj.IsActive);
            cmd.Parameters.AddWithValue("@EntryDate", DateTime.Now);
            cmd.Parameters.AddWithValue("@EntryBy", obj.EntryBy);
            cmd.Parameters.AddWithValue("@RoleId", obj.RoleId);
            cmd.Parameters.AddWithValue("@DoctorAddress", obj.DoctorAddress);

            cmd.ExecuteNonQuery();
            return(RedirectToAction("index", "Home"));
        }
Exemplo n.º 4
0
        public void CreateDoctor(DoctorClass doctor)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            _doctorsRepository.CreateDoctor(doctor);
        }
Exemplo n.º 5
0
        public void Put(int id, [FromBody] DoctorClass doctor)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }


            _doctorsRepository.Update(id, doctor);
        }
Exemplo n.º 6
0
 public ActionResult Edit(int id, DoctorClass smodel)
 {
     try
     {
         DoctorMasterDbHandle sdb = new DoctorMasterDbHandle();
         sdb.UpdateDetails(smodel);
         return(RedirectToAction("DoctorList"));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(View());
     }
 }
        protected void register_btn_Click(object sender, EventArgs e)
        {
            DoctorClass doc = new DoctorClass();

            doctor d = getUpdatedDoctorObject();
            //Register
            bool registerSucceeded = doc.editDoctor(d, false);

            if (registerSucceeded)
            {
                ErrorL.InnerText = "Succeed";
            }
            else
            {
                ErrorL.InnerText = "Error";
            }
        }
Exemplo n.º 8
0
        protected void register_btn_Click(object sender, EventArgs e)
        {
            DoctorClass doc = new DoctorClass();

            d = getUpdatedDoctorObject();
            //Register
            bool registerSucceeded = doc.editDoctor(d, true);



            if (registerSucceeded)
            {
                Response.Redirect("AdminViewDoctor.aspx");
            }
            else
            {
                ErrorL.Text = "Error";
            }
        }
Exemplo n.º 9
0
 public ActionResult Create(DoctorClass smodel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             DoctorMasterDbHandle sdb = new DoctorMasterDbHandle();
             if (sdb.AddDoctor(smodel))
             {
                 ViewBag.Message = "Doctor Details Added Successfully";
                 ModelState.Clear();
             }
         }
         return(View());
     }
     catch (Exception ex)
     {
         ex.StackTrace.ToString();
         return(View());
     }
 }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["doctorname"] == null)
            {
                Response.Redirect("DoctorLogin.aspx");
            }


            DoctorClass     doc = new DoctorClass();
            List <ActCases> ac  = doc.viewActiveCases(Int32.Parse(Session["doctorId"].ToString()));

            if (ac != null)
            {
                gvTab.DataSource = ac;
                gvTab.DataBind();
            }
            else
            {
                grid_not_visible.Text = "No Data Found.!";
            }
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["doctorname"] == null)
            {
                Response.Redirect("DoctorLogin.aspx");
            }

            DoctorClass doc   = new DoctorClass();
            var         query = doc.getDoctorAsQueryable(Int32.Parse(Session["doctorId"].ToString()));

            foreach (var d in query)
            {
                doctor_name_lb.Text          = d.name;
                dob_lb.Text                  = d.dob.ToString("dd-MM-yyyy");
                doctor_age_lb.Text           = d.age.ToString();
                doctor_qualification_lb.Text = d.qualification;
                doctor_field_lb.Text         = d.field;
                Experience_lb.Text           = d.experience.ToString() + " Years";
                phoneno_lb.Text              = d.phoneno;
                address_lb.Text              = d.address;
                email_lb.Text                = d.email;
            }
        }
Exemplo n.º 12
0
        //Change Doctors details
        public void Update(int id, DoctorClass doctor)
        {
            var sql = "UPDATE Doctors set Email = @Email, [Password] = @Password  where DoctorId = @DoctorId";

            this.db.Query <string>(sql, new { Email = doctor.Email, Password = doctor.Password, DoctorId = id });
        }
Exemplo n.º 13
0
        //Add new Doctor
        public void CreateDoctor(DoctorClass doctor)
        {
            var sql = "INSERT INTO Doctors([Email], [Password]) VALUES(@Email, @Password)";

            this.db.Query <string>(sql, doctor);
        }