Beispiel #1
0
        static ViewDesignBid()
        {
            dsNBD = new NBDDataSet();
            PROJECTTableAdapter        daProject       = new PROJECTTableAdapter();
            TASKTableAdapter           daTask          = new TASKTableAdapter();
            WORKER_TYPETableAdapter    daWorkerType    = new WORKER_TYPETableAdapter();
            MATERIALTableAdapter       daMaterial      = new MATERIALTableAdapter();
            INVENTORYTableAdapter      daInventory     = new INVENTORYTableAdapter();
            MATERIAL_REQTableAdapter   daMaterialReq   = new MATERIAL_REQTableAdapter();
            CLIENTTableAdapter         daClient        = new CLIENTTableAdapter();
            LABOUR_SUMMARYTableAdapter daLabourSummary = new LABOUR_SUMMARYTableAdapter();

            try
            {
                daProject.Fill(dsNBD.PROJECT);
                daTask.Fill(dsNBD.TASK);
                daWorkerType.Fill(dsNBD.WORKER_TYPE);
                daMaterial.Fill(dsNBD.MATERIAL);
                daInventory.Fill(dsNBD.INVENTORY);
                daMaterialReq.Fill(dsNBD.MATERIAL_REQ);
                daClient.Fill(dsNBD.CLIENT);
                daLabourSummary.Fill(dsNBD.LABOUR_SUMMARY);
            }
            catch { }
        }
Beispiel #2
0
        public void FillProjectMaterialsByType(string p, string t)
        {
            MATERIAL_REQTableAdapter daMaterialReq = new MATERIAL_REQTableAdapter();

            try { daMaterialReq.FillBy(dsNBD.MATERIAL_REQ, Convert.ToInt32(p), t); }
            catch { }

            rows = dsNBD.MATERIAL_REQ.Select();
            foreach (DataRow row in rows)
            {
                if (t == "Plant")
                {
                    txtPlantQ.Text         = row.ItemArray[3].ToString();
                    ddlPlant.SelectedValue = row.ItemArray[7].ToString();
                    txtPlantS.Text         = row.ItemArray[8].ToString();
                    lblPlantSU.Text        = " " + row.ItemArray[9].ToString();
                    txtPlantU.Text         = row.ItemArray[10].ToString();
                    txtPlantD.Text         = row.ItemArray[1].ToString();
                    txtPlantI.Text         = row.ItemArray[2].ToString();
                    txtPlantE.Text         = row.ItemArray[6].ToString();
                    int extCost = Convert.ToInt32(row.ItemArray[10]);
                    int qty     = Convert.ToInt32(row.ItemArray[3]);
                    txtPlantE.Text = (extCost * qty).ToString();
                }
                else if (t == "Pottery")
                {
                    txtPotteryQ.Text         = row.ItemArray[3].ToString();
                    ddlPottery.SelectedValue = row.ItemArray[7].ToString();
                    txtPotteryS.Text         = row.ItemArray[8].ToString();
                    lblPotterySU.Text        = row.ItemArray[9].ToString();
                    txtPotteryU.Text         = row.ItemArray[10].ToString();
                    txtPotteryD.Text         = row.ItemArray[1].ToString();
                    txtPotteryI.Text         = row.ItemArray[2].ToString();
                    txtPotteryE.Text         = row.ItemArray[6].ToString();
                    int extCost = Convert.ToInt32(row.ItemArray[10]);
                    int qty     = Convert.ToInt32(row.ItemArray[3]);
                    txtPotteryE.Text = (extCost * qty).ToString();
                }
                else if (t == "Materials")
                {
                    txtMaterialQ.Text         = row.ItemArray[3].ToString();
                    ddlMaterial.SelectedValue = row.ItemArray[7].ToString();
                    txtMaterialS.Text         = row.ItemArray[8].ToString();
                    lblMaterialSU.Text        = row.ItemArray[9].ToString();
                    txtMaterialU.Text         = row.ItemArray[10].ToString();
                    txtMaterialD.Text         = row.ItemArray[1].ToString();
                    txtMaterialI.Text         = row.ItemArray[2].ToString();
                    txtMaterialE.Text         = row.ItemArray[6].ToString();
                    int extCost = Convert.ToInt32(row.ItemArray[10]);
                    int qty     = Convert.ToInt32(row.ItemArray[3]);
                    txtMaterialE.Text = (extCost * qty).ToString();
                }
            }
        }
