public dynamic GetInfo(int Id) { ItemType model = new ItemType(); try { model = _itemTypeService.GetObjectById(Id); return(Json(new { model.Id, model.Name, model.Description, model.Errors }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { LOG.Error("GetInfo", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } }
public dynamic GetList(string _search, long nd, int rows, int?page, string sidx, string sord, string filters = "") { // Construct where statement string strWhere = GeneralFunction.ConstructWhere(filters); // Get Data var query = _itemService.GetAll().Where(d => d.IsDeleted == false); var list = query as IEnumerable <Item>; var pageIndex = Convert.ToInt32(page) - 1; var pageSize = rows; var totalRecords = query.Count(); var totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize); // default last page if (totalPages > 0) { if (!page.HasValue) { pageIndex = totalPages - 1; page = totalPages; } } list = list.Skip(pageIndex * pageSize).Take(pageSize); return(Json(new { total = totalPages, page = page, records = totalRecords, rows = ( from item in list select new { id = item.Id, cell = new object[] { item.Id, item.Name, item.ItemTypeId, _itemTypeService.GetObjectById(item.ItemTypeId).Name, item.Sku, item.Category, item.UoMId, _uoMService.GetObjectById(item.UoMId).Name, item.Quantity, item.PendingReceival, item.PendingDelivery, item.CreatedAt, item.UpdatedAt, } }).ToArray() }, JsonRequestBehavior.AllowGet)); }
public Item VHasItemType(Item item, IItemTypeService _itemTypeService) { ItemType itemType = _itemTypeService.GetObjectById(item.ItemTypeId); if (itemType == null) { item.Errors.Add("ItemType", "Tidak boleh tidak ada"); } return item; }
public Item VHasItemType(Item item, IItemTypeService _itemTypeService) { ItemType itemType = _itemTypeService.GetObjectById(item.ItemTypeId); if (itemType == null) { item.Errors.Add("ItemType", "Tidak boleh tidak ada"); } return(item); }
public QuantityPricing VIsValidItemType(QuantityPricing quantityPricing, IItemTypeService _itemTypeService) { ItemType itemType = _itemTypeService.GetObjectById(quantityPricing.ItemTypeId); if (itemType == null) { quantityPricing.Errors.Add("Generic", "ItemTypeId Tidak valid"); } return(quantityPricing); }
public Barring VHasItemTypeAndIsLegacy(Barring barring, IItemTypeService _itemTypeService) { ItemType itemType = _itemTypeService.GetObjectById(barring.ItemTypeId); if (itemType == null) { barring.Errors.Add("ItemTypeId", "Tidak boleh tidak ada"); } else if (!itemType.IsLegacy) { barring.Errors.Add("ItemTypeId", "Harus berupa legacy item"); } return(barring); }
public Item VHasItemTypeAndNotLegacyItem(Item item, IItemTypeService _itemTypeService) { ItemType itemType = _itemTypeService.GetObjectById(item.ItemTypeId); if (itemType == null) { item.Errors.Add("ItemType", "Tidak boleh tidak ada"); } else if (itemType.IsLegacy) { item.Errors.Add("ItemType", "Tidak boleh memilih Legacy item type"); } return(item); }
public ActionResult ReportItem(int itemTypeId = 0) { var company = _companyService.GetQueryable().FirstOrDefault(); var q = _itemService.GetQueryable().Include("ItemType").Include("UoM"); string filter = "true"; ItemType itemType = _itemTypeService.GetObjectById(itemTypeId); if (itemType != null) { filter = "ItemTypeId == " + itemTypeId.ToString(); } var query = (from model in q select new { model.Id, model.Name, model.ItemTypeId, itemtype = model.ItemType.Name, model.Sku, uom = model.UoM.Name, model.Quantity, model.SellingPrice, model.AvgPrice, model.Margin, model.PendingReceival, model.PendingDelivery, CompanyName = company.Name, CompanyAddress = company.Address, CompanyContactNo = company.ContactNo, cogs = model.AvgPrice * model.Quantity, }).Where(filter).ToList(); var rd = new ReportDocument(); //Loading Report rd.Load(Server.MapPath("~/") + "Reports/General/Item.rpt"); // Setting report data source rd.SetDataSource(query); var stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
public dynamic GetInfo(int Id) { Item model = new Item(); try { model = _itemService.GetObjectById(Id); return(Json(new { model.Id, model.Sku, model.Name, model.UoMId, UoM = _uoMService.GetObjectById(model.UoMId).Name, model.ItemTypeId, ItemType = _itemTypeService.GetObjectById(model.ItemTypeId).Name, model.Quantity, model.SellingPrice, model.PendingDelivery, model.PendingReceival, model.Category, model.Margin, model.Errors }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { LOG.Error("GetInfo", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "GetInfo Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } }
public dynamic GetList(string _search, long nd, int rows, int?page, string sidx, string sord, string filters = "") { // Construct where statement string strWhere = GeneralFunction.ConstructWhere(filters); // Get Data var query = _barringService.GetAll().Where(d => d.IsDeleted == false); var list = query as IEnumerable <Barring>; var pageIndex = Convert.ToInt32(page) - 1; var pageSize = rows; var totalRecords = query.Count(); var totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize); // default last page if (totalPages > 0) { if (!page.HasValue) { pageIndex = totalPages - 1; page = totalPages; } } list = list.Skip(pageIndex * pageSize).Take(pageSize); return(Json(new { total = totalPages, page = page, records = totalRecords, rows = ( from model in list select new { id = model.Id, cell = new object[] { model.Id, model.Name, model.Category, model.ItemTypeId, _itemTypeService.GetObjectById(model.ItemTypeId).Name, model.UoMId, _uomService.GetObjectById(model.UoMId).Name, model.Sku, model.RollNo, model.ContactId, _contactService.GetObjectById(model.ContactId).Name, model.MachineId, _machineService.GetObjectById(model.MachineId).Name, model.BlanketItemId, _itemService.GetObjectById(model.BlanketItemId).Name, model.LeftBarItemId.HasValue ? model.LeftBarItemId.Value : model.LeftBarItemId = null, model.LeftBarItemId.HasValue ? _itemTypeService.GetObjectById(model.LeftBarItemId.Value).Name : "", model.RightBarItemId.HasValue ? model.RightBarItemId.Value : model.RightBarItemId = null, model.RightBarItemId.HasValue ? _itemTypeService.GetObjectById(model.RightBarItemId.Value).Name : "", model.AC, model.AR, model.thickness, model.KS, model.Quantity, model.CreatedAt, model.UpdatedAt, } }).ToArray() }, JsonRequestBehavior.AllowGet)); }
public Maintenance VHasItemTypeByItem(Maintenance maintenance, IItemService _itemService, IItemTypeService _itemTypeService) { Item item = _itemService.GetObjectById(maintenance.ItemId); ItemType itemType = _itemTypeService.GetObjectById(item.ItemTypeId); if (itemType == null) { maintenance.Errors.Add("ItemType", "Tidak boleh tidak ada"); } return maintenance; }
public Maintenance VHasItemType(Maintenance maintenance, IItemService _itemService, IItemTypeService _itemTypeService) { ItemType itemType = _itemTypeService.GetObjectById(maintenance.ItemTypeId); if (itemType == null) { VHasItemTypeByItem(maintenance, _itemService, _itemTypeService); } return maintenance; }
public dynamic GetList(string _search, long nd, int rows, int?page, string sidx, string sord, string filters = "") { // Construct where statement string strWhere = GeneralFunction.ConstructWhere(filters); // Get Data var query = _rollerBuilderService.GetAll().Where(d => d.IsDeleted == false); var list = query as IEnumerable <RollerBuilder>; var pageIndex = Convert.ToInt32(page) - 1; var pageSize = rows; var totalRecords = query.Count(); var totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize); // default last page if (totalPages > 0) { if (!page.HasValue) { pageIndex = totalPages - 1; page = totalPages; } } list = list.Skip(pageIndex * pageSize).Take(pageSize); return(Json(new { total = totalPages, page = page, records = totalRecords, rows = ( from model in list select new { id = model.Id, cell = new object[] { model.Id, model.Name, model.Category, model.UoMId, _uomService.GetObjectById(model.UoMId).Name, model.BaseSku, model.SkuRollerUsedCore, model.SkuRollerNewCore, model.MachineId, _machineService.GetObjectById(model.MachineId).Name, model.RollerTypeId, _rollerTypeService.GetObjectById(model.RollerTypeId).Name, model.CompoundId, _itemTypeService.GetObjectById(model.CompoundId).Name, model.CoreBuilderId, _coreBuilderService.GetObjectById(model.CoreBuilderId).Name, model.RD, model.CD, model.RL, model.WL, model.TL, _itemService.GetObjectById(model.RollerUsedCoreItemId).Quantity, _itemService.GetObjectById(model.RollerNewCoreItemId).Quantity, model.CreatedAt, model.UpdatedAt, } }).ToArray() }, JsonRequestBehavior.AllowGet)); }