R
RBBM
Guest
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace Inventory
{
public partial class FrmAddProduct : Form
{
private string _ProductName;
private string _Category;
private string _MfgDate;
private string _ExpDate;
private string _Description;
private int _Quantity;
private double _SellPrice;
public FrmAddProduct()
{
InitializeComponent();
}
private void FrmAddProduct_Load(object sender, EventArgs e)
{
string[] ListOfProductCategory = new string[]
{
"Beverages",
"Bread/Bakery",
"Canned/Jarred Goods",
"Dairy",
"Frozen Goods",
"Meat",
"Personal Care",
"Other"
};
foreach (string Products in ListOfProductCategory)
{
cbCategory.Items.Add(Products);
}
}
public string Product_Name(string name)
{
if (!Regex.IsMatch(name, @"^[a-zA-Z]+$"))
{
return name;
}
}
public int Quantity(string qty)
{
if (!Regex.IsMatch(qty, @"^[0-9]"))
{
return Convert.ToInt32(qty);
}
}
public double SellingPrice(string price)
{
if (!Regex.IsMatch(price.ToString(), @"^(\d*\.)?\d+$"))
{
return Convert.ToDouble(price);
}
}
private void cbCategory_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
Continue reading...
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace Inventory
{
public partial class FrmAddProduct : Form
{
private string _ProductName;
private string _Category;
private string _MfgDate;
private string _ExpDate;
private string _Description;
private int _Quantity;
private double _SellPrice;
public FrmAddProduct()
{
InitializeComponent();
}
private void FrmAddProduct_Load(object sender, EventArgs e)
{
string[] ListOfProductCategory = new string[]
{
"Beverages",
"Bread/Bakery",
"Canned/Jarred Goods",
"Dairy",
"Frozen Goods",
"Meat",
"Personal Care",
"Other"
};
foreach (string Products in ListOfProductCategory)
{
cbCategory.Items.Add(Products);
}
}
public string Product_Name(string name)
{
if (!Regex.IsMatch(name, @"^[a-zA-Z]+$"))
{
return name;
}
}
public int Quantity(string qty)
{
if (!Regex.IsMatch(qty, @"^[0-9]"))
{
return Convert.ToInt32(qty);
}
}
public double SellingPrice(string price)
{
if (!Regex.IsMatch(price.ToString(), @"^(\d*\.)?\d+$"))
{
return Convert.ToDouble(price);
}
}
private void cbCategory_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
Continue reading...