Ejemplo n.º 1
0
        private void RetrieveDataCustomer()
        {
            if (editingData)
            {
                if (Mobilize.Web.MessageBox.Show("Do you want to cancel previous edited data?", "Data edition", Mobilize.Web.MessageBoxButtons.YesNo, Mobilize.Web.MessageBoxIcon.Question) != Mobilize.Web.DialogResult.Yes)
                {
                    return;
                }
            }

            Mobilize.Web.ListViewItem withVar = null;
            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!(lvCustomers.FocusedItem is null))
            {
                withVar                 = lvCustomers.FocusedItem;
                currentIdCustomer       = Convert.ToInt32(double.Parse(lvCustomers.FocusedItem.Text));
                currentCompanyName      = Mobilize.Web.ListView.GetListViewSubItem(withVar, 1).Text;
                currentContactName      = Mobilize.Web.ListView.GetListViewSubItem(withVar, 2).Text + " " + Mobilize.Web.ListView.GetListViewSubItem(withVar, 3).Text;
                txtCustomerCompany.Text = currentCompanyName;
                txtCustomerContact.Text = currentContactName;
                editingData             = false;
            }

            LoadProductsById();
            cmdSave.Enabled        = true;
            cmdAddProducts.Enabled = true;
            dtRequired.Enabled     = true;
            dtPromised.Enabled     = true;
        }
Ejemplo n.º 2
0
        private void LoadProductsById()
        {
            string productCode = "";

            modConnection.ExecuteSql("Select p.ProductID, p.ProductName, p.UnitPrice, p.QuantityPerUnit, p.Unit from Products as p, " + Table + " as pb Where pb." + ColumnName + " = " + Id.ToString() + " And pb.ProductId = p.ProductId");

            modMain.LogStatus("There are " + modConnection.rs.RecordCount.ToString() + " records with the selected criteria", this);
            Mobilize.Web.ListViewItem x = null;
            if (modConnection.rs.RecordCount > 0)
            {
                while (!modConnection.rs.EOF)
                {
                    //productCode = CStr(rs.Fields(0).value)
                    productCode = Convert.ToString(modConnection.rs[0]);
                    modFunctions.AddToCollection(productsStored, productCode);
                    x = lvProductsBy.Items.Add(productCode);
                    for (modMain.i = 1; modMain.i <= 2; modMain.i++)
                    {
                        //UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                        if (modConnection.rs.GetField(modMain.i) != null)
                        {
                            Mobilize.Web.ListView.GetListViewSubItem(x, modMain.i).Text = Convert.ToString(modConnection.rs[modMain.i]);
                        }
                    }
                    Mobilize.Web.ListView.GetListViewSubItem(x, 3).Text = Convert.ToString(modConnection.rs[3]) + Convert.ToString(modConnection.rs[4]);
                    modConnection.rs.MoveNext();
                }
            }
        }
Ejemplo n.º 3
0
        private void DoSearchProduct()
        {
            string filter = "";

            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!string.IsNullOrEmpty(txtCode.Text))
            {
                filter = "ProductId LIKE '%" + txtCode.Text + "%'";
            }

            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!string.IsNullOrEmpty(txtName.Text))
            {
                // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                if (!string.IsNullOrEmpty(filter))
                {
                    filter = filter + " AND ";
                }

                filter = filter + "ProductName LIKE '%" + txtName.Text + "%'";
            }

            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!string.IsNullOrEmpty(filter))
            {
                filter = "Where " + filter;
            }

            modConnection.ExecuteSql("Select ProductID, ProductName, UnitPrice, UnitsInStock, UnitsOnOrder, QuantityPerUnit, Unit from Products " + filter);
            lvProducts.Items.Clear();
            Mobilize.Web.ListViewItem x = null;
            if (modConnection.rs.RecordCount == 0)
            {
                modMain.LogStatus("There are no records with the selected criteria", this);
            }
            else
            {
                while (!modConnection.rs.EOF)
                {
                    x = lvProducts.Items.Add(Convert.ToString(modConnection.rs[0]));
                    int tempForEndVar = (modConnection.rs.FieldsMetadata.Count - 1);
                    for (modMain.i = 1; modMain.i <= tempForEndVar; modMain.i++)
                    {
                        // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                        if (!(modConnection.rs.GetField(modMain.i) is null))
                        {
                            Mobilize.Web.ListView.GetListViewSubItem(x, modMain.i).Text = Convert.ToString(modConnection.rs[modMain.i]);
                        }
                    }

                    modConnection.rs.MoveNext();
                }

                if (lvProducts.Items.Count == 1)
                {
                    lvProducts.Items[lvProducts.Items[0].Index].Selected = true;
                    // RetrieveDataProduct
                }
            }
        }
