Пример #1
0
        /// <summary>
        /// Main function of the form - Manages the Adding of a New Change to a selected Project
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonAddChange_Click(object sender, EventArgs e)
        {
            #region Validation
            if (!ValidateChangeInput().Equals("OK"))
            {
                MessageBox.Show(ValidateChangeInput(), "KChange: Incorrect input");
                return;
            }
            #endregion
            #region Adding Change into DB
            Project_Change newChange = new Project_Change();

            newChange.Change_Type = Data.GetChangeTypeByDescription((string)changeTypeComboBox.SelectedValue);
            newChange.Project = myProject;
            newChange.ChangeDescription = changeDescriptionTextBox.Text;
            newChange.Project_File = Data.GetFileByName(myProject, (string)changeFileComboBox.SelectedValue);
            newChange.ChangedBy = changeByTextBox.Text;
            newChange.ChangeDate = DateTime.Now;

            if (Data.InsertChange(newChange))
            {
                MessageBox.Show("Change added!", "KChange: Success");
                ClearControls();
            }
            else
                MessageBox.Show("Change adding failed.", "KChange: Error");
            #endregion
        }
Пример #2
0
 /// <summary>
 /// Attempts to insert a given Project_Change Entity into Project_Changes EntitySet
 /// </summary>
 /// <param name="theChange">The Project_Change Entity to be inserted</param>
 /// <returns>Project_Change entity upon success, null upon failure</returns>
 public bool InsertChange(Project_Change theChange)
 {
     try
     {
         Project_Changes.InsertOnSubmit(theChange);
         SubmitChanges();
         return true;
     }
     catch (Exception ex)
     {
         //TODO: 17.12.2012 Karol, add proper exception handling
         return false;
     }
 }
		private void detach_Project_Changes(Project_Change entity)
		{
			this.SendPropertyChanging();
			entity.Change_Type = null;
		}
 partial void DeleteProject_Change(Project_Change instance);
 partial void UpdateProject_Change(Project_Change instance);
 partial void InsertProject_Change(Project_Change instance);
		private void attach_Project_Changes(Project_Change entity)
		{
			this.SendPropertyChanging();
			entity.Project = this;
		}
		private void detach_Project_Change(Project_Change entity)
		{
			this.SendPropertyChanging();
			entity.Project_File = null;
		}