Exemplo n.º 1
0
        public CartonManagementModel Delete(CartonManagementModel cartonModel)
        {
            var body = JsonConvert.SerializeObject(cartonModel);
            CartonManagementModel CartonManagementDelete = ServerResponse.Invoke <CartonManagementModel>("api/cartonManagement/delete?id=" + cartonModel.Id, body, "POST");

            return(CartonManagementDelete);
        }
        public ActionResult _Index1(CartonManagementModel search, int?page)
        {
            int TotalCount  = 0;
            var pageSize    = 10;
            var pageNumber  = page ?? 1;
            int CurrentPage = pageNumber;
            var endPage     = CurrentPage + 4;
            int PagesToShow = 10;

            ViewBag.PageSize = pageSize;
            var CartonModelList = Services.CartonManagementService.GetSearchData(search, page, out TotalCount);

            ViewBag.TotalCount = TotalCount;

            var result     = Helper.CommonFunction.GetPages(TotalCount, pageSize, CurrentPage, PagesToShow);
            int totalPages = (TotalCount / pageSize) + (TotalCount % pageSize == 0 ? 0 : 1);

            ViewBag.result      = result;
            ViewBag.totalPages  = totalPages;
            ViewBag.CurrentPage = CurrentPage;
            var pageCount = result.Count();

            ViewBag.pageCount = pageCount;
            ViewBag.endPage   = endPage;
            return(View(CartonModelList));
        }
Exemplo n.º 3
0
        public JsonResult ProductDetail1(CartonManagementModel carton)
        {
            List <CartonManagementDetailModel> model = new List <CartonManagementDetailModel>();

            model = carton.CartonManagementDetails;

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
 public ActionResult DeleteConfirmed(CartonManagementModel model)
 {
     if (model.Id > 0)
     {
         var CartonDelete = Services.CartonManagementService.Delete(model);
         TempData["Success"] = "Data Deleted Successfully!";
         return(RedirectToAction("Index", "CartonManagement"));
     }
     return(View(model));
 }
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CartonManagementModel CartonManagementModelById = Services.CartonManagementService.GetById(id);

            if (CartonManagementModelById == null)
            {
                return(HttpNotFound());
            }
            return(View(CartonManagementModelById));
        }
Exemplo n.º 6
0
        public List <CartonManagementModel> GetSearchData(CartonManagementModel search, int?page, out int TotalCount)
        {
            int pageNumber = (page ?? 1);
            var body       = JsonConvert.SerializeObject(search);
            var result     = ServerResponse.Invoke <ServiceResult <List <CartonManagementModel> > >("api/cartonManagement/getSearchData", body, "Post");

            TotalCount = result.TotalCount;

            if (result.data != null)
            {
                var model = result.data.ToList();
                return(model);
            }
            else
            {
            }
            return(result.data.ToList());
        }
        public IHttpActionResult GenerateIBT(CartonManagementModel model)
        {
            CartonManagement carton = new CartonManagement();

            carton.IBTNumber = model.IBTNumber;
            // carton.IsActive = true;
            carton.BranchID = db.Branches.Where(x => x.IsActive == true && x.Name == model.BranchName).FirstOrDefault().Id;
            DateTime today = DateTime.Today;

            carton.PackDate = today;
            //carton.CartonNumber = 0;
            carton.DistributionSummaryID = model.DistributionSummaryID;
            carton.CreatedOn             = System.DateTime.UtcNow;
            carton.UpdatedOn             = System.DateTime.UtcNow;
            db.CartonManagements.Add(carton);
            db.SaveChanges();
            return(Ok(true));
        }
