Beispiel #1
0
        private void LoadData()
        {
            PersonnelBindingSource.DataSource    = PersonnelManagement.GetA(PersonnelNo);
            EducationObjBindingSource.DataSource = StaticClass.ListEducation(PersonnelNo);
            EligibilityBindingSource.DataSource  = EligibilityManagement.GetAll(PersonnelNo);
            ExperiencyBindingSource.DataSource   = ExperienceManagement.GetAll(PersonnelNo);
            VoluntaryBindingSource.DataSource    = VoluntaryManagement.GetAll(PersonnelNo);
            TrainingBindingSource.DataSource     = TrainingManagement.GetAll(PersonnelNo);
            SpousBindingSource.DataSource        = SpouseManagement.GetA(PersonnelNo);
            SkillBindingSource.DataSource        = SkillManagement.GetAll(PersonnelNo);
            OrganizationBindingSource.DataSource = OrganizationManagement.GetAll(PersonnelNo);
            DistinctionBindingSource.DataSource  = DistinctionManagement.GetAll(PersonnelNo);
            QuestionBindingSource.DataSource     = QuestionManagement.GetAll(PersonnelNo);
            ReferenceBindingSource.DataSource    = ReferencesManagement.GetAll(PersonnelNo);
            DetailBindingSource.DataSource       = Details.GetAll(PersonnelNo);

            if (SpousBindingSource?.Current == null)
            {
                return;
            }
            ChildrenObjBindingSource.DataSource = StaticClass.ListChildren(((Spous)SpousBindingSource.Current).SpouseNo);

            reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
            reportViewer1.ZoomMode    = ZoomMode.Percent;
            reportViewer1.ZoomPercent = 100;

            this.reportViewer1.RefreshReport();
        }
Beispiel #2
0
 private void organizationDataGridView_RowLeave(object sender, DataGridViewCellEventArgs e)
 {
     if (organizationBindingSource == null)
     {
         return;
     }
     if (organizationDataGridView.Rows.Count <= 1)
     {
         return;
     }
     if (!organizationDataGridView.IsCurrentRowDirty)
     {
         return;
     }
     Validate();
     ((Organization)organizationBindingSource.Current).PersonnelNo = Personnel.PersonnelNo;
     organizationBindingSource.EndEdit();
     var iResult = OrganizationManagement.Save((Organization)organizationBindingSource.Current);
 }
