Пример #1
0
        /*
        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);
                    }
                }
            }
        }
Пример #2
0
        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);
                    }
                }
            }
        }
Пример #3
0
 /*
   Funcion: Actualiza un upn
   Param: upnId, UpnStatus,multissession
   Return: Status
   */
 public String updateUpn(UpnUpdateView upnUpdateView)
 {
     return context.InsertUpdateDeleteMSQL("EXEC updateUpn @UpnId='" + upnUpdateView.UpnId
         + "', @UpnStatus=" + upnUpdateView.UpnStatus+ ",@UpnMultipleSessions ="+ upnUpdateView.Multisession+ ";");
 }
Пример #4
0
        /*Funcion: actualiza un Upn
          Param:  UpnUpdateView, AuditDataFromWeb
          Return: Status
          */
        public CUDView updateUpn(UpnUpdateView upnUpdateView, AuditDataFromWeb audit)
        {
            CUDView logic = new CUDView();
            AuditDao auditDao = new AuditDao();
            DataTable auditDaoResult = auditDao.getUpnOldValues(upnUpdateView.UpnId);
            String OldValues = "UpnId: " + upnUpdateView.UpnId;

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

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

            if (logic.update == true)
            {
                AuditService auditservice = new AuditService();
                String Action = "Update Upn";
                String NewValues = "UpnId: " + upnUpdateView.UpnId
                    + ", Enable: " + upnUpdateView.UpnStatus
                    + ", UpnMultipleSession: " + upnUpdateView.Multisession;

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

            return logic;
        }