Exemplo n.º 1
0
        public ActionResult Edit(string id)
        {
            ItemModel model = ItemHelper.GetItem(id);

            if (model.COGSCodeCombination == null)
            {
                model.COGSCodeCombination = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value)
                                            .Select(x => new SelectListItem
                {
                    Text  = Utility.Stringize(".", x.Segment1, x.Segment2, x.Segment3, x.Segment4, x.Segment5, x.Segment6, x.Segment7, x.Segment8),
                    Value = x.Id.ToString()
                }).ToList();
                model.COGSCodeCombinationId = model.COGSCodeCombination.Any() ?
                                              Convert.ToInt32(model.COGSCodeCombination.First().Value) : 0;
            }

            if (model.SalesCodeCombination == null)
            {
                model.SalesCodeCombination = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value)
                                             .Select(x => new SelectListItem
                {
                    Text  = Utility.Stringize(".", x.Segment1, x.Segment2, x.Segment3, x.Segment4, x.Segment5, x.Segment6, x.Segment7, x.Segment8),
                    Value = x.Id.ToString()
                }).ToList();
                model.SalesCodeCombinationId = model.SalesCodeCombination.Any() ?
                                               Convert.ToInt32(model.SalesCodeCombination.First().Value) : 0;
            }

            model.ItemWarehouses = ItemHelper.GetItemWarehouses(id).ToList();
            model.SOBId          = SessionHelper.SOBId;
            model.CompanyId      = AuthenticationHelper.CompanyId.Value;
            SessionHelper.Item   = model;

            return(View("Create", model));
        }
Exemplo n.º 2
0
        public ActionResult Index(WithholdingListModel model, string message = "")
        {
            ViewBag.ErrorMessage = message;
            model.SOBId          = SessionHelper.SOBId;
            if (model.CodeCombinition == null)
            {
                model.CodeCombinition = CodeCombinationHelper.GetCodeCombinations(model.SOBId, AuthenticationHelper.CompanyId.Value)
                                        .Select(x => new SelectListItem
                {
                    Text  = Utility.Stringize(".", x.Segment1, x.Segment2, x.Segment3, x.Segment4, x.Segment5, x.Segment6, x.Segment7, x.Segment8),
                    Value = x.Id.ToString()
                }).ToList();
            }
            model.CodeCombinitionId = model.CodeCombinitionId > 0 ? model.CodeCombinitionId : model.CodeCombinition != null?model.CodeCombinition.Count() > 0 ? Convert.ToInt64(model.CodeCombinition[0].Value.ToString()) : 0 : 0;

            if (model.Vendor == null)
            {
                model.Vendor = VendorHelper.GetAll()
                               .Select(x => new SelectListItem
                {
                    Text  = x.Name,
                    Value = x.Id.ToString()
                }).ToList();
            }
            model.VendorId = model.VendorId > 0 ? model.VendorId : model.Vendor != null?model.Vendor.Count() > 0 ? Convert.ToInt64(model.Vendor[0].Value.ToString()) : 0 : 0;

            SessionHelper.VendorId          = model.VendorId;
            SessionHelper.CodeCombinitionId = model.CodeCombinitionId;

            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult Edit(string id)
        {
            AccountCreateViewModel model = AccountHelper.GetAccount(id);

            List <AccountValueViewModel> accountValues = AccountValueHelper.GetAccountValuesbyChartId(Convert.ToInt64(id), SessionHelper.SOBId);

            if (accountValues.Any())
            {
                throw new Exception("Edit Error", new Exception {
                    Source = "Accounts having values cannot be edited"
                });
            }

            List <Core.Entities.CodeCombinition> codeCombinitions = CodeCombinationHelper.GetCodeCombinations(model.SOBId, AuthenticationHelper.CompanyId.Value);

            if (codeCombinitions.Any())
            {
                throw new Exception("Edit Error", new Exception {
                    Source = "Accounts having code combinitions cannot be edited"
                });
            }

            model.SOBId = SessionHelper.SOBId;
            return(View(model));
        }
        public ActionResult GetCodeCombinitionList()
        {
            CodeCombinitionListModel model = new CodeCombinitionListModel();

            model.SOBId            = SessionHelper.SOBId;
            model.CodeCombinitions = CodeCombinationHelper.GetCodeCombinations(model);
            return(PartialView("_List", model));
        }
        private List <SelectListItem> getCodeCombinationList(long sobId)
        {
            List <SelectListItem> list = CodeCombinationHelper.GetCodeCombinations(sobId, AuthenticationHelper.CompanyId.Value)
                                         .Select(x => new SelectListItem
            {
                Text  = Utility.Stringize(".", x.Segment1, x.Segment2, x.Segment3, x.Segment4, x.Segment5, x.Segment6, x.Segment7, x.Segment8),
                Value = x.Id.ToString()
            }).ToList();

            return(list);
        }
Exemplo n.º 6
0
        public ActionResult Create()
        {
            ItemModel model = SessionHelper.Item;

            if (model == null)
            {
                model = new ItemModel
                {
                    SOBId = SessionHelper.SOBId
                };
                if (model.COGSCodeCombination == null)
                {
                    model.COGSCodeCombination = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value)
                                                .Select(x => new SelectListItem
                    {
                        Text  = Utility.Stringize(".", x.Segment1, x.Segment2, x.Segment3, x.Segment4, x.Segment5, x.Segment6, x.Segment7, x.Segment8),
                        Value = x.Id.ToString()
                    }).ToList();
                    model.COGSCodeCombinationId = model.COGSCodeCombination.Any() ?
                                                  Convert.ToInt32(model.COGSCodeCombination.First().Value) : 0;
                }

                if (model.SalesCodeCombination == null)
                {
                    model.SalesCodeCombination = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value)
                                                 .Select(x => new SelectListItem
                    {
                        Text  = Utility.Stringize(".", x.Segment1, x.Segment2, x.Segment3, x.Segment4, x.Segment5, x.Segment6, x.Segment7, x.Segment8),
                        Value = x.Id.ToString()
                    }).ToList();
                    model.SalesCodeCombinationId = model.SalesCodeCombination.Any() ?
                                                   Convert.ToInt32(model.SalesCodeCombination.First().Value) : 0;
                }
                model.CompanyId = AuthenticationHelper.CompanyId.Value;
                ViewBag.SOBName = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name;

                SessionHelper.Item = model;
                if (SessionHelper.Item.ItemWarehouses == null)
                {
                    SessionHelper.Item.ItemWarehouses = new List <ItemWarehouseModel>();
                }
            }

            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult Delete(string id)
        {
            List <AccountValueViewModel> accountValues = AccountValueHelper.GetAccountValuesbyChartId(Convert.ToInt64(id), SessionHelper.SOBId);

            if (accountValues.Any())
            {
                throw new Exception("Delete Error", new Exception {
                    Source = "Accounts having values cannot be deleted"
                });
            }

            List <Core.Entities.CodeCombinition> codeCombinitions = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value);

            if (codeCombinitions.Any())
            {
                throw new Exception("Delete Error", new Exception {
                    Source = "Accounts having code combinitions cannot be edited"
                });
            }

            AccountHelper.Delete(id);
            return(RedirectToAction("Index"));
        }
 public ActionResult Index(long id, CodeCombinitionListModel model)
 {
     model.SOBId            = id;
     model.CodeCombinitions = CodeCombinationHelper.GetCodeCombinations(model);
     return(View(model));
 }