/******************************************************************/

    protected void btnAdvanced_Click(object sender, EventArgs e)
    {
        if (btnAdvanced.Text.Equals("Expand"))
        {
            mode                = "Advanced";
            btnAdvanced.Text    = "Hide Optional Parameters";
            lblAdvanced         = pnlMainGrid.FindControl("lblAdvancedMode") as Label;
            lblAdvanced.ToolTip = "compress additional columns";
            lblAdvanced.Text    = "<i class='fas fa-eye-slash fa-fw row-icon'></i><span>SHOW/HIDE</span>";
        }
        else
        {
            mode                = "Standard";
            btnAdvanced.Text    = "Expand";
            lblAdvanced         = pnlMainGrid.FindControl("lblAdvancedMode") as Label;
            lblAdvanced.ToolTip = "expand additional columns";
            lblAdvanced.Text    = "<i class='fas fa-eye-slash fa-fw-slash row-icon'></i><span>SHOW/HIDE</span>";
        }

        for (int i = 0; i < FIELDS.Length; i++)
        {
            if (ADVANCED_FIELDS[i])
            {
                grid.Columns[i].Visible = !grid.Columns[i].Visible;
            }
        }

        if (PAGENAME.Equals("/input/products/bom.aspx"))
        {
            CheckBox myCheck = pnlMainGrid.FindControl("checkAllSubComponents") as CheckBox;
            myCheck.Checked = !myCheck.Checked;
        }
        this.SetData();
    }
    protected override void OnInit(EventArgs e)
    {
        InitializeComponent();
        pnlMenu.Controls.Add(new LiteralControl("<h2>What-If: Products</h2>"));
        base.OnInit(e);
        if (!LocalTablesLinked())
        {
            ResetModelGoToModels();
        }

        if (!IsWhatifMode())
        {
            string whatifPart = "whatif_";
            Response.Redirect(PAGENAME.Substring(whatifPart.Length));
        }
        helperProduct.SetMenuContainer(pnlMenu);
        helperProduct.OnInit(e);
        string dataFile = GetDirectory() + userDir + MAIN_USER_DATABASE;

        srcProductsList.DataFile = dataFile;
        dropListProducts.DataBind();
        srcSelectedOper.DataFile = dataFile;
        srcComboOperTo.DataFile  = dataFile;
        FillGridRouting();
        tableSync = new TableSyncOperRouting(userDir);
        //srcSortRouting.DataFile = dataFile;
        //InitializeSortRoutingComp();
    }
 protected void grid_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     if (PAGENAME.Equals("labor.aspx") || PAGENAME.Equals("whatif_labor.aspx"))
     {
         RowUpdate(e.RowIndex);
         SyncTables();
         SetModelModified(true, false);
     }
 }
Example #4
0
 protected override void OnInit(EventArgs e)
 {
     InitializeComponent();
     base.OnInit(e);
     if (!IsWhatifMode())
     {
         string whatifPart = "whatif_";
         Response.Redirect(PAGENAME.Substring(whatifPart.Length));
     }
     tableSync = new TableSyncEquip(userDir);
 }
Example #5
0
 protected override void OnInit(EventArgs e)
 {
     InitializeComponent();
     pnlMenu.Controls.Add(new LiteralControl("<h2>What-If:Products</h2>"));
     base.OnInit(e);
     if (!IsWhatifMode())
     {
         string whatifPart = "whatif_";
         Response.Redirect(PAGENAME.Substring(whatifPart.Length));
     }
     helperProduct.SetMenuContainer(pnlMenu);
     helperProduct.OnInit(e);
     tableSync = new TableSyncOperRouting(userDir);
 }
