public SellDetailPageViewModel(FranchiseSell_Class fs, INavigation navigation) { _navigation = navigation; enableSave = true; IsRemoveCoupon = false; FranchiseSell_Class_Data_List = fs; SendOTPCommand = new Command(async() => await SendOTP()); SaveCommand = new Command(async() => await SaveAsync()); _IAllDataServices = new AllDataServices(); }
public SellDetailPage(FranchiseSell_Class fs) { if (Application.Current.Properties.ContainsKey("Key")) { InitializeComponent(); BindingContext = new SellDetailPageViewModel(fs, Navigation); } else { Navigation.PushModalAsync(new MainPage()); } }
public CustomerInvoiceDetailPage(FranchiseSell_Class Franchise_Sell_Class_Data) { if (Application.Current.Properties.ContainsKey("Key")) { InitializeComponent(); BindingContext = new CustomerInvoiceDetailPageViewModel(Franchise_Sell_Class_Data); if (!string.IsNullOrEmpty(Franchise_Sell_Class_Data.Invoice_No)) { ps = Franchise_Sell_Class_Data; } } else { Navigation.PushModalAsync(new MainPage()); } }
public SellViewModel(INavigation _navigation) { navigation = _navigation; App.isBusy = false; ArticleMaster_Class_Data_List = new ObservableCollection <ArticleMaster_Class>(); this.Customer_Class = new Customer_Class(); GetContectNoCommand = new Command(async() => await CheckContectNo()); GetArticleNoCommand = new Command(async() => await CheckArticleNo()); GetScanCommand = new Command(async() => await ScanArticleNo()); AddCommand = new Command(async() => await Add()); // CancelCommand = new Command( CancelTask()); SaveCommand = new Command(async() => await Save()); CustomerClassToBind = new Customer_Class(); _IAllDataServices = new AllDataServices(); Franchise_Sell_Class_Data = new FranchiseSell_Class(); ArticleMasterClassList = new ObservableCollection <ArticleMaster_Class>(); GetListAsync(); }
private async Task Save() { if (!App.isBusy) { // ObservableCollection<FranchiseSellDetails_Class> fscd = new ObservableCollection<FranchiseSellDetails_Class>(); App.isBusy = true; FranchiseSell_Class Franchise_Sell_Class = new FranchiseSell_Class(); Franchise_Sell_Class.Customer_Id = Franchise_Sell_Class_Data.Customer_Id; var Wait = UserDialogs.Instance.Loading("Wait..", null, null, true, MaskType.Black); Wait.Show(); if (Franchise_Sell_Class.Customer_Id > 0) { Franchise_Sell_Class.Customer_Class_Data = Franchise_Sell_Class_Data.Customer_Class_Data; foreach (var item in ArticleMasterClassList) { foreach (var Subitem in item.FranchiseStokeMaster_Class_List) { if (Subitem.Insert_New_Qty > 0) { FranchiseSellDetails_Class fsl = new FranchiseSellDetails_Class(); Franchise_Sell_Class.Total_Amount = Franchise_Sell_Class.Total_Amount + (Subitem.Insert_New_Qty * item.MRP); fsl.SubCategory_Id = Subitem.SubCategoryMaster_Class_Data.SubCategory_Id; fsl.Article_Id = item.Article_Id; fsl.MRP = item.MRP; fsl.Quantity = Subitem.Insert_New_Qty; StockMaster_Class smc = new StockMaster_Class(); smc.Stock_Id = Subitem.Stock_Id; fsl.FranchiseStokeMaster_Class_Data = smc; ArticleMaster_Class amc = new ArticleMaster_Class(); amc.Article_No = item.Article_No; amc.Article_PrimaryImage = item.Article_PrimaryImage; amc.Article_SecondaryImage = item.Article_SecondaryImage; fsl.ArticleMaster_Class_Data = amc; CategoryMaster_Class cmc = new CategoryMaster_Class(); cmc.Category_Name = item.CategoryMaster_Class_Data.Category_Name + " - " + Subitem.SubCategoryMaster_Class_Data.SubCategory_Name; fsl._CategoryMaster_Class_Data = cmc; //fsl._SubCategoryMaster_Class_Data.SubCategory_Name = Subitem.SubCategory_Name; fsl.Total_Amount = (fsl.MRP * fsl.Quantity).ToString(); // fscd.Add(fsl); Franchise_Sell_Class.FranchiseSellDetails_Class_List.Add(fsl); } } } // Franchise_Sell_Class_Data.FranchiseSellDetails_Class_List.Add(fscd); Wait.Hide(); App.isBusy = false; if (Franchise_Sell_Class.Total_Amount > 0) { await navigation.PushAsync(new SellDetailPage(Franchise_Sell_Class), true); } else { await App.Current.MainPage.DisplayAlert("Oops!", "Please Fill Qty Then Submit..", "Ok"); } } else { if (Customer_Class.Customer_Name != null && Customer_Class.Customer_Name != "") { JObject result = await _IAllDataServices.CustomerRegistration(Customer_Class); if (result != null && result["Type"].ToString() == "1" || result["Type"].ToString() == "0") { JObject result2 = await _IAllDataServices.GetCustomerByMobileNo(Customer_Class); type1 = result2["Type"].ToString(); if (type1 == "1") { Franchise_Sell_Class.Customer_Id = (int)result2["Result"]["Customer_Id"]; foreach (var item in ArticleMasterClassList) { foreach (var Subitem in item.FranchiseStokeMaster_Class_List) { if (Subitem.Insert_New_Qty > 0) { FranchiseSellDetails_Class fsl = new FranchiseSellDetails_Class(); Franchise_Sell_Class.Total_Amount = Franchise_Sell_Class.Total_Amount + (Subitem.Insert_New_Qty * item.MRP); fsl.SubCategory_Id = Subitem.SubCategoryMaster_Class_Data.SubCategory_Id; fsl.Article_Id = item.Article_Id; fsl.MRP = item.MRP; fsl.Quantity = Subitem.Insert_New_Qty; StockMaster_Class smc = new StockMaster_Class(); smc.Stock_Id = Subitem.Stock_Id; fsl.FranchiseStokeMaster_Class_Data = smc; ArticleMaster_Class amc = new ArticleMaster_Class(); amc.Article_No = item.Article_No; amc.Article_PrimaryImage = item.Article_PrimaryImage; amc.Article_SecondaryImage = item.Article_SecondaryImage; fsl.ArticleMaster_Class_Data = amc; CategoryMaster_Class cmc = new CategoryMaster_Class(); cmc.Category_Name = item.CategoryMaster_Class_Data.Category_Name + " - " + Subitem.SubCategoryMaster_Class_Data.SubCategory_Name; fsl._CategoryMaster_Class_Data = cmc; //fsl._SubCategoryMaster_Class_Data.SubCategory_Name = Subitem.SubCategory_Name; fsl.Total_Amount = (fsl.MRP * fsl.Quantity).ToString(); // fscd.Add(fsl); Franchise_Sell_Class.FranchiseSellDetails_Class_List.Add(fsl); } } } if (Franchise_Sell_Class.Total_Amount > 0) { App.isBusy = false; await navigation.PushAsync(new SellDetailPage(Franchise_Sell_Class), true); } else { App.isBusy = false; await App.Current.MainPage.DisplayAlert("Oops!", "Please Fill Qty Then Submit..", "Ok"); } } else { App.isBusy = false; await App.Current.MainPage.DisplayAlert("Oops!", "Something is worng please try Again....", "Ok"); } } else { App.isBusy = false; await App.Current.MainPage.DisplayAlert("Oops!", (string)result["ResponseMessage"], "Ok"); } } else { App.isBusy = false; await App.Current.MainPage.DisplayAlert("Oops!", "Please fill customer name ", "Ok"); } Wait.Hide(); } Wait.Hide(); } }
public CustomerInvoiceDetailPageViewModel(FranchiseSell_Class FranchiseSell_Class) { Franchise_Sell_Class_Data = FranchiseSell_Class; }