Exemplo n.º 8
0
        public IHttpActionResult GenerateId(CartonManagementModel model)
        {
            CartonManagementDetail detail = new CartonManagementDetail();

            detail.CartonManagementID = model.Id;
            detail.IsActive           = true;
            detail.Z01       = detail.Z01 ?? 0;
            detail.Z02       = detail.Z02 ?? 0;
            detail.Z03       = detail.Z03 ?? 0;
            detail.Z04       = detail.Z04 ?? 0;
            detail.Z05       = detail.Z05 ?? 0;
            detail.Z06       = detail.Z06 ?? 0;
            detail.Z07       = detail.Z07 ?? 0;
            detail.Z08       = detail.Z08 ?? 0;
            detail.Z09       = detail.Z09 ?? 0;
            detail.Z10       = detail.Z10 ?? 0;
            detail.Z11       = detail.Z11 ?? 0;
            detail.Z12       = detail.Z12 ?? 0;
            detail.Z13       = detail.Z13 ?? 0;
            detail.Z14       = detail.Z14 ?? 0;
            detail.Z15       = detail.Z15 ?? 0;
            detail.Z16       = detail.Z16 ?? 0;
            detail.Z17       = detail.Z17 ?? 0;
            detail.Z18       = detail.Z18 ?? 0;
            detail.Z19       = detail.Z19 ?? 0;
            detail.Z20       = detail.Z20 ?? 0;
            detail.Z21       = detail.Z21 ?? 0;
            detail.Z22       = detail.Z22 ?? 0;
            detail.Z23       = detail.Z23 ?? 0;
            detail.Z24       = detail.Z24 ?? 0;
            detail.Z25       = detail.Z25 ?? 0;
            detail.Z26       = detail.Z26 ?? 0;
            detail.Z27       = detail.Z27 ?? 0;
            detail.Z28       = detail.Z28 ?? 0;
            detail.Z29       = detail.Z29 ?? 0;
            detail.Z30       = detail.Z30 ?? 0;
            detail.CreatedOn = System.DateTime.UtcNow;
            detail.UpdatedOn = System.DateTime.UtcNow;
            db.CartonManagementDetails.Add(detail);
            db.SaveChanges();
            return(Ok(true));
        }
        public ActionResult _Index1(CartonManagementModel search, int?page)
        {
            int TotalCount  = 0;
            var pageSize    = 10;
            var pageNumber  = page ?? 1;
            int CurrentPage = pageNumber;
            var endPage     = CurrentPage + 4;
            int PagesToShow = 10;

            ViewBag.PageSize = pageSize;
            CartonManagementStockModel model = new CartonManagementStockModel();
            var StockDistributionSummaryId   = Services.StockDistributionSummaryService.GetAllid();

            ViewBag.StockDistributionSummaryId = new SelectList(StockDistributionSummaryId, "Id", "Id");
            var BranchModelList = Services.BranchService.GetAll();

            ViewBag.BranchId = new SelectList(BranchModelList, "Id", "Name");

            var CartonManagementList = Services.CartonManagementService.GetSearchData(search, page, out TotalCount);

            if (CartonManagementList != null)
            {
                ViewBag.CartonManagementID = CartonManagementList.LastOrDefault().Id;
            }

            model.CartonList   = CartonManagementList;
            ViewBag.TotalCount = TotalCount;

            var result     = Helper.CommonFunction.GetPages(TotalCount, pageSize, CurrentPage, PagesToShow);
            int totalPages = (TotalCount / pageSize) + (TotalCount % pageSize == 0 ? 0 : 1);

            ViewBag.result      = result;
            ViewBag.totalPages  = totalPages;
            ViewBag.CurrentPage = CurrentPage;
            var pageCount = result.Count();

            ViewBag.pageCount = pageCount;

            ViewBag.endPage = endPage;
            return(View(model));
        }
        public ServiceResult <List <CartonManagement> > GetSearchData(CartonManagementModel search)
        {
            var pageSize = 10;
            ServiceResult <List <CartonManagement> > model = new ServiceResult <List <CartonManagement> >();
            var source = db.CartonManagements.Where(x => x.IsActive == true && x.TotalItems != null).Include(x => x.Branch).Include(x => x.StockDistributionSummary);

            if (search != null)
            {
                if (!string.IsNullOrEmpty(search.BranchName) && !search.BranchName.All(char.IsNumber))
                {
                    source = source.Where(m => m.Branch.Name.Contains(search.BranchName.ToLower()));
                }
                //if (search.DistributionSummaryID > 0)
                //	source = source.Where(m => m.DistributionSummaryID == search.DistributionSummaryID);
                //  var items = source.OrderBy(m => m.Id).Skip((areaSearch.Page ?? 1 - 1) * pageSize).Take(pageSize).ToList();
            }
            int count = source.Count();
            var items = source.OrderByDescending(m => m.Id).Skip(((search.Page ?? 1) - 1) * pageSize)
                        .Take(pageSize).ToList();

            model.data = items.Select(x => new CartonManagement
            {
                Id = x.Id,
                DistributionSummaryID = x.DistributionSummaryID,
                TotalItems            = x.TotalItems,
                PackDate = x.PackDate,
                BranchID = x.BranchID,
                Branch   = x.Branch,
                CartonManagementDetails  = db.CartonManagementDetails.Where(k => k.CartonManagementID == x.Id).ToList(),
                StockDistributionSummary = x.StockDistributionSummary,
                CartonNumber             = x.CartonNumber,
                IBTNumber    = x.IBTNumber,
                IsDispatched = x.IsDispatched,
            }).ToList();
            model.TotalCount = count;
            return(model);
        }
