Beispiel #1
0
        protected void dgvAgent_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int AgentId = Convert.ToInt32(dgvAgent.DataKeys[e.RowIndex].Value);

            BusinessLayer.AgentMaster objAgent = new BusinessLayer.AgentMaster();
            objAgent.Delete(AgentId);
            LoadAgent();
        }
Beispiel #2
0
        protected void LoadAgent()
        {
            BusinessLayer.AgentMaster objAgent = new BusinessLayer.AgentMaster();
            DataTable dt = objAgent.GetAll();

            if (dt != null)
            {
                dgvAgent.DataSource = dt;
                dgvAgent.DataBind();
            }
        }
Beispiel #3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BusinessLayer.AgentMaster objAgentMaster = new BusinessLayer.AgentMaster();
     Entity.AgentMaster        agentMaster    = new Entity.AgentMaster();
     agentMaster.AgentId   = AgentId;
     agentMaster.Name      = txtName.Text.Trim();
     agentMaster.Email     = txtEmail.Text.Trim();
     agentMaster.ContactNo = txtContactNo.Text.Trim();
     agentMaster.Password  = txtPassword.Text.Trim();
     objAgentMaster.Save(agentMaster);
     LoadAgent();
 }
Beispiel #4
0
 protected void PopulateAgentMaster()
 {
     BusinessLayer.AgentMaster objAgentMaster = new BusinessLayer.AgentMaster();
     Entity.AgentMaster        agentMaster    = new Entity.AgentMaster();
     agentMaster = objAgentMaster.GetAgentMasterById(AgentId);
     if (agentMaster != null)
     {
         AgentId           = agentMaster.AgentId;
         txtName.Text      = agentMaster.Name.ToString();
         txtEmail.Text     = agentMaster.Email.ToString();
         txtContactNo.Text = agentMaster.ContactNo.ToString();
         txtPassword.Text  = agentMaster.Password.ToString();
     }
 }
Beispiel #5
0
        protected void LoginStatus1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string u = LoginStatus1.UserName;
            string p = LoginStatus1.Password;



            if (u.ToUpper() == "FOURFUSION" && p.ToUpper() == "FOURFUSION123456789")
            {
                FormsAuthenticationTicket Authticket = new FormsAuthenticationTicket(
                    1,
                    "Admin",
                    DateTime.Now,
                    DateTime.Now.AddMinutes(30),
                    false,
                    "admin",
                    FormsAuthentication.FormsCookiePath);
                string     hash       = FormsAuthentication.Encrypt(Authticket);
                HttpCookie Authcookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);
                if (Authticket.IsPersistent)
                {
                    Authcookie.Expires = Authticket.Expiration;
                }
                Response.Cookies.Add(Authcookie);
                Session["UserId"] = "Admin";
                Response.Redirect("AddEditBlock.aspx");
            }
            else if (u.ToUpper() == "BIBHAS" && p.ToUpper() == "NOACCESS@123")
            {
                FormsAuthenticationTicket Authticket = new FormsAuthenticationTicket(
                    1,
                    "Bibhas",
                    DateTime.Now,
                    DateTime.Now.AddMinutes(30),
                    false,
                    "Customer",
                    FormsAuthentication.FormsCookiePath);
                string     hash       = FormsAuthentication.Encrypt(Authticket);
                HttpCookie Authcookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);
                if (Authticket.IsPersistent)
                {
                    Authcookie.Expires = Authticket.Expiration;
                }
                Response.Cookies.Add(Authcookie);
                Session["UserId"] = "Bibhas";
                Response.Redirect("AddEditPotatoRate.aspx");
            }
            else
            {
                BusinessLayer.AgentMaster objAgentMaster = new BusinessLayer.AgentMaster();
                Entity.AgentMaster        agentMaster    = new Entity.AgentMaster();
                agentMaster = objAgentMaster.AuthenticateUser(u);

                if (agentMaster != null)
                {
                    if ((agentMaster.Password) == p)
                    {
                        string UserId = agentMaster.AgentId.ToString();
                        FormsAuthenticationTicket Authticket = new FormsAuthenticationTicket(
                            1,
                            UserId,
                            DateTime.Now,
                            DateTime.Now.AddMinutes(240),
                            false,
                            "Agent",
                            FormsAuthentication.FormsCookiePath);
                        string     hash       = FormsAuthentication.Encrypt(Authticket);
                        HttpCookie Authcookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);
                        if (Authticket.IsPersistent)
                        {
                            Authcookie.Expires = Authticket.Expiration;
                        }
                        Response.Cookies.Add(Authcookie);

                        System.Web.Caching.Cache cacheObject = System.Web.HttpContext.Current.Cache;
                        //cacheObject.Insert(UserId, Employee.Roles);

                        Session["UserId"] = agentMaster.Name;
                        Session.Timeout   = 240;
                        Response.Redirect("AddSubscription.aspx");
                    }
                }
                //txtPassword.Text = "";
                //txtPassword.Focus();
                //FailureText.Text = "Invalid Username or Password !";
            }
        }