/*
        Metodo para realizar una actualizacion
        */
        private void updateAuxiliar()
        {
            if (HttpContext.Current.Session["IdUpn"] != null)
            {
                if (Upn.Text != "" & ProcessSelector1.SelectedItem != null)
                {
                    if (validateRecipeonOperationUpdate() & checkEnableRecipeUpdate())
                    {

                        UpnService upnService = new UpnService();
                        UpnUpdateView upn = new UpnUpdateView();

                        upn.UpnId = Upn.Text;
                        upn.UpnStatus = upnEnable.Items[0].Selected;
                        upn.Multisession = multisessionEnable.Items[0].Selected;

                        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;

                        CUDView crud = upnService.updateUpn(upn, audit);

                        String processSelectorId = ProcessSelector1.SelectedItem.Value;
                        String upnId = upn.UpnId;

                        if (crud.update == false)
                        {
                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the UPN')", true);
                        }
                        else
                        {
                            foreach (GridViewRow gvrow in GridView1.Rows)
                            {
                                CheckBox operationEnable = (CheckBox)gvrow.FindControl("EnableOperation1");
                                Label lblOperationId = (Label)gvrow.FindControl("OperationId1");
                                Label lblRecipeId = (Label)gvrow.FindControl("recipeOperationId1");
                                Label lblRecipe = (Label)gvrow.FindControl("recipeOperation1");

                                if (lblRecipe.Text != "")
                                {
                                    UpnOperationView newOperationUpn = new UpnOperationView();
                                    newOperationUpn.Enable = operationEnable.Checked;
                                    newOperationUpn.OperationId = Int32.Parse(lblOperationId.Text);
                                    newOperationUpn.ProcessId = Int32.Parse(processSelectorId);
                                    newOperationUpn.RecipeId = Int32.Parse(lblRecipeId.Text);
                                    newOperationUpn.UpnId = upnId;
                                    crud = upnService.updateUpnOperation(newOperationUpn, audit);
                                }
                            }

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

                        }

                        fillUpnTable();
                        Upn.Text = "";
                        Product.Text = "";

                        clearOperationTable1();
                        clearProcesses1();
                        clearRecipeUpn1();

                        RecipeUpn1.Enabled = false;
                        GridView1.Enabled = false;

                        upnEnable.Items[0].Enabled = false;
                        upnEnable.Items[0].Selected = false;

                        multisessionEnable.Items[0].Enabled = false;
                        multisessionEnable.Items[0].Selected = false;

                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Add at least one enabled recipe to operation table.')", true);
                    }
                }
            }
        }
Beispiel #2
0
 /*
   Funcion: Actualizar los upn operations
   Param: upnId, OperationID, RecipeId, ProcessId, Enable
   Return: Status
   */
 public String updateUpnOperation(UpnOperationView upnUpdateView)
 {
     return context.InsertUpdateDeleteMSQL("EXEC updateUpnOperation @upnId='"+upnUpdateView.UpnId+"',@OperationId="+upnUpdateView.OperationId
         +",@RecipeId="+upnUpdateView.RecipeId+", @ProcessId="+upnUpdateView.ProcessId+",@RecipeEnable="+upnUpdateView.Enable);
 }