Exemplo n.º 11
0
        public JsonResult StartPacking(string BranchName, int DistributionSummaryID)
        {
            CartonManagementModel CM = new CartonManagementModel();

            CM.BranchName = BranchName;
            var list = Services.IBTService.GetIBTNumber();
            var IBT  = Services.IBTService.GetIBTNumber().LastOrDefault();

            CM.IBTNumber = CommonFunction.IBtNo(list);
            //  var Summary = Services.IBTService.GetBySummaryId(DistributionSummaryID);
            if (DistributionSummaryID != null)
            {
                var SummaryId = DistributionSummaryID;

                //ViewBag.SummaryId = SummaryId;
                CM.DistributionSummaryID = SummaryId;
                //Session["ReceiveOrder"] = RO.ReceiptNumber;
                var createCartonManagement = Services.IBTService.CreateCartonManagement(CM);

                var c = Services.CartonManagementService.GetAllDetail(SummaryId);
                if (c.Count != 0)
                {
                    var cd1 = c.Where(x => x.DistributionSummaryID == SummaryId);
                    var cd  = cd1.LastOrDefault().CartonNumber;
                    IBT.CartonNumber = cd + 1;
                }
                else
                {
                    IBT.CartonNumber = 1;
                }
            }
            //bool createCartonDetail = Services.IBTService.CreateCartonDetail1(IBT);
            return(Json(IBT, JsonRequestBehavior.AllowGet));

            // return RedirectToAction("Index", "IBTCarton");
        }
        public ServiceResult <List <CartonManagement> > GetSearchDataReport(CartonManagementModel search)
        {
            var pageSize = 10;

            ServiceResult <List <CartonManagement> > model = new ServiceResult <List <CartonManagement> >();
            var source = db.CartonManagements.Where(x => x.IsActive == true && x.TotalItems != null).Include(x => x.Branch).Include(x => x.StockDistributionSummary);

            if (search != null)
            {
                if (search.BranchID > 0)
                {
                    source = source.Where(m => m.BranchID == search.BranchID);
                }
                if (search.DistributionSummaryID > 0)
                {
                    source = source.Where(m => m.DistributionSummaryID == search.DistributionSummaryID);
                }
                //  var items = source.OrderBy(m => m.Id).Skip((areaSearch.Page ?? 1 - 1) * pageSize).Take(pageSize).ToList();
            }
            int count = source.Count();
            var items = source.OrderByDescending(m => m.Id).Skip(((search.Page ?? 1) - 1) * pageSize)
                        .Take(pageSize).ToList();

            model.data = items.Select(x => new CartonManagement
            {
                Id = x.Id,
                DistributionSummaryID = x.DistributionSummaryID,
                TotalItems            = x.TotalItems,
                PackDate = x.PackDate,
                BranchID = x.BranchID,
                Branch   = x.Branch,
                StockDistributionSummary = db.StockDistributionSummaries.Where(m => m.Id == x.DistributionSummaryID).FirstOrDefault(),
            }).ToList();
            model.TotalCount = count;
            return(model);
        }
Exemplo n.º 13
0
        //public ActionResult Start(CartonManagementModel CartonMangement, int? StockDistributionSummaryId, int? BranchId)
        //{
        //    bool status = Services.CartonManagementService.Create(CartonMangement);

        //    return View();
        //}

        public ActionResult Create(CartonManagementModel CartonMangement, int?StockDistributionSummaryId, int?BranchId)
        {
            // bool status = Services.CartonManagementService.Create(CartonMangement);
            var carton = Services.CartonManagementService.GetAll();

            ViewBag.TotalItems = carton.FirstOrDefault().TotalItems;
            var CartonManagement   = Services.CartonManagementService.GetAll();
            var CartonManagementID = CartonManagement.LastOrDefault().Id;

            ViewBag.CartonManagementID = CartonManagementID;
            var list  = Services.CartonManagementDetailService.GetAll();
            var list2 = list.Where(x => x.CartonManagementID == CartonManagementID);
            int?Total = 0;

            foreach (var item in list2)
            {
                Total += item.Total;
            }
            ViewBag.Total = Total;
            var ProductList = Services.StockDistributionService.GetProducts(StockDistributionSummaryId, BranchId);

            ViewBag.ProductID = new SelectList(ProductList, "ProductId", "ProductName");
            return(View());
        }
Exemplo n.º 14
0
 public bool CompleteCreate(CartonManagementModel model)
 {
     return(ServerResponse.Invoke <bool>("api/cartonManagement/completeCreate", JsonConvert.SerializeObject(model), "POST"));
 }
Exemplo n.º 15
0
 public bool CreateCartonDetail1(CartonManagementModel model)
 {
     return(ServerResponse.Invoke <bool>("api/cartonManagementDetail/GenerateDetailId", JsonConvert.SerializeObject(model), "POST"));
 }
Exemplo n.º 16
0
        public ActionResult CreateA(CartonManagementModel model)
        {
            var create = Services.IBTService.CompleteCreate(model);

            return(RedirectToAction("Index", "IBTCarton"));
        }
Exemplo n.º 17
0
 public bool Edit(CartonManagementModel carton)
 {
     return(ServerResponse.Invoke <bool>("api/cartonManagement/edit?id=" + carton.Id, JsonConvert.SerializeObject(carton), "POST"));
 }