Exemplo n.º 1
0
        /*
        Metodo para realizar una insersion
        */
        private void saveAuxiliar()
        {
            if (Upn2.Text != "" & ProcessSelector.SelectedItem != null & Product2.SelectedItem != null)
            {
                if (ProcessSelector.SelectedItem.Value != "" & Product2.SelectedItem.Value != "")
                {

                    if (validateRecipeonOperation() & checkEnableRecipeInsert())
                    {

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

                        upn.ProductLineId = Int32.Parse(Product2.SelectedItem.Value);
                        upn.UpnId = Upn2.Text;
                        upn.UPNStatus = upnEnable2.Items[0].Selected;
                        upn.Multisession = multisessionCheck.Items[0].Selected;
                        upn.UpnTypeId = 0; // cambiar, esta alambrado

                        String user = Context.User.Identity.Name;
                        AuditDataFromWeb audit = new AuditDataFromWeb();
                        audit.Reason = "N/A";
                        audit.StationIP = General.getIp(this.Page);
                        audit.UserName = user;

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

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

                            foreach (GridViewRow gvrow in GridView2.Rows)
                            {
                                CheckBox operationEnable = (CheckBox)gvrow.FindControl("EnableOperation");
                                Label lblOperationId = (Label)gvrow.FindControl("OperationId");
                                Label lblRecipeId = (Label)gvrow.FindControl("recipeOperationId");
                                Label lblRecipe = (Label)gvrow.FindControl("recipeOperation");

                                if (lblRecipe.Text != "")
                                {
                                    UpnInsertOperationView newOperationUpn = new UpnInsertOperationView();
                                    newOperationUpn.OperationEnable = operationEnable.Checked;
                                    newOperationUpn.OperationId = Int32.Parse(lblOperationId.Text);
                                    newOperationUpn.ProcessId = Int32.Parse(ProcessSelector.SelectedItem.Value);
                                    newOperationUpn.RecipeId = Int32.Parse(lblRecipeId.Text);
                                    newOperationUpn.UpnId = upn.UpnId;
                                    crud = upnService.insertUpnOperation(newOperationUpn, audit);
                                }

                            }

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

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

                            clearOperationTable();
                            clearProcesses();
                            fillProducts();

                            clearRecipeUpn();

                            FirstDIV.Visible = true;
                            SecondDIV.Visible = false;

                        }

                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Add at least one enabled recipe to operation table.')", true);
                    }

                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
                }
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
            }
        }
Exemplo n.º 2
0
        private void saveAuxiliar()
        {
            if (Upn2.Text != "" & ProcessSelector.SelectedItem != null & Product2.SelectedItem != null)
            {
                if (ProcessSelector.SelectedItem.Value != "" & Product2.SelectedItem.Value != "")
                {

                    if (validateRecipeonOperation())
                    {
                        string confirmValue = Request.Form["confirm_value"];
                        if (confirmValue == "Yes")
                        {
                            UpnService upnService = new UpnService();
                            UpnInsertView upn = new UpnInsertView();

                            upn.ProductLineId = Int32.Parse(Product2.SelectedItem.Value);
                            upn.UpnId = Upn2.Text;
                            upn.UPNStatus = upnEnable2.Items[0].Selected;
                            upn.UpnTypeId = 0; // cambiar, esta alambrado

                            CUDView crud = upnService.insertUpn(upn);

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

                                foreach (GridViewRow gvrow in GridView2.Rows)
                                {
                                    CheckBox operationEnable = (CheckBox)gvrow.FindControl("EnableOperation");
                                    Label lblOperationId = (Label)gvrow.FindControl("OperationId");
                                    Label lblRecipeId = (Label)gvrow.FindControl("recipeOperationId");
                                    Label lblRecipe = (Label)gvrow.FindControl("recipeOperation");

                                    if (lblRecipe.Text != "")
                                    {
                                        UpnInsertOperationView newOperationUpn = new UpnInsertOperationView();
                                        newOperationUpn.OperationEnable = operationEnable.Checked;
                                        newOperationUpn.OperationId = Int32.Parse(lblOperationId.Text);
                                        newOperationUpn.ProcessId = Int32.Parse(ProcessSelector.SelectedItem.Value);
                                        newOperationUpn.RecipeId = Int32.Parse(lblRecipeId.Text);
                                        newOperationUpn.UpnId = upn.UpnId;
                                        crud = upnService.insertUpnOperation(newOperationUpn);
                                    }

                                }

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

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

                                clearOperationTable();
                                clearProcesses();
                                fillProducts();

                                clearRecipeUpn();

                                FirstDIV.Visible = true;
                                SecondDIV.Visible = false;

                            }
                        }
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Add at least one recipe to operation table.')", true);
                    }

                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
                }
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
            }
        }
Exemplo n.º 3
0
 /*
   Funcion: Insertar Upn
   Param: UpnId, ProductLineID,UpnStatus,Multisession
   Return: Status
   */
 //Queda amarrado el UpnTypeId (siempre debe existir en la tabla UpnTypeId uno con un 1)
 public String insertUpn(UpnInsertView upnInsertView)
 {
     return context.InsertUpdateDeleteMSQL("insertUpn @upnId='" + upnInsertView.UpnId + "',@ProductLineId=" + upnInsertView.ProductLineId + ",@UpnStatus=" +
         upnInsertView .UPNStatus+ ",@UpnTypeId=1"+ ",@UpnMultipleSessions=" +  upnInsertView.Multisession);
 }
Exemplo n.º 4
0
        /*Funcion: Inserta un Upn
          Param:  upnInsertView, AuditDataFromWeb
          Return: status
          */
        public CUDView insertUpn(UpnInsertView upnInsertView, AuditDataFromWeb audit)
        {
            UpnDao Dao = new UpnDao();
            String state = Dao.insertUpn(upnInsertView);
            CUDView logic = CUDVerifyLogic.verifierInsertDeleteUpdate("insert", state);

            if (logic.insert == true)
            {
                AuditService auditservice = new AuditService();
                String Action = "Insert new UPN";
                String NewValues = "UpnId: " + upnInsertView.UpnId
                    + ", ProductLineId: " + upnInsertView.ProductLineId
                    + ", UPNStatus: " + upnInsertView.UPNStatus
                    + ", UpnTypeId: " + upnInsertView.UpnTypeId
                    + ", UpnMultipleSession: " + upnInsertView.Multisession;

                auditservice.formInsert(Action, NewValues, audit);
            }
            return logic;
        }