The most important is the sort, category
1. Analyze the data and get the attributes to access the database
Minimizing access to the database (consolidating vehicle duplication into a single piece of information) gets the vehicle's license plate number and GPS. Used: dictionary<string, string> cl_id = new dictionary<string, string> ();
cl_id. containskey,cl_id. Containsvalue getting key values
2, determine whether the vehicle within the specified range of the remaining results sorted at the same time
Loop through the raw data, put the required storage down, (at the same time by vehicle sort) The list collection's sort () method, where the parameters to write their own, Showvehicle.sort (Cl_idcompare)
private static int Cl_idcompare (Model.DbHelper.V_QianFeng A, Model.DbHelper.V_QianFeng B)
{
Return A.cl_id.compareto (b.cl_id);//the license plate as a comparative rule
}
3. Store the same car as a collection. Determine if a duplicate vehicle is included (that is, all information is the same) using the equal of the list collection, overriding the equal method, and customizing the comparison rule
public override bool Equals (object obj)
{
if (obj==null)
{
return false;
}
V_qianfeng tmp = NULL;
TMP = (V_qianfeng) obj;
return this. qf_id. Equals (TMP. QF_ID);
}
4, judge a car's seal status (according to the time of the order, take the last state of each lock) Note: custom comparison rules.
5, the electronic lock added to the ArrayList, according to the electronic lock number to determine whether to add duplicate information (l_temp)
6. Iterate through the l_temp to judge the status of "Application" and "completion status", and modify the corresponding property values.
7. Finally bind the GridView data
GridView Displays the color of the specific row data
protected void Grid_vehicle_htmlrowprepared (object sender, Aspxgridviewtableroweventargs e)
{
if (e.rowtype! = DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;
string s = (string) e.getvalue ("Qqzt_name");
if (s.trim () = = "Not all closed")
{
E.row.backcolor = color.red;
}
Else
{
E.row.backcolor = Color.green;
}
}
Get: Char,varchar,nvarchar
Char is fixed-length , that is, when you enter a character less than the number you specify, char (8), the character you enter is less than 8 o'clock, it will be followed by the empty value . When you enter a character that is larger than the specified number, it intercepts the characters that are out of the bounds .
nvarchar (n)
A variable-length Unicode character data that contains n characters. The value of n must be between 1 and 4,000. Byte storage size is twice times the number of characters entered
varchar[(N)]
Variable-length, non-Unicode character data with a length of n bytes. n must be a numeric value between 1 and 8,000. Storage size is the actual length of bytes of input data, not n bytes
CHAR storing fixed-length data is convenient, CHAR the index on the field is high-efficiency
in general, if you include Chinese characters, use the Nchar/nvarchar , if pure English and numbers, with Char/varchar
List collection sort using sort, but to customize the comparison rule
ArrayList and Array Conversions
Example 1:
ArrayList List = new ArrayList ();
List.add (1);
List.add (2);
List.add (3);
Int32[] values = (int32[]) List.toarray (typeof (Int32));
Example 2:
ArrayList List = new ArrayList ();
List.add (1);
List.add (2);
List.add (3);
Int32[] values = new Int32[list.count];
List.copyto (values);
Judging multi-condition Personal summary