Esempio n. 1
0
        /// <summary>
        /// Updates a record in the sol_Stage table.
        /// </summary>
        public virtual void Update(Sol_Stage sol_Stage)
        {
            ValidationUtility.ValidateArgument("sol_Stage", sol_Stage);

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@StageID", sol_Stage.StageID),
                new SqlParameter("@ShipmentID", sol_Stage.ShipmentID),
                new SqlParameter("@UserID", sol_Stage.UserID),
                new SqlParameter("@UserName", sol_Stage.UserName),
                new SqlParameter("@Date", sol_Stage.Date),
                new SqlParameter("@TagNumber", sol_Stage.TagNumber),
                new SqlParameter("@ContainerID", sol_Stage.ContainerID),
                new SqlParameter("@ContainerDescription", sol_Stage.ContainerDescription),
                new SqlParameter("@ProductID", sol_Stage.ProductID),
                new SqlParameter("@ProductName", sol_Stage.ProductName),
                new SqlParameter("@Dozen", sol_Stage.Dozen),
                new SqlParameter("@Quantity", sol_Stage.Quantity),
                new SqlParameter("@Price", sol_Stage.Price),
                new SqlParameter("@Remarks", sol_Stage.Remarks),
                new SqlParameter("@Status", sol_Stage.Status),
                new SqlParameter("@DateClosed", sol_Stage.DateClosed)
            };

            SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "sol_Stage_Update", parameters);
        }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxTagNumber.Text))
            {
                MessageBox.Show("Please, enter a valid tag number!");
                textBoxTagNumber.Focus();
                return;
            }

            if (sol_Stage_Sp == null)
            {
                sol_Stage_Sp = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }

            sol_Stage = sol_Stage_Sp._SelectByTagNumberStatus(textBoxTagNumber.Text, "");   //I");
            if (sol_Stage != null)
            {
                MessageBox.Show("Tag number already exists, try another one please.");
                textBoxTagNumber.Focus();
                return;
            }

            tagNumber  = textBoxTagNumber.Text;
            cancelFlag = false;
            Close();
        }
        private void ShippingShipmentsScanner_Load(object sender, EventArgs e)
        {
            //disable form resizing
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            //classes of tables
            sol_Stage    = new Sol_Stage();
            sol_Stage_Sp = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString);
        }
Esempio n. 4
0
        /// <summary>
        /// Selects all records from the sol_Stage table.
        /// </summary>
        public virtual List <Sol_Stage> SelectAll()
        {
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "sol_Stage_SelectAll"))
            {
                List <Sol_Stage> sol_StageList = new List <Sol_Stage>();
                while (dataReader.Read())
                {
                    Sol_Stage sol_Stage = MakeSol_Stage(dataReader);
                    sol_StageList.Add(sol_Stage);
                }

                return(sol_StageList);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Selects all records from the sol_Stage table by a foreign key.
        /// </summary>
        public virtual List <Sol_Stage> _SelectAllByStatus(string status)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Status", status)
            };

            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "sol_Stage_SelectAllByStatus", parameters))
            {
                List <Sol_Stage> sol_StageList = new List <Sol_Stage>();
                while (dataReader.Read())
                {
                    Sol_Stage sol_Stage = MakeSol_Stage(dataReader);
                    sol_StageList.Add(sol_Stage);
                }

                return(sol_StageList);
            }
        }
