Esempio n. 1
0
        public void SetAvgUnitWeight()
        {
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            SqlCommand    objSQLCommand;
            SqlDataReader objReader;
            Single        sngTemp = 0.0F;
            int           intTemp = 0;
            string        strSQL;


            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("GetItemAvgUnitWeightAndCount", new string[] { ItemID });

            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand = new SqlCommand(strSQL, objExtraSytelineTableSettings.SQLConnection);

            objReader = objSQLCommand.ExecuteReader();
            objReader.Read();

            Single.TryParse(objReader[0].ToString(), out sngTemp);
            PieceWgt = sngTemp;

            int.TryParse(objReader[1].ToString(), out intTemp);
            mUnitWeightHistoryCount = intTemp;

            objExtraSytelineTableSettings.SQLConnection.Close();
        }
Esempio n. 2
0
        public static int GetMaxItemPieceUnitWeightHistoryCount()
        {
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            SqlCommand    objSQLCommand;
            SqlDataReader objDataReader;
            string        strSQL;
            int           intTemp;


            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("SelectSetting", new string[] { "ItemPieceWeightHistoryCount" });

            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand             = objExtraSytelineTableSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            objDataReader = objSQLCommand.ExecuteReader();
            objDataReader.Read();

            if (int.TryParse(objDataReader["Setting"].ToString(), out intTemp))
            {
                return(intTemp);
            }
            else
            {
                throw new Exception("Unable to get a valid ItemPieceWeightHistoryCount from the Settings Table.");
            }
        }
