//private void ControlShtoBtn() //{ // if (isArtikulliValid && isSasiaValid) btnShto.Enabled = true; // else btnShto.Enabled = false; //} private bool CheckUnique(FaturHyrje afature) { bool check = true; foreach (DataGridViewRow row in gridFature.Rows) { var artikulli = (FaturHyrje)row.DataBoundItem; if (afature.artikulli.ID == artikulli.artikulli.ID) { check = false; XtraMessageBox.Show("Artikulli eshte ne fature"); break; } } return(check); }
private void btnShto_Click(object sender, EventArgs e) { if (!isArtikulliValid() || !isSasiaValid()) { return; } else { FaturHyrje fature = toFatureHyrje(); if (!CheckUnique(fature)) { return; } faturaHyrje.Add(fature); FillGrid(); Deactivate(); } }