private void btnSave_Click(object sender, EventArgs e) { try { BO.Brand ObjBrand = new BO.Brand(); //ObjBrand.BrandID = Convert.ToInt16(lblMessageBox.Text); ObjBrand.BrandName = txtBrand.Text; ObjBrand.BrandDescription = txtBrndDescription.Text; if (btnSave.Text == "Update" && txtBrand.Text != "") { ObjBrand.BrandID = ID; if (_IBrand.Update(ObjBrand) > 0) { MessageBox.Show("Successfully Update"); Reset(); } else { MessageBox.Show("Update Failed !"); } } else if (txtBrand.Text != "") { if (_IBrand.Insert(ObjBrand) > 0) { MessageBox.Show("Operation Success"); // lblMessageBox.Text = "Operation Success"; // lblMessageBox.ForeColor = System.Drawing.Color.Green; // GetBrand(); Reset(); } else { MessageBox.Show("Operation Failed"); //lblMessageBox.Text = "Operation Failed"; //lblMessageBox.ForeColor = System.Drawing.Color.Red; // lblMessageBox.Font.Bold = true; } } else { MsgBox msgBox = new MsgBox(); msgBox.Show(); // MessageBox.Show("Please Fill Up Required Fill..!"); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 添加数据到数据库 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(BrandInfo model) { return(dal.Insert(model)); }