public IActionResult Index()
        {
            BasicSlittingDetailModel model = new BasicSlittingDetailModel
            {
                SlittingDate = DateTime.Now
            };

            ViewBag.CoreList      = SelectionList.CoreList().Select(x => new { x.CoreId, Name = x.Name + " " + x.Thickness, x.Weight });
            ViewBag.OrderList     = SelectionList.OrderList().Select(x => new { x.OrderId, x.OrderNo });
            ViewBag.TreatmentList = SelectionList.SlittingTreatmentList().Select(x => new { x.TreatmentId, x.Name });
            ViewBag.QualityList   = SelectionList.SlittingStatusList().Select(x => new { x.SlittingStatusId, x.Name });
            ViewBag.JumboList     = SelectionList.JumboList().Select(x => new { x.JumboId, x.JumboNo });

            return(View(model));
        }
Beispiel #2
0
        public IActionResult Create(string type)
        {
            BasicSlittingDetailModel model = new BasicSlittingDetailModel
            {
                IsPrimarySlitting = type == "P",
                SlittingDate      = DateTime.Now
            };

            ViewBag.CoreList      = SelectionList.CoreList().Select(x => new { x.CoreId, Name = x.Name + " " + x.Thickness, x.Weight });
            ViewBag.OrderList     = SelectionList.OrderList().Select(x => new { x.OrderId, x.OrderNo });
            ViewBag.TreatmentList = SelectionList.SlittingTreatmentList().Select(x => new { x.TreatmentId, x.Name });
            ViewBag.QualityList   = SelectionList.SlittingStatusList().Select(x => new { x.SlittingStatusId, x.Name });

            if (type == "P")
            {
                return(View("NewCreateSlitting", model));
            }
            else
            {
                return(View("CreateSecondarySlitting", model));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Method to return details of Audit History
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult AuditDetails(long id)
        {
            AuditDetailsModel model = _service.GetById(id);

            List <AuditChange> rslt = new List <AuditChange>();

            AuditChange Change = new AuditChange
            {
                DateTimeStamp       = model.DateTime.Value.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture),
                AuditActionTypeName = model.Action
            };

            var delta = JsonConvert.DeserializeObject <List <AuditDelta> >(model.Changes);

            foreach (AuditDelta objAuditDelta in delta)
            {
                if (objAuditDelta.FieldName == "ProductId")
                {
                    objAuditDelta.FieldName = "Product";

                    List <TblProduct> productList = SelectionList.ProductList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.ProductId == Convert.ToInt16(objAuditDelta.ValueBefore)).FilmType;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.ProductId == Convert.ToInt16(objAuditDelta.ValueAfter)).FilmType;
                    }
                }

                if (objAuditDelta.FieldName == "ShiftId")
                {
                    objAuditDelta.FieldName = "Shift";

                    List <TblShiftType> productList = SelectionList.ShiftTypeList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.ShiftId == Convert.ToInt16(objAuditDelta.ValueBefore)).Name;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.ShiftId == Convert.ToInt16(objAuditDelta.ValueAfter)).Name;
                    }
                }

                if (objAuditDelta.FieldName == "ShiftInchargeId")
                {
                    objAuditDelta.FieldName = "Shift Incharge";

                    List <TblUser> productList = SelectionList.UserList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.UserId == Convert.ToInt16(objAuditDelta.ValueBefore)).Name;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.UserId == Convert.ToInt16(objAuditDelta.ValueAfter)).Name;
                    }
                }

                if (objAuditDelta.FieldName == "StatusId")
                {
                    objAuditDelta.FieldName = "Status";

                    List <TblJumboStatus> productList = SelectionList.JumboStatusList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.StatusId == Convert.ToInt16(objAuditDelta.ValueBefore)).Name;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.StatusId == Convert.ToInt16(objAuditDelta.ValueAfter)).Name;
                    }
                }


                if (objAuditDelta.FieldName == "BuyerId")
                {
                    objAuditDelta.FieldName = "Buyer";

                    List <TblCustomer> productList = SelectionList.CustomerList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.CustomerId == Convert.ToInt16(objAuditDelta.ValueBefore)).Name;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.CustomerId == Convert.ToInt16(objAuditDelta.ValueAfter)).Name;
                    }
                }

                if (objAuditDelta.FieldName == "ConsigneeId")
                {
                    objAuditDelta.FieldName = "Shift";

                    List <TblConsignee> productList = SelectionList.ConsigneeList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.ConsigneeId == Convert.ToInt16(objAuditDelta.ValueBefore)).Name;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.ConsigneeId == Convert.ToInt16(objAuditDelta.ValueAfter)).Name;
                    }
                }


                if (objAuditDelta.FieldName == "CoreId")
                {
                    objAuditDelta.FieldName = "Core";

                    List <TblCore> productList = SelectionList.CoreList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.CoreId == Convert.ToInt16(objAuditDelta.ValueBefore)).Name + " " +
                                                    productList.FirstOrDefault(x => x.CoreId == Convert.ToInt16(objAuditDelta.ValueBefore)).Thickness;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.CoreId == Convert.ToInt16(objAuditDelta.ValueAfter)).Name + " " +
                                                   productList.FirstOrDefault(x => x.CoreId == Convert.ToInt16(objAuditDelta.ValueAfter)).Thickness;
                    }
                }

                if (objAuditDelta.FieldName == "TreatmentId")
                {
                    objAuditDelta.FieldName = "Treatment";

                    List <TblTreatment> productList = SelectionList.SlittingTreatmentList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.TreatmentId == Convert.ToInt16(objAuditDelta.ValueBefore)).Name;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.TreatmentId == Convert.ToInt16(objAuditDelta.ValueAfter)).Name;
                    }
                }

                if (objAuditDelta.FieldName == "JumboId")
                {
                    objAuditDelta.FieldName = "Jumbo Nr";

                    List <TblJumbo> productList = SelectionList.JumboList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.JumboId == Convert.ToInt16(objAuditDelta.ValueBefore)).JumboNo;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.JumboId == Convert.ToInt16(objAuditDelta.ValueAfter)).JumboNo;
                    }
                }

                if (objAuditDelta.FieldName == "OrderId")
                {
                    objAuditDelta.FieldName = "Order Nr";

                    List <TblOrder> productList = SelectionList.OrderList();

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueBefore))
                    {
                        objAuditDelta.ValueBefore = productList.FirstOrDefault(x => x.OrderId == Convert.ToInt16(objAuditDelta.ValueBefore)).OrderNo;
                    }

                    if (!string.IsNullOrEmpty(objAuditDelta.ValueAfter))
                    {
                        objAuditDelta.ValueAfter = productList.FirstOrDefault(x => x.OrderId == Convert.ToInt16(objAuditDelta.ValueAfter)).OrderNo;
                    }
                }
            }

            Change.Changes.AddRange(delta);
            rslt.Add(Change);

            return(PartialView("_Details", rslt));
        }