Esempio n. 1
0
        private void tempBtnAddAddressClick(object sender, RoutedEventArgs e)
        {
            Response res = null;

            try
            {
                DataLayer dl      = new DataLayer();
                Address   address = new Address();
                address.addressID = 1135;
                address.companyID = ((Company)dl.GetCompanyByCompanyName("vinay2").body).companyId;
                address.address1  = "address12";
                address.address2  = "address22";
                address.address3  = "address32";
                address.city      = "mumbai";
                address.state     = "Maharastra";
                address.country   = "India";
                address.pincode   = "123456";
                address.phone     = "1234567890";
                address.GSTNo     = "123GST";
                res = dl.AddAddress(address);
                //res = dl.EditAddress(address);
                if (res.success)
                {
                    MessageBox.Show("address added");
                }
                else if (res.isException)
                {
                    MessageBox.Show(res.exception);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
        private void btnAddAddressDetails_Click(object sender, RoutedEventArgs e)
        {
            Button b = e.Source as Button;

            if (b.Content.ToString() == "Add")
            {
                setAddAddressMode();
            }
            else if (b.Content.ToString() == "Ok")
            {
                DataLayer dl      = new DataLayer();
                Address   address = new Address();
                address.address1 = txtAddress1.Text;
                address.address2 = txtAddress2.Text;
                address.address3 = txtAddress3.Text;
                address.city     = txtCity.Text;
                address.GSTNo    = txtGSTNo.Text;
                address.phone    = txtPhone.Text;
                address.pincode  = txtPincode.Text;
                address.state    = getSelectedState().stateName;
                address.country  = txtCountry.Text;
                if (txtStateCode.Text.Trim() != "")
                {
                    address.stateCode = Int32.Parse(txtStateCode.Text);
                }
                address.companyID = ((Company)cmbCompanies.SelectedItem).companyId;
                Response res = dl.AddAddress(address);
                if (res.success)
                {
                    // address added
                    Thread.Sleep(1000);
                    setAddressComponent(getCurrentSelectedCompany().companyId);
                    setViewAddressMode();
                    populateCompaniesCmb();
                    lblAddressStatus.Content = "Address Added Successfully";
                }
                else if (res.isException)
                {
                    MessageBox.Show(res.exception);
                }
            }
        }