public ActionResult Edit(int id)
 {
     ViewBag.CustomerList     = SelectionList.CustomerList().Select(m => new { m.CustomerId, m.CustomerName });
     ViewBag.MachineTypeList  = SelectionList.MachineTypeList().Select(m => new { m.MachineTypeId, m.MachineTypeName });
     ViewBag.MachineModelList = SelectionList.MachineModelsList().Select(m => new { m.MachineModelId, m.MachineName });
     return(View("Create", _dbRepository.SelectById(id)));
 }
 public ActionResult Index()
 {
     ViewBag.CustomerList     = SelectionList.CustomerList().Select(m => new { m.CustomerId, m.CustomerName });
     ViewBag.MachineTypeList  = SelectionList.MachineTypeList().Select(m => new { m.MachineTypeId, m.MachineTypeName });
     ViewBag.MachineModelList = SelectionList.MachineModelsList().Select(m => new { m.MachineModelId, m.MachineName });
     return(View());
 }
 public IActionResult Index()
 {
     ViewBag.CustomerList    = SelectionList.CustomerList().Select(x => new { x.CustomerId, x.Name });
     ViewBag.ConsigneeList   = SelectionList.ConsigneeList().Select(x => new { x.ConsigneeId, x.Name });
     ViewBag.OrderStatusList = SelectionList.OrderStatusList().Select(x => new { x.OrderStatusId, x.Name });
     return(View());
 }
 public ActionResult Create()
 {
     ViewBag.CustomerList     = SelectionList.CustomerList().Select(m => new { m.CustomerId, m.CustomerName });
     ViewBag.MachineTypeList  = SelectionList.MachineTypeList().Select(m => new { m.MachineTypeId, m.MachineTypeName });
     ViewBag.MachineModelList = SelectionList.MachineModelsList().Select(m => new { m.MachineModelId, m.MachineName });
     return(View(new tblAMCQuotation {
         QuotationDate = DateTime.Now.Date
     }));
 }
        public ActionResult SaveModelData(tblAMCQuotation model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.CustomerList     = SelectionList.CustomerList().Select(m => new { m.CustomerId, m.CustomerName });
                ViewBag.MachineTypeList  = SelectionList.MachineTypeList().Select(m => new { m.MachineTypeId, m.MachineTypeName });
                ViewBag.MachineModelList = SelectionList.MachineModelsList().Select(m => new { m.MachineModelId, m.MachineName });
                return(View("Create", model));
            }

            string message = string.Empty;

            try
            {
                model.CGSTPercentage     = model.GSTPercentage / 2;
                model.CGSTAmount         = model.GSTAmount / 2;
                model.TotalAmountInWords = CurrencyHelper.changeCurrencyToWords(model.TotalAmount);
                if (model.Id > 0)
                {
                    model.ModifiedBy   = SessionHelper.UserId;
                    model.ModifiedDate = DateTime.Now;
                    message            = _dbRepository.Update(model);
                }
                else
                {
                    model.CreatedBy   = SessionHelper.UserId;
                    model.CreatedDate = DateTime.Now;
                    message           = _dbRepository.Insert(model);
                }
            }
            catch (Exception ex)
            {
                message = CommonHelper.GetErrorMessage(ex);
            }

            return(RedirectToAction("Index"));
        }
Exemple #6
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));
        }