private void UltraButton1_Click(object sender, EventArgs e) { CurrencyManager manager = (CurrencyManager)this.BindingContext[this.ds.S_OS_STANJE_LOKACIJA]; CurrencyManager manager2 = (CurrencyManager)this.BindingContext[this.dslokacije.LOKACIJE]; OSRAZMJESTAJDataAdapter adapter = new OSRAZMJESTAJDataAdapter(); OSRAZMJESTAJDataSet dataSet = new OSRAZMJESTAJDataSet(); DataRow row = dataSet.OSRAZMJESTAJ.NewRow(); DataRow row2 = dataSet.OSRAZMJESTAJ.NewRow(); row["idlokacije"] = RuntimeHelpers.GetObjectValue(((DataRowView)manager2.Current)["idlokacije"]); row["invbroj"] = RuntimeHelpers.GetObjectValue(((DataRowView)manager.Current)["invbroj"]); row["kolicinaulaza"] = RuntimeHelpers.GetObjectValue(((DataRowView)manager.Current)["stanje"]); row["kolicinarashoda"] = 0; row2["idlokacije"] = RuntimeHelpers.GetObjectValue(((DataRowView)manager.Current)["idlokacije"]); row2["invbroj"] = RuntimeHelpers.GetObjectValue(((DataRowView)manager.Current)["invbroj"]); row2["kolicinaulaza"] = 0; row2["kolicinarashoda"] = 0 - Conversions.ToInteger(((DataRowView)manager.Current)["stanje"]); dataSet.OSRAZMJESTAJ.Rows.Add(row); dataSet.OSRAZMJESTAJ.Rows.Add(row2); adapter.Update(dataSet); this.ds.Clear(); this.m_cmDisable = true; this.daStanje.Fill(this.ds, Conversions.ToLong(NewLateBinding.LateGet(this.__CurrencyManager.Current, null, "item", new object[] { 0 }, null, null, null))); this.IzbaciLokacije(); this.m_cmDisable = false; this.m_cm_PositionChanged(null, null); }
private void UltraButton2_Click(object sender, EventArgs e) { CurrencyManager manager = (CurrencyManager)this.BindingContext[this.ds.S_OS_STANJE_LOKACIJA]; if (manager.Count == 0) { return; } frmKolicina kolicina = new frmKolicina { kolicina = { MaxValue = RuntimeHelpers.GetObjectValue(((DataRowView)manager.Current)["stanje"]), Value = RuntimeHelpers.GetObjectValue(((DataRowView)manager.Current)["stanje"]) } }; if (kolicina.ShowDialog() == DialogResult.OK) { int num = Convert.ToInt32(kolicina.kolicina.Value); if (num > 0) { CurrencyManager manager2 = (CurrencyManager)this.BindingContext[this.dslokacije.LOKACIJE]; OSRAZMJESTAJDataAdapter adapter = new OSRAZMJESTAJDataAdapter(); OSRAZMJESTAJDataSet dataSet = new OSRAZMJESTAJDataSet(); DataRow row = dataSet.OSRAZMJESTAJ.NewRow(); DataRow row2 = dataSet.OSRAZMJESTAJ.NewRow(); row["idlokacije"] = RuntimeHelpers.GetObjectValue(((DataRowView)manager2.Current)["idlokacije"]); row["invbroj"] = RuntimeHelpers.GetObjectValue(((DataRowView)manager.Current)["invbroj"]); row["kolicinaulaza"] = num; row["kolicinarashoda"] = 0; row2["idlokacije"] = RuntimeHelpers.GetObjectValue(((DataRowView)manager.Current)["idlokacije"]); row2["invbroj"] = RuntimeHelpers.GetObjectValue(((DataRowView)manager.Current)["invbroj"]); row2["kolicinaulaza"] = 0; row2["kolicinarashoda"] = 0 - num; dataSet.OSRAZMJESTAJ.Rows.Add(row); dataSet.OSRAZMJESTAJ.Rows.Add(row2); adapter.Update(dataSet); this.m_cmDisable = true; this.ds.Clear(); this.daStanje.Fill(this.ds, Conversions.ToLong(this.OSController.DataSet.OS.Rows[0]["invbroj"])); this.IzbaciLokacije(); this.m_cmDisable = false; this.m_cm_PositionChanged(null, null); } } }