Esempio n. 1
0
        //private void Validate(object sender, CancelEventArgs e)
        //{
        //    string strType = sender.GetType().ToString();


        //    //strbldrMessage = new StringBuilder();
        //    switch (strType.Substring(strType.LastIndexOf('.') + 1))
        //    {
        //        case "ComboBox":
        //            ComboBox objComboBox = (ComboBox)sender;

        //            if (objComboBox.SelectedIndex == -1 || ((ComboBoxItem)objComboBox.Items[0]).Value.Equals("0"))
        //                switch (objComboBox.Name)
        //                {
        //                    case "cboCarrier":
        //                        mstrbldrErrors.Append("\r\n- No \"Carrier\" selected");
        //                        lblCarrierError.Text = "X";
        //                        break;
        //                    case "cboShipClass":
        //                        mstrbldrErrors.Append("\r\n- No \"Ship Classification\" selected");
        //                        lblShipClassificationError.Text = "X";
        //                        break;
        //                    case "cboFreightCharges":
        //                        mstrbldrErrors.Append("\r\n- No \"Freight Charges\" selected");
        //                        lblFreightChargesError.Text = "X";
        //                        break;
        //                }
        //            else
        //                switch (objComboBox.Name)
        //                {
        //                    case "cboCarrier":
        //                        lblCarrierError.Text = string.Empty;
        //                        break;
        //                    case "cboShipClass":
        //                        lblShipClassificationError.Text = string.Empty;
        //                        break;
        //                    case "cboFreightCharges":
        //                        lblFreightChargesError.Text = string.Empty;
        //                        break;
        //                }
        //                //objComboBox.BackColor = Color.FromKnownColor(KnownColor.ControlText);
        //            break;
        //        case "TextBox":
        //            TextBox objTextBox = (TextBox)sender;
        //            double dblTemp;

        //            switch (objTextBox.Name)
        //            {
        //                case "txtOrder":
        //                    if (objTextBox.Text.Length == 0)
        //                    {
        //                        mstrbldrErrors.Append("\r\n- Missing \"Order\"");
        //                        lblOrderError.Text = "X";
        //                    }
        //                    else
        //                        lblOrderError.Text = string.Empty;
        //                    break;
        //                case "txtGrossWgt":
        //                    if (objTextBox.Text.Length == 0 || !double.TryParse(objTextBox.Text, out dblTemp))
        //                    {
        //                        mstrbldrErrors.Append("\r\n- Invalid or missing \"Gross Wgt\".");
        //                        lblGrossWeightError.Text = "X";
        //                    }
        //                    else
        //                        lblGrossWeightError.Text = string.Empty;
        //                    break;
        //                case "txtPalletCt":
        //                    if (objTextBox.Text.Length == 0 || !double.TryParse(objTextBox.Text, out dblTemp))
        //                    {
        //                        mstrbldrErrors.Append("\r\n- Invalid or missing \"# of Pallets\"");
        //                        lblPalletCountError.Text = "X";
        //                    }
        //                    else
        //                        lblPalletCountError.Text = string.Empty;
        //                    break;
        //                case "txtAddress":
        //                    if (objTextBox.Text.Length == 0)
        //                    {
        //                        mstrbldrErrors.Append("\r\n- No \"Customer Address\" specified");
        //                        lblAddressError.Text = "X";
        //                    }
        //                    else
        //                        lblAddressError.Text = string.Empty;
        //                    break;
        //            }
        //            break;
        //    }

        //if (strbldrMessage.Length != 0)
        //{
        //    //MessageBox.Show("The following information is missing or invalid:" +
        //    //    strbldrMessage.ToString(), "Information Missing or Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
        //    e.Cancel = true;
        //}

        //}

        private void SetDGVDataSource()
        {
            mobjOrderLines = new SortableSearchableBindingList <OrderLine>();

            if (chkLastFilledOrder.Checked) /*I added this implementation so that Tony could create a packing slip for -mfg items that are going to a plater under a filled order */
            {                               /*Since there would not be an open order for a -mfg item under which they could ship.*/
                mobjOrderLines.Add(mobjOrder.OrderLines
                                   .Where(o => o.LineOrReleaseStatus == "F")
                                   .OrderByDescending(l => l.CustomerOrderLine)
                                   .OrderByDescending(l => l.CustomerOrderRelease)
                                   .Take(1)
                                   .SingleOrDefault());

                if (mobjOrderLines[0] == null) //if there is no value returned from the above query then a null orderline is added to the collection.
                {
                    mobjOrderLines.Clear();    //I cleare it out so that it doesn't show on my datagrid as an empty row.
                }
            }
            else
            {
                foreach (OrderLine objOrderLine in mobjOrder.OrderLines.Where(o => o.LineOrReleaseStatus == "O").ToList())
                {
                    objOrderLine.Notes = objOrderLine.GetInternalNotes();
                    mobjOrderLines.Add(objOrderLine);
                }
            }

            dgvOrderLines.DataSource = mobjOrderLines;
        }