Esempio n. 6
0
        private bool DeleteAdjustment(int stageId)
        {
            sol_ShipmentAdjustment = sol_Shipment_Sp.SelectByRBillNumber(textBoxRBill.Text);
            sol_StageAdjustment    = sol_Stage_Sp.Select(stageId);
            if (sol_StageAdjustment != null)
            {
                //check if it was a staging container addition (option 2)
                bool flagDelete = false;
                int  l          = sol_StageAdjustment.TagNumber.Count() - 1;
                if (l > 0)
                {
                    if (sol_StageAdjustment.TagNumber.Substring(l, 1) == "A")
                    {
                        flagDelete = true;
                    }
                }

                if (flagDelete)
                {
                    //sol_StageAdjustment.Status = "V";
                    //sol_Stage_Sp.Update(sol_StageAdjustment);
                    sol_Stage_Sp._DeleteAllByShipmentIdTagNumber(sol_ShipmentAdjustment.ShipmentID, sol_StageAdjustment.TagNumber);
                }
                else
                {
                    sol_StageAdjustment.ShipmentID = 0;
                    sol_StageAdjustment.Status     = "I"; //from "S" to "I"
                    sol_Stage_Sp.Update(sol_StageAdjustment);

                    sol_Stage_SelectAllByAgencyTableAdapter.Fill(
                        this.dataSetStageLookup.sol_Stage_SelectAllByAgency,
                        "I", sol_Shipment.AgencyID);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Esempio n. 7
0
        /// <summary>
        /// Creates a new instance of the sol_Stage class and populates it with data from the specified SqlDataReader.
        /// </summary>
        protected virtual Sol_Stage MakeSol_Stage(SqlDataReader dataReader)
        {
            Sol_Stage sol_Stage = new Sol_Stage();

            sol_Stage.StageID              = SqlClientUtility.GetInt32(dataReader, "StageID", 0);
            sol_Stage.ShipmentID           = SqlClientUtility.GetInt32(dataReader, "ShipmentID", 0);
            sol_Stage.UserID               = SqlClientUtility.GetGuid(dataReader, "UserID", Guid.Empty);
            sol_Stage.UserName             = SqlClientUtility.GetString(dataReader, "UserName", String.Empty);
            sol_Stage.Date                 = SqlClientUtility.GetDateTime(dataReader, "Date", new DateTime(0));
            sol_Stage.TagNumber            = SqlClientUtility.GetString(dataReader, "TagNumber", String.Empty);
            sol_Stage.ContainerID          = SqlClientUtility.GetInt32(dataReader, "ContainerID", 0);
            sol_Stage.ContainerDescription = SqlClientUtility.GetString(dataReader, "ContainerDescription", String.Empty);
            sol_Stage.ProductID            = SqlClientUtility.GetInt32(dataReader, "ProductID", 0);
            sol_Stage.ProductName          = SqlClientUtility.GetString(dataReader, "ProductName", String.Empty);
            sol_Stage.Dozen                = SqlClientUtility.GetInt32(dataReader, "Dozen", 0);
            sol_Stage.Quantity             = SqlClientUtility.GetInt32(dataReader, "Quantity", 0);
            sol_Stage.Price                = SqlClientUtility.GetDecimal(dataReader, "Price", Decimal.Zero);
            sol_Stage.Remarks              = SqlClientUtility.GetString(dataReader, "Remarks", String.Empty);
            sol_Stage.Status               = SqlClientUtility.GetString(dataReader, "Status", String.Empty);
            sol_Stage.DateClosed           = SqlClientUtility.GetDateTime(dataReader, "DateClosed", new DateTime(0));

            return(sol_Stage);
        }
Esempio n. 8
0
        private bool CreateAdjustment(AdjustmentActionTypes adjActionTypes, int stageId, int productId)
        {
            sol_Stage = sol_Stage_Sp.Select(stageId);
            if (sol_Stage == null)
            {
                MessageBox.Show(String.Format("StageID not found ({0}) ", stageId));
                return(false);
            }

            DateTime dt = sol_Stage.Date;

            if (checkBoxDate.Checked)
            {
                dt = Main.rc.FechaActual;
            }

            Sol_Stage sol_StageAdjustment = new Sol_Stage();

            sol_StageAdjustment.ShipmentID = sol_ShipmentAdjustment.ShipmentID;
            sol_StageAdjustment.UserID     = sol_Stage.UserID;
            sol_StageAdjustment.UserName   = sol_Stage.UserName;
            //sol_StageAdjustment.Date = dt;
            sol_StageAdjustment.Date = Main.rc.FechaActual; // ; // Properties.Settings.Default.FechaActual;;

            sol_StageAdjustment.TagNumber            = sol_Stage.TagNumber + "A";
            sol_StageAdjustment.ContainerID          = sol_Stage.ContainerID;
            sol_StageAdjustment.ContainerDescription = sol_Stage.ContainerDescription;
            sol_StageAdjustment.ProductID            = sol_Stage.ProductID;
            sol_StageAdjustment.ProductName          = sol_Stage.ProductName;
            sol_StageAdjustment.Dozen    = 0; //not used anymore sol_Stage.Dozen * -1;
            sol_StageAdjustment.Quantity = sol_Stage.Quantity * -1;
            sol_StageAdjustment.Price    = sol_Stage.Price;
            sol_StageAdjustment.Remarks  = sol_Stage.Remarks;
            sol_StageAdjustment.Status   = sol_Stage.Status;

            //in case there is no default value in the db
            sol_StageAdjustment.DateClosed = DateTime.Parse("1753-01-01 12:00:00.000");

            switch (adjActionTypes)
            {
            case AdjustmentActionTypes.Return:
                //remove it
                //sol_StageAdjustment.TagNumber = sol_Stage.TagNumber;
                sol_StageAdjustment.Dozen    = sol_Stage.Dozen * -1;
                sol_StageAdjustment.Quantity = sol_Stage.Quantity * -1;
                //sol_StageAdjustment.Status = sol_Stage.Status;
                sol_Stage_Sp.Insert(sol_StageAdjustment);

                //add an adjustment to return to inventory
                sol_StageAdjustment.ShipmentID = 0;
                sol_StageAdjustment.TagNumber  = textBoxNewTagNumber.Text; //sol_Stage.TagNumber
                sol_StageAdjustment.Dozen      = 0;                        //not used anymore sol_Stage.Dozen;
                sol_StageAdjustment.Quantity   = sol_Stage.Quantity;
                sol_StageAdjustment.Status     = "I";                      //sol_Stage.Status;

                sol_Stage_Sp.Insert(sol_StageAdjustment);

                ////remove it from shipment
                //sol_Stage.ShipmentID = 0;
                //sol_Stage.TagNumber = textBoxNewTagNumber.Text;
                //sol_Stage.Status = "I";
                //sol_Stage_Sp.Update(sol_Stage);


                MessageBox.Show(
                    string.Format(
                        @"Tag Number {0} has been added to inventory. Note: This tag is in inventory and is no longer linked to the previous shipment.  Therefore, the new tag will not be removed if you delete the adjustment."
                        , textBoxNewTagNumber.Text
                        ));

                return(true);

            //break;

            case AdjustmentActionTypes.Remove:

                break;
            //case AdjustmentActionTypes.Add:
            //    break;

            case AdjustmentActionTypes.Adjust:
                //create reverse adjustment to remove original quantity
                sol_Stage_Sp.Insert(sol_StageAdjustment);

                //create adjustment with new product
                if (productId > 0)
                {
                    if (sol_Product_Sp == null)
                    {
                        sol_Product_Sp = new Sol_Product_Sp(Properties.Settings.Default.WsirDbConnectionString);
                    }
                    sol_Product = sol_Product_Sp.Select(productId);
                    sol_StageAdjustment.ProductID   = productId;
                    sol_StageAdjustment.ProductName = sol_Product.ProName;
                    //sol_StageAdjustment.Dozen = sol_Stage.Dozen;
                    //sol_StageAdjustment.Quantity = sol_Stage.Quantity;
                }

                int newQuantity = 0;
                int.TryParse(textBoxNewQuantity.Text, out newQuantity);

                sol_StageAdjustment.Quantity = newQuantity;
                sol_StageAdjustment.Dozen    = 0;   //not used anymore newQuantityOfDozens;

                break;

            //case AdjustmentActionTypes.Change:
            //    //create reverse adjustment to remove original product

            //    sol_Stage_Sp.Insert(sol_StageAdjustment);

            //    //create adjustment with new product
            //    if (sol_Product_Sp == null)
            //        sol_Product_Sp = new Sol_Product_Sp(Properties.Settings.Default.WsirDbConnectionString);
            //    sol_Product = sol_Product_Sp.Select(productId);
            //    sol_StageAdjustment.ProductID = productId;
            //    sol_StageAdjustment.ProductName = sol_Product.ProName;
            //    sol_StageAdjustment.Dozen = sol_Stage.Dozen;
            //    sol_StageAdjustment.Quantity = sol_Stage.Quantity;

            //    break;
            //case AdjustmentActionTypes.Delete:
            //    break;
            default:
                break;
            }

            sol_Stage_Sp.Insert(sol_StageAdjustment);

            return(true);
        }
        private void buttonParse_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBoxInput.Text))
            {
                MessageBox.Show("Nothing to parse! TextBox empty.");
                return;
            }

            // Display the ProgressBar control.
            progressBar1.Visible = true;
            // Set Minimum to 1 to represent the first file being copied.
            progressBar1.Minimum = 1;
            // Set the initial value of the ProgressBar.
            progressBar1.Value = 1;
            // Set the Step property to a value of 1 to represent each file being copied.
            progressBar1.Step = 1;


            string[] tags       = textBoxInput.Text.Split('\n');
            string   strBadTags = "";

            //badTags = new string[tags.GetLength(0)];
            // Set Maximum to the total number of files to copy.
            progressBar1.Maximum = tags.GetLength(0);
            bool flagAdded = false;

            foreach (string ren in tags)
            {
                // Perform the increment on the ProgressBar.
                progressBar1.PerformStep();
                string renx = ren.Trim();
                if (String.IsNullOrEmpty(renx))
                {
                    continue;
                }

                int ps = renx.LastIndexOf(',');
                if (ps < 0)
                {
                    ps = -1;
                }
                string tagNumber = renx.Substring(ps + 1);
                if (String.IsNullOrEmpty(tagNumber))
                {
                    continue;
                }

                //was a barcode read?
                //string x = tagNumber;
                //if (x.Length > 7)
                //{
                //    x = x.Substring(x.Length - 7);
                //    int intValue = 0;
                //    Int32.TryParse(x, out intValue);
                //    if (intValue > 0)
                //        tagNumber = String.Format("{0}", intValue);
                //    else
                //        continue;

                //}

                ps        = 0;
                sol_Stage = sol_Stage_Sp._SelectByTagNumberStatus(tagNumber, "I");
                if (
                    //SearchStagedContainerOnShipment(tagNumber) ||
                    sol_Stage == null)
                {
                    //badTags[ps++] = tagNumber + " - Tag number does not exist or already in shipment\n";
                    strBadTags += tagNumber + " - Tag number does not exist or already in shipment" + Environment.NewLine;

                    continue;
                }
                //switch containers
                ShippingShipments.SwitchContainers(
                    ref ShippingShipments.listViewCurrentStagedContainers,
                    ref ShippingShipments.listViewContainersOnShipment, sol_Stage.TagNumber, true, null);

                flagAdded = true;
            }

            // Perform the increment on the ProgressBar.
            progressBar1.Value = progressBar1.Maximum;


            //tags not processed
            if (!String.IsNullOrEmpty(strBadTags))
            {
                SirLib.CajaDeMensaje.Show("Tags not processed", "Error parsing tags numbers.", strBadTags, SirLib.CajaDeMensajeImagen.Error);
            }

            string men = "Done!";

            if (flagAdded)
            {
                if (String.IsNullOrEmpty(strBadTags))
                {
                    men += " - All tags added.";
                }
                else
                {
                    men += " - With some tags not added.";
                }
            }
            else
            {
                men += " - Nothing added";
            }


            MessageBox.Show(men);
            // Set the Step property to a value of 1 to represent each file being copied.
            progressBar1.Value = 1;
            textBoxInput.Text  = "";
        }
