protected void grdGridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditData")
     {
         hdnOperationType.Value = "Update";
         int Id = Convert.ToInt32(e.CommandArgument);
         hdnIDPK.Value = Id.ToString();
         ReceptionBAO    BAO = new ReceptionBAO();
         ReceptionDetail obj = BAO.GetReceptionDetailsById(Id);
         if (obj != null)
         {
             txtFullName.Text        = obj.FullName;
             txtAGE.Text             = Convert.ToString(obj.Age);
             txtDOB.Text             = obj.DOB;
             txtAddress.Text         = obj.Address;
             rbtGender.SelectedValue = obj.Gender;
             txtMobileNumber.Text    = obj.MobileNumber;
             txtEmail.Text           = obj.Email;
             txtPassword.Text        = obj.Password;
         }
         pnlAddForm.Visible = true;
         pnlGrid.Visible    = false;
     }
     if (e.CommandName == "DeleteData")
     {
         int          id  = Convert.ToInt32(e.CommandArgument);
         ReceptionBAO BAO = new ReceptionBAO();
         BAO.DeleteReception(id);
         FillGridView();
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ReceptionDetail Rec = new ReceptionDetail();

            Rec.FullName      = txtFullName.Text;
            Rec.DOB           = txtDOB.Text;
            Rec.Age           = Convert.ToInt32(txtAGE.Text);
            Rec.Gender        = rbtGender.SelectedValue;
            Rec.Address       = txtAddress.Text;
            Rec.MobileNumber  = txtMobileNumber.Text;
            Rec.Email         = txtEmail.Text;
            Rec.IsActive      = 1;
            Rec.Password      = txtPassword.Text;
            Rec.CreatedBY     = "Samyu";
            Rec.ModifiedBy    = "System";
            Rec.FK_HospitalId = Convert.ToInt32(Session["HospitalId"]);

            if (hdnOperationType.Value == "Update")
            {
                Rec.PK_Reception = Convert.ToInt32(hdnIDPK.Value);
            }
            ReceptionBAO BAO = new ReceptionBAO();

            BAO.SaveReception(Rec);

            lblMessage.Text = "Save Successfully";
            ClearForm();

            FillGridView();

            pnlGrid.Visible    = true;
            pnlAddForm.Visible = false;
        }
        public void FillGridView()
        {
            ReceptionBAO BAO        = new ReceptionBAO();
            int          hospitalid = Convert.ToInt32(Session["HospitalId"]);

            grdGridView.DataSource = BAO.GetReceptionDetails(hospitalid);
            grdGridView.DataBind();
        }
Ejemplo n.º 4
0
 protected void btnogin_Click(object sender, EventArgs e)
 {
     if (ddlUserType.SelectedValue == "Doctor")
     {
         //txtUserName.Text
         //txtPassword.Text
         DoctorBAO    obj    = new DoctorBAO();
         DoctorDetail Doctor = obj.GetDoctorDetailByEmail(txtUserName.Text);
         if (Doctor != null)
         {
             if (Doctor.Password == txtPassword.Text)
             {
                 UserLogin user = new UserLogin();
                 user.UserName         = Doctor.Email;
                 user.FullName         = Doctor.DoctorName;
                 user.Id               = Doctor.PK_Doctor;
                 user.Password         = Doctor.Password;
                 user.TypeOfUser       = UserType.DoctorUser;
                 Session["UserObject"] = user;
                 Session["UserName"]   = user.UserName;
                 Session["HospitalId"] = Doctor.FK_HospitalId;
                 Response.Redirect("~/Doctor/DoctorHome.aspx");
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Invalid User name password')", true);
             }
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Invalid User name password')", true);
         }
     }
     else if (ddlUserType.SelectedValue == "Reception")
     {
         ReceptionBAO    obj       = new ReceptionBAO();
         ReceptionDetail reception = obj.GetReceptionByEmail(txtUserName.Text);
         if (reception != null)
         {
             if (reception.Password == txtPassword.Text)
             {
                 UserLogin user = new UserLogin();
                 user.UserName         = reception.Email;
                 user.FullName         = reception.FullName;
                 user.Id               = reception.PK_Reception;
                 user.Password         = reception.Password;
                 user.TypeOfUser       = UserType.ReceptionUser;
                 Session["UserObject"] = user;
                 Session["UserName"]   = user.UserName;
                 Session["HospitalId"] = reception.FK_HospitalId;
                 Response.Redirect("~/Reception/ReceptionHome.aspx");
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Invalid User name password')", true);
             }
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Invalid User name password')", true);
         }
     }
     else if (ddlUserType.SelectedValue == "HospitalAdmin")
     {
         //Need to implement Login check from DB for Hospital Admin
         ApplicationAdminBAO obj = new ApplicationAdminBAO();
         HospitalDetail      h   = obj.GetHospitalDetailsByAdminEmail(txtUserName.Text);
         if (h != null)
         {
             if (h.Password == txtPassword.Text)
             {
                 UserLogin user = new UserLogin();
                 user.UserName         = h.AdminEmail;
                 user.FullName         = h.HospitalAdminName;
                 user.Id               = h.PK_HospitalId;
                 user.Password         = h.Password;
                 user.TypeOfUser       = UserType.HospitalAdmin;
                 Session["HospitalId"] = h.PK_HospitalId;
                 Session["UserObject"] = user;
                 Session["UserName"]   = user.UserName;
                 Response.Redirect("~/HospitalAdminPages/HospitalHome.aspx");
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Invalid User name password')", true);
             }
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Invalid User name password')", true);
         }
     }
 }