Esempio n. 2
0
        private void RadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (sender is RadioButton)
            {
                RadioButton objRad = (RadioButton)sender;

                if (objRad.Checked)
                {
                    switch (objRad.Name)
                    {
                    case "optAll":
                        dgvItemHistory.DataSource = mobjItem.GetHistory(ItemHistoryView.All);
                        TotalCheckBoxes           = dgvItemHistory.RowCount;
                        TotalCheckedCheckBoxes    = 0;
                        HeaderCheckBox.Checked    = false;
                        SelectedTotal             = 0;
                        mstrbldrReportType.Clear().Append("All Transactions");
                        //MessageBox.Show("Fired " + objRad.Name);
                        break;

                    case "optReceiving":
                        if (mblnIsShipping)    //This check was implemented to accomodate filtering by job when shipping an item.
                        {
                            var objQuery = mobjItem.GetHistory(ItemHistoryView.Recieved)
                                           .Where(t => t.FormattedJobNumber.Equals(mobjItem.SelectedJob.FormattedJobNumber) && t.Suffix == mobjItem.SelectedJob.Suffix)
                                           .ToList();
                            var objItemHistoryList = new SortableSearchableBindingList <ItemHistoryTransaction>(); //create a new sortablesearchablebindinglist
                            foreach (ItemHistoryTransaction objItemHistoryTransaction in objQuery)                 //add each filtered item to the binding list
                            {
                                objItemHistoryList.Add(objItemHistoryTransaction);
                            }
                            dgvItemHistory.DataSource = objItemHistoryList;
                        }
                        else
                        {
                            dgvItemHistory.DataSource = mobjItem.GetHistory(ItemHistoryView.Recieved);
                        }
                        TotalCheckBoxes        = dgvItemHistory.RowCount;
                        TotalCheckedCheckBoxes = 0;
                        HeaderCheckBox.Checked = false;
                        SelectedTotal          = 0;
                        mstrbldrReportType.Clear().Append("Recieving Transactions");
                        //MessageBox.Show("Fired " + objRad.Name);
                        break;

                    case "optShipping":
                        dgvItemHistory.DataSource = mobjItem.GetHistory(ItemHistoryView.Shipped);
                        TotalCheckBoxes           = dgvItemHistory.RowCount;
                        TotalCheckedCheckBoxes    = 0;
                        HeaderCheckBox.Checked    = false;
                        SelectedTotal             = 0;
                        mstrbldrReportType.Clear().Append("Shipping Transactions");
                        //MessageBox.Show("Fired " + objRad.Name);
                        break;
                    }
                }
            }
        }