Esempio n. 10
0
        private bool AddStagedRow()
        {
            //if(osi == null)
            //    osi = new SirLib.ObtenerSiguienteId(Properties.Settings.Default.WsirDbConnectionString);

            sol_Stage = new Sol_Stage();


            if (sol_Agency != null &&
                sol_Agency.AutoGenerateTagNumber
                )
            {
                AutoGenerateTagNumber();
                sol_Stage.TagNumber = textBoxTagNumber.Text;
            }

            //sol_Stage.StageID = osi.Id("Sol_Stage", "StageId", null, null);

            if (membershipUser == null)
            {
                membershipUser = Membership.GetUser(Properties.Settings.Default.UsuarioNombre);
            }
            if (membershipUser == null)
            {
                MessageBox.Show("User does not exits, cannot close the Container");
                return(false);
            }
            sol_Stage.UserID   = (Guid)membershipUser.ProviderUserKey;
            sol_Stage.UserName = Properties.Settings.Default.UsuarioNombre;
            sol_Stage.Date     = Main.rc.FechaActual; // ; // Properties.Settings.Default.FechaActual;;
            sol_Stage.Status   = "I";                 //InProcess

            //sol_Stage.TagNumber = osi.Id("Sol_Stage", "Cast(TagNumber as int)", null, null).ToString();

            //in case there is no default value in the db
            sol_Stage.DateClosed = DateTime.Parse("1753-01-01 12:00:00.000");

            try
            {
                sol_Stage_Sp.Insert(sol_Stage);
            }
            catch
            {
                //try once more
                if (sol_Agency != null &&
                    sol_Agency.AutoGenerateTagNumber
                    )
                {
                    AutoGenerateTagNumber();
                }
                try
                {
                    sol_Stage_Sp.Insert(sol_Stage);
                }
                catch (Exception e)
                {
                    CajaDeMensaje.Show("SqlError", "Error trying to add a new Staged Container row, try again later please", e.Message, CajaDeMensajeImagen.Error);
                    sol_Stage = null;
                    return(false);
                }
            }


            return(true);
        }
