Esempio n. 1
0
        public void RemoveProduct(ProjectProduct projectProduct)
        {
            projectProduct.Validate();

            if (!ProjectProducts.Any(i => i.Id == projectProduct.Id))
            {
                throw new ValidationException("PROJPRODUCT-02");
            }

            ProjectProducts.Update(projectProduct);
        }
Esempio n. 2
0
        public void AddProduct(ProjectProduct projectProduct)
        {
            projectProduct.Validate();

            if (ProjectProducts.Any(i => i.Id == projectProduct.Id))
            {
                throw new ValidationException("PROJPRODUCT-01");
            }

            ProjectProducts.Add(projectProduct);
        }
Esempio n. 3
0
        public Product UpdateProjectProductQty(ProjectProducts pp)
        {
            Product pro = context.Product.FirstOrDefault(a => a.ID == pp.ProductID);

            if (pp.Quantity <= 0)
            {
                context.ProjProd.Remove(pp);
            }
            else
            {
                context.ProjProd.Update(pp);
                pro.Price   *= (pp.Quantity - pro.Quantity);
                pro.Quantity = pp.Quantity;
            }
            context.SaveChanges();

            return(pro);
        }
Esempio n. 4
0
        public int AddProjectProductId(int projectID, int productId, int qty)
        {
            ProjectProducts pd;

            if (context.ProjProd.Any(a => a.ProjectID == projectID && a.ProductID == productId) == false)
            {
                pd = new ProjectProducts()
                {
                    ProductID = productId, ProjectID = projectID, Quantity = qty
                };
                context.ProjProd.Add(pd);
            }
            else
            {
                pd = context.ProjProd.FirstOrDefault(a => a.ProjectID == projectID && a.ProductID == productId);

                pd.Quantity += qty;
                context.ProjProd.Update(pd);
            }
            return(context.SaveChanges());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtLabourHours.Text = "3";
                txtPerHourRate.Text = "150";
                txtProjectCost.Text = "0";
                txtLabourTotalCost.Text = "450";
                txtProjectTotalCost.Text = "0";
            }
            ProjectProductsBindingList.AvailableProjectProductList.Clear();
            if (Application["newProject"] != null)
            {
                List<REQProducts> lstREQProductss = (List<REQProducts>)Application["ProjectProducts"];
                ClientVehicle = Application["ClientVehicleNum"].ToString();
                Project newProject = (Project)Application["newProject"];

                foreach (ClientVehicle cv in ClientVehicleBindingList.ClientVehicleList)
                {
                    if (newProject.ClientVehicleNumber == cv.ClientVehicleNumber)
                    {
                        ClientVehicle = cv.ModelNumber;
                    }
                }
                ProjectProducts pp = new ProjectProducts();
                pp.SearchAvailableProducts(newProject.ClientVehicleNumber, ClientVehicle);
                gvwStudents.DataSource = ProjectProductsBindingList.AvailableProjectProductList;
                gvwStudents.DataBind();

                pp.SearchInstalledProducts(newProject.ClientVehicleNumber, ClientVehicle);

                GridView1.DataSource = ProjectProductsBindingList.InstalledProjectProductList;
                GridView1.DataBind();

            }
            else
            {
                Response.Redirect("./ViewProjectRequests");
            }
        }
 public IActionResult ProjProdEdit(ProjectProducts pp)
 {
     TempData["Message"] = "Product Updated";
     prodProj.UpdateProjectProductQty(pp);
     return(View("ProjectView", project.ShowProjectByID(pp.ProjectID, CLIENT)));
 }
Esempio n. 7
0
 public Product UpdateProjectProductQty(ProjectProducts pp)
 {
     throw new NotImplementedException();
 }