private void Submit(object sender, EventArgs e) { if (dgvResults.DataSource == null || dgvResults.Rows.Count == 0) { MessageBox.Show("Nothing is currently selected", "Error", MessageBoxButtons.OK); return; } if (FormType == "Custodian") { if (String.IsNullOrEmpty(CustodianId.ToString()) == false && String.IsNullOrEmpty(PlanId.ToString()) == false) { try { ISP.Business.Entities.Relational_Custodians_Plans.Insert(CustodianId, PlanId); this.Close(); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } } else if (FormType == "Plan") { if (String.IsNullOrEmpty(FundId.ToString()) == false && String.IsNullOrEmpty(PlanId.ToString()) == false) { try { ISP.Business.Entities.Relational_Funds_Plans.Insert(FundId, PlanId, frmMain_Parent.CurrentUser.UserId); this.Close(); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } } else if (FormType == "Fund") { if (String.IsNullOrEmpty(FundId.ToString()) == false && String.IsNullOrEmpty(PlanId.ToString()) == false) { try { ISP.Business.Entities.Relational_Funds_Plans.Insert(FundId, PlanId, frmMain_Parent.CurrentUser.UserId); this.Close(); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } } }
private void btnSortUp_Click(object sender, EventArgs e) { if (dgvFunds.Rows.Count == 0) { return; } int index = dgvFunds.CurrentRow.Index; Guid relationalFundsPlansId = new Guid(dgvFunds.Rows[index].Cells[0].Value.ToString()); int oldOrdinal; try { oldOrdinal = Int32.Parse(dgvFunds.Rows[index].Cells[2].Value.ToString()); } catch { oldOrdinal = -1; } if (index == 0 || oldOrdinal <= 0) { dgvFunds.Rows[index].Cells[2].Value = DBNull.Value; try { ISP.Business.Entities.Relational_Funds_Plans.UpdateOrdinal(relationalFundsPlansId, frmMain_Parent.CurrentUser.UserId, null); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } else { int newOrdinal = oldOrdinal - 1; dgvFunds.Rows[index].Cells[2].Value = newOrdinal; try { ISP.Business.Entities.Relational_Funds_Plans.UpdateOrdinal(relationalFundsPlansId, frmMain_Parent.CurrentUser.UserId, newOrdinal); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } SortFundDataGridViewAscending(); SelectRowWithGuid(relationalFundsPlansId); }
private void btnSaveIpsCriteria_Click(object sender, EventArgs e) { try { savePlanDetails(); UnsavedChangesIps = false; MessageBox.Show("IPS Monitoring Criteria successfully saved!", "Success!", MessageBoxButtons.OK); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } }
private void btnSaveFund_Click(object sender, EventArgs e) { try { SaveFundDetails(); MessageBox.Show("Record successfully saved!", "Success!", MessageBoxButtons.OK); UnsavedChangesFund = false; } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } }
private void btnSave_Click(object sender, EventArgs e) { if (btnTimeStart.Text == "Stop") { btnTimeStart.PerformClick(); } if (String.IsNullOrWhiteSpace(txtStartDate.Text)) { MessageBox.Show("Start date field cannot be blank. Please correct and try again.", "Error!", MessageBoxButtons.OK); return; } else if (String.IsNullOrWhiteSpace(txtEndDate.Text)) { MessageBox.Show("End date field cannot be blank. Please correct and try again.", "Error!", MessageBoxButtons.OK); return; } taskTime.Description = txtDescription.Text; taskTime.StartDate = DateTime.Parse(txtStartDate.Text); taskTime.EndDate = DateTime.Parse(txtEndDate.Text); TimeSpan duration = TimeSpan.Parse(txtDuration.Text); taskTime.DurationMinutes = (decimal)duration.TotalMinutes; taskTime.Notes = txtNotes.Text; try { taskTime.SaveToDatabase(); this.Close(); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } }
private void btnDelete_Click(object sender, EventArgs e) { if (cboSelectedReview.SelectedItem is string || cboSelectedReview.SelectedIndex == -1 || ((Utilities.ListItem)cboSelectedReview.SelectedItem).HiddenObject == null) { MessageBox.Show("The selected Probation Analysis Review is not available for deletion.", "Attention", MessageBoxButtons.OK); return; } Business.Entities.ProbationAnalysis probationAnalysis = (Business.Entities.ProbationAnalysis)((Utilities.ListItem)cboSelectedReview.SelectedItem).HiddenObject; DialogResult result; if (probationAnalysis.DatePresented == null) { result = MessageBox.Show("Are you sure you wish to delete the Probation Analysis Review for " + SelectedFund.Ticker + " that has not been presented?", "Attention", MessageBoxButtons.YesNoCancel); } else { result = MessageBox.Show("Are you sure you wish to delete the Probation Analysis Review for " + SelectedFund.Ticker + " presented on " + ((DateTime)probationAnalysis.DatePresented).ToString("MM/dd/yyyy") + "?", "Attention", MessageBoxButtons.YesNoCancel); } if (result == DialogResult.Yes) { try { probationAnalysis.DeleteDatabaseRecord(); MessageBox.Show("Record succesfully deleted!", "Success!", MessageBoxButtons.OK); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } GetAssociatedReviewsFromFundAndPlan(SelectedFund.FundId, SelectedPlan.PlanId); } }
void btnSave_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(comboBox1.Text)) { MessageBox.Show("Please enter a task", "Task Save Error", MessageBoxButtons.OK); } else if (String.IsNullOrEmpty(UserId)) { MessageBox.Show("Please enter an owner of this task", "Task Save Error", MessageBoxButtons.OK); } else if (textBox1.Text.Length > 2 || textBox2.Text.Length > 2 || textBox3.Text.Length > 4) { MessageBox.Show("Please enter a valid date", "Task Save Error", MessageBoxButtons.OK); } else if (textBox4.Text.Length > 2 || textBox5.Text.Length > 2) { MessageBox.Show("Please enter a valid time", "Task Save Error", MessageBoxButtons.OK); } else if (String.IsNullOrEmpty(textBox7.Text) && String.IsNullOrEmpty(textBox8.Text) && String.IsNullOrEmpty(textBox9.Text)) { MessageBox.Show("A new task must be associated with at least one of the following: fund, account, or manager", "Task Save Error", MessageBoxButtons.OK); } else { string task = comboBox1.SelectedIndex.ToString(); string mo = textBox1.Text; string day = textBox2.Text; string yr = textBox3.Text; string hr = textBox4.Text; string mi = textBox5.Text; string am = domainUpDown.Text; string dueOn = mo + "/" + day + "/" + yr + " " + hr + ":" + mi + " " + am; DateTime?DueOn; bool isValidDate = false; if (mo == "mm" || day == "dd" || yr == "yyyy" || hr == "hh" || mi == "mm") { DueOn = null; } else { try { DueOn = DateTime.Parse(dueOn); isValidDate = ValidateTime(dueOn, "MM/dd/yyyy hh:mm tt"); } catch { MessageBox.Show("The Due On field is not in the correct format (MM/dd/yyyy hh:mm tt)", "Error", MessageBoxButtons.OK); return; } } Guid taskTypeId = new Guid(TaskTypeId); Guid?fundId; if (String.IsNullOrEmpty(FundId)) { fundId = null; } else { fundId = new Guid(FundId); } Guid?accountId; if (String.IsNullOrEmpty(AccountId)) { accountId = null; } else { accountId = new Guid(AccountId); } Guid?managerId; if (String.IsNullOrEmpty(ManagerId)) { managerId = null; } else { managerId = new Guid(ManagerId); } Guid userId = new Guid(UserId); string TaskDetail = textBox6.Text; try { ISP.Business.Entities.Task.Insert(taskTypeId, fundId, accountId, managerId, userId, TaskDetail, DueOn, frmMain_Parent.CurrentUser.UserId); MessageBox.Show("Success! The new task has been created!", "Success!", MessageBoxButtons.OK); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } this.Close(); } }
public frmAddExistingItem(frmMain mf, string _FormType, Guid RegardingId1, string RegardingId2, FormClosedEventHandler Close) { Presentation.Forms.frmSplashScreen ss = new Presentation.Forms.frmSplashScreen(); ss.Show(); Application.DoEvents(); InitializeComponent(); frmMain_Parent = mf; Application.AddMessageFilter(this); controlsToMove.Add(this.label1); controlsToMove.Add(this.label23); controlsToMove.Add(this.panel2); controlsToMove.Add(this.panel16); controlsToMove.Add(this.pictureBox1); this.FormClosed += Close; FormType = _FormType; if (FormType == "Custodian") { FormType = "Custodian"; label23.Text = "Add a custodian"; labelRegarding1.Text = "Plan"; label31.Text = "Select a custodian"; try { Business.Entities.Plan plan = new Business.Entities.Plan(RegardingId1); PlanId = plan.PlanId; textBox7.Text = plan.PlanName; } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } else if (FormType == "Plan") { FormType = "Plan"; label23.Text = "Add a plan"; labelRegarding1.Text = "Fund"; label31.Text = "Select a plan"; try { Fund details = new Fund(RegardingId1, null); FundId = details.FundId; textBox7.Text = details.FundName; } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } else if (FormType == "Fund") { FormType = "Fund"; label23.Text = "Add a fund"; labelRegarding1.Text = "Plan"; label31.Text = "Select a fund"; try { Business.Entities.Plan plan = new Business.Entities.Plan(RegardingId1); PlanId = plan.PlanId; textBox7.Text = plan.PlanName; } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } ss.Close(); this.Show(); txtSearch.Select(); }
public frmAdvisor(frmMain frmMain_Parent, Guid advisorId, FormClosedEventHandler Close = null) { frmSplashScreen ss = new frmSplashScreen(); ss.Show(); Application.DoEvents(); InitializeComponent(); mf_parent = frmMain_Parent; LoadManagementRolesCbo(); this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size; this.MouseWheel += new MouseEventHandler(pnlSummary_MouseWheel); Application.AddMessageFilter(this); controlsToMove.Add(this.pnlFormHeader); controlsToMove.Add(this.pnlHeader); controlsToMove.Add(this.lblHeader); FormClosed += Close; tabMain.SelectedIndex = 0; AdvisorId = advisorId; UserId = frmMain_Parent.CurrentUser.UserId; try { UpdateResearchTypeCbo(); LoadManagement(); foreach (DataRow dr in ISP.Business.Entities.Advisors.GetAdvisorDetails(advisorId).Rows) { decimal fixedIncome = -1; decimal equity = -1; decimal other = -1; if (String.IsNullOrEmpty(dr["AssetsFixedIncome"].ToString()) == false) { Decimal.TryParse(dr["AssetsFixedIncome"].ToString(), out fixedIncome); } if (String.IsNullOrEmpty(dr["AssetsEquity"].ToString()) == false) { Decimal.TryParse(dr["AssetsEquity"].ToString(), out equity); } if (String.IsNullOrEmpty(dr["AssetsOther"].ToString()) == false) { Decimal.TryParse(dr["AssetsOther"].ToString(), out other); } lblHeader.Text = dr["Name"].ToString(); txtName.Text = dr["Name"].ToString(); Text = dr["Name"].ToString(); label1.Text = "Investment Services Program - " + dr["Name"].ToString(); txtFounded.Text = dr["CompanyFounded"].ToString(); txtPhilosophies.Text = dr["InvestmentPhilosophy"].ToString(); txtConflicts.Text = dr["InterestConflicts"].ToString(); txtRights.Text = dr["ShareHolderRights"].ToString(); txtCompensation.Text = dr["CompensationStructure"].ToString(); cboProfessional.Text = dr["IsCultureProfessional"].ToString(); cboTransparent.Text = dr["IsCultureTransparent"].ToString(); cboMoral.Text = dr["IsCultureMoralStandardsHigh"].ToString(); cboProprietary.Text = dr["IsResearchProprietary"].ToString(); cboQuantitative.Text = dr["IsResearchQuantitative"].ToString(); cboFundamental.Text = dr["IsResearchFundamental"].ToString(); cboResearchType.Text = dr["ResearchTypeIdName"].ToString(); txtSize.Text = dr["StaffSize"].ToString(); txtCredential.Text = dr["StaffCredentials"].ToString(); txtExperience.Text = dr["StaffExperience"].ToString(); txtAnalystRatio.Text = dr["AnalystRatio"].ToString(); if (fixedIncome != -1) { txtFixed.Text = fixedIncome.ToString("C"); } if (equity != -1) { txtEquity.Text = equity.ToString("C"); } if (other != -1) { txtOther.Text = other.ToString("C"); } } } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } dgvFunds.DataSource = ISP.Business.Entities.Fund.GetAssociatedFromAdvisor(advisorId); dgvFunds.Columns[0].Visible = false; dgvMgrs.DataSource = ISP.Business.Entities.Manager.GetAssociatedFromAdvisor(advisorId); dgvMgrs.Columns[0].Visible = false; this.Show(); ss.Close(); }
private void btnSave_Click(object sender, EventArgs e) { Business.Entities.ProbationAnalysis probationAnalysis; if (cboSelectedReview.SelectedItem is string || cboSelectedReview.SelectedIndex == -1 || ((Utilities.ListItem)cboSelectedReview.SelectedItem).HiddenObject == null) { probationAnalysis = new Business.Entities.ProbationAnalysis(); try { if (String.IsNullOrWhiteSpace(txtDateApproved.Text)) { probationAnalysis.DateApproved = null; } else { probationAnalysis.DateApproved = DateTime.Parse(txtDateApproved.Text); } } catch { MessageBox.Show("Error: The date approved field is not in a propper date format. Please correct and try again.", "Error!", MessageBoxButtons.OK); return; } try { if (String.IsNullOrWhiteSpace(txtDatePresented.Text)) { probationAnalysis.DatePresented = null; } else { probationAnalysis.DatePresented = DateTime.Parse(txtDatePresented.Text); } } catch { MessageBox.Show("Error: The date presented field is not in a propper date format. Please correct and try again.", "Error!", MessageBoxButtons.OK); return; } probationAnalysis.FundId = SelectedFund.FundId; probationAnalysis.PlanId = SelectedPlan.PlanId; if (cboSelectedQuarter.SelectedIndex <= 0) { probationAnalysis.TimeTableId = null; } else { probationAnalysis.TimeTableId = ((Business.Entities.TimeTable)((Utilities.ListItem)cboSelectedQuarter.SelectedItem).HiddenObject).TimeTableId; } probationAnalysis.ProbationRecognition = txtRecognition.Text; probationAnalysis.Hypothesis = txtHypothesis.Text; probationAnalysis.HypothesisSupportandAnalysis = txtHypothesisSupport.Text; probationAnalysis.TemporaryVsPermanent = txtTemporaryPermanent.Text; probationAnalysis.SpecialConsiderations = txtConsiderations.Text; probationAnalysis.Recommendations = txtRecommendation.Text; if (cboRecommendedWord.SelectedIndex <= 0) { probationAnalysis.RecommendedWordId = null; probationAnalysis.RecommendedWordIdName = null; } else { probationAnalysis.RecommendedWordId = new Guid(((Utilities.ListItem)cboRecommendedWord.SelectedItem).HiddenValue); probationAnalysis.RecommendedWordIdName = ((Utilities.ListItem)cboRecommendedWord.SelectedItem).ToString(); } try { probationAnalysis.InsertDatabaseRecord(frmMain_Parent.CurrentUser.UserId); btnNewProbationAnalysis.Text = "New"; MessageBox.Show("Record succesfully saved!", "Success!", MessageBoxButtons.OK); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } else { probationAnalysis = (Business.Entities.ProbationAnalysis)((Utilities.ListItem)cboSelectedReview.SelectedItem).HiddenObject; try { if (String.IsNullOrWhiteSpace(txtDateApproved.Text)) { probationAnalysis.DateApproved = null; } else { probationAnalysis.DateApproved = DateTime.Parse(txtDateApproved.Text); } } catch { MessageBox.Show("Error: The date approved field is not in a propper date format. Please correct and try again.", "Error!", MessageBoxButtons.OK); return; } try { if (String.IsNullOrWhiteSpace(txtDatePresented.Text)) { probationAnalysis.DatePresented = null; } else { probationAnalysis.DatePresented = DateTime.Parse(txtDatePresented.Text); } } catch { MessageBox.Show("Error: The date presented field is not in a propper date format. Please correct and try again.", "Error!", MessageBoxButtons.OK); return; } probationAnalysis.FundId = SelectedFund.FundId; probationAnalysis.PlanId = SelectedPlan.PlanId; if (cboSelectedQuarter.SelectedIndex <= 0) { probationAnalysis.TimeTableId = null; } else { probationAnalysis.TimeTableId = ((Business.Entities.TimeTable)((Utilities.ListItem)cboSelectedQuarter.SelectedItem).HiddenObject).TimeTableId; } probationAnalysis.ProbationRecognition = txtRecognition.Text; probationAnalysis.Hypothesis = txtHypothesis.Text; probationAnalysis.HypothesisSupportandAnalysis = txtHypothesisSupport.Text; probationAnalysis.TemporaryVsPermanent = txtTemporaryPermanent.Text; probationAnalysis.SpecialConsiderations = txtConsiderations.Text; probationAnalysis.Recommendations = txtRecommendation.Text; if (cboRecommendedWord.SelectedIndex <= 0) { probationAnalysis.RecommendedWordId = null; probationAnalysis.RecommendedWordIdName = null; } else { probationAnalysis.RecommendedWordId = new Guid(((Utilities.ListItem)cboRecommendedWord.SelectedItem).HiddenValue); probationAnalysis.RecommendedWordIdName = ((Utilities.ListItem)cboRecommendedWord.SelectedItem).ToString(); } if (cboOwner.SelectedIndex <= 0) { probationAnalysis.OwnerId = null; } else { probationAnalysis.OwnerId = ((User)((Utilities.ListItem)cboOwner.SelectedItem).HiddenObject).UserId; } try { probationAnalysis.UpdateDatabaseRecord(frmMain_Parent.CurrentUser.UserId); MessageBox.Show("Record succesfully saved!", "Success!", MessageBoxButtons.OK); } catch (Exception ex) { frmError _frmError = new Presentation.Forms.frmError(frmMain_Parent, ex); } } GetAssociatedReviewsFromFundAndPlan(SelectedFund.FundId, SelectedPlan.PlanId); SelectCboSelectedReviewItem(probationAnalysis); UnsavedChanges = false; }