Esempio n. 11
0
        private void Shipping_Load(object sender, EventArgs e)
        {
            //classes of tables
            sol_Shipment     = new Sol_Shipment();
            sol_Shipment_Sp  = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_ShipmentList = new List <Sol_Shipment>();

            sol_Stage     = new Sol_Stage();
            sol_Stage_Sp  = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_StageList = new List <Sol_Stage>();

            toolStrip1.Renderer = new App_Code.NewToolStripRenderer();

            if (Properties.Settings.Default.TouchOriented)
            {
                toolStripButtonVirtualKb.Visible = true;
            }

            //clock
            object obj1 = toolStripStatusLabelToday;
            object obj2 = toolStripStatusLabelTimer;

            Main.rc.CambiarControlFecha(ref obj1);
            Main.rc.CambiarControlHora(ref obj2);


            //disable form resizing
            //this.FormBorderStyle = FormBorderStyle.FixedSingle;


            //listview with headers
            listViewCurrentStagedContainers.View = View.Details;
            //listViewCurrentStagedContainers.Columns.Add("Tag #", 190, HorizontalAlignment.Right);   //70
            //listViewCurrentStagedContainers.Columns.Add("Product", 165, HorizontalAlignment.Left);
            //listViewCurrentStagedContainers.Columns.Add("Dozen", 80, HorizontalAlignment.Left);
            //listViewCurrentStagedContainers.Columns.Add("Container", 170, HorizontalAlignment.Left);

            listViewCurrentStagedContainers.Columns.Add("Tag #", 190, HorizontalAlignment.Left);   //70
            listViewCurrentStagedContainers.Columns.Add("Product", 165, HorizontalAlignment.Left);
            listViewCurrentStagedContainers.Columns.Add("Quantity", 80, HorizontalAlignment.Right);
            listViewCurrentStagedContainers.Columns.Add("Container", 170, HorizontalAlignment.Left);
            listViewCurrentStagedContainers.Columns.Add("Dozen", 80, HorizontalAlignment.Right);

            listViewCurrentStagedContainers.FullRowSelect = true;
            //listViewCurrentStagedContainers.CheckBoxes = true;
            listViewCurrentStagedContainers.GridLines = true;
            //listView1.Activation = ItemActivation.OneClick;

            //manual sorting of items by columns
            listViewCurrentStagedContainers.Sorting = System.Windows.Forms.SortOrder.Ascending;

            // Make owner-drawn to be able to give different alignments to single subitems
            //listViewCurrentStagedContainers.OwnerDraw = true;
            //listViewCurrentStagedContainers.DrawColumnHeader += new System.Windows.Forms.DrawListViewColumnHeaderEventHandler(this.listView1_DrawColumnHeader);
            //listViewCurrentStagedContainers.DrawSubItem += new System.Windows.Forms.DrawListViewSubItemEventHandler(this.listView1_DrawSubItem);

            //listViewCurrentStagedContainers.DrawSubItem += new System.Windows.Forms.DrawListViewSubItemEventHandler(this.listView2_DrawSubItem);



            //listview with headers
            listViewCurrentShipment.View = View.Details;
            //listViewCurrentShipment.Columns.Add("ShipmentID", 100, HorizontalAlignment.Left);
            listViewCurrentShipment.Columns.Add("BOL #", 160, HorizontalAlignment.Left);
            listViewCurrentShipment.Columns.Add("Agency", 300, HorizontalAlignment.Left);

            listViewCurrentShipment.FullRowSelect = true;
            //listViewCurrentShipment.CheckBoxes = true;
            listViewCurrentShipment.GridLines = true;


            //listview with headers
            listViewContainersOnShipment.View = View.Details;
            //listViewContainersOnShipment.Columns.Add("Tag #", 190, HorizontalAlignment.Right);
            //listViewContainersOnShipment.Columns.Add("Product", 165, HorizontalAlignment.Left);
            //listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Left);
            //listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Tag #", 190, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Product", 165, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Quantity", 80, HorizontalAlignment.Right);
            listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Right);

            //listViewContainersOnShipment.FullRowSelect = true;
            //listViewContainersOnShipment.CheckBoxes = true;
            listViewContainersOnShipment.GridLines = true;


            //read outstandig orders (unpaid)
            ReadCurrentStagedContainers();

            //read shipments ready to be shippped
            ReadCurrentShipments();

            //training warning
            if (Properties.Settings.Default.SQLBaseDeDatos == "Solum_Training")
            {
                toolStripStatusLabelTrainingMode.Visible = true;
                Main.tslCntr            = toolStripStatusLabelTrainingMode;
                Main.timerBlink.Enabled = true;
            }

            CheckUserPermissions();


            if (Properties.Settings.Default.StagingType == 0)   //!Properties.Settings.Default.MultiProductStagingEnabled)
            {
                toolStripSeparatorMultiProductStaging.Visible = false;
                toolStripButtonMultiProductStaging.Visible    = false;
            }
        }
