示例#1
0
        private void FillMaintData()
        {
            string connection = ConfigurationManager.ConnectionStrings["Tool"].ConnectionString;

            using (SqlConnection db = new SqlConnection(connection))
            {
                SqlCommand query = new SqlCommand(@"select * from maintenance where (NextNormal <= getdate()+7 or NextAnnual <= getdate()+7) AND Status='Available';", db);

                using (var adapter = new SqlDataAdapter(query))
                {
                    var maintenanceTable = new DataTable();
                    adapter.Fill(maintenanceTable);

                    if (maintenanceTable.Rows.Count > 0)
                    {
                        RequestGrid.DataSource = maintenanceTable;
                        RequestGrid.DataBind();

                        DataRow[] rows  = maintenanceTable.Select();
                        var       count = 0;
                        foreach (var row in rows)
                        {
                            if (DateTime.Now >= Convert.ToDateTime(row["NextNormal"]).AddDays(-7) || DateTime.Now >= Convert.ToDateTime(row["NextAnnual"]).AddDays(-7))
                            {
                                var button = new Button {
                                    ID = row["ToolingID"] + "_" + row["NP"].ToString(), Text = "Solicitar",
                                };
                                button.CssClass = "btn btn-info";
                                button.ToolTip  = "Request";
                                button.Click   += Ok_Click;

                                RequestGrid.Rows[count].Cells[11].Controls.Add(button);
                            }
                            else
                            {
                                rows[count].Delete();
                            }
                            ++count;
                        }
                    }
                    else
                    {
                        maintenanceTable.Rows.Add(maintenanceTable.NewRow());
                        RequestGrid.DataSource = maintenanceTable;
                        RequestGrid.DataBind();
                        int totalColums = RequestGrid.Rows[0].Cells.Count;
                        RequestGrid.Rows[0].Cells.Clear();
                        RequestGrid.Rows[0].Cells.Add(new TableCell());
                        RequestGrid.Rows[0].Cells[0].ColumnSpan = totalColums;
                        RequestGrid.Rows[0].Cells[0].Text       = "No hay nuevas solicitides";
                    }
                }
            }
            FillInProgressesTable();
        }
示例#2
0
        private void Filldata()
        {
            string connection = ConfigurationManager.ConnectionStrings["Tool"].ConnectionString;

            using (var db = new SqlConnection(connection))
            {
                SqlCommand query = new SqlCommand(@"select * from maintenance;", db);

                using (var adapter = new SqlDataAdapter(query))
                {
                    var maintenanceTable = new DataTable();
                    adapter.Fill(maintenanceTable);

                    if (maintenanceTable.Rows.Count > 0)
                    {
                        RequestGrid.DataSource = maintenanceTable;
                        RequestGrid.DataBind();

                        DataRow[] rows  = maintenanceTable.Select();
                        var       count = 0;
                        foreach (var row in rows)
                        {
                            var button = new Button {
                                ID = row["ToolingID"].ToString(), Text = "Borrar",
                            };
                            button.CssClass = "btn btn-danger";
                            button.ToolTip  = "Borrar";
                            button.Click   += Delete_Click;

                            RequestGrid.Rows[count].Cells[11].Controls.Add(button);

                            ++count;
                        }
                    }
                    else
                    {
                        maintenanceTable.Rows.Add(maintenanceTable.NewRow());
                        RequestGrid.DataSource = maintenanceTable;
                        RequestGrid.DataBind();
                        int totalColums = RequestGrid.Rows[0].Cells.Count;
                        RequestGrid.Rows[0].Cells.Clear();
                        RequestGrid.Rows[0].Cells.Add(new TableCell());
                        RequestGrid.Rows[0].Cells[0].ColumnSpan = totalColums;
                        RequestGrid.Rows[0].Cells[0].Text       = "El catalogo esta vacío.";
                    }
                }
            }
        }
示例#3
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        QueueGrid.DataSource = Session["Queues"];
        QueueGrid.DataBind();

        lblRequests.Visible = true;

        if (Session["Requests"] != null)
        {
            RequestGrid.Visible    = true;
            pnlSelection.Visible   = true;
            RequestGrid.DataSource = Session["Requests"];
            RequestGrid.DataBind();
        }
        else
        {
            RequestGrid.Visible  = false;
            pnlSelection.Visible = false;
        }
    }
