protected void Page_Load(object sender, EventArgs e)
        {
            Lrbd.Business.Customer objcu = new Lrbd.Business.Customer();

            GridView1.DataSource = objcu.getallCustomer();
            GridView1.DataBind();
        }
        protected void CreateUser_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["lrbdConnectionString"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand("SELECT * FROM CustomerMaster WHERE username='******'", connection);
            SqlDataReader reader = command.ExecuteReader();
            
            //while (reader.Read())
            //{
                if (reader.Read())
                {
                    ErrorMessage.Text = reader["username"].ToString() + " User already exist";
                }
                else
                {                   
                    Lrbd.BusinessEntity.CustomerBase objcu = new Lrbd.BusinessEntity.CustomerBase();                    
                    objcu.username = UserName.Text;
                    objcu.password = Password.Text;
                    objcu.name = Name.Text;
                    objcu.email = Email.Text;
                    objcu.phone = Phone.Text;
                    Lrbd.Business.Customer objcustomer = new Lrbd.Business.Customer();
                    objcustomer.CreateCustomer(objcu);

                    Response.Redirect("Login.aspx");
                }
                
            //}
                connection.Close();

            
            //ErrorMessage.Text = result.Errors.FirstOrDefault();
            
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     Lrbd.Business.Customer objcu = new Lrbd.Business.Customer();
     Lrbd.BusinessEntity.CustomerBase objcust = new Lrbd.BusinessEntity.CustomerBase();
     objcust.username = Username.Text;
     objcust.password = Password.Text;
     objcust.name = Name.Text;
     objcust.email = Email.Text;
     objcust.phone = Phone.Text;
     objcu.CreateCustomer(objcust);
     
     Response.Redirect("Customerlisting.aspx");
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Lrbd.BusinessEntity.CustomerBase objcu = new Lrbd.BusinessEntity.CustomerBase();
            objcu.customer_id = Int32.Parse(CustomerId.Value);
            objcu.username = Username.Text;
            objcu.password = Password.Text;
            objcu.name = Name.Text;
            objcu.email = Email.Text;
            objcu.phone = Phone.Text;

            Lrbd.Business.Customer objcustomer = new Lrbd.Business.Customer();
            objcustomer.EditCustomer(objcu);
            Response.Redirect("Dashboard.aspx");
        }
 protected void LogIn(object sender, EventArgs e)
 {
     if (IsValid)
     {
         Lrbd.Business.Customer objlogin = new Lrbd.Business.Customer();
         if (objlogin.login(UserName.Text,Password.Text) > 0)
         {                    
             Response.Redirect("Dashboard.aspx");
         }
         else
         {
             LabelMsg.Text = "Sorry wrong username or password";
         }
         
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Lrbd.Business.Customer customr = new Lrbd.Business.Customer();
            DataTable returnItems = customr.LoginCustomerInfo();
            
            foreach (DataRow row in returnItems.Rows)
            {                
                customername = row["name"].ToString();
                email = row["email"].ToString();
                phone = row["phone"].ToString();
            }

            Lrbd.Business.AddCart art = new Lrbd.Business.AddCart();
            GridView1.DataSource = art.AllcartItem();
            GridView1.DataBind();
            
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string Id = HttpUtility.ParseQueryString(this.ClientQueryString).Get("id");
         Lrbd.Business.Customer objcustomer = new Lrbd.Business.Customer();
         DataTable returnItems = objcustomer.CustomerbyID(Id);
         
         foreach (DataRow row in returnItems.Rows)
         {
             CustomerId.Value = row["customer_id"].ToString();
             Username.Text = row["username"].ToString();
             Password.Text = row["password"].ToString();
             Name.Text = row["name"].ToString();
             Email.Text = row["email"].ToString();
             Phone.Text = row["phone"].ToString();
         }
     }
 }