Beispiel #3
0
        private void DeleteOrganization()
        {
            var dResult = MessageBox.Show(@"Delete Organization current record?", @"Delete", MessageBoxButtons.YesNo,
                                          MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (dResult == DialogResult.Yes)
            {
                if (OrganizationManagement.Delete(((Organization)organizationBindingSource.Current).OrganizationNo))
                {
                    MessageBox.Show(@"Record was deleted successfully.", @"Delete", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    organizationBindingSource.RemoveCurrent();
                }
                else
                {
                    MessageBox.Show(@"Error on delete operation.", @"Delete", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    organizationDataGridView.Focus();
                }
            }
        }
Beispiel #4
0
        private void LoadInitPersonnelRelatedRecord()
        {
            Cursor.Current = Cursors.WaitCursor;
            var pNo = ((Personnel)personnelBindingSource.Current).PersonnelNo;

            if (pNo > 0)
            {
                eligibilityBindingSource.DataSource  = EligibilityManagement.GetAll(pNo);
                experiencyBindingSource.DataSource   = ExperienceManagement.GetAll(pNo);
                voluntaryBindingSource.DataSource    = VoluntaryManagement.GetAll(pNo);
                trainingBindingSource.DataSource     = TrainingManagement.GetAll(pNo);
                educationObjBindingSource.DataSource = StaticClass.ListEducation(pNo);
                spousBindingSource.DataSource        = SpouseManagement.GetAll(pNo);
                skillBindingSource.DataSource        = SkillManagement.GetAll(pNo);
                organizationBindingSource.DataSource = OrganizationManagement.GetAll(pNo);
                distinctionBindingSource.DataSource  = DistinctionManagement.GetAll(pNo);
                questionBindingSource.DataSource     = QuestionManagement.GetAll(pNo);
                referenceBindingSource.DataSource    = ReferencesManagement.GetAll(pNo);
                detailBindingSource.DataSource       = Details.GetAll(pNo);
            }
            Cursor.Current = Cursors.Default;
        }
Beispiel #5
0
 public FunctionDataProvider(OrganizationManagement orgManager)
 {
     this._orgManager = orgManager;
 }
 protected void btnAddInstitution_Click(object sender, EventArgs e)
 {
     string Name = txtName.Text;
     string Email = txtEmail.Text;
     string Password = txtPassword.Text;
     if (Name != "" && Email != "" && Password != "")
     {
         if ((from org in dc.Organizations where org.Name == Name select org).Count() == 0)
         {
             if ((from usr in dc.aspnet_Users where usr.UserName == Email select usr).Count() == 0)
             {
                 try
                 {
                     // add organization
                     Organization org = new Organization();
                     org.Name = Name;
                     org.Description = txtDesc.Text;
                     dc.Organizations.InsertOnSubmit(org);
                     dc.SubmitChanges();
                     // add user
                     MembershipUser newUser = Membership.CreateUser(Email, Password, Email);
                     Roles.AddUserToRole(newUser.UserName, "institute administrator");
                     // get organization ID and user ID
                     long orgID = (from org1 in dc.Organizations where org1.Name == Name select org1).Single().OrganizationID;
                     Guid userID = (from usr in dc.aspnet_Users where usr.UserName == Email select usr).Single().UserId;
                     // create relationship
                     OrganizationManagement relationship = new OrganizationManagement();
                     relationship.OrganizationID = orgID;
                     relationship.UserID = userID;
                     dc.OrganizationManagements.InsertOnSubmit(relationship);
                     dc.SubmitChanges();
                     lbStatus.Text = "Institution successfully added";
                     txtName.Text = txtDesc.Text = txtEmail.Text = "";
                     List<Organization> list = (from org0 in dc.Organizations select org0).ToList<Organization>();
                     rptInstitution.DataSource = list;
                     rptInstitution.DataBind();
                 }
                 catch (Exception ex)
                 {
                     Organization org = (from org2 in dc.Organizations where org2.Name == Name select org2).SingleOrDefault();
                     aspnet_User user = (from usr1 in dc.aspnet_Users where usr1.UserName == Email select usr1).SingleOrDefault();
                     OrganizationManagement relationship = null;
                     if (org != null && user != null)
                     {
                         relationship = (from rel in dc.OrganizationManagements where rel.UserID == user.UserId && rel.OrganizationID == org.OrganizationID select rel).SingleOrDefault();
                     }
                     if (org != null)
                     {
                         dc.Organizations.DeleteOnSubmit(org);
                     }
                     if (user != null)
                     {
                         Membership.DeleteUser(Email, true);
                     }
                     if (relationship != null)
                     {
                         dc.OrganizationManagements.DeleteOnSubmit(relationship);
                     }
                     dc.SubmitChanges();
                     lbStatus.Text = "Institution not added, an error has occurred";
                 }
             }
             else
             {
                 lbStatus.Text = "A user with the same Email exists already";
             }
         }
         else
         {
             lbStatus.Text = "An institution with the same name exists already";
         }
     }
     else
     {
         lbStatus.Text = "Please complete the form";
     }
 }
Beispiel #7
0
 public DepartmentDataProvider(OrganizationManagement orgManager)
 {
     this._orgManager = orgManager;
 }
 partial void DeleteOrganizationManagement(OrganizationManagement instance);
 partial void UpdateOrganizationManagement(OrganizationManagement instance);
 partial void InsertOrganizationManagement(OrganizationManagement instance);
	private void detach_OrganizationManagements(OrganizationManagement entity)
	{
		this.SendPropertyChanging();
		entity.Organization = null;
	}
Beispiel #12
0
 public GroupDataProvider(OrganizationManagement orgManager)
 {
     this._orgManager = orgManager;
 }