private void Button_Click_50(object sender, RoutedEventArgs e)
        {
            AddSupplier add = new AddSupplier();

            add.Show();
            this.Close();
        }
Exemple #2
0
        private void btnUpSup_Click(object sender, EventArgs e)
        {
            if (dgvSup.RowCount > 0)
            {
                AddSupplier m = new AddSupplier();

                try
                {
                    m.lblId.Text        = dgvSup.CurrentRow.Cells[0].Value.ToString();
                    m.txtCompany.Text   = dgvSup.CurrentRow.Cells[1].Value.ToString();
                    m.txtFirstName.Text = dgvSup.CurrentRow.Cells[2].Value.ToString();
                    m.txtLastName.Text  = dgvSup.CurrentRow.Cells[3].Value.ToString();
                    m.txtPhone.Text     = dgvSup.CurrentRow.Cells[6].Value.ToString();
                    m.txtEmail.Text     = dgvSup.CurrentRow.Cells[5].Value.ToString();
                    m.txtAdress.Text    = dgvSup.CurrentRow.Cells[7].Value.ToString();
                    m.btnAdd.Text       = "Update";
                    m.ShowDialog();
                    RefreshSup();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("There is nothing to Update !!!", "Opration Failed", MessageBoxButtons.OK, icon: MessageBoxIcon.Error);
            }
        }
 private void AddSupplier_Click(object sender, RoutedEventArgs e)
 {
     ProductViewModel cancel = new ProductViewModel();
     cancel.Cancel_Product();
     AddSupplier _AS = new AddSupplier();
     _AS.ShowDialog();
 }
Exemple #4
0
        public IActionResult Add([FromBody] AddSupplier supplier)
        {
            var mappedSupplier = _mapper.Map <Supplier>(supplier);

            var response = _service.Add(mappedSupplier);

            return(Ok(response));
        }
Exemple #5
0
        private void AddSupplier_Click(object sender, RoutedEventArgs e)
        {
            CustomerViewModel cancel = new CustomerViewModel();

            cancel.Cancel_Customer();
            AddSupplier _AS = new AddSupplier();

            _AS.ShowDialog();
        }
Exemple #6
0
        private void btnAddSup_Click(object sender, EventArgs e)
        {
            AddSupplier m = new AddSupplier();

            try
            {
                m.btnAdd.Text = "Add New";
                m.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            RefreshSup();
        }
        public ActionResult Add(AddSupplier model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var supplier = new Supplier();
                    supplier.SupplierName   = model.SupplierName;
                    supplier.Description    = model.Description;
                    supplier.Address        = model.Address;
                    supplier.Phone          = model.Phone;
                    supplier.Fax            = model.Fax;
                    supplier.Email          = model.Email;
                    supplier.Website        = model.Website;
                    supplier.CreationUser   = GetLogonUserName();
                    supplier.CreationDate   = DateTime.Now;
                    supplier.LastUpdate     = null;
                    supplier.LastUpdateUser = null;

                    db.Suppliers.Add(supplier);
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);

                // Write error log
                var log = new Log();
                log.LogDate = DateTime.Now;
                log.Action  = "Supplier - Add()";
                log.Tags    = "Error";
                log.Message = ex.ToString();
                db.Logs.Add(log);
            }
            return(View(model));
        }
        public async void AddSupplier()
        {
            Value = true;
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Warning,
                    Languages.CheckConnection,
                    Languages.Ok);

                return;
            }
            if (string.IsNullOrEmpty(Code) || string.IsNullOrEmpty(Description))
            {
                //IsVisible = true;
                Value = true;
                //IsEnabled = true;
                //await Application.Current.MainPage.DisplayAlert(Languages.Error, Languages.UsernameValidation, Languages.Ok);
                return;
            }
            if (Containner == null || CustomsDuty == null)
            {
                Value = true;
                return;
            }

            IsRunning = false;
            IsEnabled = false;

            var supplier = new AddSupplier
            {
                code        = Code,
                description = Description,
                country     = Country,
                container   = Containner,
                customsDuty = CustomsDuty,
                note        = Note,
                european    = European,
                exporter    = Exporter,
                dutyFree    = DutyFree
            };
            var response = await apiService.Save <AddSupplier>(
                "https://app.smart-path.it",
                "/md-core",
                "/medial/supplier",
                supplier);

            Debug.WriteLine("********responseIn ViewModel*************");
            Debug.WriteLine(response);
            if (!response.IsSuccess)
            {
                IsRunning = true;
                IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }

            Value     = false;
            IsRunning = true;
            IsEnabled = true;
            MessagingCenter.Send((App)Application.Current, "OnSaved");
            DependencyService.Get <INotification>().CreateNotification("Medial", "Supplier Added");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
