예제 #1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (simpleButton1.Text == "Add Location")
            {
                simpleButton1.Text          = "Save";
                tabCustomer.SelectedTabPage = xtraTabPage3;
                xtraTabPage1.PageEnabled    = false;
                xtraTabPage2.PageEnabled    = false;
                xtraTabPage3.PageEnabled    = true;
                //  xtraTabPage2.PageEnabled = false;
                // xtraTabPage3.PageEnabled = true;
                //
                // lblLocationCustomerId.Text=gridView1.GetFocusedDataRow()["Id"].ToString();
                //lblLocationContactPersonName.Text=gridView1.GetFocusedDataRow()["CustomerName"].ToString();
                int customerid = Convert.ToInt32(gridView1.GetFocusedDataRow()["Id"].ToString());

                clearAllLocation();

                CustomerService customer = new CustomerService();
                customer.IntCustomerId = customerid;
                customer.GetCustomerDetailsByID();
                lblLocationCustomerId.Text   = customerid.ToString();
                lblLocationCusName.Text      = customer.StrCustomerName;
                txtLocationMainLocation.Text = customer.StrLocation;


                txtLocationSubLocation.Enabled = true;
                txtLocationSubLocation.Focus();
            }
            else
            {
                simpleButton1.Text = "Add Location";

                if (ValidationCustomerLocation())
                {
                    XtraMessageBox.Show(InfoPCMS.message.GET_EMPTY_FIELDS_ERROR(), "Error");
                }
                else
                {
                    CustomerService customer = new CustomerService();

                    customer.IntCustomerId              = Convert.ToInt32(lblLocationCustomerId.Text.ToString().Trim());
                    customer.StrCustomerName            = lblLocationCusName.Text.Trim();
                    customer.StrContactPerson           = txtLocContactPer.Text.Trim();
                    customer.StrDesignation             = txtLocDesignation.Text.Trim();
                    customer.StrContactNo               = txtLocationContactNumber.Text.Trim();
                    customer.StrAddress                 = txtLocationAddress.Text.Trim();
                    customer.StrEmail                   = txtLocEmail.Text.Trim();
                    customer.StrFaxNo                   = txtLocFax.Text.Trim();
                    customer.StrLocation                = txtLocationMainLocation.Text.Trim();
                    customer.StrSubLocation             = txtLocationSubLocation.Text.ToString();
                    customer.StrServiceCenter           = cmbxLocServiceCen.SelectedValue.ToString().Trim();
                    customer.StrDistanceToServiceCenter = txtLocDistanceSer.Text.Trim();
                    customer.StrDistanceFromColombo     = txtLocDistanceCol.Text.Trim();
                    customer.StrHiltopSite              = Convert.ToString(chkLocHiltop.Checked);
                    customer.StrNonMotorable            = txtLocationNonMotorable.Text.Trim();


                    Boolean result = customer.AddCustomerLocation();

                    if (result)
                    {
                        clearAllLocation();
                        clearAll();

                        tabCustomer.SelectedTabPage = xtraTabPage1;
                        xtraTabPage1.PageEnabled    = true;
                        xtraTabPage2.PageEnabled    = false;
                        xtraTabPage3.PageEnabled    = false;
                    }


                    XtraMessageBox.Show(InfoPCMS.message.GET_RECORD_ADDED_INFORMATION(), "Information");
                }
            }
        }