Esempio n. 12
0
        private void buttonVoidStagedContainer_Click(object sender, EventArgs e)
        {
            if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolModifyContainer", true))
            {
                return;
            }

            ListView.SelectedListViewItemCollection selectedItems = listViewCurrentStagedContainers.SelectedItems;
            if (selectedItems.Count < 1)
            {
                MessageBox.Show("Please select a Staged Container");
                return;
            }


            ////ListViewItem itm;   // = new ListViewItem();
            //foreach (ListViewItem item in selectedItems)
            //{
            //    tagNumber = item.SubItems[0].Text;
            //}

            //ShippingForm = 2;   //StagedContainers
            //StagedContainerButtonView = true;
            //Close();


            bool firstTime = true;
            //int stageId = 0;
            string tagNumber = "";

            //selected items
            foreach (ListViewItem item in selectedItems)
            {
                try
                {
                    //stageId = Int32.Parse(item.SubItems[0].Text);
                    tagNumber = item.SubItems[0].Text;
                }
                catch
                {
                    continue;
                }

                if (firstTime)
                {
                    firstTime = false;
                    if (MessageBox.Show("Are you sure you want to delete Staged Container:" + item.SubItems[0].Text + "?", "Delete Staged Container", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != System.Windows.Forms.DialogResult.Yes)
                    {
                        return;
                    }
                }


                //read order
                //sol_Stage = sol_Stage_Sp.Select(stageId);
                sol_Stage = sol_Stage_Sp._SelectByTagNumberStatus(tagNumber, "I");  // .Select(stageId);
                //not found?
                if (sol_Stage == null)
                {
                    continue;
                }

                ////marked as deleted
                //sol_Stage.Status = "D";
                //sol_Stage_Sp.Update(sol_Stage);

                sol_Stage_Sp.Delete(sol_Stage.StageID);


                //sol_OrdersDetail_Sp._DeleteAllByOrderID_OrderType(
            }

            //refresh list or remove item above???
            ReadCurrentStagedContainers();
        }
Esempio n. 13
0
        private void ShippingAdjustments_Load(object sender, EventArgs e)
        {
            //classes of tables
            sol_Shipment     = new Sol_Shipment();
            sol_Shipment_Sp  = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_ShipmentList = new List <Sol_Shipment>();

            sol_Stage     = new Sol_Stage();
            sol_Stage_Sp  = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_StageList = new List <Sol_Stage>();

            if (Properties.Settings.Default.TouchOriented)
            {
                toolStripButtonVirtualKb.Visible = true;
            }

            toolStrip1.Renderer = new App_Code.NewToolStripRenderer();

            //clock
            object obj1 = toolStripStatusLabelToday;
            object obj2 = toolStripStatusLabelTimer;

            Main.rc.CambiarControlFecha(ref obj1);
            Main.rc.CambiarControlHora(ref obj2);

            //disable form resizing
            // this.FormBorderStyle = FormBorderStyle.FixedSingle;


            //listview with headers
            listViewContainersOnShipment.View = View.Details;
            //listViewContainersOnShipment.Columns.Add("Tag #", 200, HorizontalAlignment.Left);
            //listViewContainersOnShipment.Columns.Add("Product", 190, HorizontalAlignment.Left);
            //listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Left);
            //listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left);
            //listViewContainersOnShipment.Columns.Add("StageID", 170, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Tag #", 200, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Product", 190, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Quantity", 80, HorizontalAlignment.Right);
            listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("StageID", 170, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Right);

            //listViewContainersOnShipment.Columns["StageID"]

            listViewContainersOnShipment.FullRowSelect = true;
            listViewContainersOnShipment.CheckBoxes    = true;
            listViewContainersOnShipment.GridLines     = true;
            //listViewContainersOnShipment.Activation = ItemActivation.OneClick;
            listViewContainersOnShipment.MultiSelect = true;


            sol_Shipment_SelectAllByStatusTableAdapter.Fill(this.dataSetShipmentByStatusLookup.sol_Shipment_SelectAllByStatus, "S", true);
            //sol_Orders_SelectAllLookupTableAdapter.Fill(this.dataSetOrdersLookup.sol_Orders_SelectAllLookup, userName, strOrderType, "A", "");   //r = returns,  = normal unpaid

            this.sol_ProductsTableAdapter.Fill(this.dataSetProductsLookup.sol_Products, 0); //0 = return products

            ChangeView(AdjustmentViewTypes.Overview);
            //read shipments ready to be shippped
            ReadCurrentShipments();


            if (ShippingLookup.ShipmentButtonAdjustment)
            {
                comboBoxRbill.SelectedIndex = comboBoxRbill.FindStringExact(ShippingLookup.RBillNumber);
                buttonCreate.PerformClick();

                ////textBoxRBillNumber.Text = ShippingHome.RBillNumber;
                ////ShippingHome.RBillNumber = "";
                ////ShippingHome.ShipmentButtonView = false;

                ////buttonSearch.Enabled = true;
                ////buttonSearch.PerformClick();


                ////if (dataGridViewCurrentShipment.SelectedRows.Count < 1)
                ////{
                ////    MessageBox.Show("Please select a Shipment to view", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ////    return;
                ////}

                //RBillNumber = ShippingLookup.RBillNumber;   // dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString();
                //ChangeView(AdjustmentViewTypes.Details);
                //textBoxRBill.Text = RBillNumber;    // RemoveShipmentPostFix(RBillNumber);

                //sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(RemoveShipmentPostFix(RBillNumber));
                //sol_Stage_SelectAllByAgencyTableAdapter.Fill(
                //    this.dataSetStageLookup.sol_Stage_SelectAllByAgency,
                //    "I", sol_Shipment.AgencyID);

                //buttonOriginalRbill.PerformClick();
                //buttonOriginalRbill.Select();
            }


            //training warning
            if (Properties.Settings.Default.SQLBaseDeDatos == "Solum_Training")
            {
                toolStripStatusLabelTrainingMode.Visible = true;
                Main.tslCntr            = toolStripStatusLabelTrainingMode;
                Main.timerBlink.Enabled = true;
            }
            //initialFlag = false;


            CheckUserPermissions();

            if (Properties.Settings.Default.StagingType == 0)   //!Properties.Settings.Default.MultiProductStagingEnabled)
            {
                toolStripSeparatorMultiProductStaging.Visible = false;
                toolStripButtonMultiProductStaging.Visible    = false;
            }
        }
Esempio n. 14
0
        private void ShippingLookup_Load(object sender, EventArgs e)
        {
            ShipmentButtonAdjustment = false;

            //classes of tables
            sol_Shipment     = new Sol_Shipment();
            sol_Shipment_Sp  = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_ShipmentList = new List <Sol_Shipment>();

            sol_Stage     = new Sol_Stage();
            sol_Stage_Sp  = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_StageList = new List <Sol_Stage>();

            toolStrip1.Renderer = new App_Code.NewToolStripRenderer();

            //años
            int  aa  = Main.rc.FechaActual.Year;
            byte ah  = Main.Sol_ControlInfo.HistoryYears;
            int  uah = aa - ah;

            dateTimePickerFrom.MinDate = DateTime.Parse(String.Format("{0}-1-1", uah));
            dateTimePickerFrom.MaxDate = Main.rc.FechaActual;
            dateTimePickerFrom.Value   = dateTimePickerFrom.MaxDate;
            dateTimePickerTo.MinDate   = dateTimePickerFrom.MaxDate;
            dateTimePickerTo.MaxDate   = dateTimePickerFrom.MaxDate;
            dateTimePickerTo.Value     = dateTimePickerFrom.MaxDate;

            if (Properties.Settings.Default.TouchOriented)
            {
                toolStripButtonVirtualKb.Visible = true;
            }

            //clock
            object obj1 = toolStripStatusLabelToday;
            object obj2 = toolStripStatusLabelTimer;

            Main.rc.CambiarControlFecha(ref obj1);
            Main.rc.CambiarControlHora(ref obj2);

            //disable form resizing
            //this.FormBorderStyle = FormBorderStyle.FixedSingle;


            //dataGridViewCurrentShipment
            //this.dataGridViewCurrentShipment.CellBorderStyle = DataGridViewCellBorderStyle.None;
            //this.dataGridViewCurrentShipment.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
            //this.dataGridViewCurrentShipment.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;


            //this.dataGridViewCurrentShipment.GridColor = Color.Black;
            //this.dataGridViewCurrentShipment.BorderStyle = BorderStyle.Fixed3D;
            //this.dataGridViewCurrentShipment.CellBorderStyle = DataGridViewCellBorderStyle.None;
            //this.dataGridViewCurrentShipment.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
            //this.dataGridViewCurrentShipment.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;


            //listview with headers
            listViewContainersOnShipment.View = View.Details;
            //listViewContainersOnShipment.Columns.Add("Tag #", 190, HorizontalAlignment.Left);
            //listViewContainersOnShipment.Columns.Add("Product", 170, HorizontalAlignment.Left);
            //listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Left);
            //listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Tag #", 190, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Product", 170, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Quantity", 80, HorizontalAlignment.Right);
            listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left);
            listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Right);

            //listViewContainersOnShipment.FullRowSelect = true;
            //listViewContainersOnShipment.CheckBoxes = true;
            listViewContainersOnShipment.GridLines = true;
            //listViewContainersOnShipment.Activation = ItemActivation.OneClick;

            //read shipments ready to be shippped
            ReadCurrentShipments();

            //training warning
            if (Properties.Settings.Default.SQLBaseDeDatos == "Solum_Training")
            {
                toolStripStatusLabelTrainingMode.Visible = true;
                Main.tslCntr            = toolStripStatusLabelTrainingMode;
                Main.timerBlink.Enabled = true;
            }
            //initialFlag = false;

            CheckUserPermissions();

            if (Properties.Settings.Default.StagingType == 0)   //!Properties.Settings.Default.MultiProductStagingEnabled)
            {
                toolStripSeparatorMultiProductStaging.Visible = false;
                toolStripButtonMultiProductStaging.Visible    = false;
            }

            //originally in Solum
            //if (!(Main.Sol_ControlInfo.State == "AB"
            //    && Main.QuickDrop_DepotID != null && Main.QuickDrop_DepotID.Length == 6)
            //    )
            //{
            //    buttoneRBill.Visible = false;
            //    //buttonPrintRBill
            //    //buttonUnNow

            //    //this.buttoneRBill.Location = new System.Drawing.Point(604, 5);
            //    this.buttonPrintRBill.Location = new System.Drawing.Point(604, 5); //new System.Drawing.Point(721, 5);
            //    this.buttonUnNow.Location = new System.Drawing.Point(721, 5); //new System.Drawing.Point(838, 5);
            //}
        }
