Exemplo n.º 1
0
        protected void cmdSubmit_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                lblError.Text = "Please enter a customer name.";
                return;
            }

            lblError.Text = "";
            _currentCustomer = (TimeCustomers) Session["CurrentCustomer"];
            if (_currentCustomer == null)
            {
                //new company object
                TimeCustomers company = TimeCustomers.New();

                //fill object with data
                company.CustomerName = txtName.Text;
                company.Description = txtDescription.Text;
                company.Status = 1;
                company.Type = 1;

                //save the new company
                company.Save();
            }
            else
            {
                _currentCustomer.CustomerName = txtName.Text;
                _currentCustomer.Description = txtDescription.Text;
                _currentCustomer.Status = 1;
                _currentCustomer.Type = 1;

                //save the new company
                _currentCustomer.Save();
            }

            txtName.Text = "";
            txtDescription.Text = "";
            _currentCustomer = null;
            Session["CurrentCustomer"] = _currentCustomer;
            RefreshEntries();
            updEntries.Update();

            lblSuccessMessage.Text = "Successfully submitted data!";
            mpSuccess.Show();
        }