Exemple #9
0
        public async void Edit_Supplier()
        {
            try
            {
                if (selectSupplier.SUPPLIER_ID != null && selectSupplier.SUPPLIER_ID != 0)
                {
                    data = null;
                    App.Current.Properties["Action"] = "Edit";
                    HttpClient client = new HttpClient();
                    client.BaseAddress = new Uri(GlobalData.gblApiAdress);
                    client.DefaultRequestHeaders.Accept.Add(
                        new MediaTypeWithQualityHeaderValue("application/json"));
                    client.Timeout = new TimeSpan(500000000000);
                    HttpResponseMessage response = client.GetAsync("api/SupplierAPI/EditSuppliers/?id=" + selectSupplier.SUPPLIER_ID + "").Result;
                    //response = client.GetAsync("api/DeliveryAddressAPI/EditDelivery/?id=" + selectDelivery.DELIVERY_ID + "").Result;
                    if (response.StatusCode.ToString() == "OK")
                    {
                        data = JsonConvert.DeserializeObject <SupplierModel[]>(await response.Content.ReadAsStringAsync());
                        if (data.Length > 0)
                        {
                            for (int i = 0; i < data.Length; i++)
                            {
                                SUPPLIER_CODE = data[i].SUPPLIER_CODE;
                                SUPPLIER_NAME = data[i].SUPPLIER_NAME;
                                ADDRESS       = data[i].ADDRESS;
                                COUNTRY       = data[i].COUNTRY;
                                POSTCODE      = data[i].POSTCODE;
                                SUPPLIER_ID   = data[i].SUPPLIER_ID;
                                WEBSITE       = data[i].WEBSITE;
                                VAT_TYPE      = data[i].VAT_TYPE;
                                PRICE_TYPE    = data[i].PRICE_TYPE;
                                DYNAMIC_DISC  = data[i].DYNAMIC_DISC;
                                SEND_MAIL     = data[i].SEND_MAIL;
                                //COMPANY_ID = a.COMPANY_ID,
                                SUPPLIER_INACTIVE  = data[i].SUPPLIER_INACTIVE;
                                REGISTERED         = data[i].REGISTERED;
                                DUNS_NO            = data[i].DUNS_NO;
                                STATEMENT          = data[i].STATEMENT;
                                IS_CUSTOMER        = data[i].IS_CUSTOMER;
                                CONTACT_TYPE       = data[i].CONTACT_TYPE;
                                CONTACT_NAME       = data[i].CONTACT_NAME;
                                CONTACT_SALUTATION = data[i].CONTACT_SALUTATION;
                                CONTACT_PHONE_NO   = data[i].CONTACT_PHONE_NO;
                                CONTACT_EXTN_NO    = data[i].CONTACT_EXTN_NO;
                                CONTACT_MOBILE_NO  = data[i].CONTACT_MOBILE_NO;
                                CONTACT_FAX        = data[i].CONTACT_FAX;
                                EMAIL        = data[i].EMAIL;
                                SKYPE        = data[i].SKYPE;
                                DATE_STARTED = data[i].DATE_STARTED;
                                LAST_PAYMENT = data[i].LAST_PAYMENT;
                                GROUP        = data[i].GROUP;
                                DEF_PMT_DAY  = data[i].DEF_PMT_DAY;
                                CASH_ACC     = data[i].CASH_ACC;
                                CREDIT_LIMIT = data[i].CREDIT_LIMIT;
                            }

                            App.Current.Properties["SupplierEdit"] = selectSupplier;
                            Cancel_Supplier();
                            AddSupplier _AS = new AddSupplier();
                            _AS.ShowDialog();
                        }
                    }
                }

                else
                {
                    MessageBox.Show("Select Supplier first..", "Item Selection", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #10
0
        public void AddSupplier_Click()
        {
            AddSupplier _AC = new AddSupplier();

            _AC.ShowDialog();
        }
        private void btnAddSupplier_Click(object sender, EventArgs e)
        {
            AddSupplier newSup = new AddSupplier();

            newSup.ShowDialog();
        }
Exemple #12
0
        private void addSupplierToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddSupplier addSupplier = new AddSupplier();

            addSupplier.ShowDialog();
        }