Esempio n. 15
0
        private void buttonSaveAdjustment_Click(object sender, EventArgs e)
        {
            //REMOVE
            if (radioButtonRemove.Checked)
            {
                if (detailsButtonView != StageTypes.Original)
                {
                    MessageBox.Show("You have to be in the Original Container list of Shipment");
                    buttonOriginalRbill.PerformClick();
                    return;
                }



                ListView.CheckedListViewItemCollection checkedItems = listViewContainersOnShipment.CheckedItems; //.SelectedItems;
                if (checkedItems.Count < 1)
                {
                    MessageBox.Show("Please select a Container on Shipment");
                    return;
                }

                if (radioButtonRemoveReturn.Checked &&
                    String.IsNullOrEmpty(textBoxNewTagNumber.Text)
                    )
                {
                    MessageBox.Show("Please supply a new Tag Number for the inventory return");
                    textBoxNewTagNumber.Focus();
                    return;
                }


                //if needed
                CreateShipmentEntry();

                //ListViewItem itm;   // = new ListViewItem();
                foreach (ListViewItem item in checkedItems)
                {
                    //SwitchContainers(ref listViewContainersOnShipment, ref listViewCurrentStagedContainers, item.SubItems[0].Text, false, null);
                    int stageId = 0;
                    int.TryParse(item.SubItems[4].Text, out stageId);

                    if (radioButtonRemoveReturn.Checked)
                    {
                        CreateAdjustment(AdjustmentActionTypes.Return, stageId, 0);
                    }
                    else if (radioButtonRemoveRemove.Checked)
                    {
                        CreateAdjustment(AdjustmentActionTypes.Remove, stageId, 0);
                    }
                }
            } // ADD
            else if (radioButtonAdd.Checked)
            {
                //
                if (detailsButtonView != StageTypes.Original)
                {
                    MessageBox.Show("You have to be in the Original Container list of Shipment");
                    buttonOriginalRbill.PerformClick();
                    return;
                }

                if (comboBoxCurrentStaging.SelectedIndex < 0)
                {
                    MessageBox.Show("Please select a Stage Container");
                    return;
                }

                //comboBoxCurrentStaging.SelectedText = comboBoxCurrentStaging.Text;
                string   fullDescription = comboBoxCurrentStaging.SelectedValue.ToString();
                string[] fields          = fullDescription.Split('-');
                int      stageId         = 0;
                int.TryParse(fields[0], out stageId);
                sol_Stage = sol_Stage_Sp.Select(stageId);
                if (sol_Stage == null)
                {
                    MessageBox.Show("Invalid Stage Contanier");
                    return;
                }

                //if needed
                CreateShipmentEntry();

                sol_Stage.ShipmentID = sol_ShipmentAdjustment.ShipmentID;
                sol_Stage.Status     = "S"; //from "I" to "S"
                sol_Stage_Sp.Update(sol_Stage);

                //sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(RemoveShipmentPostFix(RBillNumber));
                sol_Stage_SelectAllByAgencyTableAdapter.Fill(
                    this.dataSetStageLookup.sol_Stage_SelectAllByAgency,
                    "I", sol_Shipment.AgencyID);
            } //ADJUST
            else if (radioButtonAdjust.Checked)
            {
                //
                if (detailsButtonView != StageTypes.Original)
                {
                    MessageBox.Show("You have to be in the Original Container list of Shipment");
                    buttonOriginalRbill.PerformClick();
                    return;
                }

                //ListView.SelectedListViewItemCollection selectedItems = listViewContainersOnShipment.SelectedItems;
                ListView.CheckedListViewItemCollection checkedItems = listViewContainersOnShipment.CheckedItems; //.SelectedItems;

                if (checkedItems.Count < 1)
                {
                    MessageBox.Show("Please select a Container on Shipment");
                    return;
                }

                int newQuantityOfDozens = 0;
                int.TryParse(textBoxNewQuantity.Text, out newQuantityOfDozens);
                if (newQuantityOfDozens < 1)
                {
                    MessageBox.Show("Please supply a valid quantity of dozens for adjustment");
                    textBoxNewQuantity.Focus();
                    return;
                }


                //if needed
                CreateShipmentEntry();

                foreach (ListViewItem item in checkedItems)
                {
                    int productId = 0;
                    if (item.SubItems[1].Text != comboBoxNewProduct.SelectedText)
                    {
                        productId = (int)comboBoxNewProduct.SelectedValue;
                    }


                    int stageId = 0;
                    int.TryParse(item.SubItems[4].Text, out stageId);

                    CreateAdjustment(AdjustmentActionTypes.Adjust, stageId, productId);
                }
            } //CHANGE
              //else if (radioButtonChange.Checked)
              //{
              //    if (detailsButtonView != StageTypes.Original)
              //    {
              //        MessageBox.Show("You have to be in the Original Container list of Shipment");
              //        buttonOriginalRbill.PerformClick();
              //        return;
              //    }

            //    //ListView.SelectedListViewItemCollection selectedItems = listViewContainersOnShipment.SelectedItems;
            //    ListView.CheckedListViewItemCollection checkedItems = listViewContainersOnShipment.CheckedItems; //.SelectedItems;

            //    if (checkedItems.Count < 1)
            //    {
            //        MessageBox.Show("Please select a Container on Shipment");
            //        return;
            //    }

            //    //
            //    if (comboBoxNewProduct.SelectedIndex < 0)
            //    {
            //        MessageBox.Show("Please select a new Product");
            //        return;
            //    }

            //    //if needed
            //    CreateShipmentEntry();

            //    int productId = (int)comboBoxNewProduct.SelectedValue;

            //    //ListViewItem itm;   // = new ListViewItem();
            //    foreach (ListViewItem item in checkedItems)
            //    {
            //        //SwitchContainers(ref listViewContainersOnShipment, ref listViewCurrentStagedContainers, item.SubItems[0].Text, false, null);
            //        int stageId = 0;
            //        int.TryParse(item.SubItems[4].Text, out stageId);
            //        CreateAdjustment(AdjustmentActionTypes.Change, stageId, productId);
            //    }

            //} //DELETE
            //else if (radioButtonDelete.Checked)
            //{
            //    if (detailsButtonView != StageTypes.Adjustment)
            //    {
            //        MessageBox.Show("You have to be in the Adjustments list of Shipment");
            //        buttonAdjustments.PerformClick();
            //        return;
            //    }

            //    //ListView.SelectedListViewItemCollection checkedItems = listViewContainersOnShipment.SelectedItems;
            //    ListView.CheckedListViewItemCollection checkedItems = listViewContainersOnShipment.CheckedItems; //.SelectedItems;
            //    if (checkedItems.Count < 1)
            //    {
            //        MessageBox.Show("Please select a Container on Shipment");
            //        return;
            //    }

            //    //ListViewItem itm;   // = new ListViewItem();
            //    foreach (ListViewItem item in checkedItems)
            //    {
            //        //SwitchContainers(ref listViewContainersOnShipment, ref listViewCurrentStagedContainers, item.SubItems[0].Text, false, null);
            //        int stageId = 0;
            //        int.TryParse(item.SubItems[4].Text, out stageId);
            //        DeleteAdjustment(stageId);
            //    }

            //    //if needed
            //    DeleteShipmentEntry();

            //    buttonAdjustments.PerformClick();

            //}

            buttonAdjustments.PerformClick();
            //unselect all items
            foreach (ListViewItem i in listViewContainersOnShipment.Items)
            {
                i.Selected = false;
            }
        }