Ejemplo n.º 4
0
        private void AddProductToSet()
        {
            Mobilize.Web.ListViewItem y = null;
            int  i     = 0;
            bool found = false;

            Mobilize.Web.ListViewItem x = null;
            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!(lvProducts.FocusedItem is null))
            {
                y = lvProducts.FocusedItem;
                currentIdProduct = lvProducts.FocusedItem.Text;
                found            = false;
                int tempForEndVar = lvProductsBy.Items.Count;
                for (i = 1; i <= tempForEndVar; i++)
                {
                    if (lvProductsBy.Items[i - 1].Text == currentIdProduct)
                    {
                        lvProductsBy.Items[lvProductsBy.Items[i - 1].Index].Selected = true;
                        found = true;
                        break;
                    }
                    else if (string.CompareOrdinal(lvProductsBy.Items[i - 1].Text, currentIdProduct) > 0)
                    {
                        break;
                    }
                }

                if (!found)
                {
                    editingData = true;
                    if (!modFunctions.Exists(productsStored, currentIdProduct))
                    {
                        if (modFunctions.Exists(productsToDelete, currentIdProduct))
                        {
                            productsToDelete.Remove(currentIdProduct);
                        }
                        else
                        {
                            modFunctions.AddToCollection(productsToAdd, currentIdProduct);
                        }
                    }
                    else
                    {
                        if (modFunctions.Exists(productsToDelete, currentIdProduct))
                        {
                            productsToDelete.Remove(currentIdProduct);
                        }
                    }

                    x = lvProductsBy.Items.Insert(i - 1, currentIdProduct);
                    Mobilize.Web.ListView.GetListViewSubItem(x, 1).Text = Mobilize.Web.ListView.GetListViewSubItem(y, 1).Text;
                    Mobilize.Web.ListView.GetListViewSubItem(x, 2).Text = Mobilize.Web.ListView.GetListViewSubItem(y, 2).Text;
                    Mobilize.Web.ListView.GetListViewSubItem(x, 3).Text = Mobilize.Web.ListView.GetListViewSubItem(y, 5).Text + Mobilize.Web.ListView.GetListViewSubItem(y, 6).Text;
                }
            }
        }
Ejemplo n.º 5
0
        private void RetrieveDataProduct()
        {
            if (editingData)
            {
                if (Mobilize.Web.MessageBox.Show("Do you want to cancel previous edited data?", "Data edition", Mobilize.Web.MessageBoxButtons.YesNo, Mobilize.Web.MessageBoxIcon.Question) != Mobilize.Web.DialogResult.Yes)
                {
                    return;
                }
            }

            bool setEmpty = true;

            Mobilize.Web.ListViewItem withVar = null;
            if (!(lvStocks.FocusedItem is null))
            {
                // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                if (!(lvStocks.FocusedItem is null))
                {
                    currentIdStock           = Convert.ToInt32(double.Parse(lvStocks.FocusedItem.Text));
                    withVar                  = lvStocks.FocusedItem;
                    currentStock             = double.Parse(Mobilize.Web.ListView.GetListViewSubItem(withVar, 1).Text);
                    currentStockPrice        = double.Parse(Mobilize.Web.ListView.GetListViewSubItem(withVar, 4).Text);
                    codeGeneratedChange      = true;
                    txtOriginalQuantity.Text = currentStock.ToString();
                    txtOriginalPrice.Text    = currentStockPrice.ToString();
                    txtStockID.Text          = currentIdStock.ToString();
                    txtValues[0].Text        = currentStockPrice.ToString();
                    txtValues[1].Text        = currentStock.ToString();
                    lblNewQuantity.Text      = StringsHelper.Format(currentStock * double.Parse(currentQuantityPerUnit), "##,###.00") + currentUnit;
                    lblCurrentQuantity.Text  = StringsHelper.Format(currentStock * double.Parse(currentQuantityPerUnit), "##,###.00") + currentUnit;
                    codeGeneratedChange      = false;
                    setEmpty                 = false;
                    txtValues[0].ReadOnly    = false;
                    txtValues[1].ReadOnly    = false;
                    txtValues[0].Focus();
                }
            }

            if (setEmpty)
            {
                codeGeneratedChange      = true;
                txtOriginalQuantity.Text = "";
                txtOriginalPrice.Text    = "";
                txtStockID.Text          = "";
                txtValues[0].Text        = "";
                txtValues[1].Text        = "";
                lblNewQuantity.Text      = "";
                lblCurrentQuantity.Text  = "";
                codeGeneratedChange      = false;
            }

            editingData = false;
        }
