/// <summary> /// adding an item /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveADD_Click(object sender, RoutedEventArgs e) { try { Double dbl = new double(); if (Double.TryParse(tbx_def_Cost.Text, out dbl) && tbx_def_IName.Text != "" && tbx_def_IDesc.Text != "" && tbx_def_Cost.Text != "") { DAItem.AddItem(tbx_def_IName.Text, tbx_def_IDesc.Text, dbl); List <Item> totalitems = DAItem.GetList(); cmb_def_Item.Items.Clear(); foreach (Item i in totalitems) { cmb_def_Item.Items.Add(i); } tbx_def_IName.IsEnabled = false; tbx_def_IDesc.IsEnabled = false; tbx_def_Cost.IsEnabled = false; tbx_def_IName.Text = ""; tbx_def_IDesc.Text = ""; tbx_def_Cost.Text = ""; btn_def_Save.IsEnabled = false; } else { } } catch (Exception ex) { Exceptions.Spool(ex); } }
internal void PrintOrSentTsd(Guid useroid, DEBusinessItem item, string action, out StringBuilder strErr) { this.cmd.Parameters.Clear(); strErr = new StringBuilder(); this.cmd.CommandType = CommandType.StoredProcedure; Guid ssoid = Guid.NewGuid(); this.cmd.CommandText = "PLM_DQ_DOSSIER.TsdToPrintOrSent"; this.cmd.Parameters.Add(":ssoid", OracleDbType.Raw).Value = ssoid.ToByteArray(); this.cmd.Parameters.Add(":tAction", OracleDbType.Varchar2).Value = action; this.cmd.Parameters.Add(":useroid", OracleDbType.Raw).Value = useroid.ToByteArray(); this.cmd.Parameters.Add(":mOid", OracleDbType.Raw).Value = item.MasterOid.ToByteArray(); this.cmd.Parameters.Add(":tId", OracleDbType.Varchar2).Value = item.Id; this.cmd.Parameters.Add(":clentip", OracleDbType.Varchar2).Value = DAItem.GetClientIp(); this.cmd.ExecuteNonQuery(); this.cmd.Parameters.Clear(); this.cmd.CommandType = CommandType.Text; this.cmd.CommandText = "select PLM_ID,PLM_INFO from plm_tmp_archivmanage where plm_ssoid =:ssoid"; this.cmd.Parameters.Add(":ssoid", OracleDbType.Raw).Value = ssoid.ToByteArray(); OracleDataReader reader = this.cmd.ExecuteReader(); while (reader.Read()) { string str = reader.GetOracleString(0).Value; if (!reader.IsDBNull(1)) { strErr.Append("托晒单:" + str + ":"); strErr.Append(reader.GetOracleString(1).Value); } } this.ClearTmpData(ssoid); }
/// <summary> /// Deletes the selected item from the invoice /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void DeleteSelectedItem(object sender, RoutedEventArgs e) { try { Item del = null; // searches for the item with the button containing the tag with the item number and removes it from the database foreach (Item i in lItemList) { if (i.iItemNumber == (int)((Button)sender).Tag) { del = i; DAItem.RemovefromInvoice(del, this); } } // Removes the item from the item list lItemList.Remove(del); //rebuilds the itemstack myGrid.Children.Clear(); myGrid.Children.Add(myStack()); //enables editing EnableEdit(); } catch (Exception ex) { Exceptions.Spool(ex); } }
/// <summary> /// adds and item to the invoice adding one to an existing item, or adding a new item /// </summary> /// <param name="itm">item to add</param> public void addItem(Item itm) { try { bool contains = false; foreach (Item i in lItemList) { if (i.iItemNumber == itm.iItemNumber) { contains = true; itm = i; } } if (contains) { DAItem.AddOne(itm, this); itm.iModified = 3; } else { itm.iNumber = 1; itm.iModified = 2; DAItem.AddNewtoInvoice(itm, this); lItemList.Add(itm); } myGrid.Children.Clear(); myGrid.Children.Add(myStack()); } catch (Exception ex) { Exceptions.Spool(ex); } }
/// <summary> /// window constructor /// </summary> public def() { try { InitializeComponent(); List <Item> totalitems = DAItem.GetList(); foreach (Item i in totalitems) { cmb_def_Item.Items.Add(i); } } catch (Exception ex) { Exceptions.Spool(ex); } }
/// <summary> /// load the list of items /// </summary> private void LoadCombo() { try { cbo_mw_ItemList.Items.Clear(); List <Item> totalitems = DAItem.GetList(); foreach (Item i in totalitems) { cbo_mw_ItemList.Items.Add(i); } } catch (Exception ex) { Exceptions.Spool(ex); } }
/// <summary> /// Commits to edits of items and updates database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_def_EditSave_Click(object sender, RoutedEventArgs e) { try { itemName = tbx_def_IName1.Text; itemDescription = tbx_def_IDesc1.Text; int itemNumber = 2; Double db2 = new double(); if (Double.TryParse(tbx_def_Cost1.Text, out db2) && tbx_def_IName1.Text != "" && tbx_def_IDesc1.Text != "" && tbx_def_Cost1.Text != "") { Cost = db2; itemNumber = int.Parse(tbx_def_inumber.Text); DAItem.editItem(itemName, itemDescription, Cost, itemNumber); List <Item> totalitems = DAItem.GetList(); cmb_def_Item.Items.Clear(); foreach (Item i in totalitems) { cmb_def_Item.Items.Add(i); } //disabling the boxes tbx_def_IName1.IsEnabled = false; tbx_def_IDesc1.IsEnabled = false; tbx_def_Cost1.IsEnabled = false; btn_def_EditSave.IsEnabled = false; btn_def_EditItem.IsEnabled = false; //clearing the boxes tbx_def_IName1.Text = ""; tbx_def_IDesc1.Text = ""; tbx_def_Cost1.Text = ""; tbx_def_inumber.Text = ""; } else { } } catch (Exception ex) { Exceptions.Spool(ex); } }
/// <summary> /// the delete button /// it deletes items that not in the invoice /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_def_Delete_Click(object sender, RoutedEventArgs e) { try { int itemNumber = Convert.ToInt32(tbx_def_inumber.Text); bool itemDeleted = DAItem.deleteItem(itemName, itemDescription, Cost, itemNumber); if (itemDeleted) { MessageBox.Show("Item deleted Successfully!"); } else { MessageBox.Show("Item exists in invoice"); } List <Item> totalitems = DAItem.GetList(); cmb_def_Item.Items.Clear(); foreach (Item i in totalitems) { cmb_def_Item.Items.Add(i); } tbx_def_IName.IsEnabled = false; tbx_def_IDesc.IsEnabled = false; tbx_def_Cost.IsEnabled = false; tbx_def_inumber.Text = ""; tbx_def_IName1.Text = ""; tbx_def_IDesc1.Text = ""; tbx_def_Cost1.Text = ""; } catch (Exception ex) { Exceptions.Spool(ex); } }
public BindingList <ItemModel> BLGetItem() { DAItem dac = new DAItem(); DataTable dt = new DataTable(); dt = dac.GetItem(); BindingList <ItemModel> list = new BindingList <ItemModel>(); for (int i = 0; i < dt.Rows.Count; i++) { ItemModel item = new ItemModel(); item.itemId = Convert.ToInt32(dt.Rows[i]["ItemId"].ToString()); item.itemName = dt.Rows[i]["ItemName"].ToString(); item.itemCode = dt.Rows[i]["ItemCode"].ToString(); item.measuringUnitName = dt.Rows[i]["MeasuringUnitName"].ToString(); item.itemDescription = dt.Rows[i]["ItemDescription"].ToString(); list.Add(item); } return(list); }