Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            CustomerRepo customerrepo = new CustomerRepo();

            lbMessage.Text = "";
            if (customerrepo.DoesUsernameExist(txtUserName.Text))
            {
                lbMessage.Text      = "Username already exists!";
                lbMessage.ForeColor = System.Drawing.Color.Red;
                txtUserName.Text    = "";
                return;
            }
            if (customerrepo.DoesEmailExist(txtEmail.Text))
            {
                lbMessage.Text      = "Email already exists!";
                lbMessage.ForeColor = System.Drawing.Color.Red;
                txtEmail.Text       = "";
                return;
            }
            Model.Customer customer = new Model.Customer();
            customer.FirstName   = txtFirstName.Text;
            customer.LastName    = txtLastName.Text;
            customer.Username    = txtUserName.Text;
            customer.Password    = Security.Encrypt(ConfigurationManager.AppSettings["KeyCustomer"], txtPassword.Text);
            customer.Key         = ConfigurationManager.AppSettings["KeyCustomer"];
            customer.Email       = txtEmail.Text;
            customer.Phone       = txtPhone.Text;
            customer.DateOfBirth = ToSQL.SQLToDateTimeNull(txtDateOfBirth.Text);
            customer.Gender      = rdbtnGender.SelectedIndex == 0 ? true : false;
            customer.DateCreated = DateTime.Now;
            int i = customerrepo.CreateCustomer(customer);

            Response.Redirect("Management-Customer.aspx");
        }
Exemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Customer customer = customerRepo.GetById(ToSQL.SQLToInt(Request.QueryString["Id"]));

            if (customer != null)
            {
                lbMessage.Text = "";
                if (customerRepo.DoesEmailExist(txtEmail.Text) && !customer.Email.ToLower().Equals(txtEmail.Text.ToLower()) && ToSQL.EmptyNull(txtEmail.Text) != "")
                {
                    lbMessage.Text      = "Email already exists!";
                    lbMessage.ForeColor = System.Drawing.Color.Red;
                    txtEmail.Text       = "";
                    return;
                }

                customer.FirstName   = txtFirstName.Text;
                customer.LastName    = txtLastName.Text;
                customer.Email       = txtEmail.Text;
                customer.Phone       = txtPhone.Text;
                customer.DateOfBirth = ToSQL.SQLToDateTimeNull(txtDateOfBirth.Text);
                customer.Gender      = rdbtnGender.SelectedIndex == 0 ? true : false;
                int i = customerRepo.UpdateCustomer(customer);
                Response.Redirect("Management-Customer.aspx");
            }
            else
            {
                Response.Redirect("Management-Customer.aspx");
            }
        }
Exemplo n.º 3
0
        private void BindItemsList()
        {
            List <Model.Contact> users = new ContactRepo().GetManagementContacts(ToSQL.SQLToDateTimeNull(txtFromDate.Text), ToSQL.SQLToDateTimeNull(txtToDate.Text));

            _PageDataSource.DataSource       = users;
            _PageDataSource.AllowPaging      = true;
            _PageDataSource.PageSize         = 10;
            _PageDataSource.CurrentPageIndex = CurrentPage;
            ViewState["TotalPages"]          = _PageDataSource.PageCount;

            //this.lblPageInfo.Text = "Results: " + ProductList.Count.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;Page " + (CurrentPage + 1) + " of " + _PageDataSource.PageCount + "&nbsp;&nbsp;";

            this.btnPre.Visible  = !_PageDataSource.IsFirstPage;
            this.btnNext.Visible = !_PageDataSource.IsLastPage;
            //this.lbtnFirst.Visible = !_PageDataSource.IsFirstPage;
            //this.lbtnLast.Visible = !_PageDataSource.IsLastPage;

            this.gvContacts.DataSource = _PageDataSource;
            this.gvContacts.DataBind();
            //this.gvProducts.UseAccessibleHeader = true;
            //this.gvProducts.HeaderRow.TableSection = TableRowSection.TableHeader;
            this.doPaging();
        }
Exemplo n.º 4
0
        private void BindItemsList()
        {
            List <Order> orders = new OrderRepo().GetManagementOrders(ToSQL.SQLToInt(txtOrderID.Text), ToSQL.SQLToDateTimeNull(txtFromDate.Text), ToSQL.SQLToDateTimeNull(txtToDate.Text),
                                                                      ToSQL.SQLToInt(ddlOrderStatus.SelectedValue), ToSQL.SQLToInt(ddlCustomer.SelectedValue));

            //_PageDataSource.DataSource = users;
            //_PageDataSource.AllowPaging = true;
            //_PageDataSource.PageSize = 10;
            //_PageDataSource.CurrentPageIndex = CurrentPage;
            //ViewState["TotalPages"] = _PageDataSource.PageCount;

            //this.lblPageInfo.Text = "Results: " + ProductList.Count.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;Page " + (CurrentPage + 1) + " of " + _PageDataSource.PageCount + "&nbsp;&nbsp;";

            //this.btnPre.Visible = !_PageDataSource.IsFirstPage;
            //this.btnNext.Visible = !_PageDataSource.IsLastPage;
            //this.lbtnFirst.Visible = !_PageDataSource.IsFirstPage;
            //this.lbtnLast.Visible = !_PageDataSource.IsLastPage;

            this.gvOrders.DataSource = orders;
            this.gvOrders.DataBind();
            this.gvOrders.UseAccessibleHeader    = true;
            this.gvOrders.HeaderRow.TableSection = TableRowSection.TableHeader;
            //this.doPaging();
        }