private void MainLIstViewDataload()
        {
            StrSqltable = "PROD_SALESHEADER";
            StrSQL      = "SELECT [Sales Order],[Invoice Account] ,[Customer Name] ,[Order Date] ,[Due Date] ,[Customer Ref] ,[Status]"
                          + "FROM [PROD_SALESHEADER]"
                          + " Where[PROD_SALESHEADER].[StatusID] < 2 order by [Sales Order] desc";


            dbDataSet = db.ConnectDataSet(StrSQL, StrSqltable);
            datatable = dbDataSet.Tables[StrSqltable];
            SubFormGrid.DataSource = dbDataSet;
            SubFormGrid.DataMember = StrSqltable;
            SubFormGrid.Refresh();
            SubFormGrid.SelectedRows.Equals(0);

            InsertData.Enabled   = false;
            Save.Enabled         = false;
            SaveAll.Enabled      = false;
            DeleteRecord.Enabled = false;
            NewIndex.Enabled     = true;
            Refresh1.Enabled     = false;


            if (datatable.Rows.Count > 0)
            {
                currRecord = 0;
                //ValidateTextboxes();
            }
            else
            {
                SaleID.Text = "";
            }
        }
        public void FillControlers(int currentRec, bool PramerterFlag)
        {
            SubFormGrid.Refresh();
            if (PramerterFlag == true)
            {
                currRecord = currentRec;
            }

            if (currRecord >= 0 && currRecord < datatable.Rows.Count)
            {
                MPOLineNo_txt.Text  = datatable.Rows[currRecord]["MPOLine"].ToString();
                MPO_txt.Text        = datatable.Rows[currRecord]["MPONo"].ToString();
                ItemCode_txt.Text   = datatable.Rows[currRecord]["ItemCode"].ToString();
                ItemName_txt.Text   = datatable.Rows[currRecord]["ItemName"].ToString();
                Color_txt.Text      = datatable.Rows[currRecord]["Color"].ToString();
                cutPrGrpNo_txt.Text = datatable.Rows[currRecord]["CutProductionGroupNo"].ToString();
                SawingIn_txt.Text   = datatable.Rows[currRecord]["SewingIn"].ToString();
                SawingOut_txt.Text  = datatable.Rows[currRecord]["Counting"].ToString();
                PackingOut_txt.Text = datatable.Rows[currRecord]["PackingOut"].ToString();
                OrderQty_txt.Text   = datatable.Rows[currRecord]["orderQty"].ToString();
                LineNo_txt.Text     = datatable.Rows[currRecord]["Lineno"].ToString();
                Status_txt.Text     = datatable.Rows[currRecord]["TRStatus"].ToString();
                //ProductionNo_txt.Text = datatable.Rows[currRecord]["ProductionNO"].ToString();
                // Size_txt.Text = datatable.Rows[currRecord]["Size"].ToString();
                LineNo_txt.ReadOnly = true;
                Status_txt.ReadOnly = true;
            }
        }
        public void FillControlers(int currentRec, bool PramerterFlag)
        {
            SubFormGrid.Refresh();
            if (PramerterFlag == true)
            {
                currRecord = currentRec;
            }

            if (currRecord >= 0 && currRecord < datatable.Rows.Count)
            {
                SaleID.Text = datatable.Rows[currRecord]["Sales Order"].ToString();
                label1.Text = SaleID.Text;
                label3.Text = SaleID.Text;
            }
        }
Exemple #4
0
        private void MainLIstViewDataload()
        {
            StrSqltable = "SALESORD_LINES";
            StrSQL      = "SELECT [SOLINEID],[STOCKCODE],[DESCRIPTION] "
                          + ",[ORD_QUANT],[INV_QUANT],[UNITPRICE] ,[LOCATION]"
                          + " FROM [SALESORD_LINES] where X_PRODUCTIONREQUIRED ='Y' and HDR_SEQNO =" + TxtOrderId.Text;


            try
            {
                this.pROD_SALESHEADERTableAdapter.Fill(this.mESDataSet.PROD_SALESHEADER, ((int)(System.Convert.ChangeType(TxtOrderId.Text, typeof(int)))));
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }



            dbDataSet = db.ConnectDataSet(StrSQL, StrSqltable);
            datatable = dbDataSet.Tables[StrSqltable];
            SubFormGrid.DataSource = dbDataSet;
            SubFormGrid.DataMember = StrSqltable;
            SubFormGrid.Refresh();
            SubFormGrid.SelectedRows.Equals(0);

            InsertData.Enabled = false;
            Save.Enabled       = true;
            splitContainer1.SplitterDistance = 25;

            DeleteRecord.Enabled = false;
            NewIndex.Enabled     = false;
            Refresh1.Enabled     = false;



            if (datatable.Rows.Count > 0)
            {
                currRecord = 0;
            }
        }
        public void Dataload(string StrSql, string Strtable)
        {
            db        = new dbConnection();
            dbDataSet = db.ConnectDataSet(StrSql, Strtable);
            datatable = dbDataSet.Tables[Strtable];
            SubFormGrid.DataSource = dbDataSet;
            SubFormGrid.DataMember = Strtable;
            SubFormGrid.Refresh();

            dbAdapter   = db.ReturnDataAdapter();
            StrSqltable = Strtable;
            StrSQL      = StrSql;
            if (datatable.Rows.Count > 0)
            {
                currRecord = 0;
                //ValidateTextboxes();
            }
            else
            {
                MPOLineNo_txt.Text  = "";
                MPO_txt.Text        = "";
                ItemCode_txt.Text   = "";
                ItemName_txt.Text   = "";
                Color_txt.Text      = "";
                cutPrGrpNo_txt.Text = "";
                Status_txt.Text     = "";
                SawingIn_txt.Text   = "";
                SawingOut_txt.Text  = "";
                PackingOut_txt.Text = "";
                OrderQty_txt.Text   = "";
                LineNo_txt.Text     = "";
                //ProductionNo_txt.Text ="";
            }


            // Get Coonction
            conn = db.ReturnConncetion();



            ///thush

            // Preparing SQL Command for Insert

            OdbcCommand InsertCommand = new OdbcCommand("{CALL STP_MPOLine(?,?,?,?,?,?,?,?,?,?,?,?)}", conn);

            InsertCommand.CommandType = CommandType.StoredProcedure;
            dbAdapter.InsertCommand   = InsertCommand;
            AddParams(dbAdapter.InsertCommand, "MPOLine", "ItemCode", "ItemName", "Color", "SewingIN", "Counting", "PackingOut", "OrderQty", "TRstatus", "MPONo", "CutProductionGroupNo", "LineNo");

            // Preparing SQL Command for update

            OdbcCommand updateCommand = new OdbcCommand("{CALL STP_MPOLine(?,?,?,?,?,?,?,?,?,?,?,?)}", conn);

            updateCommand.CommandType = CommandType.StoredProcedure;
            dbAdapter.UpdateCommand   = updateCommand;
            AddParams(dbAdapter.UpdateCommand, "MPOLine", "ItemCode", "ItemName", "Color", "SewingIN", "Counting", "PackingOut", "OrderQty", "TRstatus", "MPONo", "CutProductionGroupNo", "LineNo");


            // Preparing SQL Command for Delete

            OdbcCommand DeleteCommand = new OdbcCommand("{CALL STP_MPOLineDelete(?)}", conn);

            DeleteCommand.CommandType = CommandType.StoredProcedure;
            dbAdapter.DeleteCommand   = DeleteCommand;
            AddParams(dbAdapter.DeleteCommand, "LineNo");

            currRecord = 0;
            //insertrecode = 1;
        }