本文整理汇总了C#中System.Data.PropertyCollection.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyCollection.ContainsKey方法的具体用法?C# PropertyCollection.ContainsKey怎么用?C# PropertyCollection.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.PropertyCollection
的用法示例。
在下文中一共展示了PropertyCollection.ContainsKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadDayBills
private double LoadDayBills(DateTime selectedDay)
{
Dictionary<string, object> items = DataWorkBill.LoadDayBills(selectedDay, ConfigManager.Instance.CommonConfiguration.Path_Bills, ConfigManager.Instance.CommonConfiguration.APP_SubUnit);
DataTable currentBill = new DataTable();
PropertyCollection props = new PropertyCollection();
Dictionary<string, object> billInfo = new Dictionary<string, object>();
double generalSuma = 0.0;
try
{
foreach (KeyValuePair<string, object> billEntry in items)
{
currentBill = (DataTable)((object[])billEntry.Value)[0];
props = (PropertyCollection)((object[])billEntry.Value)[1];
billInfo = ((Dictionary<string, object>)props[CoreConst.BILL]);
this.billFileList.Add(billInfo[CoreConst.OID].ToString(), billEntry.Key);
listGrid.Rows.Add(
new object[] {
billInfo[CoreConst.OID],
billInfo[CoreConst.BILL_NO],
billInfo[CoreConst.DATETIME],
(billInfo[CoreConst.COMMENT] != null)?billInfo[CoreConst.COMMENT].ToString().Replace("%20", " "):"",
(double)props[CoreConst.ORDER_REAL_SUMA],
bool.Parse(billInfo[CoreConst.IS_LOCKED].ToString()),
props[CoreConst.ORDER_NO],
(billInfo.ContainsKey(CoreConst.DATETIME_LOCK)?billInfo[CoreConst.DATETIME_LOCK]:"-")
}
);
generalSuma += (double)props[CoreConst.ORDER_REAL_SUMA];
if (props.ContainsKey(CoreConst.ORDER_NO) && props[CoreConst.ORDER_NO] != null && props[CoreConst.ORDER_NO].ToString() != string.Empty)
{
Font extFont = listGrid.Font;
listGrid.Rows[listGrid.Rows.Count - 1].DefaultCellStyle.Font = new Font(extFont, FontStyle.Strikeout);
}
else
listGrid.Rows[listGrid.Rows.Count - 1].DefaultCellStyle.BackColor = Color.LightPink;
}
}
catch { }
/*
string item = string.Empty;
bills = Directory.GetFiles(ConfigManager.Instance.CommonConfiguration.Path_Bills, string.Format("{0:X2}_N*_{1}.bill", ConfigManager.Instance.CommonConfiguration.APP_SubUnit, selectedDay.ToString("ddMMyy")));
Array.Sort(bills);
double billListSuma = 0.0;
double billSuma = 0.0;
object[] billEntry = new object[2];
PropertyCollection props = new PropertyCollection();
Dictionary<string, object> billInfo = new Dictionary<string, object>();
object orderNo = new object();
for (int i = 0; i < bills.Length; i++, item = string.Empty)
{
try
{
stream = new FileStream(bills[i], FileMode.Open, FileAccess.Read, FileShare.Read);
billEntry = (object[])binF.Deserialize(stream);
//dTBill = (DataTable)binF.Deserialize(stream);
dTBill = (DataTable)billEntry[0];
props = (PropertyCollection)billEntry[1];
billInfo = ((Dictionary<string, object>)props[CoreConst.BILL]);
stream.Close();
stream.Dispose();
//Adding item
billFileList.Add(billInfo[CoreConst.OID].ToString(), bills[i]);
billSuma = (double)props[CoreConst.ORDER_SUMA];
orderNo = props[CoreConst.ORDER_NO];
// hide special flags
//if (orderNo != null && (string.Compare(orderNo.ToString(), "null") == 0 || string.Compare(orderNo.ToString(), "k") == 0))
// orderNo = string.Empty;
listGrid.Rows.Add(
new object[] {
billInfo[CoreConst.OID],
billInfo[CoreConst.BILL_NO],
billInfo[CoreConst.DATETIME],
billInfo[CoreConst.COMMENT],
billSuma,
bool.Parse(billInfo[CoreConst.IS_LOCKED].ToString()),
orderNo
}
);
billListSuma += billSuma;
if (props.ContainsKey(CoreConst.ORDER_NO) && props[CoreConst.ORDER_NO] != null && props[CoreConst.ORDER_NO].ToString() != string.Empty)
{
Font extFont = listGrid.Font;
listGrid.Rows[listGrid.Rows.Count - 1].DefaultCellStyle.Font = new Font(extFont, FontStyle.Strikeout);
}
}
catch (Exception ex) { CoreLib.WriteLog(ex, "LoadDayBills(DateTime selectedDay); Unable to load bill file: " + bills[i]); }
}*/
return generalSuma;
}
示例2: PanelFields
private List<Field> PanelFields(int idPanel)
{
DataTable tbl = fetchAll("SELECT * FROM fields JOIN field_types USING(id_field) WHERE id_panel = ", idPanel);
List<Field> res = new List<Field>();
foreach(DataRow row in tbl.Rows){
int typeId = (int) row["id_type"];
int fieldId = (int)row["id_field"];
PropertyCollection properties = new PropertyCollection();
PropertyCollection rules = new PropertyCollection();
PropertyCollection controlOptions = new PropertyCollection();
DataTable propsTab = fetchAll("SELECT name, val, concerns FROM fields_meta WHERE id_field = ", fieldId);
foreach(DataRow propRow in propsTab.Rows)
switch((string)propRow["concerns"]){
case "view":
properties.Add(propRow["name"], propRow["val"]);
break;
case "validation":
rules.Add(propRow["name"], propRow["val"]);
break;
case "controls":
controlOptions.Add(propRow["name"], propRow["val"]);
break;
default:
throw new Exception("Cannot handle metadata about " + propRow["concerns"].ToString() + " (yet).");
}
properties.Add("caption", row["caption"] as string);
string typeName = row["type_name"] as string;
if(!controlOptions.ContainsKey("isFK") && !controlOptions.ContainsKey("isM2NMapping")){
res.Add(new Field(fieldId, (string)row["column_name"], typeId, (string)row["type_name"], idPanel, properties, rules));
continue; // just a standard field
}
// FK or M2NMapping
string myTable = fetchSingle("SELECT table_name FORM panels WHERE id_panel = ", idPanel) as string;
string myColumn = row["column_name"] as string;
string refTable = controlOptions[CC.FIELD_REF_TABLE] as string;
string refColumn = controlOptions[CC.FIELD_REF_COLUMN] as string;
string displayColumn = controlOptions[CC.FIELD_DISPLAY_COLUMN] as string;
if(controlOptions.ContainsKey("isFK")){ // foreign key
FKMySql fk = new FKMySql(myTable, myColumn, refTable, refColumn, displayColumn);
res.Add(new FKField(fieldId, myColumn, typeId, typeName, idPanel, fk, properties, rules));
}
// M2NMapping
string mapTable = controlOptions[CC.FIELD_MAP_TABLE] as string;
string mapMyColumn = controlOptions[CC.FIELD_MAP_MY_COLUMN] as string;
string mapRefColumn = controlOptions[CC.FIELD_REF_COLUMN] as string;
M2NMappingMySql mapping = new M2NMappingMySql(myTable, myColumn, refTable, refColumn, mapTable, displayColumn, mapMyColumn, mapRefColumn);
res.Add(new M2NMappingField(fieldId, myColumn, typeId, typeName, idPanel, mapping, properties, rules));
}
return res;
}