Esempio n. 3
0
        private void GetItems()
        {
            SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings;
            DataTable      objDataTable = new DataTable();
            SqlDataAdapter objDataAdapter;
            SqlCommand     objSQLCommand;
            Item           objItem;
            string         strSQL;
            double         dblTemp;
            Match          objMFGMatch, objDashIntMatch;


            Cursor.Current   = Cursors.WaitCursor;
            dgvItems.Visible = false;

            objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
            strSQL = QueryDefinitions.GetQuery("SelectTopNItems", new string[] { MINTMAXRECORDCOUNT.ToString(),
                                                                                 ((ComboBoxItem)cboSortSearch.SelectedItem).Value, txtItem.Text, ((ComboBoxItem)cboSortSearch.SelectedItem).Value });
            objSL8_WTF_DataBaseSettings.SQLConnection.Open();
            objSQLCommand  = new SqlCommand(strSQL, objSL8_WTF_DataBaseSettings.SQLConnection);
            objDataAdapter = new SqlDataAdapter(objSQLCommand);
            objDataAdapter.Fill(objDataTable);

            mobjItemList = new SortableSearchableBindingList <Item>();

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

                    objItem.ItemID      = objRow["Item"].ToString();
                    objItem.Description = objRow["Description"].ToString();
                    objItem.Revision    = objRow["revision"].ToString();
                    objItem.QtyOnHand   = double.TryParse(objRow["qty_on_hand"].ToString(), out dblTemp) ? dblTemp : 0.0;

                    objMFGMatch     = Regex.Match(objItem.ItemID, @"-MFG\Z", RegexOptions.IgnoreCase);
                    objDashIntMatch = Regex.Match(objItem.ItemID, @"-[0-9]\Z", RegexOptions.IgnoreCase);
                    //objItem.IsMFG = objRow["Item"].ToString().ToUpper().EndsWith("MFG");
                    objItem.IsSubItem = objMFGMatch.Success || objDashIntMatch.Success;//Implemented so isMFG functionality could be utilized for -1, -2, etc items


                    mobjItemList.Add(objItem);
                }
            }
            else
            {
                MessageBox.Show(((ComboBoxItem)cboSortSearch.SelectedItem).Text + " " + txtItem.Text + " not found!", "No Item Found", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }

            Cursor.Current      = Cursors.Default;
            dgvItems.Visible    = true;
            dgvItems.DataSource = mobjItemList;
            dgvItems.Refresh();
        }
Esempio n. 4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="comboBox"></param>
 /// <param name="displayMember"></param>
 /// <param name="valueMember"></param>
 /// <param name="nullTest"></param>
 /// <param name="cnStr"></param>
 /// <param name="post"></param>
 public void SetComboBoxData(DevExpress.XtraEditors.LookUpEdit comboBox, string displayMember, string valueMember, string nullTest, string cnStr, SortableSearchableBindingList<dicCity> post) {
     comboBox.Properties.Columns.Clear();
     comboBox.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
     comboBox.Properties.DataSource = post;
     comboBox.Properties.DisplayMember = displayMember;
     comboBox.Properties.ValueMember = valueMember;
     comboBox.Properties.NullText = nullTest;
     comboBox.Properties.Columns.AddRange(new DevExpress.XtraEditors.Controls.LookUpColumnInfo[] {
     new DevExpress.XtraEditors.Controls.LookUpColumnInfo(valueMember, "ID", 20, DevExpress.Utils.FormatType.None, "", false, DevExpress.Utils.HorzAlignment.Default),
     new DevExpress.XtraEditors.Controls.LookUpColumnInfo(displayMember, cnStr)});
 }
