/*
        Metodo para actualizar un producto
        */
        private void updateProcessGroupAux()
        {
            if (HttpContext.Current.Session["ProductId"] != null)
            {
                string value = ValueProduct.Text;
                if (value != "")
                {
                    ProcessService processService = new ProcessService();
                    ProductUpdateView ProductsView = new ProductUpdateView();

                    String reason = Session["reason"].ToString();
                    String user = Context.User.Identity.Name;
                    AuditDataFromWeb audit = new AuditDataFromWeb();
                    audit.Reason = reason;
                    audit.StationIP = General.getIp(this.Page);
                    audit.UserName = user;

                    ProductsView.ProductLineId = Int32.Parse(HttpContext.Current.Session["ProductId"].ToString());
                    ProductsView.ProductLineName = value;

                    CUDView crud = processService.updateProduct(ProductsView,audit);

                    if (crud.update == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Value')", true);
                    }
                    else
                    {
                        ValueProduct.Text = "";
                        fillProductGroupTable();
                        updateProductModal.Update();
                    }
                    HttpContext.Current.Session["operation"] = "create";
                    showProductModal();
                }
            }
        }
Esempio n. 2
0
        /*Funcion: actualizar productos
          Param: ProductUpdateView,AuditDataFromWeb
          Return: Lista Units
          */
        public CUDView updateProduct(ProductUpdateView product, AuditDataFromWeb audit)
        {
            CUDView logic = new CUDView();
            AuditDao auditDao = new AuditDao();
            DataTable auditDaoResult = auditDao.getProductsOldValues(product.ProductLineId);
            String OldValues = "ProductId: " + product.ProductLineId;

            foreach (DataRow row in auditDaoResult.Rows)
            {
                if (auditDaoResult.Columns.Contains("Product") && row["Product"] != DBNull.Value) { OldValues = OldValues + ", Product: " + row["Product"].ToString(); }
            }

            ProcessDao Dao = new ProcessDao();
            String state = Dao.updateProduct(product);
            logic=CUDVerifyLogic.verifierInsertDeleteUpdate("update", state);

            if (logic.update == true)
            {
                AuditService auditservice = new AuditService();
                String Action = "Update Product";
                String newValues = "ProductId: " + product.ProductLineId;
                newValues = newValues + ", Product: " + product.ProductLineName;

                auditservice.formUpdate(Action, newValues, OldValues, audit);
            }

            return logic;
        }
Esempio n. 3
0
 /*
   Funcion: Actualiza un producto
   Param: productLineId,ProductLineName
   Return: Status
   */
 public String updateProduct(ProductUpdateView product)
 {
     return context.InsertUpdateDeleteMSQL("EXEC updateProduct @ProductLineId=" + product.ProductLineId + ",@ProductLineName='" + product.ProductLineName + "';");
 }
        protected void updateProcessGroup_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["ProductId"] != null)
            {

                string value = ValueProduct.Text;
                if (value != "")
                {
                    ProcessService processService = new ProcessService();
                    ProductUpdateView ProductsView = new ProductUpdateView();

                    ProductsView.ProductLineId = Int32.Parse(HttpContext.Current.Session["ProductId"].ToString());
                    ProductsView.ProductLineName = value;

                    CUDView crud = processService.updateProduct(ProductsView);

                    if (crud.update == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Value')", true);
                    }
                    else
                    {
                        ValueProduct.Text = "";
                        fillProductGroupTable();
                        updateProductModal.Update();
                    }
                }
            }
        }