/// <summary> /// Deprecated Method for adding a new object to the MachineTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMachineTypes(MachineType machineType) { base.AddObject("MachineTypes", machineType); }
protected void btnAddMachType_Click(object sender, EventArgs e) { if (txtAddMachType.Text == "") { lblAddMachTypeError.Text = "Required"; } else { using (GESEntities db = new GESEntities()) { try { MachineType newMachineType = new MachineType(); newMachineType.MachineTypeName = txtAddMachType.Text.ToString(); newMachineType.MachineTypeDescription = txtAddMachType.Text.ToString(); newMachineType.Status = "Active"; db.MachineTypes.AddObject(newMachineType); db.SaveChanges(); txtAddMachType.Text = ""; lblAddMach.Text = "Added succesfully"; lblAddMachTypeError.Text = ""; refreshMachineTypeEDS(); } catch (Exception exp) { throw new Exception("ERROR: Unable to Add entry - " + exp.Message.ToString(), exp); } } } }
/// <summary> /// Create a new MachineType object. /// </summary> /// <param name="machineTypeID">Initial value of the MachineTypeID property.</param> /// <param name="machineTypeName">Initial value of the MachineTypeName property.</param> /// <param name="status">Initial value of the Status property.</param> public static MachineType CreateMachineType(global::System.Int32 machineTypeID, global::System.String machineTypeName, global::System.String status) { MachineType machineType = new MachineType(); machineType.MachineTypeID = machineTypeID; machineType.MachineTypeName = machineTypeName; machineType.Status = status; return machineType; }