Пример #1
0
        protected void deleteUpn_Click(object sender, ImageClickEventArgs e)
        {
            if (HttpContext.Current.Session["IdUpn"] != null)
            {
                string confirmValue = Request.Form["confirm_value"];
                if (confirmValue == "Yes")
                {
                    string IdUpn = HttpContext.Current.Session["IdUpn"].ToString();
                    UpnService upnService = new UpnService();
                    CUDView crud = upnService.deleteUpn(IdUpn);

                    if (crud.delete == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not delete the recipe')", true);
                    }
                    else
                    {
                        fillUpnTable();
                        Upn.Text = "";
                        Product.Text = "";
                        upnEnable.Items[0].Selected = false;
                    }
                }
            }
        }
Пример #2
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);
                    }
                }
            }
        }
Пример #3
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);
            }
        }
Пример #4
0
 /*
 Metodo que llena la tabla de upn
 */
 private void fillUpnTable()
 {
     UpnService upnService = new UpnService();
     List<UpnView> upnData = upnService.getUpn();
     GridView3.DataSource = upnData;
     GridView3.PageIndex = 0;
     GridView3.DataBind();
 }
Пример #5
0
 /*
 Metodo para llenar la tabla de operation dado el id del upn y el id del proceso
 */
 private void fillOperationTable1(string upnId, int processId)
 {
     UpnService upnService = new UpnService();
     List<UpnOperationView> recipeOperation = upnService.getUpnOperationbyUpn(upnId, processId);
     GridView1.DataSource = recipeOperation;
     GridView1.DataBind();
 }
Пример #6
0
 /*
    Metodo para llenar la tabla de operation dada la seleccion de un proceso
    */
 private void fillOperationTable(int ProcessSelected)
 {
     UpnService recipeService = new UpnService();
     List<RecipeOperationView> recipeOperation = recipeService.getRecipeOperationForProcessUpn(ProcessSelected);
     GridView2.DataSource = recipeOperation;
     GridView2.DataBind();
 }
Пример #7
0
 /*
 Metodo para llenar la tabla upn segun la busqueda
 */
 protected void searchButton_Click(object sender, ImageClickEventArgs e)
 {
     UpnService upnService = new UpnService();
     List<UpnView> upnData = upnService.searchUpn(searchText.Text);
     GridView3.DataSource = upnData;
     GridView3.DataBind();
 }
Пример #8
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);
                    }
                }
            }
        }
Пример #9
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);
            }
        }