示例#4
0
        protected void SearchTool_Click(object sender, EventArgs e)
        {
            string query = "SELECT * FROM Maintenance WHERE NP='" + InputSearchTooling.Value + "';";

            if (InputSearchTooling.Value.EndsWith("*"))
            {
                query = "select * from maintenance where np like '%" + InputSearchTooling.Value.Trim('*') + "%'";
            }

            string connection = ConfigurationManager.ConnectionStrings["Tool"].ConnectionString;

            using (SqlConnection db = new SqlConnection(connection))
            {
                SqlCommand cmd = new SqlCommand(query, db);

                using (var adapter = new SqlDataAdapter(cmd))
                {
                    var maintenanceTable = new DataTable();
                    adapter.Fill(maintenanceTable);

                    if (maintenanceTable.Rows.Count > 0)
                    {
                        RequestGrid.DataSource = maintenanceTable;
                        RequestGrid.DataBind();
                    }
                    else
                    {
                        maintenanceTable.Rows.Add(maintenanceTable.NewRow());
                        RequestGrid.DataSource = maintenanceTable;
                        RequestGrid.DataBind();
                        int totalColums = RequestGrid.Rows[0].Cells.Count;
                        RequestGrid.Rows[0].Cells.Clear();
                        RequestGrid.Rows[0].Cells.Add(new TableCell());
                        RequestGrid.Rows[0].Cells[0].ColumnSpan = totalColums;
                        RequestGrid.Rows[0].Cells[0].Text       = "Tooling not found.";
                    }
                }
            }
        }
示例#5
0
        private void Filldata()
        {
            string connection = ConfigurationManager.ConnectionStrings["Tool"].ConnectionString;

            using (var db = new SqlConnection(connection))
            {
                SqlCommand query = new SqlCommand(@"SELECT * FROM Repair;", db);

                using (var adapter = new SqlDataAdapter(query))
                {
                    var maintenanceTable = new DataTable();
                    adapter.Fill(maintenanceTable);

                    if (maintenanceTable.Rows.Count > 0)
                    {
                        RequestGrid.DataSource = maintenanceTable;
                        RequestGrid.DataBind();

                        DataRow[] rows  = maintenanceTable.Select();
                        var       count = 0;
                        foreach (var row in rows)
                        {
                            if (row["Status"].ToString() == "REQUESTED")
                            {
                                var btnAprove = new Button {
                                    ID = row["NP"].ToString(), Text = "OK"
                                };
                                btnAprove.CssClass = "btn btn-warning";
                                btnAprove.ToolTip  = "Aprovar Mantenimiento";
                                btnAprove.Click   += AproveRepair_Click;
                                RequestGrid.Rows[count].Cells[12].Controls.Add(btnAprove);
                            }
                            else
                            {
                                var btnStatus = new Button {
                                    ID = row["NP"].ToString(), Text = "OK",
                                };
                                btnStatus.CssClass = "btn btn-success";
                                btnStatus.ToolTip  = "Cambiar Status";
                                btnStatus.Click   += ChangeStatus_Click;
                                RequestGrid.Rows[count].Cells[12].Controls.Add(btnStatus);
                            }


                            PaintCells(count, row["NP"].ToString());

                            //var button = new Button { ID = row["ToolingID"].ToString(), Text = "Borrar", };
                            //button.CssClass = "btn btn-danger";
                            //button.ToolTip = "Borrar";
                            //button.Click+= Delete_Click;

                            //RequestGrid.Rows[count].Cells[12].Controls.Add(button);

                            ++count;
                        }
                    }
                    else
                    {
                        maintenanceTable.Rows.Add(maintenanceTable.NewRow());
                        RequestGrid.DataSource = maintenanceTable;
                        RequestGrid.DataBind();
                        int totalColums = RequestGrid.Rows[0].Cells.Count;
                        RequestGrid.Rows[0].Cells.Clear();
                        RequestGrid.Rows[0].Cells.Add(new TableCell());
                        RequestGrid.Rows[0].Cells[0].ColumnSpan = totalColums;
                        RequestGrid.Rows[0].Cells[0].Text       = "No hay reparaciones en curso.";
                    }
                }
            }
        }