private void LoadScreenToObject() { CBCustomer c = new CBCustomer(); CBEmployee e = new CBEmployee(); CBRateSchedule rs = new CBRateSchedule(); moProj.Number = txtNumber.Text; moProj.Description = txtDescription.Text; moProj.CustomerProjNumber = txtCustomerNumber.Text; Func <ComboBox, int?> getId = (box) => { var selected = ((RSLib.COListItem)box.SelectedItem); return((selected != null) ? selected.ID : (int?)null); }; moProj.CustomerID = getId(cboCustomer) ?? moProj.CustomerID; moProj.LocationID = getId(cboLocation) ?? moProj.LocationID; moProj.ProjMngrID = getId(cboManager) ?? moProj.ProjMngrID; moProj.LeadProjMngrID = getId(cboManagerLead) ?? moProj.LeadProjMngrID; moProj.RelationshipMngrID = getId(cboRelationship) ?? moProj.RelationshipMngrID; moProj.RateSchedID = getId(cboRateSched) ?? moProj.RateSchedID; moProj.Multiplier = RevSol.RSMath.IsDecimalEx(txtMultiplier.Text); moProj.Overlay = RevSol.RSMath.IsDecimalEx(txtOverlay.Text); moProj.POAmount = txtPOAmount.Text; moProj.DateStart = dtpStart.Value; moProj.DateEnd = dtpEnd.Value; moProj.IsProposal = chkActiveProposal.Checked; moProj.IsBooked = chkIsBooked.Checked; moProj.IsActive = chkIsActive.Checked; moProj.IsGovernment = chkIsGovernment.Checked; moProj.IsMaster = chkIsMaster.Checked; if (cboMasterJobs.SelectedItem == null) { moProj.MasterID = 0; } else { moProj.MasterID = ((RSLib.COListItem)cboMasterJobs.SelectedItem).ID; } moProj.ReportingStatus = cboReportStatus.SelectedIndex; moProj.Notes = rtbNotes.Text; moProj.IsFixedRate = chkIsFixedRate.Checked; }
private void LoadRateSchedBox() { SqlDataReader dr; RSLib.COListItem li; dr = CBRateSchedule.GetList(); cboRateSched.Items.Clear(); while (dr.Read()) { li = new RSLib.COListItem(); li.ID = Convert.ToInt32(dr["ID"]); li.Description = dr["Name"].ToString(); cboRateSched.Items.Add(li); } dr.Close(); }
private void LoadObjectToScreen() { CBCustomer c = new CBCustomer(); CBLocation l = new CBLocation(); CBEmployee e = new CBEmployee(); CBRateSchedule rs = new CBRateSchedule(); txtNumber.Text = moProj.Number; txtDescription.Text = moProj.Description; c.Load(moProj.CustomerID); cboCustomer.Text = c.Name; txtCustomerNumber.Text = moProj.CustomerProjNumber; LoadLocationBox(moProj.CustomerID); l.Load(moProj.LocationID); cboLocation.Text = l.FullName; e.Load(moProj.ProjMngrID); cboManager.Text = e.Name; e.Load(moProj.LeadProjMngrID); cboManagerLead.Text = e.Name; e.Load(moProj.RelationshipMngrID); cboRelationship.Text = e.Name; rs.Load(moProj.RateSchedID); cboRateSched.Text = rs.Name; if (rs.IsMultiplier == true) { lblMultiplier.Visible = true; txtMultiplier.Visible = true; txtMultiplier.Text = moProj.Multiplier.ToString("#,##0.00"); lblOverlay.Visible = true; txtOverlay.Visible = true; txtOverlay.Text = moProj.Overlay.ToString("#,##0.00"); } else { lblMultiplier.Visible = false; txtMultiplier.Visible = false; txtMultiplier.Text = "0.00"; lblOverlay.Visible = false; txtOverlay.Visible = false; txtOverlay.Text = "0.00"; } txtPOAmount.Text = moProj.POAmount; dtpStart.Value = moProj.DateStart; dtpEnd.Value = moProj.DateEnd; chkActiveProposal.Checked = moProj.IsProposal; chkIsBooked.Checked = moProj.IsBooked; chkIsActive.Checked = moProj.IsActive; chkIsGovernment.Checked = moProj.IsGovernment; chkIsMaster.Checked = moProj.IsMaster; chkIsFixedRate.Checked = moProj.IsFixedRate; if (moProj.MasterID > 0) { cboMasterJobs.Text = CBProject.GetNumberByID(moProj.MasterID); } cboReportStatus.SelectedIndex = moProj.ReportingStatus; rtbNotes.Text = moProj.Notes; mdsBudget = CBProjectBudget.GetListDSByProjID(moProj.ID); tdbgBudget.SetDataBinding(mdsBudget, "Table", true); TotalBudget(); RSLib.COSecurity sec = new RSLib.COSecurity(); CBUser u = new CBUser(); sec.InitAppSettings(); u.Load(sec.UserID); if (u.IsAdministrator == true || u.IsEngineerAdmin == true) { chkActiveProposal.Enabled = true; chkIsActive.Enabled = true; chkIsBooked.Enabled = true; } }