Esempio n. 5
0
        private void GetVendors()
        {
            Cursor.Current     = Cursors.WaitCursor;
            dgvVendors.Visible = false;

            SortableSearchableBindingList <VendorAddress> objVendorAddressList = VendorAddress.Search(txtVendor.Text.Trim(),
                                                                                                      MINTMAXRECORDCOUNT, ((ComboBoxItem)cboSortSearch.SelectedItem).Value);

            if (objVendorAddressList.Count == 0)
            {
                MessageBox.Show(((ComboBoxItem)cboSortSearch.SelectedItem).Text + " " + txtVendor.Text + " not found!", "No Customer Found", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }

            Cursor.Current        = Cursors.Default;
            dgvVendors.Visible    = true;
            dgvVendors.DataSource = objVendorAddressList;
            dgvVendors.Refresh();
        }
        //Retrieves a list of customers that match the customer number
        public static SortableSearchableBindingList<VendorAddress> Search(string strVendorNumber, int intMaxRecordCount = 100, string strSearchBy = "vend_num")
        {
            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;
        }
        //Retrieves a list of addresses of the specified customer
        public static SortableSearchableBindingList<CustomerAddress> Find(string strCustomerNumber)
        {
            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;
        }
        private void SetDGVDatasource()
        {
            if (chkFilterLOrRStatus.Checked)
            {
                SortableSearchableBindingList <OrderLine> objList = new SortableSearchableBindingList <OrderLine>();


                var objQuery = mobjOrderLines.Where(o => o.LineOrReleaseStatus == "O").ToList();

                foreach (OrderLine objOrderLine in objQuery)
                {
                    objList.Add(objOrderLine);
                }

                dgvOrderLines.DataSource = objList;
            }
            else
            {
                dgvOrderLines.DataSource = mobjOrderLines;
            }
        }
        private void txtOrderNum_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Enter:
                txtOrderNum.ReadOnly    = true;
                Cursor.Current          = Cursors.WaitCursor;
                lblItemDescription.Text = "Searching for Order Lines...";
                lblItemDescription.Refresh();


                try
                {
                    SetDefaults();
                    mobjOrder      = new Order(txtOrderNum.Text.Trim());
                    mobjOrderLines = mobjOrder.OrderLines;
                    AddRemoveReleaseColumn();
                    SetDGVDatasource();

                    txtOrderNum.Text  = mobjOrder.CustomerOrderNumber.Trim();
                    lblCustomer.Text  = mobjOrder.CustomerName.Trim();
                    lblOrderDate.Text = mobjOrder.OrderDate.ToShortDateString();
                    lblOrderType.Text = mobjOrder.IsBlanketOrder ? "Blanket" : "Regular";
                }
                catch (Exception objEx)
                {
                    MessageBox.Show(objEx.Message);
                    txtOrderNum.SelectAll();
                }


                txtOrderNum.ReadOnly    = false;
                lblItemDescription.Text = string.Empty;
                Cursor.Current          = Cursors.Default;
                break;
            }
        }
Esempio n. 10
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;
        }
        private void txtOrderNum_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Enter:
                    txtOrderNum.ReadOnly = true;
                    Cursor.Current = Cursors.WaitCursor;
                    lblItemDescription.Text = "Searching for Order Lines...";
                    lblItemDescription.Refresh();

                    try
                    {
                        SetDefaults();
                        mobjOrder = new Order(txtOrderNum.Text.Trim());
                        mobjOrderLines = mobjOrder.OrderLines;
                        AddRemoveReleaseColumn();
                        SetDGVDatasource();

                        txtOrderNum.Text = mobjOrder.CustomerOrderNumber.Trim();
                        lblCustomer.Text = mobjOrder.CustomerName.Trim();
                        lblOrderDate.Text = mobjOrder.OrderDate.ToShortDateString();
                        lblOrderType.Text = mobjOrder.IsBlanketOrder ? "Blanket" : "Regular";
                    }
                    catch (Exception objEx)
                    {
                        MessageBox.Show(objEx.Message);
                        txtOrderNum.SelectAll();
                    }

                    txtOrderNum.ReadOnly = false;
                    lblItemDescription.Text = string.Empty;
                    Cursor.Current = Cursors.Default;
                    break;
            }
        }
        private void SetDGVDatasource()
        {
            if (chkFilterLOrRStatus.Checked)
            {
                SortableSearchableBindingList<OrderLine> objList = new SortableSearchableBindingList<OrderLine>();

                var objQuery = mobjOrderLines.Where(o => o.LineOrReleaseStatus == "O").ToList();

                foreach (OrderLine objOrderLine in objQuery)
                    objList.Add(objOrderLine);

                dgvOrderLines.DataSource = objList;
            }
            else
                dgvOrderLines.DataSource = mobjOrderLines;
        }
        private void RadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (sender is RadioButton)
            {
                RadioButton objRad = (RadioButton)sender;

                if (objRad.Checked)
                    switch (objRad.Name)
                    {
                        case "optAll":
                            dgvItemHistory.DataSource = mobjItem.GetHistory(ItemHistoryView.All);
                            TotalCheckBoxes = dgvItemHistory.RowCount;
                            TotalCheckedCheckBoxes = 0;
                            HeaderCheckBox.Checked = false;
                            SelectedTotal = 0;
                            mstrbldrReportType.Clear().Append("All Transactions");
                            //MessageBox.Show("Fired " + objRad.Name);
                            break;
                        case "optReceiving":
                            if (mblnIsShipping)//This check was implemented to accomodate filtering by job when shipping an item.
                            {
                                var objQuery = mobjItem.GetHistory(ItemHistoryView.Recieved)
                                    .Where(t => t.FormattedJobNumber.Equals(mobjItem.SelectedJob.FormattedJobNumber) && t.Suffix == mobjItem.SelectedJob.Suffix)
                                    .ToList();
                                var objItemHistoryList = new SortableSearchableBindingList<ItemHistoryTransaction>();//create a new sortablesearchablebindinglist
                                foreach (ItemHistoryTransaction objItemHistoryTransaction in objQuery)//add each filtered item to the binding list
                                    objItemHistoryList.Add(objItemHistoryTransaction);
                                dgvItemHistory.DataSource = objItemHistoryList;
                            }
                            else
                                dgvItemHistory.DataSource = mobjItem.GetHistory(ItemHistoryView.Recieved);
                            TotalCheckBoxes = dgvItemHistory.RowCount;
                            TotalCheckedCheckBoxes = 0;
                            HeaderCheckBox.Checked = false;
                            SelectedTotal = 0;
                            mstrbldrReportType.Clear().Append("Recieving Transactions");
                            //MessageBox.Show("Fired " + objRad.Name);
                            break;
                        case "optShipping":
                            dgvItemHistory.DataSource = mobjItem.GetHistory(ItemHistoryView.Shipped);
                            TotalCheckBoxes = dgvItemHistory.RowCount;
                            TotalCheckedCheckBoxes = 0;
                            HeaderCheckBox.Checked = false;
                            SelectedTotal = 0;
                            mstrbldrReportType.Clear().Append("Shipping Transactions");
                            //MessageBox.Show("Fired " + objRad.Name);
                            break;
                    }
            }
        }
