public RetailerOrderDetailPageViewModel(Employee_OrderGenerate_Class fs, INavigation navigation)
 {
     _navigation       = navigation;
     fs.DateOfDispatch = DateTime.Now;
     Employee_OrderGenerate_Class_data = fs;
     SendOTPCommand    = new Command(async() => await SendOTP());
     SaveCommand       = new Command(async() => await SaveAsync());
     _IAllDataServices = new AllDataServices();
 }
Esempio n. 2
0
 public RetailerOrderDetailPage(Employee_OrderGenerate_Class eoc)
 {
     if (Application.Current.Properties.ContainsKey("Key"))
     {
         InitializeComponent();
         BindingContext = new RetailerOrderDetailPageViewModel(eoc, Navigation);
     }
     else
     {
         Navigation.PushModalAsync(new MainPage());
     }
 }
        private async Task Save()
        {
            Employee_OrderGenerate_Class eoc = new Employee_OrderGenerate_Class();

            eoc.Retailer_Id = RetailerMaster_Class_Data.RetailerMaster_Id;
            eoc.RetailerMaster_Class_Data.Mobile_No = RetailerMaster_Class_Data.Mobile_No;
            foreach (var data in _Article_List)
            {
                foreach (var subdata in data.FranchiseStokeMaster_Class_List)
                {
                    if (subdata.Insert_New_Qty > 0)
                    {
                        eoc.Total_Amount = eoc.Total_Amount + (subdata.Insert_New_Qty * Convert.ToDouble(data.MRP));
                        eoc.Total_Item   = eoc.Total_Item + subdata.Insert_New_Qty;
                        Employee_OrderDetailsMaster_Class eodc = new Employee_OrderDetailsMaster_Class();
                        eodc.Article_Id     = data.Article_Id;
                        eodc.MRP            = Convert.ToDouble(data.MRP);
                        eodc.Quantity       = subdata.Insert_New_Qty;
                        eodc.SellPrice      = data.Selling_Price;
                        eodc.SubCategory_Id = subdata.SubCategory_Id;
                        eodc.ArticleMaster_Class_Data.Article_No = data.Article_No;

                        eodc.ArticleMaster_Class_Data.Article_PrimaryImage   = data.Article_PrimaryImage;
                        eodc.ArticleMaster_Class_Data.Article_SecondaryImage = data.Article_SecondaryImage;
                        eodc.CategoryMaster_Class_Date.Category_Name         = data.CategoryMaster_Class_Data.Category_Name + '-' + subdata.SubCategoryMaster_Class_Data.SubCategory_Name;
                        eoc.odm.Add(eodc);
                    }
                }
            }


            if (eoc.Total_Amount > 0)
            {
                await _navigation.PushAsync(new RetailerOrderDetailPage(eoc), true);
            }
            else
            {
                await App.Current.MainPage.DisplayAlert("Oops!", "please fill qty then submit..", "ok");
            }
            //FranchiseSell_Class Franchise_Sell_Class = new FranchiseSell_Class();
            //Franchise_Sell_Class.Customer_Id = Franchise_Sell_Class_Data.Customer_Id;
            //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 && Subitem.Insert_New_Qty != null)
            //        {
            //            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);

            //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");
            //}
        }