コード例 #1
0
        public static Entity.AgentMaster GetAgentMasterById(int agentId)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.CommandType = CommandType.StoredProcedure;

                oDm.Add("@pAgentId", SqlDbType.Int, ParameterDirection.Input, agentId);

                SqlDataReader dr = oDm.ExecuteReader("AgentMaster_GetById");

                Entity.AgentMaster agentMaster = new Entity.AgentMaster();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        agentMaster.AgentId   = agentId;
                        agentMaster.Name      = (dr[1] == DBNull.Value) ? "" : dr[1].ToString();
                        agentMaster.Email     = (dr[2] == DBNull.Value) ? "" : dr[2].ToString();
                        agentMaster.ContactNo = (dr[3] == DBNull.Value) ? "" : dr[3].ToString();
                        agentMaster.Password  = (dr[4] == DBNull.Value) ? "" : dr[4].ToString();
                    }
                }
                return(agentMaster);
            }
        }
コード例 #2
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();
 }
コード例 #3
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();
     }
 }
コード例 #4
0
        public static void Save(Entity.AgentMaster agentmaster)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@pAgentId", SqlDbType.Int, ParameterDirection.InputOutput, agentmaster.AgentId);
                oDm.Add("@pName", SqlDbType.VarChar, 50, agentmaster.Name);
                oDm.Add("@pEmail", SqlDbType.VarChar, 100, agentmaster.Email);
                oDm.Add("@pContactNo", SqlDbType.VarChar, 50, agentmaster.ContactNo);
                oDm.Add("@pPassword", SqlDbType.VarChar, 50, agentmaster.Password);


                oDm.CommandType = CommandType.StoredProcedure;

                oDm.ExecuteNonQuery("AgentMaster_Save");

                agentmaster.AgentId = (int)oDm["@pAgentId"].Value;
            }
        }
コード例 #5
0
        public static Entity.AgentMaster AuthenticateUser(string Email)
        {
            using (DataManager oDm = new DataManager())
            {
                oDm.Add("@Email", SqlDbType.VarChar, 50, Email);
                oDm.CommandType = CommandType.StoredProcedure;
                SqlDataReader      dr    = oDm.ExecuteReader("GetUserNameAndPass_Customer");
                Entity.AgentMaster agent = new Entity.AgentMaster();

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        agent.AgentId  = (dr[0] == DBNull.Value) ? 0 : Convert.ToInt32(dr[0].ToString());
                        agent.Email    = (dr[1] == DBNull.Value) ? "" : dr[1].ToString();
                        agent.Password = (dr[2] == DBNull.Value) ? "" : dr[2].ToString();
                        agent.Name     = (dr[3] == DBNull.Value) ? "" : dr[3].ToString();
                    }
                    return(agent);
                }
                return(null);
            }
        }
コード例 #6
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 !";
            }
        }
コード例 #7
0
 public void Save(Entity.AgentMaster agentmaster)
 {
     DataAccess.AgentMaster.Save(agentmaster);
 }