public static IList <TimeSheetType> GenerateListOfTimeSheetType(int minLengthOfEachCatalog = 5, int maxLengthOfEachCatalog = 10) { var results = new List <TimeSheetType>(); var listCatalog = (TimeSheetCatalog[])Enum.GetValues(typeof(TimeSheetCatalog)); if (minLengthOfEachCatalog < 1) { minLengthOfEachCatalog = 5; } if (maxLengthOfEachCatalog < 10) { maxLengthOfEachCatalog = 10; } for (int c = 2; c < listCatalog.Length; c++) { var cat = listCatalog[c]; var catLen = rand.Next(minLengthOfEachCatalog, maxLengthOfEachCatalog); for (int i = 0; i < catLen; i++) { var tsType = new TimeSheetType() { Id = i + 1, Catalog = cat, Code = GetTimeSheetCode(cat), }; results.Add(tsType); } } return(results); }
public TimeSheetRecord(TimeSheetRecord tsRecord) { _fromTime = tsRecord.FromTime; _toTime = tsRecord.ToTime; _timeSheetType = tsRecord.TimeSheetType; _status = tsRecord.Status; }
protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, System.ComponentModel.TypeConverter valueTypeConverter, System.ComponentModel.TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) { Bitmap resultImage = new Bitmap(this.OwningColumn.Width, this.OwningRow.Height); using (Graphics g = Graphics.FromImage(resultImage)) { var rect = new Rectangle(1, 1, resultImage.Width - 3, resultImage.Height - 3); TimeSheetType data = value as TimeSheetType; if (data != null) { Renderer.DrawBoxWithText(g, rect, cellStyle.BackColor, false, data.ToString(), cellStyle.Font, ContentAlignment.MiddleLeft); } } return(resultImage); }
public TimeSheetTypeEditorControl(TimeSheetType tsType) { InitializeComponent(); this.Value = tsType; this.Load += (s, e) => { var catalogDataSource = MethodHelper .EnumToListKeyValuePair <TimeSheetCatalog>() .Filter(kv => ((KeyValuePair <string, TimeSheetCatalog>)kv).Value == this.Value.Catalog); this.catalogComboBox.DataSource = catalogDataSource; this.catalogComboBox.DisplayMember = "Key"; this.catalogComboBox.ValueMember = "Value"; this.timeSheetTypeBindingSource.DataSource = this.Value; }; this.btnUpdate.Click += (s, e) => { OnValueUpdated(); this.Hide(); }; }
public TimeSheetTypeEditorForm(TimeSheetType tsType) { InitializeComponent(); this.Value = tsType; this.Paint += (s, e) => { using (Pen pen = new Pen(Color.Black, 2)) { e.Graphics.DrawRectangle(pen, e.ClipRectangle); } }; this.Load += (s, e) => { var catalogDataSource = MethodHelper .EnumToListKeyValuePair <TimeSheetCatalog>() .Filter(kv => ((KeyValuePair <string, TimeSheetCatalog>)kv).Value == this.Value.Catalog); this.catalogComboBox.DataSource = catalogDataSource; this.catalogComboBox.DisplayMember = "Key"; this.catalogComboBox.ValueMember = "Value"; this.timeSheetTypeBindingSource.DataSource = this.Value; }; this.btnUpdate.Click += (s, e) => { ClosePopup(); _valueChanged = true; this.EditingControlDataGridView.NotifyCurrentCellDirty(true); OnValueUpdated(); }; }