protected void btnAddIndustry_Click(object sender, EventArgs e) { if (txtAddIndustry.Text == "") { lblAddIndustryError.Text = "Required"; } else { using (GESEntities db = new GESEntities()) { try { Industry newIndustry = new Industry(); newIndustry.IndustryName = txtAddIndustry.Text.ToString(); newIndustry.IndustryDescription = txtAddIndustry.Text.ToString(); newIndustry.Status = "Active"; db.Industries.AddObject(newIndustry); db.SaveChanges(); txtAddIndustry.Text = ""; lblAddIndustry.Text = "Added succesfully"; lblAddIndustryError.Text = ""; refreshIndustryEDS(); } catch (Exception exp) { throw new Exception("ERROR: Unable to Add entry - " + exp.Message.ToString(), exp); } } } }
/// <summary> /// Create a new Industry object. /// </summary> /// <param name="industryID">Initial value of the IndustryID property.</param> /// <param name="industryName">Initial value of the IndustryName property.</param> /// <param name="status">Initial value of the Status property.</param> public static Industry CreateIndustry(global::System.Int32 industryID, global::System.String industryName, global::System.String status) { Industry industry = new Industry(); industry.IndustryID = industryID; industry.IndustryName = industryName; industry.Status = status; return industry; }
/// <summary> /// Deprecated Method for adding a new object to the Industries EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToIndustries(Industry industry) { base.AddObject("Industries", industry); }