/// <summary> /// Populates a Time Entry Panel with an timesheetrow /// </summary> public void PopulateTimeEntryForm(TimeSheetDS.TimeSheetRow row) { // keep the databinding in a local variable for later _timesheetrow = row; // build the status list based on a proxy call status.DataSource = TEMPOServerProxy.Instance.GetStatusChange(_timesheetrow).Status; status.DisplayMember = "StatusName"; status.ValueMember = "StatusID"; // add the appropriate data binding to the status combo box Binding b = new Binding("SelectedValue", _timesheetrow, "StatusID"); status.DataBindings.Add(b); // populate the fullname fullname.Text = _timesheetrow.EmployeeName; // update the date/time values for the timesheet System.DateTime periodending = _timesheetrow.EndingDate; for (int i = (days.Length - 1); i >= 0; i--) { days[i].Text = " " + periodending.Day.ToString(); periodending = periodending.AddDays(-1); } // create the line items panel and pass in an array of time entry rows _lineItemsPanel = new LineItemsPanel(_timesheetrow); _lineItemsPanel.onTimeSheetTotalChange += new LineItemsPanel.TimeSheetTotalChangedDelegate(updateTotal); this.Controls.Add(_lineItemsPanel); }
/// <summary> /// Send the updated Timesheets to the server /// </summary> private void saveTimeSheet(object sender, EventArgs e) { TimeEntry.EndUpdating(); try { TEMPOServerProxy.Instance.UpdateTimeSheet(_timesheets); } catch { MessageBox.Show(this.getStringResource("18")); return; } //display the success message MessageBox.Show(this.getStringResource("21")); // then reload the timesheet combobox loadSavedTimeSheets(); // hide the time sheet buttons hideTimeSheetButtons(); // make the panel go away for now TimeEntry.Visible = false; // remove the reference to the open timesheet _opents = null; }
public TimeSheetNotesForm(TimeSheetDS.TimeSheetRow tsrow) { InitializeComponent(); _timesheetrow = tsrow; // build up the User Interface this.BackgroundImage = new Bitmap(typeof(TEMPO.Client.MainScreen), "Resources.modalwindow.png"); this.ClientSize = new System.Drawing.Size(374, 254); m_save = new GraphicButton(new Point(282, 208), new Size(59, 15)); m_save.setGraphic(new Bitmap(typeof(TEMPO.Client.MainScreen), "Resources.savebutton.png")); m_save.setOverGraphicState(new Bitmap(typeof(TEMPO.Client.MainScreen), "Resources.savebutton-over.png")); m_save.Click += new System.EventHandler(m_save_Click); this.Controls.Add(m_save); // assign the form icon this.Icon = new Icon(typeof(TEMPO.Client.MainScreen), "Resources.trayicon.ico"); // populate the text box with the info if (_timesheetrow.IsNotesNull()) { m_notes.Text = ""; } else { m_notes.Text = _timesheetrow.Notes; } }
/// <summary> /// Reset the Panel to it original state /// </summary> public void ResetPanel() { // remove the data bindings status.DataBindings.Clear(); // release the timesheet _timesheetrow = null; // clear the line items panel this.Controls.Remove(_lineItemsPanel); }
/// <summary> /// Populate the UI with the timesheet data /// </summary> /// <param name="row"></param> public void PopulateLineItem(TimeSheetDS.TimeSheetRow row) { // store a local pointer to the data _timesheetrow = row; // populate the line item _employee.Text = _timesheetrow.EmployeeName; _status.Text = _timesheetrow.StatusName; _periodending.Text = _timesheetrow.EndingDate.ToShortDateString(); }
public AP_LineItemsPanel(TimeSheetDS.TimeSheetRow row) : base(new Point(8, 36), new Size(758, 192), "LineItemsPanel", true) { // store a local reference to the timesheet data _timesheetrow = row; // setup the UI this.BackColor = System.Drawing.Color.FromArgb(238, 234, 231); // set up the memory for the UI m_lineitems = new AP_LineItemPanel[LINE_ITEM_MAX]; // populate the form PopulateLineItems(); }
/// <summary> /// Open a Timeheet based on the selected index of the combo box /// </summary> private void OpenTimeSheet(object sender, EventArgs e) { if (current_timesheets.SelectedIndex != -1) { // get the TimeSheet Row _opents = _timesheets.TimeSheet.FindByTID((int)(current_timesheets.SelectedValue)); // clear any existing data TimeEntry.ResetPanel(); TimeEntry.PopulateTimeEntryForm(_opents); TimeEntry.Visible = true; // update the total at the bottom of the panel TimeEntry.updateTotal(); // show the buttons showTimeSheetButtons(); } }
/// <summary> /// Event Handler for Remove TimeSheet Button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RemoveTimeSheet(object sender, EventArgs e) { // prompt to make sure DialogResult dr = MessageBox.Show(this.getStringResource("115"), this.getStringResource("114"), MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { // stop updating TimeEntry.EndUpdating(); // mark the timesheet for deletion _opents.Delete(); try { TEMPOServerProxy.Instance.DeleteTimeSheet(_timesheets); } catch { MessageBox.Show(this.getStringResource("117")); return; } //display the success message MessageBox.Show(this.getStringResource("116")); // then reload the timesheet combobox loadSavedTimeSheets(); // hide the time sheet buttons hideTimeSheetButtons(); // make the panel go away for now TimeEntry.Visible = false; // remove the reference to the open timesheet _opents = null; } }