Esempio n. 16
0
        private void Inventory_Load(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.TouchOriented)
            {
                toolStripButtonVirtualKb.Visible = true;
            }


            //FullScreenMode
            if (Properties.Settings.Default.SettingsAdFullScreenMode)
            {
                this.WindowState = FormWindowState.Maximized;
            }
            else
            {
                this.WindowState = FormWindowState.Normal;
            }
            //años                                                      //ejemplo:
            int  aa = Main.rc.FechaActual.Year;          // System.DateTime.Now.Year;                          // 2010 año actual computadora
            byte ah = Main.Sol_ControlInfo.HistoryYears; //   -5 años de historia
            //-----
            int uah = aa - ah;                           // 2005 ultimo año de historia

            string c = Main.rc.FechaActual.ToString();   // DateTime.Now.ToString();

            flagInicio = true;
            dateTimePickerTo.MaxDate = Main.rc.FechaActual;
            dateTimePickerTo.Value   = dateTimePickerTo.MaxDate;
            flagInicio = false;

            dateFrom = null;
            dateTo   = null;
            UpdateDataSets();


            //classes of tables
            sol_Shipment     = new Sol_Shipment();
            sol_Shipment_Sp  = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_ShipmentList = new List <Sol_Shipment>();

            sol_Stage     = new Sol_Stage();
            sol_Stage_Sp  = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_StageList = new List <Sol_Stage>();

            //disable form resizing
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            //listview with headers
            listViewUnstagedProducts.View = View.Details;
            listViewUnstagedProducts.Columns.Add("Category", 160, HorizontalAlignment.Left);
            listViewUnstagedProducts.Columns.Add("Quantity", 100, HorizontalAlignment.Right);
            listViewUnstagedProducts.Columns.Add("Dozen", 90, HorizontalAlignment.Right);
            listViewUnstagedProducts.Columns.Add("Amount", 120, HorizontalAlignment.Right);

            listViewUnstagedProducts.FullRowSelect = true;
            //listViewCurrentStagedContainers.CheckBoxes = true;
            listViewUnstagedProducts.GridLines = true;
            //listView1.Activation = ItemActivation.OneClick;


            //listViewUnstagedProducts.FullRowSelect = true;
            //listViewUnstagedProducts.GridLines = true;
            listViewUnstagedProducts.LabelEdit      = false; // true;
            listViewUnstagedProducts.columnEditable = 1;     //-1 = all


            //listview with headers
            listViewStagedProducts.View = View.Details;
            listViewStagedProducts.Columns.Add("Product Category", 175, HorizontalAlignment.Left);
            listViewStagedProducts.Columns.Add("Quantity", 100, HorizontalAlignment.Right);
            listViewStagedProducts.Columns.Add("Dozen", 90, HorizontalAlignment.Right);
            listViewStagedProducts.Columns.Add("Amount", 120, HorizontalAlignment.Right);

            listViewStagedProducts.GridLines = true;

            //array to store categoryid
            this.arrayListViewCategoryId   = new ArrayList();
            this.arrayListViewQuantity     = new ArrayList();
            this.arrayListViewRefundAmount = new ArrayList();


            ReadProducts(dataSetProductsUnstaged.Tables[0], listViewUnstagedProducts, labelUnstagedTotalQuantity, labelUnstagedTotalAmount, false, "Unstaged");
            ReadProducts(dataSetProductsStaged.Tables[0], listViewStagedProducts, labelStagedTotalQuantity, labelStagedTotalAmount, false, "Staged");

            //training warning
            if (Properties.Settings.Default.SQLBaseDeDatos == "Solum_Training")
            {
                toolStripStatusLabelTrainingMode.Visible = true;
                Main.tslCntr            = toolStripStatusLabelTrainingMode;
                Main.timerBlink.Enabled = true;
            }
        }
