void articleChooserViewModel_OnSelect(OITM_Articles obj) { IsModalVisible = false; var detail = new IGE1_GoodsIssueDetail() { ItemCode = obj.ItemCode, Quantity = ArticleChooserViewModel.Quantity, UnitMsr = obj.InvntryUom, AcctCode = obj.AccCount, // OITM_Articles = obj OnHand = ArticlesHelper.GetOnHandFor(obj.ItemCode), Dscription = obj.ItemName, }; ArticleChooserViewModel.CleanFields(); GoodsIssuesDetails.Add(detail); if (SelectedGoodsIssues != null) { SelectedGoodsIssues.IGE1_GoodsIssueDetail.Add(detail); } RaisePropertyChanged("GoodsIssuesDetails"); IsEnabled = GoodsIssuesDetails.Count == 0; }
public override void ExecuteEdit() { FormTitle = "Salida " + SelectedGoodsIssues.DocNum.ToString(); GoodsIssuesDetails = new ObservableCollection <IGE1_GoodsIssueDetail>(SelectedGoodsIssues.IGE1_GoodsIssueDetail); IsEnabled = GoodsIssuesDetails.Count == 0; if (!string.IsNullOrEmpty(SelectedGoodsIssues.IdMovement)) { SelectedMovement = MovementTypes.First(m => m.Code == SelectedGoodsIssues.IdMovement); } if (SelectedGoodsIssues.ItmsGrpCod.HasValue) { SelectedGroup = Groups.FirstOrDefault(g => g.ItmsGrpCod == SelectedGoodsIssues.ItmsGrpCod); } // actualizar inventario actual. var inventory = ArticlesHelper.GetArticlesFor(SelectedGoodsIssues.IGE1_GoodsIssueDetail.Select(p => p.ItemCode).ToList()); GoodsIssuesDetails.ToList().ForEach(d => { var product = inventory.FirstOrDefault(p => p.ItemCode == d.ItemCode); if (product != null && product.OnHand1.HasValue) { d.OnHand = product.OnHand1.Value; } //GetOnHandFromProduct(product); }); ShowDialog(new GoodIssuesView(), this); }
public override void ExecuteEdit() { ErrorMessage = string.Empty; SalesDetailsCollection = null; RaisePropertyChanged("SelectedSale"); if (SelectedSale != null) { UserIsValid = false; SelectedPartner = BusinessPartnerHelper.GetBusinessPartner(SelectedSale.CardCode); SelectedDownPayment = DownPaymentHelper.GetDownPaymentInSale(SelectedSale, asNotrack: true); HasDownPayment = SelectedDownPayment != null; Exento = SelectedSale.INV1_SalesDetail.Any(d => d.TaxCode == Config.IVAEXE); WithHolding = !Exento && SelectedSale.INV1_SalesDetail.Any(d => d.TaxCode == Config.IVARET); serie = SeriesHelper.GetSerie(selectedSale.Series); RaisePropertyChanged("Serie"); IsRoyality(); // Para actualizar existencias. var itemCodes = SelectedSale.INV1_SalesDetail.Select(d => d.ItemCode).ToList(); var inventory = ArticlesHelper.GetSalesArticles(itemCodes); SelectedSale.INV1_SalesDetail.ToList().ForEach(d => { var product = inventory.FirstOrDefault(p => p.ItemCode == d.ItemCode); if (product != null) { d.OnHand = ArticlesHelper.GetOnHandFor(product.ItemCode); // GetOnHandFromProduct(product); } }); } FormTitle = "Detalle de Venta " + SelectedSale.DocNum; ShowDialog(new SaleDetailsView(), this, resizeMode: ResizeMode.CanResize); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } Article = await _context.Articles.FindAsync(id); var authResult = await _auth.AuthorizeAsync(User, Article, ArticlePolicies.DeleteArticles); if (!authResult.Succeeded) { ArticlesHelper.LogFailure(_logger, Article, authResult.Failure); return(new ChallengeResult()); } if (Article != null) { _context.Articles.Remove(Article); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync() { var authResult = await _auth.AuthorizeAsync(User, ArticlePolicies.ListArticles2); if (!authResult.Succeeded) { ArticlesHelper.LogFailure(_logger, authResult.Failure); return(new ChallengeResult()); } var userMaturity = MaturityHelper.GetMaturity(User); var userName = User.Identity.Name; Article = await _context.Articles .EnforceAgeAndOwner(userName, userMaturity) .ToListAsync(); return(Page()); //var denied = res // .Where(r => !r.AuthResultTask.Result.Succeeded) // .Select(r => new FailureDescriptor() // { // Article = r.Article, // Failure = r.AuthResultTask.Result.Failure, // }) // .ToList(); //ArticlesHelper.LogFailure(_logger, denied); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } Article = await _context.Articles.FirstOrDefaultAsync( m => m.Id == id); var authResult = await _auth.AuthorizeAsync( User, Article, ArticlePolicies.ReadArticles); if (!authResult.Succeeded) { ArticlesHelper.LogFailure(_logger, Article, authResult.Failure); return(new ChallengeResult()); } if (Article == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } var authResult = await _auth.AuthorizeAsync(User, Article, ArticlePolicies.UpdateArticles); if (!authResult.Succeeded) { ArticlesHelper.LogFailure(_logger, Article, authResult.Failure); return(new ChallengeResult()); } _context.Attach(Article).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArticleExists(Article.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// // GET: /E3/ public ActionResult Index() { string apiKey = System.Configuration.ConfigurationManager.AppSettings["BloggerApiKey"]; string appName = System.Configuration.ConfigurationManager.AppSettings["GoogleAppName"]; BloggerService service = new BloggerService(new Google.Apis.Services.BaseClientService.Initializer() { ApiKey = apiKey, ApplicationName = appName }); ArticlesHelper helper = new ArticlesHelper(apiKey, appName, service); List <Article> nintendoArticles = helper.GetArticlesFromBlog(NintendoBlogId, "Nintendo", 100, 1, "E3 2016", "/Artigos/Ler/"); List <Article> generalArticles = helper.GetArticlesFromBlog(MainBlogId, "Multi", 100, 1, "E3 2016", "/Artigos/Ler/"); List <Article> articles = new List <Article>(); articles.AddRange(nintendoArticles); articles.AddRange(generalArticles); ViewData["articles"] = articles.OrderByDescending(t => t.DatePublished).ToList(); return(View()); }
// // GET: /FiltroArtigo/ public ActionResult Index() { ArticlesHelper articlesHelper = new ArticlesHelper(); List <Article> articles = articlesHelper.GetArticlesFromBlog(System.Configuration.ConfigurationManager.AppSettings["nintendoBlogId"], "Nintendo", 10000, 0, "/Artigos/Ler/"); return(View(articles)); }
public ActionResult Autor(string id) { ArticlesHelper articlesHelper = new ArticlesHelper(); List <Article> articles = articlesHelper.GetArticlesFromBlog(System.Configuration.ConfigurationManager.AppSettings["nintendoBlogId"], "Nintendo", 10000, 0, "/Artigos/Ler/"); articles.RemoveAll(t => t.AuthorName != id); return(View(articles)); }
public override void ExecuteNewCreditNote() { var cn = new ORIN_ClientCreditNotes() { CardCode = SelectedSale.CardCode, DocDate = SelectedSale.DocDate, Comments = SelectedSale.Comments, Series = 3, //serie correspondiente a nota de credito NumAtCard = SelectedSale.NumAtCard, DocTotal = SelectedSale.DocTotal, WhsCode = SelectedSale.WhsCode, PaymentTypeL = SelectedSale.PaymentType, CnTypeL = ClientCreditNoteType.Sale }; SalesDetailsCollection.ToList() .ForEach(pdc => { var article = ArticlesHelper.GetArticle(pdc.ItemCode); cn.RIN1_ClientCreditNoteDetail.Add( new RIN1_ClientCreditNoteDetail() { ItemCode = pdc.ItemCode, Quantity = pdc.Quantity, Price = pdc.Price, LineTotal = pdc.LineTotal, OITM_Articles = article, BaseDocNum = selectedSale.DocNum, BaseEntry = selectedSale.DocEntry, Dscription = article.ItemName, TaxCode = pdc.TaxCode, }); } ); var vm = new ClientCreditNoteViewModel { CreditNote = cn, FormTitle = "Nueva Nota de Crédito de Venta", //todo: reemplazar esto Exento = SelectedSale.INV1_SalesDetail.Any(d => d.TaxCode == Config.IVACOM), WithHolding = !Exento && SelectedSale.INV1_SalesDetail.Any(d => d.TaxCode == Config.IVARET), }; ShowDialog(new NewClientCreditNote(), vm); }
// // GET: /ESports/EVO/ public ActionResult Index(int?page) { string apiKey = System.Configuration.ConfigurationManager.AppSettings["ESportsBloggerApiKey"]; string appName = System.Configuration.ConfigurationManager.AppSettings["ESportsGoogleAppName"]; BloggerService service = new BloggerService(new Google.Apis.Services.BaseClientService.Initializer() { ApiKey = apiKey, ApplicationName = appName }); ArticlesHelper helper = new ArticlesHelper(apiKey, appName, service); List <Article> generalArticles = helper.GetArticlesFromBlog(ESportsBlogId, "ESports", 100, 1, "EVO 2016", "/Artigos/Ler/"); ViewData["articles"] = generalArticles; return(View()); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } var authResult = await _auth.AuthorizeAsync(User, Article, ArticlePolicies.CreateArticles); if (!authResult.Succeeded) { ArticlesHelper.LogFailure(_logger, Article, authResult.Failure); return(new ChallengeResult()); } _context.Articles.Add(Article); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
//private decimal GetOnHandFromProduct(OITM_Articles product) //{ // var branchArticle = product.OITW_BranchArticles.Where(p => p.ItemCode == product.ItemCode) // .Select(p => p.OnHand1); // var onHand = branchArticle.Any() ? branchArticle.FirstOrDefault().Value : (decimal)0; // return onHand; //} private void GetSelectedArticle(OITM_Articles article) { IsModalVisible = false; if (SelectedSale == null) { SelectedSale = new OINV_Sales(); } if (SelectedSale == null) { return; } var detail = new INV1_SalesDetail() { ItemCode = article.ItemCode, Price = articleChooserViewModel.ProductPriceDecimal, Quantity = articleChooserViewModel.Quantity, LineTotal = articleChooserViewModel.TotalPriceToDecimal, //todo: OITM_Articles = article OnHand = ArticlesHelper.GetOnHandFor(article.ItemCode), // GetOnHandFromProduct(article), PriceEdited = article.PriceEdited, //TaxCode = SelectedSerie!=null && SelectedSerie.Series==43 ? "IVACOF":"IVACRF",// quemado por juan Dscription = article.ItemName, }; SelectedSale.INV1_SalesDetail.Add(detail); articleChooserViewModel.CleanFields(); detailsCollection.Add(detail); RaisePropertyChanged("SalesDetailsCollection"); IsFocusedAddButton = true; if (OnSelectedArticle != null) { OnSelectedArticle(); } }
public ActionResult Ler(string year, string month, string path) { string appName = System.Configuration.ConfigurationManager.AppSettings["GoogleAppName"]; string apiKey = System.Configuration.ConfigurationManager.AppSettings["BloggerApiKey"]; BloggerService service = new BloggerService(new Google.Apis.Services.BaseClientService.Initializer() { ApiKey = apiKey, ApplicationName = appName }); ArticlesHelper helper = new ArticlesHelper( appName, apiKey, service ); Article article = helper.GetSingleArticleFromBlogByPath(NintendoBlogId, "Nintendo", "/" + year + "/" + month + "/" + path + ".html"); if (article == null) { article = helper.GetSingleArticleFromBlogByPath(EventosBlogId, "Eventos", "/" + year + "/" + month + "/" + path + ".html"); if (article == null) { article = helper.GetSingleArticleFromBlogByPath(ESportsBlogId, "ESports", "/" + year + "/" + month + "/" + path + ".html"); if (article == null) { return(Redirect("~/Ops/NaoEncontrado")); } } } ViewData["article"] = article; return(View()); }
public ActionResult Busca(string q, int?page) { ArticlesHelper helper = new ArticlesHelper(); int pageValue = page.HasValue && page.Value > 0 ? page.Value : 0; ViewData["query"] = q; ViewData["currentPage"] = pageValue; List <Article> nintendoArticles = helper.SearchArticlesInBlog(NintendoBlogId, "Nintendo", 50, (50 * pageValue) + 1, q); List <Article> eSportsArticles = helper.SearchArticlesInBlog(ESportsBlogId, "eSports", 50, (50 * pageValue) + 1, q); List <Article> eventosArticles = helper.SearchArticlesInBlog(EventosBlogId, "Eventos", 50, (50 * pageValue) + 1, q); List <Article> allArticles = new List <Article>(); allArticles.AddRange(nintendoArticles); allArticles.AddRange(eSportsArticles); allArticles.AddRange(eventosArticles); ViewData["SearchResults"] = allArticles.OrderByDescending(t => t.DatePublished).ToList(); return(View()); }
public async Task OnGet1Async() { //var authResult = await _auth.AuthorizeAsync(User, new Article(), ArticlePolicies.ListArticles); //if (!authResult.Succeeded) //{ // IsAuthorized = false; // Article = new List<Article>(); // return; //} Article = await _context.Articles.ToListAsync(); var res = Article.Select(a => new { Article = a, AuthResultTask = _auth.AuthorizeAsync(User, a, ArticlePolicies.ListArticles1), }).ToArray(); var results = await Task.WhenAll(res.Select(t => t.AuthResultTask).ToArray()); Article = res .Where(r => r.AuthResultTask.Result.Succeeded) .Select(r => r.Article) .ToList(); var denied = res .Where(r => !r.AuthResultTask.Result.Succeeded) .Select(r => new FailureDescriptor() { Article = r.Article, Failure = r.AuthResultTask.Result.Failure, }) .ToList(); ArticlesHelper.LogFailure(_logger, denied); }
public JsonResult GetRelatedPosts(string label) { ArticlesHelper helper = new ArticlesHelper(); return(Json(helper.GetArticlesFromBlog(NintendoBlogId, "Nintendo", 3, 0, label, "/Artigos/Ler/"), JsonRequestBehavior.AllowGet)); }
private void SaveNewDetails() { CurrentOperation = Operations.Save; var autorizacion = SalesDetailsCollection.ToList().Any(dc => dc.PriceEdited); if (!UserIsValid && autorizacion) { ShowUserValidatorPicker(); return; } if (SalesHelper.VerifyNumAtCard(SelectedSale)) { if (ShowWarningMessage("Numero de Factura Repetido, Desea continuar de todas formas ?")) { return; } IsBusy = IsDetailsBusy = false; return; } if (!ConfirmDialog("Desea Guardar Los Cambios", "Guardar")) { UndoChanges(); return; } // Excluir articulos no inventariables. var productsToExclude = ArticlesHelper.GetProductsOnInventory(SalesDetailsCollection.Select(d => d.ItemCode).ToList()); //.Where(p=> p.OITM_Articles.InvntItem.Contains("Y")) var isnotValid = SalesDetailsCollection.Where(p => !productsToExclude.Contains(p.ItemCode)) .Any(d => { if (d.Quantity > d.OnHand) { ErrorMessage = string.Format("El Articulo : {0} Codigo {1} ,Quedara en Negativo", d.Dscription, d.ItemCode); ShowErrorMessageBox(ErrorMessage); return(true); } ErrorMessage = string.Empty; return(false); }); if (isnotValid) { return; } if (!Exento && !WithHolding) { CheckIVACOM(true); } else { CheckIVAEXE(Exento); CheckIVARET(WithHolding); } if (!HasDownPayment) { SelectedSale.dpEntry = 0; } SalesHelper.AddSale(SelectedSale); //if (SelectedDownPayment != null) //{ // if (HasDownPayment) SelectedDownPayment.IdSaleL = SelectedSale.IdSaleL; else SelectedDownPayment.IdSaleL = null; //} SaveChanges(); // TODO validar los valores Series y NumAtCard son diferentes de null , //y considerar el caso en que los valores son 0 if (SelectedSale == null) { return; // TODO Show error Message } var serieNumber = (int)(SelectedSale.Series.HasValue? SelectedSale.Series : 0); var numAtcoard = !string.IsNullOrEmpty(SelectedSale.NumAtCard) ? Convert.ToInt32(SelectedSale.NumAtCard) : 0; CheckBookHelper.SetNextCheckBookNumber(serieNumber, numAtcoard); ViewModelManager.CloseModal(); RefreshItemSource(); }