Esempio n. 14
0
        private void GetItems()
        {
            SL8_WTF_DataBaseSettings objSL8_WTF_DataBaseSettings;
            DataTable objDataTable = new DataTable();
            SqlDataAdapter objDataAdapter;
            SqlCommand objSQLCommand;
            Item objItem;
            string strSQL;
            double dblTemp;
            Match objMFGMatch, objDashIntMatch;

            Cursor.Current = Cursors.WaitCursor;
            dgvItems.Visible = false;

            objSL8_WTF_DataBaseSettings = new SL8_WTF_DataBaseSettings();
            strSQL = QueryDefinitions.GetQuery("SelectTopNItems", new string[] { MINTMAXRECORDCOUNT.ToString(),
                ((ComboBoxItem)cboSortSearch.SelectedItem).Value, txtItem.Text, ((ComboBoxItem)cboSortSearch.SelectedItem).Value });
            objSL8_WTF_DataBaseSettings.SQLConnection.Open();
            objSQLCommand = new SqlCommand(strSQL, objSL8_WTF_DataBaseSettings.SQLConnection);
            objDataAdapter = new SqlDataAdapter(objSQLCommand);
            objDataAdapter.Fill(objDataTable);

            mobjItemList = new SortableSearchableBindingList<Item>();

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

                    objItem.ItemID = objRow["Item"].ToString();
                    objItem.Description = objRow["Description"].ToString();
                    objItem.Revision = objRow["revision"].ToString();
                    objItem.QtyOnHand = double.TryParse(objRow["qty_on_hand"].ToString(), out dblTemp) ? dblTemp : 0.0;

                    objMFGMatch = Regex.Match(objItem.ItemID, @"-MFG\Z", RegexOptions.IgnoreCase);
                    objDashIntMatch = Regex.Match(objItem.ItemID, @"-[0-9]\Z", RegexOptions.IgnoreCase);
                    //objItem.IsMFG = objRow["Item"].ToString().ToUpper().EndsWith("MFG");
                    objItem.IsSubItem = objMFGMatch.Success || objDashIntMatch.Success;//Implemented so isMFG functionality could be utilized for -1, -2, etc items

                    mobjItemList.Add(objItem);
                }

            }
            else
            {
                MessageBox.Show(((ComboBoxItem)cboSortSearch.SelectedItem).Text + " " + txtItem.Text + " not found!", "No Item Found", MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }

            Cursor.Current = Cursors.Default;
            dgvItems.Visible = true;
            dgvItems.DataSource = mobjItemList;
            dgvItems.Refresh();
        }