コード例 #1
0
        // GET: /ProductMaster/Create

        public ActionResult Create()
        {
            ProductShape vm = new ProductShape();

            vm.IsActive = true;
            return(View("Create", vm));
        }
コード例 #2
0
ファイル: Blob.cs プロジェクト: Carpenteri1/Warehouse
 public Blob(string id, string description, long weight, int sides)
 {
     this.id          = id;
     this.description = description;
     this.weight      = weight;
     this.sides       = sides;
     shape            = ProductShape.Blob;
 }
コード例 #3
0
 public Cube(string id, string description, long weight, bool isFragile, int sides)
 {
     this.id          = id;
     this.description = description;
     this.weight      = weight;
     this.sides       = sides;
     this.isFragile   = isFragile;
     shape            = ProductShape.Cube;
 }
コード例 #4
0
ファイル: Sphere.cs プロジェクト: Carpenteri1/Warehouse
 public Sphere(string id, string description, long weight, bool isFragile, int radius)
 {
     this.id          = id;
     this.description = description;
     this.weight      = weight;
     this.radius      = radius;
     this.isFragile   = isFragile;
     shape            = ProductShape.Sphere;
 }
コード例 #5
0
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            ProductShape pt = _ProductShapeService.Find(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            return(View("Create", pt));
        }
コード例 #6
0
ファイル: Cubeoid.cs プロジェクト: Carpenteri1/Warehouse
 public Cubeoid(string id, string description, long weight, bool isFragile, int xSide, int ySide, int zSide)
 {
     this.id          = id;
     this.description = description;
     this.weight      = weight;
     this.isFragile   = isFragile;
     this.xSide       = xSide;
     this.ySide       = ySide;
     this.zSide       = zSide;
     shape            = ProductShape.Cubeoid;
 }
コード例 #7
0
        // GET: /ProductMaster/Delete/5

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

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

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

            return(PartialView("_Reason", vm));
        }
コード例 #8
0
        public static I3DStorageObject CreatingNewProduct(ProductShape shape, string id, string description, long weight, bool isFragile, int xside, int yside, int zside)
        {
            if (shape.Equals(ProductShape.Cube))
            {
                return(new Cube(id, description, weight, isFragile, xside));
            }
            if (shape.Equals(ProductShape.Sphere))
            {
                return(new Sphere(id, description, weight, isFragile, xside));
            }
            if (shape.Equals(ProductShape.Cubeoid))
            {
                return(new Cubeoid(id, description, weight, isFragile, xside, yside, zside));
            }
            if (shape.Equals(ProductShape.Blob))
            {
                return(new Blob(id, description, weight, xside));
            }

            return(null);
        }
コード例 #9
0
        public ActionResult Post(ProductShape vm)
        {
            ProductShape pt = vm;

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

                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(View("Create", vm));
                    }

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

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

                    ProductShape temp = _ProductShapeService.Find(pt.ProductShapeId);

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

                    temp.ProductShapeName = pt.ProductShapeName;
                    temp.IsActive         = pt.IsActive;

                    temp.ModifiedDate = DateTime.Now;
                    temp.ModifiedBy   = User.Identity.Name;
                    temp.ObjectState  = Model.ObjectState.Modified;
                    _ProductShapeService.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);
                        return(View("Create", pt));
                    }

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

                    return(RedirectToAction("Index").Success("Data saved successfully"));
                }
            }

            return(View("Create", vm));
        }
コード例 #10
0
 public ProductShape Add(ProductShape pt)
 {
     _unitOfWork.Repository <ProductShape>().Insert(pt);
     return(pt);
 }
コード例 #11
0
 public void Update(ProductShape pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <ProductShape>().Update(pt);
 }
コード例 #12
0
 public void Delete(ProductShape pt)
 {
     _unitOfWork.Repository <ProductShape>().Delete(pt);
 }
コード例 #13
0
 public ProductShape Create(ProductShape pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <ProductShape>().Insert(pt);
     return(pt);
 }