Exemplo n.º 1
0
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            Dimension2          D1 = _Dimension2Service.Find(id);
            Dimension2ViewModel pt = Mapper.Map <Dimension2, Dimension2ViewModel>(D1);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            ViewBag.id   = pt.ProductTypeId;
            ViewBag.Name = new ProductTypeService(_unitOfWork).Find(pt.ProductTypeId ?? 0).ProductTypeName;

            if (pt.ProductTypeId != null)
            {
                var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument((int)pt.ProductTypeId);

                if (settings == null && UserRoles.Contains("SysAdmin"))
                {
                    return(RedirectToAction("Create", "ProductTypeSettings", new { id = id }).Warning("Please create Product Type Settings"));
                }
                else if (settings == null && !UserRoles.Contains("SysAdmin"))
                {
                    return(View("~/Views/Shared/InValidSettings.cshtml"));
                }
                pt.ProductTypeSettings = Mapper.Map <ProductTypeSettings, ProductTypeSettingsViewModel>(settings);
            }

            return(View("Create", pt));
        }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     renderer1 = Dimension1.GetComponent <TilemapRenderer>();
     renderer2 = Dimension2.GetComponent <TilemapRenderer>();
     collider1 = Dimension1.GetComponent <CompositeCollider2D>();
     collider2 = Dimension2.GetComponent <CompositeCollider2D>();
     GrayscaleToggle(renderer2, collider2);
     audioSource = GetComponent <AudioSource>();
 }
Exemplo n.º 3
0
        // GET: /ProductMaster/Delete/5

        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Dimension2 Dimension2 = _Dimension2Service.Find(id);

            if (Dimension2 == null)
            {
                return(HttpNotFound());
            }

            ReasonViewModel vm = new ReasonViewModel()
            {
                id = id,
            };

            return(PartialView("_Reason", vm));
        }
Exemplo n.º 4
0
 public void Update(Dimension2 pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <Dimension2>().Update(pt);
 }
Exemplo n.º 5
0
 public void Delete(Dimension2 pt)
 {
     _unitOfWork.Repository <Dimension2>().Delete(pt);
 }
Exemplo n.º 6
0
 public Dimension2 Create(Dimension2 pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <Dimension2>().Insert(pt);
     return(pt);
 }
Exemplo n.º 7
0
 public Dimension2 Add(Dimension2 pt)
 {
     _unitOfWork.Repository <Dimension2>().Insert(pt);
     return(pt);
 }
Exemplo n.º 8
0
        public ActionResult Post(Dimension2ViewModel vm)
        {
            Dimension2 pt = Mapper.Map <Dimension2ViewModel, Dimension2>(vm);

            if (ModelState.IsValid)
            {
                if (vm.Dimension2Id <= 0)
                {
                    pt.CreatedDate  = DateTime.Now;
                    pt.ModifiedDate = DateTime.Now;
                    pt.CreatedBy    = User.Identity.Name;
                    pt.ModifiedBy   = User.Identity.Name;
                    pt.ObjectState  = Model.ObjectState.Added;
                    _Dimension2Service.Create(pt);

                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        ViewBag.id   = vm.ProductTypeId;
                        ViewBag.Name = new ProductTypeService(_unitOfWork).Find(vm.ProductTypeId ?? 0).ProductTypeName;
                        return(View("Create", vm));
                    }

                    LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId    = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Dimension2).DocumentTypeId,
                        DocId        = pt.Dimension2Id,
                        ActivityType = (int)ActivityTypeContants.Added,
                    }));

                    return(RedirectToAction("Create", new { id = vm.ProductTypeId }).Success("Data saved successfully"));
                }
                else
                {
                    List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

                    Dimension2 temp = _Dimension2Service.Find(pt.Dimension2Id);

                    Dimension2 ExRec = Mapper.Map <Dimension2>(temp);

                    temp.Dimension2Name = pt.Dimension2Name;
                    temp.IsActive       = pt.IsActive;
                    temp.Description    = pt.Description;
                    temp.ModifiedDate   = DateTime.Now;
                    temp.ModifiedBy     = User.Identity.Name;
                    temp.ObjectState    = Model.ObjectState.Modified;
                    _Dimension2Service.Update(temp);

                    LogList.Add(new LogTypeViewModel
                    {
                        ExObj = ExRec,
                        Obj   = temp,
                    });
                    XElement Modifications = new ModificationsCheckService().CheckChanges(LogList);

                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        ViewBag.id   = pt.ProductTypeId;
                        ViewBag.Name = new ProductTypeService(_unitOfWork).Find(pt.ProductTypeId ?? 0).ProductTypeName;
                        return(View("Create", pt));
                    }

                    LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId       = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Dimension2).DocumentTypeId,
                        DocId           = temp.Dimension2Id,
                        ActivityType    = (int)ActivityTypeContants.Modified,
                        xEModifications = Modifications,
                    }));

                    return(RedirectToAction("Index", new { id = pt.ProductTypeId }).Success("Data saved successfully"));
                }
            }
            ViewBag.id   = vm.ProductTypeId;
            ViewBag.Name = new ProductTypeService(_unitOfWork).Find(vm.ProductTypeId ?? 0).ProductTypeName;
            return(View("Create", vm));
        }