Esempio n. 17
0
        private bool AddStagedContanier()
        {
            if (sol_Agency != null &&
                sol_Agency.AutoGenerateTagNumber
                )
            {
                AutoGenerateTagNumber();
            }

            sol_Stage = new Sol_Stage();
            if (membershipUser == null)
            {
                membershipUser = Membership.GetUser(Properties.Settings.Default.UsuarioNombre);
            }
            if (membershipUser == null)
            {
                MessageBox.Show("User does not exits, cannot close the Container");
                return(false);
            }
            sol_Stage.UserID               = (Guid)membershipUser.ProviderUserKey;
            sol_Stage.UserName             = Properties.Settings.Default.UsuarioNombre;
            sol_Stage.Date                 = Main.rc.FechaActual; // ; // Properties.Settings.Default.FechaActual;;
            sol_Stage.TagNumber            = textBoxTagNumber.Text;
            sol_Stage.ContainerID          = Int32.Parse(comboBoxContainers.SelectedValue.ToString());
            sol_Stage.ContainerDescription = comboBoxContainers.Text;
            sol_Stage.ProductID            = Int32.Parse(comboBoxProducts.SelectedValue.ToString());
            sol_Stage.ProductName          = comboBoxProducts.Text;
            sol_Stage.Quantity             = Int32.Parse(textBoxQuantity.Text);
            sol_Stage.Dozen                = 0;   //not using it anymore
            sol_Stage.Status               = "I"; //InProcess
            sol_Stage.Remarks              = textBoxRemarks.Text.Trim();

            ////include product price
            //Sol_Product_Sp sol_Product_Sp = new Sol_Product_Sp(Properties.Settings.Default.WsirDbConnectionString);
            //Sol_Product sol_Product = sol_Product_Sp.Select(sol_Stage.ProductID);
            //sol_Stage.Price = sol_Product.Price;
            sol_Stage.Price = 0.00m;

            //in case there is no default value in the db
            sol_Stage.DateClosed = DateTime.Parse("1753-01-01 12:00:00.000");

            try
            {
                sol_Stage_Sp.Insert(sol_Stage);
            }
            catch
            {
                if (sol_Agency != null &&
                    sol_Agency.AutoGenerateTagNumber
                    )
                {
                    AutoGenerateTagNumber();
                }
                try
                {
                    sol_Stage_Sp.Insert(sol_Stage);
                }
                catch (Exception e)
                {
                    CajaDeMensaje.Show("SqlError", "Error trying to add a new Staging, try again later please", e.Message, CajaDeMensajeImagen.Error);
                    sol_Stage = null;
                    return(false);
                }
            }

            //textBoxStageID.Text = sol_Stage.StageID.ToString();
            textBoxUserName.Text = sol_Stage.UserName;
            //dateTimePicker1.Value = sol_Stage.Date;
            textBoxDate.Text = sol_Stage.Date.ToString("G");



            return(true);
        }
Esempio n. 18
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBoxTagNumber.Text))
            {
                MessageBox.Show("Please enter a Tag number");
                textBoxTagNumber.Focus();
                controlWithFocus = textBoxTagNumber;
                return;
            }

            //wasStage  a barcode read?
            string barCode = textBoxTagNumber.Text.Trim();
            string x       = barCode;

            if (x.Length > 7)
            {
                //x = x.Substring(x.Length - 7);
                //int intValue = 0;
                //Int32.TryParse(x, out intValue);
                //if (intValue > 0)
                //    textBoxTagNumber.Text = String.Format("{0}", intValue);
                //else
                //{
                //    MessageBox.Show("Error parsing the Tag Number!");
                //    textBoxTagNumber.Focus();
                //    return;
                //}


                ////search for product from barcode
                //x = barCode;
                //x = x.Substring(x.Length - (7 + 5 + 4), 4);
                //if (sol_Product_Sp == null)
                //    sol_Product_Sp = new Sol_Product_Sp(Properties.Settings.Default.WsirDbConnectionString);

                ////search for product
                //sol_Product = sol_Product_Sp.SelectProductCode(x);
                //if (sol_Product != null)
                //{

                //    comboBoxProducts.SelectedValue = sol_Product.ProductID;


                //}
            }

            sol_Stage = sol_Stage_Sp._SelectByTagNumberStatus(textBoxTagNumber.Text, "I");
            if (sol_Stage == null)
            {
                MessageBox.Show("Tag number not found, try another one please.");
                textBoxTagNumber.Focus();
                controlWithFocus = textBoxTagNumber;
                return;
            }


            FillForm();

            textBoxTagNumber.ReadOnly = true;

            EnableButtons("search");
        }
Esempio n. 19
0
        private void buttonClose_Click(object sender, EventArgs e)
        {
            if (comboBoxProducts.SelectedIndex < 0)
            {
                MessageBox.Show("Please enter a Product");
                comboBoxProducts.Focus();
                return;
            }

            if (String.IsNullOrEmpty(textBoxTagNumber.Text))
            {
                MessageBox.Show("Please enter a Tag number");
                textBoxTagNumber.Focus();
                controlWithFocus = textBoxTagNumber;
                return;
            }

            if (comboBoxContainers.SelectedIndex < 0)
            {
                MessageBox.Show("Please enter a Container Type");
                comboBoxContainers.Focus();
                return;
            }

            int quantity = 0;

            try
            {
                quantity = Int32.Parse(textBoxQuantity.Text);
            }
            catch
            {
                MessageBox.Show("Please enter a valid quantity.");
                textBoxQuantity.Focus();
                return;
            }

            if (String.IsNullOrEmpty(textBoxDozen.Text))
            {
                MessageBox.Show("Please enter number of dozens");
                textBoxDozen.Focus();
                return;
            }

            decimal dozen = 0;

            try
            {
                dozen = decimal.Parse(textBoxDozen.Text);
            }
            catch
            {
                MessageBox.Show("Please enter a valid number of dozens.");
                textBoxDozen.Focus();
                return;
            }

            //add
            if (sol_Agency != null &&
                sol_Agency.AutoGenerateTagNumber &&
                buttonClicked == "&New"
                )
            {
                //update
                UpdateStagedContainer();
            }
            else
            {
                if (buttonClicked == "&New")
                {
                    /* I-InProgress; P-Picked S-Shipped D -Void "" = any */
                    sol_Stage = sol_Stage_Sp._SelectByTagNumberStatus(textBoxTagNumber.Text, "");   //I");
                    if (sol_Stage != null)
                    {
                        MessageBox.Show("Tag number already exists, try another one please.");
                        textBoxTagNumber.Focus();
                        controlWithFocus = textBoxTagNumber;
                        return;
                    }

                    AddStagedContanier();
                }
                else
                {
                    //update
                    UpdateStagedContainer();
                }
            }

            //view state
            EnableControls(false);

            EnableButtons("close");

            //for upon exit
            flagChange = false;

            sol_Agency = null;
        }