Esempio n. 3
0
        public bool IncrementPackingSlipSuffix()
        {
            /*I used the command "GRANT UPDATE ON [WTF_App].[dbo].[co] TO WTFApp" to grant the update priveleges
             * "REVOKE UPDATE ON [WTF_App].[dbo].[co] TO WTFApp" is the SQL to remove the privelege.
             * Note that I needed to make a new query in order for a successful execution; each time I tried to use an existing Query, it failed
             */
            SqlCommand objSQLCommand;
            string     strSQL;
            SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings;


            objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
            strSQL = QueryDefinitions.GetQuery("UpdatePackingSlipPrintSequence", new string[] { CustomerOrderNumber.Trim() });
            objSL8_WTF_DataBaseSettings.SQLConnection.Open();
            objSQLCommand             = objSL8_WTF_DataBaseSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            if (objSQLCommand.ExecuteNonQuery() == 1)//appropriate row was affected
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        public void UpdateAvgUnitWeightHistory(Single sngUnitWeight, int intQuantity)
        {
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            SqlCommand objSQLCommand;
            string     strSQL;


            //if (sngUnitWeight <= 0.0)
            //    throw new Exception("Unit Weight cannot be < or = to 0.0");
            //if (intQuantity <= 0)
            //    throw new Exception("Quantity cannot be < or = to 0.0");

            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("DeleteOldestItemUnitWeightHistory", new string[] { ItemID });
            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand = new SqlCommand(strSQL, objExtraSytelineTableSettings.SQLConnection);
            for (int intCounter = UnitWeightHistoryCount - MaxUnitWeightHistoryCount; intCounter >= 0; --intCounter)
            {
                objSQLCommand.ExecuteNonQuery();
            }

            strSQL        = QueryDefinitions.GetQuery("InsertNewItemUnitWeightHistory", new string[] { ItemID, sngUnitWeight.ToString(), intQuantity.ToString() });
            objSQLCommand = new SqlCommand(strSQL, objExtraSytelineTableSettings.SQLConnection);
            objSQLCommand.ExecuteNonQuery();

            objExtraSytelineTableSettings.SQLConnection.Close();
            SetAvgUnitWeight();
        }
Esempio n. 5
0
        public static string GetLabelPath()
        {
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            SqlCommand    objSQLCommand;
            SqlDataReader objDataReader;
            string        strSQL;


            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("SelectSetting", new string[] { "LabelPath" });

            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand             = objExtraSytelineTableSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            objDataReader = objSQLCommand.ExecuteReader();
            objDataReader.Read();

            if (string.IsNullOrEmpty(objDataReader["Setting"].ToString()) || !Directory.Exists(objDataReader["Setting"].ToString()))
            {
                throw new Exception("Unable to get a Valid File Path from LabelPath record of the Settings Table.");
            }
            else
            {
                return(objDataReader["Setting"].ToString());
            }
        }
Esempio n. 6
0
        //public static SortableSearchableBindingList<StockLocation> StockLocations
        //{
        //    get
        //    {
        //        SortableSearchableBindingList<StockLocation> objStockLocationList = new SortableSearchableBindingList<StockLocation>();
        //        StockLocation objStockLocation;
        //        SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
        //        DataTable objDataTable = new DataTable();
        //        SqlDataAdapter objDataAdapter;
        //        SqlCommand objSQLCommand;
        //        string strSQL;


        //        strSQL = QueryDefinitions.GetQuery("SelectStockRoomLocations");

        //        objSL8_WTF_DataBaseSettings.SQLConnection.Open();
        //        objSQLCommand = new SqlCommand(strSQL, objSL8_WTF_DataBaseSettings.SQLConnection);
        //        objDataAdapter = new SqlDataAdapter(objSQLCommand);
        //        objDataAdapter.Fill(objDataTable);

        //        foreach (DataRow objRow in objDataTable.Rows)
        //        {
        //            objStockLocation = new StockLocation();

        //            objStockLocation.Location = objRow["loc"].ToString();

        //            objStockLocation.LocationDescription = objRow["description"].ToString();

        //            objStockLocation.LocationType = objRow["loc_type"].ToString()[0];

        //            objStockLocationList.Add(objStockLocation);
        //        }

        //        return objStockLocationList;
        //    }
        //}
        //public static BindingList<ComboBoxItem> StockLocations
        //{
        //    get
        //    {
        //        string strSQL;
        //        SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
        //        SqlCommand objSQLCommand;
        //        SqlDataAdapter objDataAdapter;
        //        DataTable objDataTable;
        //        BindingList<ComboBoxItem> objBindingList;


        //        objBindingList = new BindingList<ComboBoxItem>();
        //        objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
        //        strSQL = QueryDefinitions.GetQuery("SelectStockRoomLocations");
        //        objSL8_WTF_DataBaseSettings.SQLConnection.Open();
        //        objSQLCommand = new SqlCommand(strSQL, objSL8_WTF_DataBaseSettings.SQLConnection);
        //        objDataAdapter = new SqlDataAdapter(objSQLCommand);
        //        objDataTable = new DataTable();
        //        objDataAdapter.Fill(objDataTable);


        //        if (objDataTable.Rows.Count > 0)
        //        {
        //            objBindingList = new BindingList<ComboBoxItem>();
        //            //objBindingList.Add(new ComboBoxItem { Text = "--- Select Carrier ---", Value = "0" });
        //            for (int intCounter = 0; intCounter < objDataTable.Rows.Count; intCounter++)
        //                objBindingList.Add(new ComboBoxItem { Value = objDataTable.Rows[intCounter][0].ToString(), Text = objDataTable.Rows[intCounter][0].ToString() });
        //            return objBindingList;
        //        }
        //        else
        //            return objBindingList;



        //    }
        //}
        public bool Insert()
        {
            /*I used the command "GRANT INSERT ON [WTF_App].[dbo].[jobtran] TO WTFApp" to grant the insert priveleges
             * "REVOKE INSERT ON [WTF_App].[dbo].[jobtran] TO WTFApp" is the SQL to remove the privelege.
             * Note that I needed to make a new query in order for a successful execution; each time I tried to use an existing Query, it failed
             */
            SortableSearchableBindingList <Operation> objOperationList = new SortableSearchableBindingList <Operation>();
            SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings       = new SL8_WTF_DataBaseSettings();
            DataTable  objDataTable = new DataTable();
            SqlCommand objSQLCommand;
            string     strSQL;
            int        intCompleteOperation, intCloseJob;


            intCompleteOperation = CompleteOperation ? 1 : 0;
            intCloseJob          = CloseJob ? 1 : 0;

            strSQL = QueryDefinitions.GetQuery("InsertIntoJobTran", new string[] { JobNumber, Suffix.ToString(), TransactionType.ToString().ToUpper(), DateTime.Now.ToString(), QtyComplete.ToString(), Operation.ToString(),
                                                                                   QtyMoved.ToString(), Warehouse, Location.ToString(), TransactionClass.ToString().ToUpper(), Operation.WorkCenter, UserCode, intCompleteOperation.ToString(), intCloseJob.ToString(), NextOperation.ToString() });
            objSL8_WTF_DataBaseSettings.SQLConnection.Open();
            objSQLCommand             = objSL8_WTF_DataBaseSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;
            if (objSQLCommand.ExecuteNonQuery() == 1) //the appropriate record was affected
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private static int UpdateNextSequenceNumber(long lngNextSequenceNo, string strTableName, string strGUID)
        {
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            SqlCommand objSQLCommand;
            string     strSQL;

            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("UpdateNextSequenceNumber", new string[] { lngNextSequenceNo.ToString(), GetGUID(), strTableName, strGUID });
            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand = new SqlCommand(strSQL, objExtraSytelineTableSettings.SQLConnection);

            return(objSQLCommand.ExecuteNonQuery());
        }
        public static SortableSearchableBindingList<VendorAddress> Search(string strVendorNumber, int intMaxRecordCount = 100, string strSearchBy = "vend_num")//Retrieves a list of customers that match the customer number
        {
            SortableSearchableBindingList<VendorAddress> objVendorAddressList;
            SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings;
            DataTable objDataTable = new DataTable();
            SqlDataAdapter objDataAdapter;
            SqlCommand objSQLCommand;
            VendorAddress objVendorAddress;
            string strSQL;


            objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
            strSQL = QueryDefinitions.GetQuery("SelectTopNVendorAddresses", new string[] { intMaxRecordCount.ToString(), strSearchBy, strVendorNumber, strSearchBy });
            objSL8_WTF_DataBaseSettings.SQLConnection.Open();
            objSQLCommand = new SqlCommand(strSQL, objSL8_WTF_DataBaseSettings.SQLConnection);
            objDataAdapter = new SqlDataAdapter(objSQLCommand);
            objDataAdapter.Fill(objDataTable);

            objVendorAddressList = new SortableSearchableBindingList<VendorAddress>();

            if (objDataTable.Rows.Count > 0)
            {
                foreach (DataRow objRow in objDataTable.Rows)
                {
                    objVendorAddress = new VendorAddress();

                    objVendorAddress.VendorNumber = objRow["vend_num"].ToString();
                    objVendorAddress.Name = objRow["Name"].ToString();
                    objVendorAddress.AddressLine1 = objRow["Addr##1"].ToString();
                    objVendorAddress.AddressLine2 = objRow["Addr##2"].ToString();
                    objVendorAddress.AddressLine3 = objRow["Addr##3"].ToString();
                    objVendorAddress.AddressLine4 = objRow["Addr##4"].ToString();
                    objVendorAddress.City = objRow["City"].ToString();
                    objVendorAddress.State = objRow["State"].ToString();
                    objVendorAddress.ZipCode = objRow["ZIP"].ToString();
                    objVendorAddress.Country = objRow["country"].ToString();

                    objVendorAddressList.Add(objVendorAddress);
                }
            }
            return objVendorAddressList;
        }
        public static SortableSearchableBindingList <CustomerAddress> Find(string strCustomerNumber)//Retrieves a list of addresses of the specified customer
        {
            SortableSearchableBindingList <CustomerAddress> objCustomerAddressList;
            SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings;
            DataTable       objDataTable = new DataTable();
            SqlDataAdapter  objDataAdapter;
            SqlCommand      objSQLCommand;
            CustomerAddress objCustomerAddress;
            string          strSQL;


            objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
            strSQL = QueryDefinitions.GetQuery("SelectCustomerAddresses", new string[] { strCustomerNumber });
            objSL8_WTF_DataBaseSettings.SQLConnection.Open();
            objSQLCommand  = new SqlCommand(strSQL, objSL8_WTF_DataBaseSettings.SQLConnection);
            objDataAdapter = new SqlDataAdapter(objSQLCommand);
            objDataAdapter.Fill(objDataTable);

            objCustomerAddressList = new SortableSearchableBindingList <CustomerAddress>();

            if (objDataTable.Rows.Count > 0)
            {
                foreach (DataRow objRow in objDataTable.Rows)
                {
                    objCustomerAddress = new CustomerAddress();

                    objCustomerAddress.CustomerNumber = objRow["cust_num"].ToString();
                    objCustomerAddress.Name           = objRow["Name"].ToString();
                    objCustomerAddress.AddressLine1   = objRow["Addr##1"].ToString();
                    objCustomerAddress.AddressLine2   = objRow["Addr##2"].ToString();
                    objCustomerAddress.AddressLine3   = objRow["Addr##3"].ToString();
                    objCustomerAddress.AddressLine4   = objRow["Addr##4"].ToString();
                    objCustomerAddress.City           = objRow["City"].ToString();
                    objCustomerAddress.State          = objRow["State"].ToString();
                    objCustomerAddress.ZipCode        = objRow["ZIP"].ToString();
                    objCustomerAddress.Country        = objRow["country"].ToString();

                    objCustomerAddressList.Add(objCustomerAddress);
                }
            }
            return(objCustomerAddressList);
        }
Esempio n. 10
0
        public static bool ShipItemFromInventory(ItemHistoryTransaction objItemHistoryTransaction)
        {
            SqlCommand objSQLCommand;
            string     strSQL;
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            SqlDataReader objDataReader;

            if (!string.IsNullOrEmpty(objItemHistoryTransaction.ShippedTimeStamp))
            {
                throw new Exception("History Transaction " + objItemHistoryTransaction.RecievedItemID + " was already shipped on " + objItemHistoryTransaction.ShippedTimeStamp);
            }

            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("SelectRecievedAccumulatorID", new string[] { objItemHistoryTransaction.ItemID, objItemHistoryTransaction.Job, objItemHistoryTransaction.Suffix.ToString() });
            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand             = objExtraSytelineTableSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            objDataReader = objSQLCommand.ExecuteReader();

            if (objDataReader.Read())
            {
                strSQL = QueryDefinitions.GetQuery("UpdateRecievedItemAccumulator",//fix this
                                                   new string[] { "- " + objItemHistoryTransaction.Quantity, DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss"), objDataReader["JobOrderNumber"].ToString(), objDataReader["ReceivedItemAccumulatorID"].ToString() });
            }
            else
            {
                throw new Exception("No accumulator record found for job " + objItemHistoryTransaction.Job);
            }

            objDataReader.Close();
            objSQLCommand.CommandText = strSQL;
            if (objSQLCommand.ExecuteNonQuery() == 1)//the appropriate row was affected
            {
                return(ShipItem(objItemHistoryTransaction.RecievedItemID));
            }
            else
            {
                throw new Exception("Unable to update accumulator record for job " + objItemHistoryTransaction.Job);
            }
        }
        private static long GetNextSequenceNumber(string strTableName)
        {
            SqlCommand objSQLCommand;
            string     strSQL;
            long       lngSequenceNo;
            string     strGUID;
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            SqlDataReader objDataReader;


            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("GetNextSequenceNumber", new string[] { strTableName });
            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand             = objExtraSytelineTableSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            objDataReader = objSQLCommand.ExecuteReader();

            if (objDataReader.Read())
            {
                long.TryParse(objDataReader["NextSequence"].ToString(), out lngSequenceNo);
                strGUID = objDataReader["GUID"].ToString();
            }
            else
            {
                throw new Exception("Unable to get record from TableSequence. TABLE: " + strTableName);
            }

            lngSequenceNo = ++lngSequenceNo;

            if (UpdateNextSequenceNumber(lngSequenceNo, strTableName, strGUID) == 1)
            {
                return(lngSequenceNo);
            }
            else
            {
                throw new Exception("Failed to update TableSequence on Table: " + strTableName);
            }
        }
Esempio n. 12
0
        public Order(string strOrderNumber)
        {
            SqlCommand objSQLCommand;
            string     strSQL;
            SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings;
            SqlDataReader            objDataReader;
            DateTime dtmTemp;
            double   dblTemp;
            int      intTemp;


            objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
            strSQL = QueryDefinitions.GetQuery("SelectTopNOrders", new string[] { "1", "co.co_num", strOrderNumber.Trim(), "co.co_num" });
            objSL8_WTF_DataBaseSettings.SQLConnection.Open();
            objSQLCommand             = objSL8_WTF_DataBaseSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            objDataReader = objSQLCommand.ExecuteReader();

            if (objDataReader.HasRows)
            {
                objDataReader.Read();

                CustomerOrderNumber      = objDataReader["co_num"].ToString();
                IsBlanketOrder           = objDataReader["type"].ToString().ToUpper().Trim().Equals("B") ? true : false;//Types are either B-Blanket, R-Regular or E-?
                CustomerPO               = objDataReader["cust_po"].ToString();
                CustomerNumber           = objDataReader["cust_num"].ToString();
                CustomerName             = objDataReader["name"].ToString();
                OrderDate                = DateTime.TryParse(objDataReader["order_date"].ToString(), out dtmTemp) ? dtmTemp : DateTime.MinValue;
                RowPointer               = objDataReader["RowPointer"].ToString();
                PackingSlipPrintSequence = double.TryParse(objDataReader["decifld1"].ToString(), out dblTemp) ? (int)dblTemp : 0;
                SelectedAddressNo        = int.TryParse(objDataReader["cust_seq"].ToString(), out intTemp) ? intTemp : 0;
                //Notes = this.GetInternalNotes();
            }
            else
            {
                throw new Exception("Order does not exist!");
            }
        }
Esempio n. 13
0
        public bool Recieve(int intQuantity, string strOperator)
        {
            SqlCommand objSQLCommand;
            string     strSQL;
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            SqlDataReader objDataReader;


            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("SelectRecievedAccumulatorID", new string[] { ItemID, SelectedJob.JobNumber, SelectedJob.Suffix.ToString() });
            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand             = objExtraSytelineTableSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            objDataReader = objSQLCommand.ExecuteReader();

            if (objDataReader.Read())
            {
                strSQL = QueryDefinitions.GetQuery("UpdateRecievedItemAccumulator",
                                                   new string[] { "+ " + intQuantity, DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss"), SelectedJob.JobOrderNumber, objDataReader["ReceivedItemAccumulatorID"].ToString() });
            }
            else
            {
                strSQL = QueryDefinitions.GetQuery("InsertIntoRecievedItemAccumulator",
                                                   new string[] { ItemID, SelectedJob.JobNumber, SelectedJob.JobOrderNumber, intQuantity.ToString(), SelectedJob.Suffix.ToString() });
            }

            objDataReader.Close();
            objSQLCommand.CommandText = strSQL;
            if (objSQLCommand.ExecuteNonQuery() == 1)//the appropriate row was affected
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private static List <Note> GetNotesListByGUID(string strGUID)
        {
            SqlCommand objSQLCommand;
            string     strSQL;
            SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings;
            SqlDataReader            objDataReader;
            Note        objNote;
            List <Note> objNoteList;


            objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
            strSQL = QueryDefinitions.GetQuery("SelectNotesByGUID", new string[] { strGUID });
            objSL8_WTF_DataBaseSettings.SQLConnection.Open();
            objSQLCommand             = objSL8_WTF_DataBaseSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            objDataReader = objSQLCommand.ExecuteReader();

            objNoteList = new List <Note>();
            if (objDataReader.HasRows)
            {
                while (objDataReader.Read())
                {
                    objNote = new Note();

                    objNote.Description    = objDataReader["Description"].ToString();
                    objNote.Notes          = objDataReader["Note"].ToString();
                    objNote.IsSpecificNote = objDataReader["IsSpecificNote"].ToString().Equals("0") ? false : true;
                    objNote.TableName      = objDataReader["TableName"].ToString();
                    objNote.RefRowPointer  = objDataReader["RefRowPointer"].ToString();
                    objNote.IsInternalNote = objDataReader["IsInternalNote"].ToString().Equals("0") ? false : true;

                    objNoteList.Add(objNote);
                }
            }

            return(objNoteList);
        }
Esempio n. 15
0
        public static bool ShipItem(int intRecieveditemID)
        {
            SqlCommand objSQLCommand;
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            string strSQL;


            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("UpdateRecievedItemHistory", new string[] { DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss"), intRecieveditemID.ToString() });

            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand             = objExtraSytelineTableSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            if (objSQLCommand.ExecuteNonQuery() == 1)
            {
                return(true);
            }
            else
            {
                throw new Exception("Unable to update RecievedItemHistory ID " + intRecieveditemID);
            }
        }
Esempio n. 16
0
        public bool AddToReceiveHistory(int intQuantity, string strOperator, double dblGrossWeight, int intPalletCount)
        {
            SqlCommand objSQLCommand;
            string     strSQL;
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;


            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery("InsertIntoRecievedItemHistory", new string[] { SelectedJob.JobNumber, ItemID, intQuantity.ToString(),
                                                                                               strOperator, dblGrossWeight.ToString(), LabelSequence.ToString(), SelectedOrder.CustomerOrderNumber, intPalletCount.ToString(), SelectedJob.Suffix.ToString() });
            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand             = objExtraSytelineTableSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            if (objSQLCommand.ExecuteNonQuery() == 1) //appropriate row was affected
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private BindingList <ComboBoxItem> GetList(string strSelectStatement)
        {
            string strSQL;
            ExtraSytelineTablesSettings objExtraSytelineTablesSettings;
            SqlCommand                 objSQLCommand;
            SqlDataAdapter             objDataAdapter;
            DataTable                  objDataTable;
            BindingList <ComboBoxItem> objBindingList;


            objBindingList = new BindingList <ComboBoxItem>();
            objExtraSytelineTablesSettings = new ExtraSytelineTablesSettings();
            strSQL = QueryDefinitions.GetQuery(strSelectStatement);
            objExtraSytelineTablesSettings.SQLConnection.Open();
            objSQLCommand  = new SqlCommand(strSQL, objExtraSytelineTablesSettings.SQLConnection);
            objDataAdapter = new SqlDataAdapter(objSQLCommand);
            objDataTable   = new DataTable();
            objDataAdapter.Fill(objDataTable);


            if (objDataTable.Rows.Count > 0)
            {
                objBindingList = new BindingList <ComboBoxItem>();
                //objBindingList.Add(new ComboBoxItem { Text = "--- Select Carrier ---", Value = "0" });
                for (int intCounter = 0; intCounter < objDataTable.Rows.Count; intCounter++)
                {
                    objBindingList.Add(new ComboBoxItem {
                        Value = objDataTable.Rows[intCounter][0].ToString(), Text = objDataTable.Rows[intCounter][1].ToString()
                    });
                }
                return(objBindingList);
            }
            else
            {
                return(objBindingList);
            }
        }
Esempio n. 18
0
        public SortableSearchableBindingList <ItemHistoryTransaction> GetHistory(ItemHistoryView enuItemHistoryView, string strJobNo = null, int intSuffix = 0)
        {
            SortableSearchableBindingList <ItemHistoryTransaction> objItemHistoryList = new SortableSearchableBindingList <ItemHistoryTransaction>();
            ItemHistoryTransaction      objItemHistoryTransaction;
            SqlCommand                  objSQLCommand;
            ExtraSytelineTablesSettings objExtraSytelineTableSettings;
            SqlDataReader               objDataReader;
            string strSQL;
            string strJobParameter;


            objExtraSytelineTableSettings = new ExtraSytelineTablesSettings();

            if (strJobNo != null)
            {
                strJobParameter = " AND job = '" + strJobNo + "' AND suffix = " + intSuffix.ToString();
            }
            else
            {
                strJobParameter = string.Empty;
            }

            switch (enuItemHistoryView)
            {
            case ItemHistoryView.All:
                strSQL = QueryDefinitions.GetQuery("SelectAllItemHistory", new string[] { ItemID, strJobParameter });
                break;

            case ItemHistoryView.Shipped:
                strSQL = QueryDefinitions.GetQuery("SelectShippedItemHistory", new string[] { ItemID, strJobParameter });
                break;

            case ItemHistoryView.Recieved:
                strSQL = QueryDefinitions.GetQuery("SelectRecievedItemHistory", new string[] { ItemID, strJobParameter });
                break;

            default:
                strSQL = string.Empty;
                break;
            }


            objExtraSytelineTableSettings.SQLConnection.Open();
            objSQLCommand             = objExtraSytelineTableSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            objDataReader = objSQLCommand.ExecuteReader();

            while (objDataReader.Read())
            {
                objItemHistoryTransaction = new ItemHistoryTransaction();

                objItemHistoryTransaction.LabelSequence       = int.Parse(objDataReader["LabelSequence"].ToString());
                objItemHistoryTransaction.ItemID              = objDataReader["item"].ToString();
                objItemHistoryTransaction.Job                 = objDataReader["job"].ToString();
                objItemHistoryTransaction.CustomerOrderNumber = objDataReader["co"].ToString();
                objItemHistoryTransaction.Quantity            = int.Parse(objDataReader["Quantity"].ToString());
                objItemHistoryTransaction.RecievedTimeStamp   = string.Format("{0:MM/dd/yyyy hh:mm:ss tt}", objDataReader["ReceivedTimestamp"]);
                objItemHistoryTransaction.ShippedTimeStamp    = string.Format("{0:MM/dd/yyyy hh:mm:ss tt}", objDataReader["ShippedTimestamp"]);
                objItemHistoryTransaction.Operator            = objDataReader["operator"].ToString();
                objItemHistoryTransaction.GrossWeight         = double.Parse(objDataReader["GrossWgt"].ToString());
                objItemHistoryTransaction.PalletCount         = int.Parse(objDataReader["PalletCt"].ToString());
                objItemHistoryTransaction.RecievedItemID      = int.Parse(objDataReader["ReceivedItemID"].ToString());
                objItemHistoryTransaction.Suffix              = int.Parse(objDataReader["suffix"].ToString());

                objItemHistoryList.Add(objItemHistoryTransaction);
            }

            return(objItemHistoryList);
        }
Esempio n. 19
0
        public Item(string strItemNo)
        {
            SqlCommand objSQLCommand;
            string     strSQL;
            double     dblTemp;
            SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings;
            SqlDataReader            objDataReader;
            Match objMFGMatch, objDashIntMatch;


            objMFGMatch     = Regex.Match(strItemNo, @"-MFG\Z", RegexOptions.IgnoreCase);
            objDashIntMatch = Regex.Match(strItemNo, @"-[0-9]\Z", RegexOptions.IgnoreCase);

            objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
            strSQL = QueryDefinitions.GetQuery("SelectTopNItems", new string[] { "1", "item.item", strItemNo, "item.item" });
            objSL8_WTF_DataBaseSettings.SQLConnection.Open();
            objSQLCommand             = objSL8_WTF_DataBaseSettings.SQLConnection.CreateCommand();
            objSQLCommand.CommandText = strSQL;

            objDataReader = objSQLCommand.ExecuteReader();

            if (objDataReader.HasRows)
            {
                objDataReader.Read();

                ItemID      = objDataReader["Item"].ToString();
                Description = objDataReader["Description"].ToString();
                Revision    = objDataReader["revision"].ToString();
                QtyOnHand   = double.TryParse(objDataReader["qty_on_hand"].ToString(), out dblTemp) ? dblTemp : 0.0;
                //CustomerItem = objDataReader["drawing_nbr"].ToString();
                CustomerItem = objDataReader["charfld1"].ToString();

                //IsMFG = ItemID.ToUpper().EndsWith("MFG");
                IsSubItem = objMFGMatch.Success || objDashIntMatch.Success;//Implemented so isMFG functionality could be utilized for -1, -2, etc items
                SetAvgUnitWeight();
                try
                {
                    MaxUnitWeightHistoryCount = Settings.GetMaxItemPieceUnitWeightHistoryCount();
                }
                catch
                {
                    throw new Exception("Unable to get ItemPieceWeightHistoryCount from the Settings Table.");
                }
            }
            else
            {
                throw new Exception("Item does not exist!");
            }


            //SL8WebServiceSettings objSL8WebServiceSettings;
            //DataSet objDataSet;


            //ValidateItemNo(strItemNo);

            //objSL8WebServiceSettings = new SL8WebServiceSettings();
            //objDataSet = objSL8WebServiceSettings.WebService.LoadDataSet(objSL8WebServiceSettings.SessionToken, "SL.SLItems", "Item, Description", "Item LIKE '" + strItemNo + "'", "Item", string.Empty, 1);

            //if (objDataSet.Tables[0].Rows.Count > 0)
            //{
            //    ItemID = objDataSet.Tables[0].Rows[0]["Item"].ToString();
            //    Description = objDataSet.Tables[0].Rows[0]["Description"].ToString();
            //    IsMFG = ItemID.ToUpper().EndsWith("MFG");
            //    SetAvgUnitWeight();
            //    MaxUnitWeightHistoryCount = 5;
            //}
            //else
            //    throw new Exception("Item does not exist!");
        }