Example #1
0
        public SPaymentController()
        {
            _factory          = new PaymentMethodFactory();
            _facXero          = new XeroFactory();
            ViewBag.ListStore = GetListStore();
            var ListAcc = new List <XeroDTO>();

            ViewBag.ListAccountXero = ListAcc;
            // ViewBag.ListAccountXero = new SelectList(ListAcc, "Code", "NameDisplayCombobox", "ReportingCodeName", 1);
        }
Example #2
0
        public bool PushDataToXero(UsageManagementRequest request)
        {
            bool result = true;

            if (IsPush(request.DateTo, request.StoreId))
            {
                //List<UsageManagementModel> lstCalResult = CalUsageManagementwithoutDetail(request);
                List <UsageManagementModel> lstCalResult = GetUsageManagement(request);
                //lstCalResult.Add(new UsageManagementModel()
                //{
                //    Code = "008",
                //    Usage = 2
                //});
                try
                {
                    IngredientSyncRequestDTO model = new IngredientSyncRequestDTO();
                    model.AppRegistrationId = Commons.XeroRegistrationAppId;
                    model.AccessToken       = Commons.XeroAccessToken;
                    model.StoreId           = request.StoreId;

                    var lstIngredient = _ingredientFactory.GetIngredient(null);

                    if (lstIngredient != null && lstIngredient.Count > 0)
                    {
                        lstIngredient = lstIngredient.Where(ww => !string.IsNullOrEmpty(ww.XeroId)).ToList();
                        if (lstIngredient != null && lstIngredient.Count > 0)
                        {
                            foreach (var item in lstCalResult)
                            {
                                var obj = lstIngredient.Where(ww => ww.Code.ToUpper().Equals(item.Code.ToUpper())).FirstOrDefault();
                                if (obj != null)
                                {
                                    model.Items.Add(new IngredientUsageSyncItem()
                                    {
                                        Id           = obj.XeroId,
                                        Code         = obj.Code,
                                        QuantityUsed = (decimal)item.Usage
                                    });
                                }
                            }
                            if (model.Items != null && model.Items.Count > 0)
                            {
                                result = XeroFactory.SyncIngredientsUsageToXero(request.DateTo, request.StoreId, model).Result;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    result = false;
                    _logger.Error(ex);
                }
            }
            return(result);
        }
Example #3
0
        public ResultModels GenerateReceiptNote(GenerateReceiptNoteApiModels request)
        {
            NSLog.Logger.Info("XeroGenerateReceiptNoteApi.......................", request);
            var result = new ResultModels();

            if (request != null)
            {
                XeroFactory _facXero = new XeroFactory();
                result = _facXero.GenerateReceiptNoteAPI(request);
            }
            return(result);
        }
Example #4
0
        public SBInventoryCategoriesInteController()
        {
            _factory            = new InteCategoriesFactory();
            _productTypeFactory = new ProductTypeFactory();
            _facXero            = new XeroFactory();
            //================
            //ViewBag.ListStore = GetListStore();
            //if (Commons.isIntegrateXero)
            var ListAcc = new List <XeroDTO>();

            ViewBag.ListAccountXero = new SelectList(ListAcc, "Code", "NameDisplayCombobox", "ReportingCodeName", 1);
        }
Example #5
0
        public bool PushDataToXero(UsageManagementRequest request, List <UsageManagementModel> lstUsages)
        {
            bool result = true;

            //if (IsPush(request.DateTo, request.StoreId))
            //{
            //List<UsageManagementModel> lstCalResult = CalUsageManagementwithoutDetail(request);
            try
            {
                IngredientSyncRequestDTO model = new IngredientSyncRequestDTO();
                model.AppRegistrationId = Commons.XeroRegistrationAppId;
                model.AccessToken       = Commons.XeroAccessToken;
                model.StoreId           = request.StoreId;

                var lstIngredient = XeroFactory.GetIngredientsFromXero(new Models.Xero.XeroBaseModel()
                {
                    AppRegistrationId = Commons.XeroRegistrationAppId,
                    AccessToken       = Commons.XeroAccessToken,
                    StoreId           = request.StoreId
                }).Result;

                if (lstIngredient.Success)
                {
                    foreach (var item in lstUsages)
                    {
                        var obj = lstIngredient.Data.Items.Where(ww => ww.Code.ToUpper().Equals(item.Code.ToUpper())).FirstOrDefault();
                        if (obj != null)
                        {
                            model.Items.Add(new IngredientUsageSyncItem()
                            {
                                Id           = obj.ID,
                                Code         = obj.Code,
                                QuantityUsed = (decimal)item.Usage
                            });
                        }
                    }
                    if (model.Items != null && model.Items.Count > 0)
                    {
                        NSLog.Logger.Info("PushDataToXero Data", model.Items);
                        result = XeroFactory.SyncIngredientsUsageToXero(request.DateTo, request.StoreId, model).Result;
                    }
                }
            }
            catch (Exception ex)
            {
                result = false;
                _logger.Error(ex);
            }
            //}
            return(result);
        }
Example #6
0
 public StockUsageFactory()
 {
     _baseFactory            = new BaseFactory();
     _xeroFactory            = new XeroFactory();
     _usageManagementFactory = new UsageManagementFactory();
 }
Example #7
0
 public SXeroController()
 {
     _factory = new XeroFactory();
 }
Example #8
0
 public PosSaleFactory()
 {
     _baseFactory = new BaseFactory();
     _xeroFactory = new XeroFactory();
 }