Exemplo n.º 9
0
 public void Delete(Dimension2 pt)
 {
     _Dimension2Repository.Delete(pt);
 }
Exemplo n.º 10
0
 public Dimension2 Create(Dimension2 pt)
 {
     pt.ObjectState = ObjectState.Added;
     _Dimension2Repository.Insert(pt);
     return(pt);
 }
Exemplo n.º 11
0
 public Dimension2 Add(Dimension2 pt)
 {
     _Dimension2Repository.Insert(pt);
     return(pt);
 }
Exemplo n.º 12
0
 public void Update(Dimension2 pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _Dimension2Repository.Update(pt);
 }
Exemplo n.º 13
0
        public IEnumerable <SaleQuotationLineViewModel> GetSaleEnquiriesForFilters(SaleQuotationLineFilterViewModel vm)
        {
            byte?UnitConvForId = new SaleQuotationHeaderService(_unitOfWork).Find(vm.SaleQuotationHeaderId).UnitConversionForId;

            var SaleQuotation = new SaleQuotationHeaderService(_unitOfWork).Find(vm.SaleQuotationHeaderId);

            var Settings = new SaleQuotationSettingsService(_unitOfWork).GetSaleQuotationSettingsForDocument(SaleQuotation.DocTypeId, SaleQuotation.DivisionId, SaleQuotation.SiteId);



            string[] ProductIdArr = null;
            if (!string.IsNullOrEmpty(vm.ProductId))
            {
                ProductIdArr = vm.ProductId.Split(",".ToCharArray());
            }
            else
            {
                ProductIdArr = new string[] { "NA" };
            }

            string[] SaleOrderIdArr = null;
            if (!string.IsNullOrEmpty(vm.SaleEnquiryHeaderId))
            {
                SaleOrderIdArr = vm.SaleEnquiryHeaderId.Split(",".ToCharArray());
            }
            else
            {
                SaleOrderIdArr = new string[] { "NA" };
            }

            string[] Dimension1 = null;
            if (!string.IsNullOrEmpty(vm.Dimension1Id))
            {
                Dimension1 = vm.Dimension1Id.Split(",".ToCharArray());
            }
            else
            {
                Dimension1 = new string[] { "NA" };
            }

            string[] Dimension2 = null;
            if (!string.IsNullOrEmpty(vm.Dimension2Id))
            {
                Dimension2 = vm.Dimension2Id.Split(",".ToCharArray());
            }
            else
            {
                Dimension2 = new string[] { "NA" };
            }


            string[] Dimension3 = null;
            if (!string.IsNullOrEmpty(vm.Dimension3Id))
            {
                Dimension3 = vm.Dimension3Id.Split(",".ToCharArray());
            }
            else
            {
                Dimension3 = new string[] { "NA" };
            }

            string[] Dimension4 = null;
            if (!string.IsNullOrEmpty(vm.Dimension4Id))
            {
                Dimension4 = vm.Dimension4Id.Split(",".ToCharArray());
            }
            else
            {
                Dimension4 = new string[] { "NA" };
            }

            string[] ProductGroupIdArr = null;
            if (!string.IsNullOrEmpty(vm.ProductGroupId))
            {
                ProductGroupIdArr = vm.ProductGroupId.Split(",".ToCharArray());
            }
            else
            {
                ProductGroupIdArr = new string[] { "NA" };
            }



            if (!string.IsNullOrEmpty(vm.DealUnitId))
            {
                Unit Dealunit = new UnitService(_unitOfWork).Find(vm.DealUnitId);

                var temp = (from p in db.ViewSaleEnquiryBalanceForQuotation
                            join t in db.SaleEnquiryHeader on p.SaleEnquiryHeaderId equals t.SaleEnquiryHeaderId into table
                            from tab in table.DefaultIfEmpty()
                            join product in db.Product on p.ProductId equals product.ProductId into table2
                            join t1 in db.SaleEnquiryLine on p.SaleEnquiryLineId equals t1.SaleEnquiryLineId into table1
                            from tab1 in table1.DefaultIfEmpty()
                            from tab2 in table2.DefaultIfEmpty()
                            join t3 in db.UnitConversion on new { p1 = p.ProductId, DU1 = vm.DealUnitId, U1 = UnitConvForId ?? 0 } equals new { p1 = t3.ProductId ?? 0, DU1 = t3.ToUnitId, U1 = t3.UnitConversionForId } into table3
                            join FP in db.FinishedProduct on p.ProductId equals FP.ProductId into tableFinishedProduct
                            from tabFinishedProduct in tableFinishedProduct.DefaultIfEmpty()
                            from tab3 in table3.DefaultIfEmpty()
                            where (string.IsNullOrEmpty(vm.ProductId) ? 1 == 1 : ProductIdArr.Contains(p.ProductId.ToString())) &&
                            (string.IsNullOrEmpty(vm.SaleEnquiryHeaderId) ? 1 == 1 : SaleOrderIdArr.Contains(p.SaleEnquiryHeaderId.ToString())) &&
                            (string.IsNullOrEmpty(vm.Dimension1Id) ? 1 == 1 : Dimension1.Contains(p.Dimension1Id.ToString())) &&
                            (string.IsNullOrEmpty(vm.Dimension2Id) ? 1 == 1 : Dimension2.Contains(p.Dimension2Id.ToString())) &&
                            (string.IsNullOrEmpty(vm.Dimension3Id) ? 1 == 1 : Dimension3.Contains(p.Dimension3Id.ToString())) &&
                            (string.IsNullOrEmpty(vm.Dimension4Id) ? 1 == 1 : Dimension4.Contains(p.Dimension4Id.ToString())) &&
                            (string.IsNullOrEmpty(vm.ProductGroupId) ? 1 == 1 : ProductGroupIdArr.Contains(tab2.ProductGroupId.ToString())) &&
                            p.BalanceQty > 0
                            orderby tab.DocDate, tab.DocNo
                            select new SaleQuotationLineViewModel
                {
                    Dimension1Name = tab1.Dimension1.Dimension1Name,
                    Dimension2Name = tab1.Dimension2.Dimension2Name,
                    Dimension3Name = tab1.Dimension3.Dimension3Name,
                    Dimension4Name = tab1.Dimension4.Dimension4Name,
                    Dimension1Id = p.Dimension1Id,
                    Dimension2Id = p.Dimension2Id,
                    Dimension3Id = p.Dimension3Id,
                    Dimension4Id = p.Dimension4Id,
                    Specification = tab1.Specification,
                    SaleEnquiryBalanceQty = p.BalanceQty,
                    Qty = p.BalanceQty,
                    Rate = vm.Rate,
                    ProductName = tab2.ProductName,
                    ProductId = p.ProductId,
                    SaleQuotationHeaderId = vm.SaleQuotationHeaderId,
                    SaleEnquiryLineId = p.SaleEnquiryLineId,
                    UnitId = tab2.UnitId,
                    SaleEnquiryDocNo = p.SaleEnquiryNo,
                    DealUnitId = (vm.DealUnitId),
                    UnitConversionMultiplier = Math.Round((tab3 == null ? 1 : tab3.ToQty / tab3.FromQty), (tab3 == null ? tab2.Unit.DecimalPlaces : Dealunit.DecimalPlaces)),
                    UnitDecimalPlaces = tab2.Unit.DecimalPlaces,
                    DealUnitDecimalPlaces = (tab3 == null ? tab2.Unit.DecimalPlaces : Dealunit.DecimalPlaces)
                });
                return(temp);
            }
            else
            {
                var temp = (from p in db.ViewSaleEnquiryBalanceForQuotation
                            join t in db.SaleEnquiryHeader on p.SaleEnquiryHeaderId equals t.SaleEnquiryHeaderId into table
                            from tab in table.DefaultIfEmpty()
                            join product in db.Product on p.ProductId equals product.ProductId into table2
                            join t1 in db.SaleEnquiryLine on p.SaleEnquiryLineId equals t1.SaleEnquiryLineId into table1
                            from tab1 in table1.DefaultIfEmpty()
                            from tab2 in table2.DefaultIfEmpty()
                            join FP in db.FinishedProduct on p.ProductId equals FP.ProductId into tableFinishedProduct
                            from tabFinishedProduct in tableFinishedProduct.DefaultIfEmpty()
                            where (string.IsNullOrEmpty(vm.ProductId) ? 1 == 1 : ProductIdArr.Contains(p.ProductId.ToString())) &&
                            (string.IsNullOrEmpty(vm.SaleEnquiryHeaderId) ? 1 == 1 : SaleOrderIdArr.Contains(p.SaleEnquiryHeaderId.ToString())) &&
                            (string.IsNullOrEmpty(vm.Dimension1Id) ? 1 == 1 : Dimension1.Contains(p.Dimension1Id.ToString())) &&
                            (string.IsNullOrEmpty(vm.Dimension2Id) ? 1 == 1 : Dimension2.Contains(p.Dimension2Id.ToString())) &&
                            (string.IsNullOrEmpty(vm.Dimension3Id) ? 1 == 1 : Dimension3.Contains(p.Dimension3Id.ToString())) &&
                            (string.IsNullOrEmpty(vm.Dimension4Id) ? 1 == 1 : Dimension4.Contains(p.Dimension4Id.ToString())) &&
                            (string.IsNullOrEmpty(vm.ProductGroupId) ? 1 == 1 : ProductGroupIdArr.Contains(tab2.ProductGroupId.ToString())) &&
                            p.BalanceQty > 0
                            select new SaleQuotationLineViewModel
                {
                    Dimension1Name = tab1.Dimension1.Dimension1Name,
                    Dimension1Id = p.Dimension1Id,
                    Dimension2Name = tab1.Dimension2.Dimension2Name,
                    Dimension2Id = p.Dimension2Id,
                    Dimension3Name = tab1.Dimension3.Dimension3Name,
                    Dimension3Id = p.Dimension3Id,
                    Dimension4Name = tab1.Dimension4.Dimension4Name,
                    Dimension4Id = p.Dimension4Id,
                    Specification = tab1.Specification,
                    SaleEnquiryBalanceQty = p.BalanceQty,
                    Qty = p.BalanceQty,
                    Rate = vm.Rate,
                    SaleEnquiryDocNo = tab.DocNo,
                    ProductName = tab2.ProductName,
                    ProductId = p.ProductId,
                    SaleQuotationHeaderId = vm.SaleQuotationHeaderId,
                    SaleEnquiryLineId = p.SaleEnquiryLineId,
                    UnitId = tab2.UnitId,
                    DealUnitId = tab2.UnitId,
                    UnitConversionMultiplier = 1,
                    UnitDecimalPlaces = tab2.Unit.DecimalPlaces,
                    DealUnitDecimalPlaces = tab2.Unit.DecimalPlaces,
                }

                            );
                return(temp);
            }
        }
Exemplo n.º 14
0
 public IEnumerable <EpsgAxisSet> ReadAllValues()
 {
     return(Dimension1.ReadAllValues()
            .Concat(Dimension2.ReadAllValues())
            .Concat(Dimension3.ReadAllValues()));
 }
Exemplo n.º 15
0
 public EpsgAxisSet GetSetByCsKey(ushort key)
 {
     return(Dimension2.GetByKey(key)
            ?? Dimension3.GetByKey(key)
            ?? Dimension1.GetByKey(key));
 }