private void Frm_distrist_Load(object sender, EventArgs e) { clsItem cls; DataTable da = new DataTable(); da = gen.GetTable("select * from Province order by ProvinceName"); for (int i = 0; i < da.Rows.Count; i++) { cls = new clsItem(da.Rows[i][0].ToString(), da.Rows[i][2].ToString()); cbprovince.Items.Add(cls); } cbprovince.DisplayMember = "PstrName"; cbprovince.ValueMember = "PstrValue"; cbprovince.SelectedIndex = 0; if (active == "1") { DataTable data = new DataTable(); data = gen.GetTable("select * from Distrist where DistristID='" + role + "'"); txtcode.Text = data.Rows[0][1].ToString(); txtname.Text = data.Rows[0][2].ToString(); txtdg.Text = data.Rows[0][3].ToString(); for (int i = 0; i < da.Rows.Count; i++) { if (data.Rows[0][4].ToString() == da.Rows[i][0].ToString()) { cbprovince.SelectedIndex = i; } } } }
public clsItemColecao CarregarProdutos() { try { clsItemColecao itemColecao = new clsItemColecao(); acessoDadosSqlServer.LimparParametros(); DataTable dataTable = acessoDadosSqlServer.ExecutarConsulta(CommandType.Text, "SELECT * FROM uvwConsultarDescricaoCategoria"); foreach (DataRow linha in dataTable.Rows) { clsItem p = new clsItem(); p.Descricao = Convert.ToString(linha["Bebida"]); itemColecao.Add(p); } return(itemColecao); } catch (Exception) { throw; } }
DataSet ds; // Dataset to hold the returned data from queries /// <summary> /// Returns the full list of jewelry items from the database /// </summary> /// <returns></returns> public ObservableCollection <clsItem> itemsCollection() { try { db = new clsDataAccess(); ObservableCollection <clsItem> col_Items = new ObservableCollection <clsItem>(); string sSQL; //Holds an SQL statement int iRet = 0; //Number of return values ds = new DataSet(); //Holds the return values clsItem items; //Used to load the return values into the combo box sSQL = "SELECT ItemCode, ItemDesc, Cost " + "FROM ItemDesc"; ds = db.ExecuteSQLStatement(sSQL, ref iRet); //Creates item objects based on the data pulled from the query than adds the object to a list for (int i = 0; i < iRet; i++) { items = new clsItem(); items.ItemCode = ds.Tables[0].Rows[i][0].ToString(); items.ItemDesc = ds.Tables[0].Rows[i]["ItemDesc"].ToString(); items.Cost = ds.Tables[0].Rows[i]["Cost"].ToString(); col_Items.Add(items); } return(col_Items); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
private void btnSalvar_Click(object sender, EventArgs e) { clsItem item = new clsItem(); clsTipo tipo = new clsTipo(); clsItemNegocio itemNegocio = new clsItemNegocio(); item.Descricao = txtDescricaoCadastrar.Text; int idTipo = ((clsTipo)cboCategoriaCadastrar.SelectedItem).id; item.idTipo = idTipo; item.Qtde = Convert.ToInt32(txtQtdeCadastrar.Text); item.PrecoUnit = Convert.ToDouble(txtPrecoCadastrar.Text); string retorno = itemNegocio.Inserir(item); try { int id_Produto = Convert.ToInt32(retorno); MetroFramework.MetroMessageBox.Show(this, "Produto inserido com sucesso. Código: " + id_Produto.ToString(), "INFORMAÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Information); //this.DialogResult = DialogResult.Yes; } catch { MessageBox.Show("Não foi possivel inserir. Detalhe: " + retorno, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); //this.DialogResult = DialogResult.No; } }
/// <summary> /// Gets all the items in an invoice /// </summary> /// <param name="invoiceId"></param> /// <returns></returns> public ObservableCollection <clsItem> getInvoiceItems(int invoiceId) { try { ObservableCollection <clsItem> lItems = new ObservableCollection <clsItem>(); sSqlStatement = "SELECT L.LineItemNum, D.ItemCode, D.ItemDesc, D.Cost FROM ItemDesc AS D " + "INNER JOIN LineItems AS L " + "ON L.ItemCode = D.ItemCode " + "WHERE L.InvoiceNum = " + invoiceId; iRet = 0; DataSet ds; ds = db.ExecuteSQLStatement(sSqlStatement, ref iRet); clsItem oItem; for (int i = 0; i < iRet; i++) { oItem = new clsItem(Int32.Parse(ds.Tables[0].Rows[i][0].ToString()), ds.Tables[0].Rows[i][1].ToString(), ds.Tables[0].Rows[i][2].ToString(), Int32.Parse(ds.Tables[0].Rows[i][3].ToString())); lItems.Add(oItem); } return(lItems); } catch (System.Exception ex) { //Just throw the exception throw new System.Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
/// <summary> /// returns a list of all items in the database /// </summary> /// <returns></returns> public ObservableCollection <clsItem> getItems() { try { ObservableCollection <clsItem> lItems = new ObservableCollection <clsItem>(); sSqlStatement = "SELECT * FROM ItemDesc"; iRet = 0; DataSet ds; ds = db.ExecuteSQLStatement(sSqlStatement, ref iRet); clsItem oItem; for (int i = 0; i < iRet; i++) { oItem = new clsItem(-1, ds.Tables[0].Rows[i][0].ToString(), ds.Tables[0].Rows[i][1].ToString(), Int32.Parse(ds.Tables[0].Rows[i][2].ToString())); lItems.Add(oItem); } return(lItems); } catch (System.Exception ex) { //Just throw the exception throw new System.Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
public void InstanceOk() { //create an instance of the class we want to create clsItem AnItem = new clsItem(); //test to see that it exists Assert.IsNotNull(AnItem); }
internal void Redo() { UndoStack.Push(Item); Item = RedoStack.Pop(); MakeLive(Item.CurrentBBTBefore); //P.F.CurrentBBT = Item.CurrentBBTBefore; //FinalizeUndoRedo(); }
internal void Undo() { RedoStack.Push(Item); //state before change Item = UndoStack.Pop(); MakeLive(Item.CurrentBBTAfter); //P.F.CurrentBBT = Item.CurrentBBTAfter; //FinalizeUndoRedo(); }
public wndMain() { itemList = new ObservableCollection <clsItem>(); item = new clsItemsLogic(); lineItemList = new ObservableCollection <clsItem>(); currItem = new clsItem(); InitializeComponent(); }
private void Frm_accountgroup_Load(object sender, EventArgs e) { radioButton1.Checked = true; txtcode.ReadOnly = true; DataTable da = new DataTable(); da = gen.GetTable("select * from AccountCategory where AccountCategoryID='" + role + "' "); txtcode.Text = da.Rows[0][0].ToString(); txtname.Text = da.Rows[0][1].ToString(); clsItem cls; cls = new clsItem("0", "Dư nợ"); cbtc.Items.Add(cls); cls = new clsItem("1", "Dư có"); cbtc.Items.Add(cls); cls = new clsItem("2", "Lưỡng tính"); cbtc.Items.Add(cls); cls = new clsItem("3", "Không có số dư"); cbtc.Items.Add(cls); cbtc.DisplayMember = "PstrName"; cbtc.ValueMember = "PstrValue"; cbtc.SelectedIndex = (int)da.Rows[0][2]; clsItem cls1; cls1 = new clsItem("0", "Nhà cung cấp"); cbdt.Items.Add(cls1); cls1 = new clsItem("1", "Khách hàng"); cbdt.Items.Add(cls1); cls1 = new clsItem("2", "Nhân viên"); cbdt.Items.Add(cls1); cbdt.DisplayMember = "PstrName"; cbdt.ValueMember = "PstrValue"; cbdt.SelectedIndex = (int)da.Rows[0][7]; int ch = 0; for (int i = 1; i < 9; i++) { if (da.Rows[0][i].ToString() == "True") { ch = 1; } } if (ch == 0) { cbct.Checked = true; cbct.Checked = false; } else { cbct.Checked = true; } radioButton1.Checked = (bool)da.Rows[0][3]; radioButton2.Checked = (bool)da.Rows[0][5]; radioButton3.Checked = (bool)da.Rows[0][6]; radioButton4.Checked = (bool)da.Rows[0][4]; radioButton5.Checked = (bool)da.Rows[0][8]; }
public void PriceOk() { //create an instance of the class we want to create clsItem AnItem = new clsItem(); //create some test data to assign to the property decimal Price = 9.99m; //assign the data to the property AnItem.Price = Price; //test to see that the two values are the same Assert.AreEqual(AnItem.Price, Price); }
public void QuantityOk() { //create an instance of the class we want to create clsItem AnItem = new clsItem(); //create some test data to assign to the property Int32 Quantity = 1; //assign the data to the property AnItem.Quantity = Quantity; //test to see that the two values are the same Assert.AreEqual(AnItem.Quantity, Quantity); }
public void DescriptionOk() { //create an instance of the class we want to create clsItem AnItem = new clsItem(); //create some test data to assign to the property String Description = "Blue Dotted Sweater"; //assign the data to the property AnItem.Description = Description; //test to see that the two values are the same Assert.AreEqual(AnItem.Description, Description); }
public void NameOk() { //create an instance of the class we want to create clsItem AnItem = new clsItem(); //create some test data to assign to the property String Name = "Sweater"; //assign the data to the property AnItem.Name = Name; //test to see that the two values are the same Assert.AreEqual(AnItem.Name, Name); }
public void ItemIDOk() { //create an instance of the class we want to create clsItem AnItem = new clsItem(); //create some test data to assign to the property Int32 ItemID = 1; //assign the data to the property AnItem.ItemID = ItemID; //test to see that the two values are the same Assert.AreEqual(AnItem.ItemID, ItemID); }
void Main(string argument, UpdateType updateSource) { Echo(DateTime.Now.ToString("s")); switch (argument.ToLower()) { case "start": Runtime.UpdateFrequency = UpdateFrequency.Update100; Echo("Start"); break; case "stop": Runtime.UpdateFrequency = UpdateFrequency.None; Echo("Stop"); break; case "scan": findAllBlocks(); Echo($"Scan all -- {STORAGETAG} --"); allBlocks.ForEach(x => Echo(x.CustomName)); break; } if (Runtime.UpdateFrequency != UpdateFrequency.None) { findAllBlocks(); foreach (IMyTerminalBlock e1 in allBlocks) { // Echo("--" + e1.CustomName); if (e1.CustomData.Contains("scan1")) { Scan((item) => { clsItemName b1 = new clsItemName(item); return($"+ {b1.rd}"); }); } if (e1.CustomData.Contains("scan2")) { Scan((item) => { clsItemName b1 = new clsItemName(item); return($"+ {(int)item.Amount} {b1.rd}"); }); } if (e1.CustomData.Contains("scan3")) { Scan((item) => { clsItemName b1 = new clsItemName(item); return($"new clsItemName(\"{b1.rs}\",\"{b1.rt}\");"); }); } } foreach (IMyTerminalBlock a1 in allBlocks) { Echo($"-{a1.CustomName}\n"); for (int nr = 0; nr < a1.InventoryCount; nr++) { IMyInventory a2 = a1.GetInventory(nr); List <MyInventoryItem> a3 = new List <MyInventoryItem>(); a2.GetItems(a3); foreach (MyInventoryItem a4 in a3) { clsItem a5 = new clsItem(a1, a2, a4); Echo($"--{a5}\n"); } } } } // Echo(Runtime.UpdateFrequency.ToString()); }
private void tsbtsave_Click(object sender, EventArgs e) { string dtkt = radioButton1.Checked.ToString(); string hd = radioButton2.Checked.ToString(); string vthh = radioButton3.Checked.ToString(); string cp = radioButton4.Checked.ToString(); string nh = radioButton5.Checked.ToString(); clsItem cls = (clsItem)cbdt.SelectedItem; string dt = cls.PstrValue; clsItem cls1 = (clsItem)cbtc.SelectedItem; string tc = cls1.PstrValue; string sql = "update AccountCategory set AccountCategoryName=N'" + txtname.Text + "',AccountCategoryKind='" + tc + "',DetailByAccountingObject='" + dtkt + "',DetailByInventoryItem='" + cp + "', DetailByJob='" + hd + "',DetailByContract='" + vthh + "',AccountingObjectType='" + dt + "',DetailByBankAccount='" + nh + "' where AccountCategoryID='" + txtcode.Text + "' "; accountgroup.checkaccountgroup(txtname.Text, sql, this); }
private void tsbtsave_Click(object sender, EventArgs e) { clsItem cls1 = (clsItem)cbprovince.SelectedItem; string tt = cls1.PstrValue; if (active == "1") { string sql = "update Distrist set DistristName=N'" + txtname.Text + "',Description=N'" + txtdg.Text + "',ProvinceID='" + tt + "' where DistristID='" + role + "'"; distrist.checkdistrist(active, txtcode, txtname, sql, this); } else { string sql = "insert into Distrist values(newid(),'" + txtcode.Text + "',N'" + txtname.Text + "',N'" + txtdg.Text + "','" + tt + "')"; distrist.checkdistrist(active, txtcode, txtname, sql, this); } }
/// <summary> /// Returns the collection of items from a certain invoice /// </summary> /// <param name="invoiceNumber"></param> /// <returns></returns> public ObservableCollection <clsItem> invoiceItems(string invoiceNumber) { try { db = new clsDataAccess(); ObservableCollection <clsItem> col_Items = new ObservableCollection <clsItem>(); List <string> itemCode = new List <string>(); string sSQL; //Holds an SQL statement int iRet = 0; //Number of return values ds = new DataSet(); //Holds the return values clsItem items; //Used to load the return values into the combo box sSQL = "SELECT ItemCode FROM LineItems " + "WHERE InvoiceNum = " + invoiceNumber; ds = db.ExecuteSQLStatement(sSQL, ref iRet); // adds all of the different item codes on the invoice to a list for (int i = 0; i < iRet; i++) { itemCode.Add(ds.Tables[0].Rows[i]["ItemCode"].ToString()); } if (itemCode.Count > 0) { foreach (string code in itemCode) { sSQL = "SELECT ItemCode, ItemDesc, Cost FROM ItemDesc " + "WHERE ItemCode = '" + code + "'"; ds = db.ExecuteSQLStatement(sSQL, ref iRet); items = new clsItem(); items.ItemCode = ds.Tables[0].Rows[0][0].ToString(); items.ItemDesc = ds.Tables[0].Rows[0]["ItemDesc"].ToString(); items.Cost = ds.Tables[0].Rows[0]["Cost"].ToString(); col_Items.Add(items); } } return(col_Items); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
public void ValidMethodOk() { //create an instance of the class we want to create clsItem AnItem = new clsItem(); //create a string variable to store the result of the validation string Error = ""; //create some test data to test the method string Name = "Candyfloss Sweater"; string Description = "Light Pink Sweater"; decimal Price = 6.99m; Int32 Quantity = 1; //invoke the method Error = AnItem.Valid(Name, Description, Price, Quantity); //test to see that the result is correct Assert.AreEqual(Error, ""); }
/// <summary> /// Add the item selected in the combobox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddItem_Click(object sender, RoutedEventArgs e) { try { //add the item from the combobox to the invoice if (cbItems.SelectedItem != null) { clsItem selectedItem = new clsItem((clsItem)cbItems.SelectedItem); oMainLogic.addItem(selectedItem); resetUI(); } } catch (Exception ex) { HandleError.handleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }