public void Update(object sender, EventArgs e) { _update = true; if (ugdFormPregled.ActiveRow.ParentRow != null) { return; //Ovo sprečava da se odabire s menija (insert, update, delete) ukoliko ne radi o Parent redu u gridu (Band[0]) } if (ugdFormPregled.ActiveRow != null) { try { BusinessLogic.Inventura.pID = Convert.ToInt32(ugdFormPregled.ActiveRow.Cells["ID"].Value); } catch { } //db - 30.01.2017 --> kontrola odbijanja editiranja ukoliko je inventura već na skladištu string text = "select Prebaceno from MT_Inventura where ID = '" + BusinessLogic.Inventura.pID + "' "; SqlCommand com = new SqlCommand(text); com.Connection = client.sqlConnection; com.CommandType = CommandType.Text; int prebaceno = 0; try { prebaceno = Convert.ToInt32(com.ExecuteScalar()); } catch { } if (prebaceno == 1) { MessageBox.Show("Odabrana inventura ne može se više uređivati jer je zaključena i prebačena na skladište."); return; } using (InventuraForm objekt = new InventuraForm(Enums.FormEditMode.Update)) { if (objekt.ShowDialogForm("Inventura") == DialogResult.OK) { try { BusinessLogic.Inventura.pSelectedIndex = ugdFormPregled.ActiveRow.Index; } catch { } ////db - 4.1.2017 //BusinessLogic.Inventura objekt2 = new BusinessLogic.Inventura(); //ugdFormPregled.DataSource = objekt2.GetMainGridData2(); //ugdFormPregled.DataBind(); //string[] popis = new string[] { "StvarnaKolicina" }; //Utils.Tools.UltraGridStyling(ugdFormPregled, popis); LoadGridData(); } } } _update = true; }
public InventuraFormPregled() { InitializeComponent(); client = new SqlClient(); _inv = new InventuraForm(); _inv.MyEvent += OnSubmit; this.smartPartInfo1 = new SmartPartInfo("Unos inventure - pregled", "Unos inventure - pregled"); this.infoProvider = new SmartPartInfoProvider(); this.infoProvider.Items.Add(this.smartPartInfo1); }
public void Copy(object sender, EventArgs e) { if (ugdFormPregled.ActiveRow != null) { BusinessLogic.Inventura.pID = (int)ugdFormPregled.ActiveRow.Cells["ID"].Value; using (InventuraForm objekt = new InventuraForm(Enums.FormEditMode.Copy)) { if (objekt.ShowDialogForm("Inventura") == DialogResult.OK) { try { BusinessLogic.Inventura.pSelectedIndex = ugdFormPregled.ActiveRow.Index; } catch { } LoadGridData(); } } } }
public void Insert(object sender, EventArgs e) { _insert = true; //if (ugdFormPregled.ActiveRow.ParentRow != null) return; //Ovo sprečava da se odabire s menija (insert, update, delete) ukoliko ne radi o Parent redu u gridu (Band[0]) using (InventuraForm objekt = new InventuraForm(Enums.FormEditMode.Insert)) { if (objekt.ShowDialogForm("Inventura") == DialogResult.OK) { try { BusinessLogic.Inventura.pSelectedIndex = ugdFormPregled.Rows.Count; } catch { } LoadGridData(); } } _insert = false; }