Ejemplo n.º 6
0
 public void LoadUsersAvoidingWith()
 {
     modConnection.ExecuteSql("Select * from Users");
     lstAccounts.Items.Clear();
     Mobilize.Web.ListViewItem x = null;
     while (!modConnection.rs.EOF)
     {
         x = lstAccounts.Items.Add(Convert.ToString(modConnection.rs["UserName"]));
         Mobilize.Web.ListView.GetListViewSubItem(x, 1).Text = Convert.ToString(modConnection.rs["Fullname"]);
         Mobilize.Web.ListView.GetListViewSubItem(x, 2).Text = Convert.ToString(modConnection.rs["Level"]);
         modConnection.rs.MoveNext();
     }
 }
Ejemplo n.º 7
0
        private void RetrieveDataProduct()
        {
            if (editingData)
            {
                if (Mobilize.Web.MessageBox.Show("Do you want to cancel previous edited data?", "Data edition", Mobilize.Web.MessageBoxButtons.YesNo, Mobilize.Web.MessageBoxIcon.Question) != Mobilize.Web.DialogResult.Yes)
                {
                    return;
                }
            }

            Mobilize.Web.ListViewItem withVar = null;
            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!(lvProducts.FocusedItem is null))
            {
                withVar          = lvProducts.FocusedItem;
                currentIdProduct = lvProducts.FocusedItem.Text;
                // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                if (!string.IsNullOrEmpty(Mobilize.Web.ListView.GetListViewSubItem(withVar, 5).Text))
                {
                    currentQuantityPerUnit = Mobilize.Web.ListView.GetListViewSubItem(withVar, 5).Text;
                }

                // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                if (!string.IsNullOrEmpty(Mobilize.Web.ListView.GetListViewSubItem(withVar, 6).Text))
                {
                    currentUnit = Mobilize.Web.ListView.GetListViewSubItem(withVar, 6).Text;
                }

                currentProductName      = Mobilize.Web.ListView.GetListViewSubItem(withVar, 1).Text;
                currentPriceReference   = double.Parse(Mobilize.Web.ListView.GetListViewSubItem(withVar, 2).Text);
                txtProductName.Text     = currentProductName;
                txtQuantityPerUnit.Text = currentQuantityPerUnit;
                txtUnit.Text            = currentUnit;
                txtValues[0].ReadOnly   = false;
                txtValues[1].ReadOnly   = false;
                txtValues[2].ReadOnly   = false;
                txtValues[0].Text       = "1";
                txtValues[1].Text       = currentPriceReference.ToString();
                txtValues[2].Text       = currentPriceReference.ToString();
                txtValues[0].Focus();
                modFunctions.SelectAll(txtValues[0]);
                editingData = false;
            }
        }
Ejemplo n.º 8
0
 private void lvCustomers_ItemClick(Mobilize.Web.ListViewItem Item)
 {
     RetrieveDataCustomer();
 }
Ejemplo n.º 9
0
        // UPGRADE_NOTE: (7001) The following declaration (txtName_Change) seems to be dead code More Information: https://www.mobilize.net/vbtonet/ewis/ewi7001
        // private void txtName_Change()
        // {
        // DoSearchCustomer();
        // }

        private void DoSearchCustomer(string Id = "")
        {
            string filter = "";

            // If Not IsEmpty(Id) Then
            if (Id != "")
            {
                filter = "CustomerID = " + Id;
            }

            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!string.IsNullOrEmpty(txtCompanyName.Text))
            {
                // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                if (!string.IsNullOrEmpty(filter))
                {
                    filter = filter + " AND ";
                }

                filter = "CompanyName LIKE '%" + txtCompanyName.Text + "%'";
            }

            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!string.IsNullOrEmpty(txtContactName.Text))
            {
                // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                if (!string.IsNullOrEmpty(filter))
                {
                    filter = filter + " AND ";
                }

                filter = filter + "ContactFirstName LIKE '%" + txtContactName.Text + "%'";
            }

            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!string.IsNullOrEmpty(txtContactLastName.Text))
            {
                // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                if (!string.IsNullOrEmpty(filter))
                {
                    filter = filter + " AND ";
                }

                filter = filter + "ContactLastName LIKE '%" + txtContactLastName.Text + "%'";
            }

            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!string.IsNullOrEmpty(filter))
            {
                filter = "Where " + filter;
            }

            modConnection.ExecuteSql("Select CustomerID, CompanyName, ContactFirstName, ContactLastName, City, StateOrProvince, 'Country/Region' From Customers " + filter);
            lvCustomers.Items.Clear();
            Mobilize.Web.ListViewItem x = null;
            if (modConnection.rs.RecordCount == 0)
            {
                modMain.LogStatus("There are no records with the selected criteria", this);
            }
            else
            {
                while (!modConnection.rs.EOF)
                {
                    x = lvCustomers.Items.Add(Convert.ToString(modConnection.rs[0]));
                    int tempForEndVar = (modConnection.rs.FieldsMetadata.Count - 1);
                    for (modMain.i = 1; modMain.i <= tempForEndVar; modMain.i++)
                    {
                        // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
                        if (!(modConnection.rs.GetField(modMain.i) is null))
                        {
                            Mobilize.Web.ListView.GetListViewSubItem(x, modMain.i).Text = Convert.ToString(modConnection.rs[modMain.i]);
                        }
                    }

                    modConnection.rs.MoveNext();
                }

                if (lvCustomers.Items.Count == 1)
                {
                    lvCustomers.Items[lvCustomers.Items[0].Index].Selected = true;
                }
            }
        }