Beispiel #3
0
        static DesignBid()
        {
            //load data at the beginning of the session
            dsNBD = new NBDDataSet();
            CLIENTTableAdapter       daClient   = new CLIENTTableAdapter();
            PROJECTTableAdapter      daProject  = new PROJECTTableAdapter();
            MATERIAL_REQTableAdapter daMatReq   = new MATERIAL_REQTableAdapter();
            MATERIALTableAdapter     daMaterial = new MATERIALTableAdapter();

            try
            {
                daClient.Fill(dsNBD.CLIENT);
                daProject.Fill(dsNBD.PROJECT);
                daMatReq.Fill(dsNBD.MATERIAL_REQ);
                daMaterial.Fill(dsNBD.MATERIAL);
            }
            catch { }
        }
        static ProductionPlan()
        {
            // Set up data adapters/data set
            dsNBD = new NBDDataSet();
            PROJECTTableAdapter      daProject     = new PROJECTTableAdapter();
            TASKTableAdapter         daTask        = new TASKTableAdapter();
            WORKER_TYPETableAdapter  daWorkerType  = new WORKER_TYPETableAdapter();
            MATERIALTableAdapter     daMaterial    = new MATERIALTableAdapter();
            INVENTORYTableAdapter    daInventory   = new INVENTORYTableAdapter();
            MATERIAL_REQTableAdapter daMaterialReq = new MATERIAL_REQTableAdapter();

            try
            {
                daProject.Fill(dsNBD.PROJECT);
                daTask.Fill(dsNBD.TASK);
                daWorkerType.Fill(dsNBD.WORKER_TYPE);
                daMaterial.Fill(dsNBD.MATERIAL);
                daInventory.Fill(dsNBD.INVENTORY);
                daMaterialReq.Fill(dsNBD.MATERIAL_REQ);
            }
            catch { }
        }
        public void SubmitProductionPlan()
        {
            if (ddlProjects.SelectedValue != "-2")
            {
                //PROJECT ID
                int n = Convert.ToInt32(ddlProjects.SelectedValue) - 1;

                try
                {
                    //Project Start Date
                    dsNBD.PROJECT[n].projActStart = txtProjectStart.Text;

                    PROJECTTableAdapter daProjects = new PROJECTTableAdapter();
                    daProjects.Update(dsNBD.PROJECT);
                }
                catch { }

                //PLANTS LISTS
                List <string> PlantQ    = new List <string>();
                List <string> PlantDesc = new List <string>();
                List <string> PlantD    = new List <string>();
                List <string> PlantI    = new List <string>();

                //POTTERY LISTS
                List <string> PotteryQ    = new List <string>();
                List <string> PotteryDesc = new List <string>();
                List <string> PotteryD    = new List <string>();
                List <string> PotteryI    = new List <string>();

                //MATERIALS LISTS
                List <string> MaterialQ    = new List <string>();
                List <string> MaterialDesc = new List <string>();
                List <string> MaterialD    = new List <string>();
                List <string> MaterialI    = new List <string>();

                //PLANTS
                foreach (TextBox txt in phPlantsOgControls.Controls.OfType <TextBox>())
                {
                    if (txt.ID.Contains("PlantQ"))
                    {
                        PlantQ.Add(txt.Text);
                    }
                    if (txt.ID.Contains("PlantD"))
                    {
                        PlantD.Add(txt.Text);
                    }
                    if (txt.ID.Contains("PlantI"))
                    {
                        PlantI.Add(txt.Text);
                    }
                }
                foreach (DropDownList ddl in phPlantsOgControls.Controls.OfType <DropDownList>())
                {
                    PlantDesc.Add(ddl.SelectedValue);
                }

                for (int i = 0; i < PlantQ.Count(); i++)
                {
                    //ADDS NEW ROW TO MATERIAL_REQ
                    NBDDataSet.MATERIAL_REQRow r = dsNBD.MATERIAL_REQ.NewMATERIAL_REQRow();
                    int matID = 0;
                    int invID = 0;

                    DataRow[] rowMatID = dsNBD.MATERIAL.Select("matDesc='" + PlantDesc[i] + "'");
                    foreach (DataRow row in rowMatID)
                    {
                        matID = Convert.ToInt32(row.ItemArray[0].ToString());
                    }

                    DataRow[] rowInvID = dsNBD.INVENTORY.Select("materialID=" + matID.ToString());
                    foreach (DataRow row in rowInvID)
                    {
                        invID = Convert.ToInt32(row.ItemArray[0].ToString());
                    }

                    r.projectID   = Convert.ToInt32(ddlProjects.SelectedValue);
                    r.inventoryID = invID;
                    r.mreqDeliver = Convert.ToDateTime(PlantD[i]);
                    r.mreqInstall = Convert.ToDateTime(PlantI[i]);
                    r.mreqActQty  = Convert.ToInt16(PlantQ[i]);
                    r.mreqEstQty  = Convert.ToInt16(PlantQ[i]);

                    dsNBD.MATERIAL_REQ.Rows.Add(r);
                    MATERIAL_REQTableAdapter daMaterialReq = new MATERIAL_REQTableAdapter();
                    daMaterialReq.Update(dsNBD.MATERIAL_REQ);

                    ScriptManager.RegisterStartupScript(this, this.GetType(),
                                                        "alert",
                                                        "alert('Production Plan Submitted!');window.location ='../Home.aspx';",
                                                        true);
                }

                //POTTERY
                foreach (TextBox txt in phPotteryOgControls.Controls.OfType <TextBox>())
                {
                    if (txt.ID.Contains("PotteryQ"))
                    {
                        PotteryQ.Add(txt.Text);
                    }
                    if (txt.ID.Contains("PotteryD"))
                    {
                        PotteryD.Add(txt.Text);
                    }
                    if (txt.ID.Contains("PotteryI"))
                    {
                        PotteryI.Add(txt.Text);
                    }
                }
                foreach (DropDownList ddl in phPotteryOgControls.Controls.OfType <DropDownList>())
                {
                    PotteryDesc.Add(ddl.SelectedValue);
                }

                for (int i = 0; i < PotteryQ.Count(); i++)
                {
                    NBDDataSet.MATERIAL_REQRow r = dsNBD.MATERIAL_REQ.NewMATERIAL_REQRow();
                    int matID = 0;
                    int invID = 0;

                    DataRow[] rowMatID = dsNBD.MATERIAL.Select("matDesc='" + PotteryDesc[i] + "'");
                    foreach (DataRow row in rowMatID)
                    {
                        matID = Convert.ToInt32(row.ItemArray[0].ToString());
                    }

                    DataRow[] rowInvID = dsNBD.INVENTORY.Select("materialID=" + matID.ToString());
                    foreach (DataRow row in rowInvID)
                    {
                        invID = Convert.ToInt32(row.ItemArray[0].ToString());
                    }

                    r.projectID   = Convert.ToInt32(ddlProjects.SelectedValue);
                    r.inventoryID = invID;
                    r.mreqDeliver = Convert.ToDateTime(PotteryD[i]);
                    r.mreqInstall = Convert.ToDateTime(PotteryI[i]);
                    r.mreqActQty  = Convert.ToInt16(PotteryQ[i]);
                    r.mreqEstQty  = Convert.ToInt16(PotteryQ[i]);

                    dsNBD.MATERIAL_REQ.Rows.Add(r);
                    MATERIAL_REQTableAdapter daMaterialReq = new MATERIAL_REQTableAdapter();
                    daMaterialReq.Update(dsNBD.MATERIAL_REQ);

                    lblMessage.Text = "Production Plan Submitted";
                }

                //MATERIALS
                foreach (TextBox txt in phMaterialsOgControls.Controls.OfType <TextBox>())
                {
                    if (txt.ID.Contains("MaterialQ"))
                    {
                        MaterialQ.Add(txt.Text);
                    }
                    if (txt.ID.Contains("MaterialD"))
                    {
                        MaterialD.Add(txt.Text);
                    }
                    if (txt.ID.Contains("MaterialI"))
                    {
                        MaterialI.Add(txt.Text);
                    }
                }
                foreach (DropDownList ddl in phMaterialsOgControls.Controls.OfType <DropDownList>())
                {
                    MaterialDesc.Add(ddl.SelectedValue);
                }

                for (int i = 0; i < MaterialQ.Count(); i++)
                {
                    NBDDataSet.MATERIAL_REQRow r = dsNBD.MATERIAL_REQ.NewMATERIAL_REQRow();
                    int matID = 0;
                    int invID = 0;

                    DataRow[] rowMatID = dsNBD.MATERIAL.Select("matDesc='" + MaterialDesc[i] + "'");
                    foreach (DataRow row in rowMatID)
                    {
                        matID = Convert.ToInt32(row.ItemArray[0].ToString());
                    }

                    DataRow[] rowInvID = dsNBD.INVENTORY.Select("materialID=" + matID.ToString());
                    foreach (DataRow row in rowInvID)
                    {
                        invID = Convert.ToInt32(row.ItemArray[0].ToString());
                    }

                    r.projectID   = Convert.ToInt32(ddlProjects.SelectedValue);
                    r.inventoryID = invID;
                    r.mreqDeliver = Convert.ToDateTime(MaterialD[i]);
                    r.mreqInstall = Convert.ToDateTime(MaterialI[i]);
                    r.mreqActQty  = Convert.ToInt16(MaterialQ[i]);
                    r.mreqEstQty  = Convert.ToInt16(MaterialQ[i]);

                    dsNBD.MATERIAL_REQ.Rows.Add(r);
                    MATERIAL_REQTableAdapter daMaterialReq = new MATERIAL_REQTableAdapter();
                    daMaterialReq.Update(dsNBD.MATERIAL_REQ);

                    lblMessage.Text = "Production Plan Submitted";
                }
            }

            else
            {
                lblMessage.Text = "Please select a project before attempting to submit.";
            }
        }