コード例 #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                iBiz.FinPro.Generic.Customers             bCustomers  = new iBiz.FinPro.Generic.Customers();
                iBiz.FinPro.Generic.Customers.objCustomer objCustomer = new iBiz.FinPro.Generic.Customers.objCustomer();

                objCustomer = bCustomers.Select(Convert.ToInt32(Request.QueryString["id"]));
                if (objCustomer != null)
                {
                    objCustomer.customerTitle        = tbCustomerTitle.Text.Trim();
                    objCustomer.customerURL          = tbCustomerURL.Text.Trim();
                    objCustomer.customerCode         = tbCustomerCode.Text.Trim();
                    objCustomer.customerDescription  = tbCustomerDescription.Text.Trim();
                    objCustomer.customerFirstName    = tbCustomerFirstName.Text.Trim();
                    objCustomer.customerLastName     = tbCustomerLastName.Text.Trim();
                    objCustomer.customerAddressLine1 = tbCustomerAddressLine1.Text.Trim();
                    objCustomer.customerAddressLine2 = tbCustomerAddressLine2.Text.Trim();
                    objCustomer.customerState        = tbCustomerState.Text.Trim();
                    objCustomer.customerZip          = tbCustomerZip.Text.Trim();
                    objCustomer.customerCountry      = tbCustomerCountry.Text.Trim();
                    objCustomer.customerEmail        = tbCustomerEmail.Text.Trim();
                    objCustomer.customerEmailAlt     = tbCustomerAltEmail.Text.Trim();
                    objCustomer.customerPhone        = tbCustomerPhone.Text.Trim();
                    objCustomer.customerPhoneAlt     = tbCustomerAltPhone.Text.Trim();

                    objCustomer.customerMinQty = 0;
                    if (tbCustomerMinQty.Text.Trim().Length > 0)
                    {
                        objCustomer.customerMinQty = Convert.ToInt32(tbCustomerMinQty.Text.Trim());
                    }

                    objCustomer.customerMaxQty = 0;
                    if (tbCustomerMaxQty.Text.Trim().Length > 0)
                    {
                        objCustomer.customerMaxQty = Convert.ToInt32(tbCustomerMaxQty.Text.Trim());
                    }

                    objCustomer.customerIsActive = true;

                    if (rblStatus.SelectedIndex == 0)
                    {
                        objCustomer.customerIsActive = false;
                    }


                    bCustomers.Update(objCustomer);
                    rnNotify.Show("Customer has been updated.");
                }
                else
                {
                    objCustomer = new iBiz.FinPro.Generic.Customers.objCustomer();
                    objCustomer.customerTitle        = tbCustomerTitle.Text.Trim();
                    objCustomer.customerURL          = tbCustomerURL.Text.Trim();
                    objCustomer.customerCode         = tbCustomerCode.Text.Trim();
                    objCustomer.customerDescription  = tbCustomerDescription.Text.Trim();
                    objCustomer.customerFirstName    = tbCustomerFirstName.Text.Trim();
                    objCustomer.customerLastName     = tbCustomerLastName.Text.Trim();
                    objCustomer.customerAddressLine1 = tbCustomerAddressLine1.Text.Trim();
                    objCustomer.customerAddressLine2 = tbCustomerAddressLine2.Text.Trim();
                    objCustomer.customerState        = tbCustomerState.Text.Trim();
                    objCustomer.customerZip          = tbCustomerZip.Text.Trim();
                    objCustomer.customerCountry      = tbCustomerCountry.Text.Trim();
                    objCustomer.customerEmail        = tbCustomerEmail.Text.Trim();
                    objCustomer.customerEmailAlt     = tbCustomerAltEmail.Text.Trim();
                    objCustomer.customerPhone        = tbCustomerPhone.Text.Trim();
                    objCustomer.customerPhoneAlt     = tbCustomerAltPhone.Text.Trim();

                    objCustomer.customerMinQty = 0;
                    if (tbCustomerMinQty.Text.Trim().Length > 0)
                    {
                        objCustomer.customerMinQty = Convert.ToInt32(tbCustomerMinQty.Text.Trim());
                    }

                    objCustomer.customerMaxQty = 0;
                    if (tbCustomerMaxQty.Text.Trim().Length > 0)
                    {
                        objCustomer.customerMaxQty = Convert.ToInt32(tbCustomerMaxQty.Text.Trim());
                    }

                    objCustomer.customerIsActive = true;

                    if (rblStatus.SelectedIndex == 0)
                    {
                        objCustomer.customerIsActive = false;
                    }

                    objCustomer.customerCreatedBy = 1;
                    objCustomer.customerCreatedIP = Request.UserHostAddress;
                    objCustomer.customerCreatedOn = DateTime.Now;

                    bCustomers.Add(objCustomer);
                    rnNotify.Show("Customer has been added.");
                }
            }
        }