Example #6
0
    protected override void OnInit(EventArgs e)
    {
        InitializeComponent();
        pnlMenu.Controls.Add(new LiteralControl("<h2>What-If: Products</h2>"));
        base.OnInit(e);
        if (!IsWhatifMode())
        {
            string whatifPart = "whatif_";
            Response.Redirect(PAGENAME.Substring(whatifPart.Length));
        }
        helperProduct.SetMenuContainer(pnlMenu);
        helperProduct.OnInit(e);
        string dataFile = GetDirectory() + userDir + MAIN_USER_DATABASE;

        tableSync = new TableSyncProduct(userDir);
        //srcProductsList.DataFile = dataFile;
    }
    protected override void OnInit(EventArgs e)
    {
        InitializeComponent();
        pnlMenu.Controls.Add(new LiteralControl("<h2>What-If: Products</h2>"));
        base.OnInit(e);
        if (!LocalTablesLinked())
        {
            ResetModelGoToModels();
        }
        if (!IsWhatifMode())
        {
            string whatifPart = "whatif_";
            Response.Redirect(PAGENAME.Substring(whatifPart.Length));
        }
        helperProduct.SetMenuContainer(pnlMenu);
        helperProduct.OnInit(e);
        string dataFile = GetDirectory() + userDir + MAIN_USER_DATABASE;

        srcProductsList.DataFile     = dataFile;
        srcProductStructure.DataFile = dataFile;
        try {
            dropListProducts.DataBind();
        } catch (Exception) {
            Master.ShowErrorMessage();
        }
        Control buttondiv    = getButtonDiv();
        Button  btnCopyTable = buttondiv.FindControl(PageControls.BTN_COPY_TABLE) as Button;

        extenderCopy.TargetControlID = copyAllDummy.ID;
        btnCopyTable.Click          += btnCopyTable_Click;

        hdnCopyMode = new HiddenField();
        pnlCopyTable.Controls.Add(hdnCopyMode);

        tableSync = new TableSynchronization(userDir);
    }
    protected override void Grid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        base.Grid_RowDataBound(sender, e);
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            //if (!PAGENAME.Equals("products_ibom.aspx") && !PAGENAME.Equals("whatif_products_ibom.aspx"))
            if (true)
            {
                Button btnToClick = e.Row.Cells[0].FindControl(GridViewTemplate.BTN_INSERT) as Button;
                string tooltip    = "Double-click to add ";
                if (PAGENAME.Contains("labor"))
                {
                    tooltip += "labor";
                }
                else if (PAGENAME.Contains("equipment"))
                {
                    tooltip += "equipment";
                }
                else if (PAGENAME.Contains("oper"))
                {
                    tooltip += "operation";
                }
                else if (PAGENAME.Contains("routing"))
                {
                    tooltip += "routing";
                }
                else if (PAGENAME.Contains("product"))
                {
                    tooltip += "product";
                }
                else
                {
                    tooltip += "row";
                }
                if (btnToClick != null)
                {
                    string btnJavascript = ClientScript.GetPostBackClientHyperlink(
                        btnToClick, "");
                    for (int columnIndex = 1; columnIndex <
                         e.Row.Cells.Count; columnIndex++)
                    {
                        // Add the column index as the event argument parameter
                        string js = btnJavascript.Insert(btnJavascript.Length - 2,
                                                         columnIndex.ToString());
                        // Add this javascript to the onclick Attribute of the cell
                        //e.Row.Cells[columnIndex].Attributes["ondblclick"] = js;
                        // Add a cursor style to the cells
                        e.Row.Cells[columnIndex].Attributes["style"] +=
                            "cursor:pointer;";
                        ////e.Row.Cells[columnIndex].ToolTip = tooltip;

                        try
                        {
                            Control control = e.Row.Cells[columnIndex].FindControl(TEXT_BOX_IDS[columnIndex]);
                            if (control is TextBox)
                            {
                                (control as TextBox).Attributes.Add("onkeydown", "doFocus('" + btnToClick.ClientID + "', event);");
                            }
                            else if (control is AjaxControlToolkit.ComboBox)
                            {
                                TextBox textBox = (control as AjaxControlToolkit.ComboBox).FindControl(control.ID + "_TextBox") as TextBox;
                                if (textBox != null)
                                {
                                    textBox.Attributes.Add("onkeydown", "doFocus('" + btnToClick.ClientID + "', event);");
                                }
                            }
                        }
                        catch (Exception) { }
                    }
                }
            }
        }
    }
    protected virtual void Grid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //if (!PAGENAME.Equals("products_ibom.aspx") && !PAGENAME.Equals("whatif_products_ibom.aspx"))
            if (true)
            {
                Button btnToClick = e.Row.Cells[0].FindControl(GridViewTemplate.BTN_EDIT) as Button;
                string tooltip    = "Double-click to edit ";
                if (((e.Row.RowState & DataControlRowState.Edit) > 0))
                {
                    btnToClick = e.Row.Cells[0].FindControl(GridViewTemplate.BTN_UPDATE) as Button;
                    //tooltip = "Double-click to update ";

                    /*e.Row.Attributes["ondblclick"] = Page.ClientScript.GetPostBackClientHyperlink(grid, "Update$" + e.Row.RowIndex);
                     * e.Row.Attributes["style"] = "cursor:normal;";
                     * e.Row.ToolTip = "Double-click to update row";*/
                }
                if (PAGENAME.Contains("labor"))
                {
                    tooltip += "labor";
                }
                else if (PAGENAME.Contains("equipment"))
                {
                    tooltip += "equipment";
                }
                else if (PAGENAME.Contains("oper"))
                {
                    tooltip += "operation";
                }
                else if (PAGENAME.Contains("routing"))
                {
                    tooltip += "routing";
                }
                else if (PAGENAME.Contains("product"))
                {
                    tooltip += "product";
                }
                else
                {
                    tooltip += "row";
                }
                if (btnToClick != null)
                {
                    string btnJavascript = ClientScript.GetPostBackClientHyperlink(
                        btnToClick, "");


                    for (int columnIndex = 1; columnIndex <
                         e.Row.Cells.Count; columnIndex++)
                    {
                        if (!((e.Row.RowState & DataControlRowState.Edit) > 0))
                        {
                            // Add the column index as the event argument parameter
                            string js = btnJavascript.Insert(btnJavascript.Length - 2,
                                                             columnIndex.ToString());
                            // Add this javascript to the onclick Attribute of the cell
                            e.Row.Cells[columnIndex].Attributes["ondblclick"] = js;
                            // Add a cursor style to the cells
                            e.Row.Cells[columnIndex].Attributes["style"] +=
                                "cursor:pointer;";
                            e.Row.Cells[columnIndex].ToolTip = tooltip;
                        }



                        try
                        {
                            Control control = e.Row.Cells[columnIndex].FindControl(TEXT_BOX_IDS[columnIndex]);
                            if (control is TextBox)
                            {
                                (control as TextBox).Attributes.Add("onkeydown", "doFocus('" + btnToClick.ClientID + "', event);");
                            }
                            else if (control is AjaxControlToolkit.ComboBox)
                            {
                                TextBox textBox = (control as AjaxControlToolkit.ComboBox).FindControl(control.ID + "_TextBox") as TextBox;
                                if (textBox != null)
                                {
                                    textBox.Attributes.Add("onkeydown", "doFocus('" + btnToClick.ClientID + "', event);");
                                }
                            }
                        }
                        catch (Exception) { }
                    }

                    //e.Row.Attributes["ondblclick"] = Page.ClientScript.GetPostBackClientHyperlink(grid, "Edit$" + e.Row.RowIndex);
                    //e.Row.Attributes["style"] = "cursor:pointer";
                    //e.Row.ToolTip = "Double-click to edit row";
                }
            }
            //e.Row.Cells[1].ForeColor = ColorTranslator.FromHtml("black");
            //e.Row.Cells[1].Font.Bold = false;


            foreach (TableCell cell in e.Row.Cells)
            {
                cell.DataBind();


                try
                {
                    foreach (Control control in cell.Controls)
                    {
                        foreach (Control control2 in control.Controls)
                        {
                            if (control2 is Label)
                            {
                                Label lbl = control2 as Label;
                                lbl.CssClass = "padding";
                                double num = Double.Parse(lbl.Text);

                                cell.HorizontalAlign = HorizontalAlign.Center;
                                if (((e.Row.RowState & DataControlRowState.Edit) > 0))
                                {
                                    lbl.Enabled              = false;
                                    lbl.Attributes["style"] += "cursor:default;";
                                }

                                break;
                            }
                            else if (control2 is TextBox || control2 is AjaxControlToolkit.ComboBox || control2 is CheckBox)
                            {
                                cell.HorizontalAlign = HorizontalAlign.Center;
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
    }