public Boolean Insert(DoctorENT entDoctor)
        {
            DoctorDAL DALDoctor = new DoctorDAL();

            if (DALDoctor.Insert(entDoctor))
            {
                return(true);
            }
            else
            {
                Message = DALDoctor.Message;
                return(false);
            }
        }
Esempio n. 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        #region server side validation
        String strErrorMessage = "";

        if (txtDoctorName.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Doctor Name <br/>";
        }
        if (ddlDepartment.SelectedIndex <= 0)
        {
            strErrorMessage += "- Select Department <br/>";
        }
        if (txtExperince.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Experence (In year) <br/>";
        }
        if (Request.QueryString["DoctorID"] == null)
        {
            if (txtUserName.Text.Trim() == "")
            {
                strErrorMessage += "- Enter UserName <br/>";
            }
            if (txtPassword.Text.Trim() == "")
            {
                strErrorMessage += "- Enter Password <br/>";
            }
            if (txtReTypePassword.Text.Trim() == "")
            {
                strErrorMessage += "- Re-type Password <br/>";
            }

            if (txtPassword.Text.Trim() != txtReTypePassword.Text.Trim())
            {
                strErrorMessage += "- Password & Re-type Password must be Same.<br/>";
            }
        }
        if (strErrorMessage.Trim() != "")
        {
            lblErrorMessage.Text = strErrorMessage;
            return;
        }
        else
        {
            lblErrorMessage.Text = "";
        }
        #endregion server side validation

        #region Collect Form Data
        DoctorENT entDoctor       = new DoctorENT();
        String    strLogicalPath  = "~/UploadedData/Images/Doctors/";
        String    strPhysicalPath = "";

        if (txtDoctorName.Text.Trim() != "")
        {
            entDoctor.DoctorName = txtDoctorName.Text.Trim();
        }
        if (txtExperince.Text.Trim() != "")
        {
            entDoctor.Experince = Convert.ToInt32(txtExperince.Text.ToString().Trim());
        }

        if (ddlDepartment.SelectedIndex > 0)
        {
            entDoctor.DepartmentID = Convert.ToInt32(ddlDepartment.SelectedValue.ToString().Trim());
        }

        if (fuDoctorImage.HasFile)
        {
            strPhysicalPath = Server.MapPath(strLogicalPath) + fuDoctorImage.FileName;

            if (File.Exists(strPhysicalPath))
            {
                File.Delete(strPhysicalPath);
            }

            fuDoctorImage.SaveAs(strPhysicalPath);

            entDoctor.DoctorImage = strLogicalPath + fuDoctorImage.FileName;
        }
        else
        {
            entDoctor.DoctorImage = "~/UploadedData/Images/Doctors/avatar5.png";
        }

        if (txtUserName.Text.Trim() != "")
        {
            entDoctor.UserName = txtUserName.Text.Trim();
        }
        if (txtPassword.Text.Trim() != "")
        {
            entDoctor.Password = txtPassword.Text.Trim();
        }

        HospitalWiseDoctorENT entHospitalWiseDoctor = new HospitalWiseDoctorENT();

        entHospitalWiseDoctor.HospitalID = Convert.ToInt32(Request.QueryString["HospitalID"].ToString().Trim());

        #endregion Collect Form Data

        DoctorBAL             balDoctor             = new DoctorBAL();
        HospitalWiseDoctorBAL balHospitalWiseDoctor = new HospitalWiseDoctorBAL();

        if (Request.QueryString["DoctorID"] == null)
        {
            if (balDoctor.Insert(entDoctor))
            {
                entHospitalWiseDoctor.DoctorID = entDoctor.DoctorID;
                if (balHospitalWiseDoctor.Insert(entHospitalWiseDoctor))
                {
                    ClientScript.RegisterStartupScript(GetType(), "SweetAlert", "swal({ type: 'success', title: 'Doctor Inserted Successfully', showConfirmButton: false, timer: 2000});", true);
                    ClearControls();
                }
                else
                {
                    lblErrorMessage.Text = balHospitalWiseDoctor.Message;
                }
            }
            else
            {
                lblErrorMessage.Text = balDoctor.Message;
            }
        }
    }
