private void Btm_MaterialEdit_Click(object sender, EventArgs e) { StoreCode.Material maSearchLoc = new StoreCode.Material(); maSearchLoc.intID = this.seSections[this.cbCategories.SelectedIndex].intID; maSearchLoc.strStore = this.seSections[this.cbCategories.SelectedIndex].strStore; maSearchLoc.strSection = this.seSections[this.cbCategories.SelectedIndex].strCode; Materials maMaterials = new Materials(); maMaterials.cnConnection = this.cnConnection; maMaterials.Owner = this; maMaterials.maSearch = maSearchLoc; maMaterials.ShowDialog(); }
private void BtmOK_Click(object sender, EventArgs e) { for (int i = 0; i < this.dsMaterials.Tables["tabStuffMaterials"].Rows.Count; i++) { if (this.dsMaterials.Tables["tabStuffMaterials"].Rows[i].RowState == DataRowState.Deleted) { StoreCode.MaterialDelete(this.cnConnection, (int)this.dsMaterials.Tables["tabStuffMaterials"].Rows[i]["intID", DataRowVersion.Original]); } if (this.dsMaterials.Tables["tabStuffMaterials"].Rows[i].RowState == DataRowState.Added) { StoreCode.Material maMaterial = new StoreCode.Material(); maMaterial.strStore = this.maSearch.strStore; maMaterial.strSection = this.maSearch.strSection; maMaterial.strName = this.dsMaterials.Tables["tabStuffMaterials"].Rows[i]["nvcName"].ToString(); StoreCode.MaterialInsert(this.cnConnection, maMaterial); } if (this.dsMaterials.Tables["tabStuffMaterials"].Rows[i].RowState == DataRowState.Modified) { StoreCode.Material maMaterial = new StoreCode.Material(); maMaterial.intID = (int)this.dsMaterials.Tables["tabStuffMaterials"].Rows[i]["intID"]; maMaterial.strName = this.dsMaterials.Tables["tabStuffMaterials"].Rows[i]["nvcName"].ToString(); StoreCode.MaterialUpdate(this.cnConnection, maMaterial); } } //if (this.Owner is StuffUpdate) //{ // StuffUpdate frmStuffUpdate = (StuffUpdate)this.Owner; // frmStuffUpdate.FillMaterials(); //} //if (this.Owner is StuffInsert) //{ // StuffInsert frmStuffInsert = (StuffInsert)this.Owner; // frmStuffInsert.FillMaterials(); //} this.Close(); }