/// <summary> /// init_data( data_report_portion_history value ) /// </summary> /// <param name="dp">data for show in the panel</param> private void init_data(data_report_portion_history dp) { this.clear( ); this._lbl_basin.Text = dp.basin; this._lbl_regime.Text = dp.regime; this._lbl_WBR.Text = dp.WBR; this._lbl_region.Text = dp.region; this._lbl_portion.Text = dp.portion.ToString( ); if (dp.date_open.Length != 0) { this._lbl_date_open.Text = helper.date_from_string(dp.date_open).ToShortDateString( ); } if (dp.date_close.Length != 0) { this._lbl_date_close.Text = helper.date_from_string(dp.date_close).ToShortDateString( ); } this._lbl_report_number.Text = dp.report_number; if (dp.report_date.Length != 0) { this._lbl_report_date.Text = helper.date_from_string(dp.report_date).ToShortDateString( ); } this._lbl_declarant.Text = dp.declarant; this._lbl_INN.Text = dp.INN; this._lbl_contract_number.Text = dp.contract_number; if (dp.contract_date.Length != 0) { this._lbl_contract_date.Text = helper.date_from_string(dp.contract_date).ToShortDateString( ); } }
private void append_item(data_report_portion_history data, Color item_color) { //id_portion не выводится в список результатов, //поэтому: (количество полей - 1) // (порядковый номер поля - 1) string[] sub_items = new string[data.record_fields_count - 1]; sub_items[(int)n_field.basin - 1] = data.basin; sub_items[(int)n_field.regime - 1] = data.regime; sub_items[(int)n_field.WBR - 1] = data.WBR; sub_items[(int)n_field.region - 1] = data.region; sub_items[(int)n_field.portion - 1] = data.portion.ToString( ); sub_items[(int)n_field.date_open - 1] = data.date_open; sub_items[(int)n_field.date_close - 1] = data.date_close; sub_items[(int)n_field.report_number - 1] = data.report_number; sub_items[(int)n_field.report_date - 1] = data.report_date; sub_items[(int)n_field.declarant - 1] = data.declarant; sub_items[(int)n_field.INN - 1] = data.INN; sub_items[(int)n_field.contract_number - 1] = data.contract_number; sub_items[(int)n_field.contract_date - 1] = data.contract_date; ListViewItem item = new ListViewItem(sub_items); item.Tag = data; item.BackColor = item_color; this.Items.Add(item); // включение элемента списка в группу this.item_group(item); }
public int Compare(object x, object y) { ListViewItem lvi_x = x as ListViewItem; ListViewItem lvi_y = y as ListViewItem; if (lvi_x.Tag == null || lvi_y.Tag == null) { return(0); } data_report_portion_history s_x = lvi_x.Tag as data_report_portion_history; data_report_portion_history s_y = lvi_y.Tag as data_report_portion_history; int result = s_x.CompareTo(s_y); return(this._sort_order == SortOrder.Ascending ? result : -result); }