Esempio n. 1
0
        public void AddDealer(object Parameter)
        {
            dealer ob = new dealer();

            ob.id             = 0;
            ob.dealer_address = DealerAddress;
            ob.dealer_name    = DealerName;
            List <dealer> temp = DelarServices.GetDelarByName(ob.dealer_name.Trim());

            if (temp.Count == 0)
            {
                int temp_dealerid = DelarServices.AddUpdateDealer(ob);
                if (temp_dealerid > 0)
                {
                    // MessageBox.Show("Dealer added successfully");
                    InventoryHelper.SuccessAlert("Success", "Dealer added successfully");
                    DealerAddress = "";
                    DealerName    = "";
                }
            }
            else
            {
                InventoryHelper.SimpleAlert("Warning", "Dealer Name already Exist");
                //MessageBox.Show("Dealer Name already Exist");
            }
        }
Esempio n. 2
0
        public void DeleteDealer(object parameter)
        {
            bool    flag     = false;
            int     delar_id = 0;
            TextBox tb       = (TextBox)parameter;

            int.TryParse(tb.Text, out delar_id);
            try
            {
                if (delar_id > 0)
                {
                    flag = DelarServices.DeleteDealer(delar_id);
                }
                if (flag == true)
                {
                    BindGrid();
                    RaisedPropertyChanged("Delars");
                    InventoryHelper.SuccessAlert("Success", "Delar Deleted");
                }
            }
            catch
            {
                InventoryHelper.SimpleAlert("Warning", "Dealer associated with Products");
            }
        }
Esempio n. 3
0
        public void UpdateDealer(object parameter)
        {
            int     delar_id = 0;
            TextBox tb       = (TextBox)parameter;

            int.TryParse(tb.Text, out delar_id);
            if (delar_id > 0)
            {
                dealer        ob_dealer = Delars.Where(s => s.id == delar_id).First();
                List <dealer> temp_list = DelarServices.GetDelarByName(ob_dealer.dealer_name.Trim());
                if (temp_list.Count == 0 || temp_list.Count == 1)
                {
                    if (temp_list.Count == 1)
                    {
                        dealer temp = temp_list.FirstOrDefault();
                        if (temp.id != ob_dealer.id)
                        {
                            BindGrid();
                            RaisedPropertyChanged("Delars");
                            return;
                        }
                    }
                    int temp_delar_id = DelarServices.AddUpdateDealer(ob_dealer);
                    if (temp_delar_id == ob_dealer.id)
                    {
                        //MessageBox.Show("Dealer " + ob_dealer.dealer_name + " is Updated");
                        InventoryHelper.SuccessAlert("Success", "Dealer " + ob_dealer.dealer_name + " is Updated");
                        BindGrid();
                        RaisedPropertyChanged("Delars");
                    }
                }
                else
                {
                    // MessageBox.Show("Dealer Name already Exist");
                    InventoryHelper.SimpleAlert("Warning", "Dealer Name already Exist");
                }
            }
        }
Esempio n. 4
0
 protected void BindGrid()
 {
     Delars = DelarServices.GetAllDelars(0);
 }
Esempio n. 5
0
 private void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     temp_load_dealers = DelarServices.GetAllDelars(0);
 }
Esempio n. 6
0
 private void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     temp_Loadtime_Dealers  = DelarServices.GetAllDelars(0);
     temp_loadtime_Category = CategoryServices.GetAllCategory(0);
 }