Beispiel #3
0
        /*Funcion: Obtiene una lista de operaciones por procesos
          Param:  processId
          Return: Lista UpnOperationView
          */
        public List<UpnOperationView> getUpnOperationbyProcess(int processId)
        {
            UpnDao Dao = new UpnDao();
            DataTable DaoResult = Dao.getUpnOperationbyProcess(processId);
            List<UpnOperationView> ViewList = new List<UpnOperationView>();
            IndexLogic index = new IndexLogic();
            foreach (DataRow row in DaoResult.Rows)
            {
                UpnOperationView x = new UpnOperationView();
                if (DaoResult.Columns.Contains("Operation") && row["Operation"] != DBNull.Value) { x.Operation = row["Operation"].ToString(); }
                if (DaoResult.Columns.Contains("Enable") && row["Enable"] != DBNull.Value) { x.Enable = (bool)row["Enable"]; }
                if (DaoResult.Columns.Contains("OperationId") && row["OperationId"] != DBNull.Value) { x.OperationId = (int)row["OperationId"]; }
                if (DaoResult.Columns.Contains("RecipeId") && row["RecipeId"] != DBNull.Value) { x.RecipeId = (int)row["RecipeId"]; }
                if (DaoResult.Columns.Contains("Recipe") && row["Recipe"] != DBNull.Value) { x.Recipe = row["Recipe"].ToString(); }
                x.Order = index.getIndex();
                ViewList.Add(x);

            }
            return ViewList;
        }
        private void updateAuxiliar()
        {
            if (HttpContext.Current.Session["IdUpn"] != null)
            {
                if (Upn.Text != "" & ProcessSelector1.SelectedItem != null)
                {
                    if (validateRecipeonOperationUpdate())
                    {
                        string confirmValue = Request.Form["confirm_value"];
                        if (confirmValue == "Yes")
                        {
                            UpnService upnService = new UpnService();
                            UpnUpdateView upn = new UpnUpdateView();

                            upn.UpnId = Upn.Text;
                            upn.UpnStatus = upnEnable.Items[0].Selected;

                            CUDView crud = upnService.updateUpn(upn);

                            String processSelectorId = ProcessSelector1.SelectedItem.Value;
                            String upnId = upn.UpnId;

                            if (crud.update == false)
                            {
                                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the UPN')", true);
                            }
                            else
                            {
                                foreach (GridViewRow gvrow in GridView1.Rows)
                                {
                                    CheckBox operationEnable = (CheckBox)gvrow.FindControl("EnableOperation1");
                                    Label lblOperationId = (Label)gvrow.FindControl("OperationId1");
                                    Label lblRecipeId = (Label)gvrow.FindControl("recipeOperationId1");
                                    Label lblRecipe = (Label)gvrow.FindControl("recipeOperation1");

                                    if (lblRecipe.Text != "")
                                    {
                                        UpnOperationView newOperationUpn = new UpnOperationView();
                                        newOperationUpn.Enable = operationEnable.Checked;
                                        newOperationUpn.OperationId = Int32.Parse(lblOperationId.Text);
                                        newOperationUpn.ProcessId = Int32.Parse(processSelectorId);
                                        newOperationUpn.RecipeId = Int32.Parse(lblRecipeId.Text);
                                        newOperationUpn.UpnId = upnId;
                                        crud = upnService.updateUpnOperation(newOperationUpn);
                                    }
                                }

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

                            }

                            fillUpnTable();
                            Upn.Text = "";
                            Product.Text = "";

                            clearOperationTable1();
                            clearProcesses1();
                            clearRecipeUpn1();

                            RecipeUpn1.Enabled = false;
                            GridView1.Enabled = false;

                            upnEnable.Items[0].Enabled = false;
                            upnEnable.Items[0].Selected = false;

                        }
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Add at least one recipe to operation table.')", true);
                    }
                }
            }
        }
Beispiel #5
0
        /*Funcion: actualiza un Upn por operacion
          Param:  upnUpdateView, AuditDataFromWeb
          Return: Status
          */
        public CUDView updateUpnOperation(UpnOperationView upnUpdateView, AuditDataFromWeb audit)
        {
            CUDView logic = new CUDView();
            AuditDao auditDao = new AuditDao();
            DataTable auditDaoResult = auditDao.getUpnOperatoinOldValues(upnUpdateView.UpnId,upnUpdateView.ProcessId,upnUpdateView.OperationId);
            String OldValues = "UpnId: " + upnUpdateView.UpnId;

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

            UpnDao Dao = new UpnDao();
            String state = Dao.updateUpnOperation(upnUpdateView);
            logic=CUDVerifyLogic.verifierInsertDeleteUpdate("update", state);

            if (logic.update == true)
            {
                AuditService auditservice = new AuditService();
                String Action = "Update upnOperation";
                String newValues = "UpnId: " + upnUpdateView.UpnId;
                newValues = newValues + ", RecipeId: " + upnUpdateView.RecipeId;
                newValues = newValues + ", Enable: " + upnUpdateView.Enable;

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

            return logic;
        }