Esempio n. 3
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        #region Server Side Validation
        String strErrorMessage = "";

        if (txtUserName.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Username <br/>";
        }

        if (txtPassword.Text.Trim() == "")
        {
            strErrorMessage += "- Enter Password <br/>";
        }

        if (strErrorMessage != "")
        {
            lblErrorMessage.Text = strErrorMessage;
            return;
        }
        else
        {
            lblErrorMessage.Text = "";
        }
        #endregion Server Side Validation

        #region Read Data
        SqlString UserName = SqlString.Null;
        SqlString Password = SqlString.Null;

        if (txtUserName.Text != "")
        {
            UserName = txtUserName.Text.ToString().Trim();
        }

        if (txtPassword.Text != "")
        {
            Password = txtPassword.Text.ToString().Trim();
        }
        #endregion Read Data

        if (Request.QueryString["user"] == "admin" || Convert.ToBoolean(Application["CheckAdmin"]) == true)
        {
            AdminBAL balAdmin = new AdminBAL();
            AdminENT entAdmin = new AdminENT();

            entAdmin = balAdmin.SelectByUserNamePassword(UserName, Password);

            if (!entAdmin.AdminID.IsNull)
            {
                if (!entAdmin.AdminID.IsNull)
                {
                    Session["UserID"] = Convert.ToString(entAdmin.AdminID.Value);
                }

                if (!entAdmin.UserName.IsNull)
                {
                    Session["UserName"] = Convert.ToString(entAdmin.UserName.Value);
                }

                if (!entAdmin.AdminImage.IsNull)
                {
                    Session["UserImage"] = Convert.ToString(entAdmin.AdminImage.Value);
                }

                string ReturnUrl = Convert.ToString(Request.QueryString["url"]);

                if (!string.IsNullOrEmpty(ReturnUrl))
                {
                    Response.Redirect(ReturnUrl);
                }
                else
                {
                    Response.Redirect("~/AdminPanel/Dashboard.aspx");
                }
            }
            else
            {
                lblErrorMessage.Text = "Eithe Username or password is Invalid, Try again...!";
            }
        }
        else if (Request.QueryString["user"] == "doctor" || Convert.ToBoolean(Application["CheckDoctor"]) == true)
        {
            DoctorBAL balDoctor = new DoctorBAL();
            DoctorENT entDoctor = new DoctorENT();

            entDoctor = balDoctor.SelectByUserNamePassword(UserName, Password);

            if (!entDoctor.DoctorID.IsNull)
            {
                if (!entDoctor.DoctorID.IsNull)
                {
                    Session["UserID"] = Convert.ToString(entDoctor.DoctorID.Value);
                }

                if (!entDoctor.DoctorName.IsNull)
                {
                    Session["UserName"] = Convert.ToString(entDoctor.DoctorName.Value);
                }

                if (!entDoctor.DoctorImage.IsNull)
                {
                    Session["UserImage"] = Convert.ToString(entDoctor.DoctorImage.Value);
                }

                if (!entDoctor.DepartmentID.IsNull)
                {
                    DepartmentENT entDepartment = new DepartmentENT();
                    DepartmentBAL balDepartment = new DepartmentBAL();

                    entDepartment             = balDepartment.SelectByPK(Convert.ToInt32(entDoctor.DepartmentID.Value));
                    Session["DepartmentName"] = entDepartment.DepartmentName.Value;
                }

                string ReturnUrl = Convert.ToString(Request.QueryString["url"]);

                if (!string.IsNullOrEmpty(ReturnUrl))
                {
                    Response.Redirect(ReturnUrl);
                }
                else
                {
                    Response.Redirect("~/AdminPanel/Dashboard.aspx");
                }
            }
            else
            {
                lblErrorMessage.Text = "Eithe Username or password is Invalid, Try again...!";
            }
        }
        else
        {
            Response.Redirect("~/AdminPanel/Authentication/CheckUser.aspx");
        }
    }