private void btnSave_MouseClick(object sender, MouseEventArgs e) { try { if (txttableNumber.Text.Trim() != "" && txttableCapacity.Text.Trim() != "") { int TempId = 0; try { Int32.TryParse(tableIdforUpdate.ToString(), out TempId); } catch (Exception) { } if (objTblServicel.IsTableNameExist(txttableNumber.Text.Trim(), TempId).Count < 1) { if (btnSavelbl.Text == "Add") { R_Tables obj = new R_Tables(); obj.Name = txttableNumber.Text.Trim(); obj.capacity = Convert.ToInt32(txttableCapacity.Text); obj.filled = 0; obj.id = 0; obj.status = chbxTableStatus.Checked ? true : false; if (objTblServicel.Save_R_tables(obj)) { MessageBox.Show("Table Added Seccessfully."); LoadAllTables(); } else { MessageBox.Show("Table Insertion Filed"); } } else if (btnSavelbl.Text == "Update") { R_Tables obj = new R_Tables(); obj.Name = txttableNumber.Text.Trim(); obj.capacity = Convert.ToInt32(txttableCapacity.Text); obj.id = tableIdforUpdate; obj.status = chbxTableStatus.Checked ? true : false; if (objTblServicel.Save_R_tables(obj)) { MessageBox.Show("Updated Seccessfully."); LoadAllTables(); ClearAll(); } else { MessageBox.Show("Table Insertion Filed"); } } else { MessageBox.Show("No Action Found", "Action Discart."); } } else { MessageBox.Show("Table already Exist!"); } } else { MessageBox.Show("Incomplete Form", "Please Fill Complete Form.!"); } } catch (Exception exp) { MessageBox.Show(exp.Message, "Error Message"); } }
public bool Save_R_tables(R_Tables model) { return(Objr_TableProvider.Save_R_tables(model)); }