Ejemplo n.º 10
0
 private void lvProducts_ItemClick(Mobilize.Web.ListViewItem Item)
 {
     RetrieveDataProduct();
 }
Ejemplo n.º 11
0
 private void lvProviders_ItemClick(Mobilize.Web.ListViewItem Item)
 {
     RetrieveDataProvider();
 }
Ejemplo n.º 12
0
 private void lvProducts_ItemClick(Mobilize.Web.ListViewItem Item)
 {
     AddProductToSet();
 }
Ejemplo n.º 13
0
        private void DoSearchStocks()
        {
            if (lvProducts.FocusedItem is null)
            {
                return;
            }

            if (editingData)
            {
                if (Mobilize.Web.MessageBox.Show("Do you want to cancel previous edited data?", "Data edition", Mobilize.Web.MessageBoxButtons.YesNo, Mobilize.Web.MessageBoxIcon.Question) != Mobilize.Web.DialogResult.Yes)
                {
                    return;
                }
            }

            string productId   = lvProducts.FocusedItem.Text;
            string productName = Mobilize.Web.ListView.GetListViewSubItem(lvProducts.FocusedItem, 1).Text;

            currentIdProduct = lvProducts.FocusedItem.Text;
            Mobilize.Web.ListViewItem withVar = null;
            withVar = lvProducts.FocusedItem;
            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!string.IsNullOrEmpty(Mobilize.Web.ListView.GetListViewSubItem(withVar, 5).Text))
            {
                currentQuantityPerUnit = Mobilize.Web.ListView.GetListViewSubItem(withVar, 5).Text;
            }

            // UPGRADE_WARNING: (2080) IsEmpty was upgraded to a comparison and has a new behavior. More Information: https://www.mobilize.net/vbtonet/ewis/ewi2080
            if (!string.IsNullOrEmpty(Mobilize.Web.ListView.GetListViewSubItem(withVar, 6).Text))
            {
                currentUnit = Mobilize.Web.ListView.GetListViewSubItem(withVar, 6).Text;
            }

            currentProductName      = Mobilize.Web.ListView.GetListViewSubItem(withVar, 1).Text;
            txtProductName.Text     = productName;
            txtUnit.Text            = currentUnit;
            txtQuantityPerUnit.Text = currentQuantityPerUnit;

            modConnection.ExecuteSql("Select StockID, Stock, InitialStock, UnitPrice, " +
                                     "StockPrice, DateStarted, DateModified, User From Stocks " +
                                     " Where ProductId = '" + productId + "'");
            lvStocks.Items.Clear();
            Mobilize.Web.ListViewItem x = null;
            if (modConnection.rs.RecordCount == 0)
            {
                modMain.LogStatus("There are no stock records of the product " + productName);
                RetrieveDataProduct();
            }
            else
            {
                while (!modConnection.rs.EOF)
                {
                    x = lvStocks.Items.Add(Convert.ToString(modConnection.rs[0]));
                    int tempForEndVar = (modConnection.rs.FieldsMetadata.Count - 1);
                    for (modMain.i = 1; modMain.i <= tempForEndVar; modMain.i++)
                    {
                        Mobilize.Web.ListView.GetListViewSubItem(x, modMain.i).Text = Convert.ToString(modConnection.rs[modMain.i]);
                    }

                    modConnection.rs.MoveNext();
                }

                if (lvStocks.Items.Count == 1)
                {
                    lvStocks.Items[lvStocks.Items[0].Index].Selected = true;
                }
            }
        }
Ejemplo n.º 14
0
 private void lvProducts_ItemClick(Mobilize.Web.ListViewItem Item)
 {
     DoSearchStocks();
 }