Exemple #1
0
        private void processSubmit()
        {
            var ItemList = string.Empty;

            for (int i = 0; i < _LocationData.Count; i++)
            {
                ItemList += GeneratePipeString(i);
            }

            if (ItemList != string.Empty)
            {
                ItemList = ItemList.Remove(ItemList.Length - 1);

                string sErrorCode;
                string sErrorText;

                AssignMDSE.UpdateAssignedItems(ItemList, out sErrorCode, out sErrorText);
                if (sErrorCode == "0")
                {
                    // BZ-51 ------------------
                    if (viewTransactionComboBox.SelectedIndex == 2)
                    {
                        clearGrid();
                        searchCriteria.Text = string.Empty;

                        searchCriteria.Focus();
                    }
                    else
                    {
                        //------------------- BZ-51
                        GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                    }
                }
                else if (sErrorCode == "1")
                {
                    MessageBox.Show(sErrorText, "Merchandise Location Assignment", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else if (sErrorCode == "2")
                {
                    MessageBox.Show("The update operation has failed.  Please retry", "Merchandise Location Assignment", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    submitButton.Focus();
                }
                else if (sErrorCode == "3")
                {
                    MessageBox.Show(sErrorText, "Merchandise Location Assignment", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Initial Setup of Form
        /// </summary>
        /// <param name="existingItems">Indicates whether this is for initial or re-assignments.</param>
        private void Setup(bool existingItems)
        {
            _SetupInProgress = true;

            string sErrorCode;
            string sErrorText;

            _CurrentRowIndex = -1;

            if (gvLocation.Controls.Count < 3)
            {
                _OtherTextBox      = new TextBox();
                _OtherTextBox.Name = "other_TextBox";
                _OtherTextBox.AutoCompleteCustomSource.Add("Gun Safe");
                _OtherTextBox.AutoCompleteCustomSource.Add("Pawn Guard Safe");
                _OtherTextBox.AutoCompleteCustomSource.Add("Standard Safe");
                _OtherTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
                _OtherTextBox.AutoCompleteMode   = AutoCompleteMode.Append;
                _OtherTextBox.Enter     += new EventHandler(validatedEntryOtherTextBox_Enter);
                _OtherTextBox.LostFocus += new EventHandler(validatedEntryOtherTextBox_Exit);
                _OtherTextBox.Visible    = false;
                _OtherTextBox.MaxLength  = 50;
                gvLocation.Controls.Add(_OtherTextBox);
            }

            _LocationData = new List <LocationData>();

            if (_UnassignedItems == null || existingItems || lastSelectedIndex == 2)
            {
                _UnassignedItems = new DataTable();
            }

            string criteria = searchCriteria.Text;
            int    srchType = searchType.SelectedIndex;

            gvLocation.ShowCellToolTips = false;

            if (!existingItems) // show all unassigned items
            {
                criteria = "";
                srchType = -1;
            }
            else
            {
                switch ((SEARCH_METHOD)srchType)
                {
                case SEARCH_METHOD.LOAN_NR:
                case SEARCH_METHOD.PURCHASE_NR:
                    if (criteria.Length > 6)
                    {
                        if (criteria.Substring(0, 5) != GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber)
                        {
                            MessageBox.Show(Commons.GetMessageString("WrongStore") + " " + criteria.Substring(0, 5),
                                            "Warning",
                                            MessageBoxButtons.OK);

                            _SetupInProgress = false;

                            return;
                        }

                        criteria = criteria.Substring(5).PadLeft(6, '0');
                    }
                    break;

                case SEARCH_METHOD.ICN:        // ICN Search

                    if (criteria.Length <= 10) // Short ICN Search
                    {
                        int  shortICN_dotLoctn = criteria.IndexOf('.');
                        bool isValidICN        = false;

                        if (shortICN_dotLoctn > 0 && shortICN_dotLoctn < criteria.Length)
                        {
                            string[] shortICN = criteria.Split(new char[]
                            {
                                '.'
                            });

                            if (shortICN.Length == 2)
                            {
                                string ICNStore = shortICN[0].PadLeft(6, '0');
                                string ICNItem  = shortICN[1];

                                isValidICN = (ICNItem.Length > 0 && ICNItem.Length <= 3);

                                if (ICNItem.Length > 0 && ICNItem.Length <= 3)
                                {
                                    ICNItem = ICNItem.PadLeft(3, '0');
                                }

                                string ICN = ICNStore + ICNItem;

                                criteria = ICN;

                                isValidICN = isValidICN && (criteria.Length == 9);
                            }
                        }

                        if (!isValidICN)
                        {
                            MessageBox.Show(Commons.GetMessageString("ICNInvalid"),
                                            "Warning",
                                            MessageBoxButtons.OK);

                            _SetupInProgress = false;

                            return;
                        }

                        gvLocation.ShowCellToolTips = true;
                    }

                    break;
                }
            }

            if (_UnassignedItems.Rows.Count == 0)
            {
                AssignMDSE.GetAssignableItems(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                                              srchType,                    // NOTE there is an assumption here that the list sequence is directly mappable to SearchType, for re-assignments
                                              criteria,
                                              out _UnassignedItems,
                                              out sErrorCode,
                                              out sErrorText);
            }
            else
            {
                sErrorCode = "0";
                sErrorText = "Success";
            }

            //BZ-56-------------------------
            string[] unassignableStatuses = { "PS", "PU", "CO", "RET", "TO" };
            var      e = from DataRow item in _UnassignedItems.Rows
                         where unassignableStatuses.Contains(item["status_cd"].ToString())
                         select item;

            if (e.Count() > 0)
            {
                MessageBox.Show("One or more items are ineligible for relocation.", "Merchandise Location Assignment", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                clearGrid();
                searchCriteria.Text = "";

                searchCriteria.Focus();
            }
            else
            //---------------------BZ-56
            if (_UnassignedItems.Rows.Count > 0)
            {
                if (!_UnassignedItems.Columns.Contains("RecID"))
                {
                    DataColumn myColumn = new DataColumn("RecID", typeof(System.Int32));
                    _UnassignedItems.Columns.Add(myColumn);

                    for (int i = 0; i < _UnassignedItems.Rows.Count; i++)
                    {
                        _UnassignedItems.Rows[i]["RecID"] = i + 1;
                    }
                }

                if (!_UnassignedItems.Columns.Contains("Ticket"))
                {
                    DataColumn myColumn = new DataColumn("Ticket", typeof(System.Int32));
                    _UnassignedItems.Columns.Add(myColumn);
                    for (int i = 0; i < _UnassignedItems.Rows.Count; i++)
                    {
                        if (_UnassignedItems.Rows[i]["status_cd"].ToString().Equals("LAY"))
                        {
                            _UnassignedItems.Rows[i]["Ticket"] = _UnassignedItems.Rows[i]["disp_doc"];
                        }
                        else
                        {
                            _UnassignedItems.Rows[i]["Ticket"] = _UnassignedItems.Rows[i]["icn_doc"];
                        }

                        if (srchType != 0)
                        {
                            _UnassignedItems.Rows[i]["LOC_AISLE"] = string.Empty;
                            _UnassignedItems.Rows[i]["LOC_SHELF"] = string.Empty;
                            _UnassignedItems.Rows[i]["LOCATION"]  = string.Empty;
                        }
                    }
                }

                UpdateDataGridData();

                if (_UnassignedItems.Rows.Count > _GridPageMaxRows)
                {
                    panel1.Visible = true;
                }

                rowIndexLabel.Visible = true;
            }
            else
            {
                if (sErrorCode == "1")
                {
                    MessageBox.Show("No Items Found.", "Merchandise Location Assignment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //this.Close();
                }
                else
                {
                    MessageBox.Show(sErrorCode + "::" + sErrorText + ".  Please contact support", "Critical Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Close();
                }
            }

            _SetupInProgress = false;
        }