/*
        Metodo que se utiliza para actualizar un proceso existente
        */
        private void updateAuxiliar()
        {
            if (HttpContext.Current.Session["ProcessId"] != null)
            {

                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;

                ProcessService processService = new ProcessService();
                ProcessUpdateView processUpdate = new ProcessUpdateView();

                processUpdate.ProcessId = Int32.Parse(HttpContext.Current.Session["ProcessId"].ToString());
                processUpdate.ProcessPlotEnable = plotEnableText.Items[0].Selected;

                CUDView crud = processService.updateProcess(processUpdate,audit);

                if (crud.update == false)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Process')", true);
                }
                else
                {
                    clearFields();
                    fillProcessTable();
                }

            }
        }
        /*Funcion: actualizar productos
          Param: ProductUpdateView,AuditDataFromWeb
          Return: Lista Units
          */
        public CUDView updateProcess(ProcessUpdateView process, AuditDataFromWeb audit)
        {
            CUDView logic = new CUDView();
            AuditDao auditDao = new AuditDao();
            DataTable auditDaoResult = auditDao.getProcessOldValues(process.ProcessId);
            String OldValues = "ProcessId: " + process.ProcessId;

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

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

            if (logic.update == true)
            {
                AuditService auditservice = new AuditService();
                String Action = "Update Process";
                String newValues = "ProcessId: " + process.ProcessId;

                newValues = newValues + ", ProcessPlotEnable: " + process.ProcessPlotEnable;

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

            return logic;
        }
Example #3
0
 /*
   Funcion: Actualiza un proceso
   Param: processId,ProcessPlotEnable
   Return: Status
   */
 public String updateProcess(ProcessUpdateView process)
 {
     return context.InsertUpdateDeleteMSQL("EXEC updateProcess @ProcessId="+process.ProcessId+",@ProcessPlotEnable="+process.ProcessPlotEnable);
 }
        private void updateAuxiliar()
        {
            if (HttpContext.Current.Session["ProcessId"] != null)
            {
                string confirmValue = Request.Form["confirm_value"];
                if (confirmValue == "Yes")
                {
                    ProcessService processService = new ProcessService();
                    ProcessUpdateView processUpdate = new ProcessUpdateView();

                    processUpdate.ProcessId = Int32.Parse(HttpContext.Current.Session["ProcessId"].ToString());
                    processUpdate.ProcessPlotEnable = plotEnableText.Items[0].Selected;

                    CUDView crud = processService.updateProcess(processUpdate);

                    if (crud.update == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Process')", true);
                    }
                    else
                    {
                        clearFields();
                        fillProcessTable();
                    }

                }
            }
        }