protected void gdvData_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            GridViewRow row       = gdvData.Rows[int.Parse(e.CommandArgument.ToString())];
            int         _Id       = int.Parse((row.FindControl("lblId") as Label).Text);
            string      tableName = (row.FindControl("lblTableName") as Label).Text;
            string      type      = e.CommandName;
            bool        Result    = new AdminDetailsSql().approveUsers(_Id, tableName, type);

            if (Result)
            {
                if (type == "approve")
                {
                    lblMsg.Text = " Request Approved Successfully!";
                }
                else
                {
                    lblMsg.Text = "Request Rejected Successfully";
                }
            }
            else
            {
                lblMsg.Text = "OOPS! Unable to Submit";
            }
            GetData();
        }
        public void GetData()
        {
            DataTable dt = new AdminDetailsSql().GetPendingAdminData();

            if (dt.Rows.Count > 0)
            {
                gdvDataAdmin.DataSource = dt;
            }
            gdvDataAdmin.DataBind();
        }
Exemplo n.º 3
0
        protected void txtBtnLogin_Click(object sender, EventArgs e)
        {
            Session["ddlRoleList"] = ddlRoleList.SelectedValue.ToString();
            Session["txtUserName"] = txtUserName.Text;
            Session["txtpassword"] = txtpassword.Text;
            lblindex.Text          = "";
            if (ddlRoleList.SelectedValue.ToString() == "s_admin")
            {
                if ((txtUserName.Text == "vinay") && (txtpassword.Text == "123456789"))
                {
                    Response.Redirect("~/ApproveAdmin.aspx");
                }
                else
                {
                    lblMsg.Text = "Invalid Username/password ";
                }

                //var UserList = adminDetails.Where(x => x.UserName1 == txtUserName.Text && x.Password1 == txtpassword.Text).ToList();
                //if (UserList.Count > 0)
                //{
                //    if (UserList[0].Isapproved1 != true)
                //    {
                //        lblMsg.Text = "Your Account is Pending for Admin Approval";
                //    }
                //    else
                //    {
                //        lblMsg.Text = "Login successfull";
                //        Response.Redirect("~/ApproveAdmin.aspx");
                //    }
                //}
                //else
                //{
                //    lblMsg.Text = "Incorrect UserId/Password";
                //}
            }
            else if (ddlRoleList.SelectedValue.ToString() == "Admin")
            {
                AdminDetailsSql     adminDetailsSql = new AdminDetailsSql();
                List <AdminDetails> adminDetails    = adminDetailsSql.DisplayAdminDetails();
                var UserList = adminDetails.Where(x => x.UserName1 == txtUserName.Text && x.Password1 == txtpassword.Text).ToList();
                if (UserList.Count > 0)
                {
                    if (UserList[0].Isapproved1 != true)
                    {
                        lblMsg.Text = "Your Account is Pending for Admin Approval";
                    }
                    else
                    {
                        lblMsg.Text = "Login successfull";
                        Response.Redirect("~/Admin.aspx");
                    }
                }
                else
                {
                    lblMsg.Text = "Incorrect UserId/Password";
                    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "successalert();", true);
                }
            }
            else if (ddlRoleList.SelectedValue == "Doctor")
            {
                DoctorDetailsSql     doctorDetailsSql = new DoctorDetailsSql();
                List <DoctorDetails> doctorDetails    = doctorDetailsSql.DisplayDoctorDetails();
                var UserList = doctorDetails.Where(x => x.UserName1 == txtUserName.Text && x.Password1 == txtpassword.Text).ToList();
                if (UserList.Count > 0)
                {
                    Session["DoctorId"] = UserList[0].DoctorID1;
                    if (UserList[0].Isapproved1 != true)
                    {
                        lblMsg.Text = "Your Account is Pending for Admin Approval";
                    }
                    else
                    {
                        lblMsg.Text = "Login successfull";
                        Response.Redirect("~/Doctor.aspx");
                    }
                }
                else
                {
                    lblMsg.Text = "Incorrect UserId/Password";
                    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "successalert();", true);
                }
            }
            else if (ddlRoleList.SelectedValue == "Patient")
            {
                PatientDetailsSql     patientDetailsSql = new PatientDetailsSql();
                List <PatientDetails> patientDetails    = patientDetailsSql.DisplayPatientDetails();
                var UserList = patientDetails.Where(x => x.UserName1 == txtUserName.Text && x.Password1 == txtpassword.Text).ToList();
                if (UserList.Count > 0)
                {
                    Session["Patientid"] = UserList[0].Patientid1;
                    if (UserList[0].Isapproved1 != true)
                    {
                        lblMsg.Text = "Your Account is Pending for Admin Approval";
                    }
                    else
                    {
                        lblMsg.Text = "Login successfull";
                        Response.Redirect("~/Patient.aspx");
                    }
                }
                else
                {
                    lblMsg.Text = "Incorrect UserId/Password";
                    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "successalert();", true);
                }
            }
            else if (ddlRoleList.SelectedValue == "Agent")
            {
                AgentDetailsSql     agentDetailsSql = new AgentDetailsSql();
                List <AgentDetails> agentDetails    = agentDetailsSql.DisplayAgentDetails();
                var UserList = agentDetails.Where(x => x.UserName1 == txtUserName.Text && x.Password1 == txtpassword.Text).ToList();
                if (UserList.Count > 0)
                {
                    if (UserList[0].Isapproved1 != true)
                    {
                        lblMsg.Text = "Your Account is Pending for Admin Approval";
                    }
                    else
                    {
                        lblMsg.Text = "Login successfull";
                        Response.Redirect("~/Agent.aspx");
                    }
                }
                else
                {
                    lblMsg.Text = "Incorrect UserId/Password";
                    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "successalert();", true);
                }
            }
            else
            {
                lblindex.Text = " Please Select the Role!!";
            }
        }