本文整理汇总了C#中System.Collections.Hashtable.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Hashtable.Add方法的具体用法?C# Hashtable.Add怎么用?C# Hashtable.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Hashtable
的用法示例。
在下文中一共展示了Hashtable.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ESData
/// <summary>
/// 構造
/// </summary>
protected ESData()
{
dict = new Hashtable();
dict.Add("itemno", "物品編號");
dict.Add("item", "產品");
dict.Add("model", "型號");
}
示例2: GetBmCodes
public ActionResult GetBmCodes(string codes)
{
Hashtable ht = new Hashtable();
string[] str = codes.Split(',');
foreach (var temp in str)
{
switch (temp)
{
case "xtzylx":
ht.Add(temp, UtilCodeInfo.xtzylx);
break;
case "xtzyzt":
ht.Add(temp, UtilCodeInfo.xtzyzt);
break;
case "usRole":
ht.Add(temp, UtilCodeInfo.usRole);
break;
case "usstate":
ht.Add(temp, UtilCodeInfo.usstate);
break;
case "rolestate":
// ht.Add(temp, UtilCodeInfo.rolestate);
break;
case "recode":
//ht.Add(temp, UtilCodeInfo.recode);
break;
}
}
return Json(ht, JsonRequestBehavior.AllowGet);
}
示例3: CargarPermisos
/// <summary>
/// Carga una hashtable que contiene los permisos del usuario (menu desplegable)
/// </summary>
/// <returns></returns>
public Hashtable CargarPermisos()
{
MedDAL.DAL.permisos_usuarios permisoUsuario;
Hashtable htPermisos = new Hashtable();
int count=1;
char cPermiso;
string[] listaPermisos = { "usuarios", "perfiles",
"clientes", "vendedores", "proveedores", "estados", "municipios", "poblaciones", "colonias",
"almacenes", "productos", "inventarios",
"pedidos", "recetas", "remisiones", "facturas",
"causes", "bitacora",
"configuracion", "campos editables", "tipos", "cuentas x cobrar",
"tipos de iva", "ensambles", "lineas de credito"};
foreach (string permiso in listaPermisos) {
permisoUsuario = (MedDAL.DAL.permisos_usuarios)blPermisosUsuarios.RecuperarPermisos(idUsuario, count);
cPermiso = (permisoUsuario.TipoAcceso.ToString().ToCharArray())[0];
if (cPermiso!='N')
htPermisos.Add(permiso, cPermiso);
count++;
}
permisoUsuario = (MedDAL.DAL.permisos_usuarios)blPermisosUsuarios.RecuperarPermisos(idUsuario, 16);
cPermiso = (permisoUsuario.TipoAcceso.ToString().ToCharArray())[0];
if (cPermiso != 'N')
htPermisos.Add("facturas x receta", cPermiso);
htPermisos.Add("reportes",'T');
htPermisos.Add("cambiar contraseña", 'T');
htPermisos.Add("movimientos", 'T');
return htPermisos;
}
示例4: FormMain
public FormMain()
{
//
// Required for Win Form Designer support
//
InitializeComponent();
originalDir = Environment.CurrentDirectory;
SetupFileDialog();
//initialize the array of effect entries
htEffects = new Hashtable();
htEffects.Add(Effect.CodeGenPathField,
"The Code Generation Path field determines the location in which your file is saved, once you click the 'Generate' button. If left empty, the file is saved in the current location (if not specified, this field will be automaticaly filled when all critical fields are completed).");
htEffects.Add(Effect.FileNameField,
"The Filename field determines the name of the file that is created, once the 'Generate' button is clicked. Note that an extension is automatically added to the name type in this box, based on the language selected from the language group below. Note, this name does not impact the name of the collection itself");
htEffects.Add(Effect.CollectionTypeField,
"The Type field determines the Type stored in your collection. The collection itself is named by concatenating the text in this field plus the word 'Collection'. The Type name specified here is also used throughout the source code generated");
htEffects.Add(Effect.CollectionTypeNamespaceField,
"The Type's Namespace (package in JScript) field indicates the Namespace in which the Type is declared. It's effect on the generated code is to include a 'using' (C#), 'Imports' (Visual Basic), or 'import' (JScript) statement near the top of the generated code");
htEffects.Add(Effect.AuthorNameField,
"The Author's Name field specifies the name of the person responsible for the created file.");
htEffects.Add(Effect.CollectionNamespaceField,
"The Collection's Namespace field indicates the Namespace (package in JScript) in which your collection is itself defined. It's effect on the generated code is to determine the Namespace declared for your collection, near the top of the code, as well as the namespace references included in the comments");
htEffects.Add(Effect.LanguageField,
"Using the language radio buttons, you can change the language in which the source code is generated. You can change this at any time");
htEffects.Add(Effect.NestedEnumField,
"Selecting the Nested Enumerator checkbox means that the Enumerator included with your collection is nested within the collection itself, rather than have it declared outside your collection. The enumerator is declared at the bottom of the generated code, and is named base on the specified Type");
htEffects.Add(Effect.ValidationField,
"Selecting the Add Validation checkbox means that Validation methods are added into the generated source code (they are added near the bottom of the code, but above the Enumerator declaration). Note that the validation methods are empty once added, but you can easily add your own validation code");
htEffects.Add(Effect.DisposeField,
"Selecting the Add Dispose checkbox means that the IDisposable interface and a Dispose() method are added into the generated code. The Dispose() method calls Dispose() for all items in the collection.");
this.MinimumSize = new Size(640,480);
}
示例5: start
//Start serial connection
public void start()
{
//Check URL valid
if (serverURL != "")
{
try
{
Uri configuri = new Uri(serverURL);
}
catch (UriFormatException ex)
{
statusLogAdd("Server URL Error: " + ex.Message);
return;
}
}
//Clear status log box
txtStatusLog.Clear();
//Set button status to disconnect
btnConnect.Text = "�Ͽ�����";
//Pass through serial port to background worker
Hashtable workerOptions = new Hashtable();
workerOptions.Add("port", comPort);
workerOptions.Add("serverURL", serverURL);
workerOptions.Add("apiKey", apiKey);
workerOptions.Add("data", "");
workerOptions.Add("bdRate", bdRate);
//Init background worker
bgWorker.RunWorkerAsync(workerOptions);
}
示例6: login
//public SqlConnection getSqlConnection()
//{
// string myConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\Project\\OSM\\OSM\\DB\\OSMDBProvider.accdb;Persist Security Info=True";
// //"server=127.0.0.1;uid=user;pwd=123456;database=Northwind;Trusted_Connection=no";
// SqlConnection sqlConnection = new SqlConnection(myConn);
// return sqlConnection;
//}
/// <summary>
/// 系统登陆数据库接口
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public Hashtable login(string sql)
{
OleDbConnection conn = getConnection();
try
{
OleDbCommand command = new OleDbCommand(sql, conn);
conn.Open();
OleDbDataReader reader = command.ExecuteReader();
if (reader.Read())
{
string id = reader["ID"].ToString();
string username = reader["USER_NAME"].ToString();
string userid = reader["USER_ID"].ToString();
string pwd = reader["USER_PWD"].ToString();
Hashtable ht = new Hashtable();
ht.Add("id", id);
ht.Add("userid", userid);
ht.Add("username", username);
conn.Close();
conn.Dispose();
return ht;
}
else
{
return null;
//throw (new Exception("当前数据表没有记录!"));
}
}
catch (Exception e)
{
throw (new Exception("数据库连接出错!" + e.Message));
}
}
示例7: Handle
public override Hashtable Handle(string path, Hashtable request)
{
string param = GetParam(path);
request.Add("param", param);
request.Add("path", path);
return m_dhttpMethod(request);
}
示例8: CreateFunctionTable
private static Hashtable CreateFunctionTable()
{
Hashtable hashtable = new Hashtable(0x24);
hashtable.Add("last", new ParamInfo(Function.FunctionType.FuncLast, 0, 0, temparray1));
hashtable.Add("position", new ParamInfo(Function.FunctionType.FuncPosition, 0, 0, temparray1));
hashtable.Add("name", new ParamInfo(Function.FunctionType.FuncName, 0, 1, temparray2));
hashtable.Add("namespace-uri", new ParamInfo(Function.FunctionType.FuncNameSpaceUri, 0, 1, temparray2));
hashtable.Add("local-name", new ParamInfo(Function.FunctionType.FuncLocalName, 0, 1, temparray2));
hashtable.Add("count", new ParamInfo(Function.FunctionType.FuncCount, 1, 1, temparray2));
hashtable.Add("id", new ParamInfo(Function.FunctionType.FuncID, 1, 1, temparray3));
hashtable.Add("string", new ParamInfo(Function.FunctionType.FuncString, 0, 1, temparray3));
hashtable.Add("concat", new ParamInfo(Function.FunctionType.FuncConcat, 2, 100, temparray4));
hashtable.Add("starts-with", new ParamInfo(Function.FunctionType.FuncStartsWith, 2, 2, temparray5));
hashtable.Add("contains", new ParamInfo(Function.FunctionType.FuncContains, 2, 2, temparray5));
hashtable.Add("substring-before", new ParamInfo(Function.FunctionType.FuncSubstringBefore, 2, 2, temparray5));
hashtable.Add("substring-after", new ParamInfo(Function.FunctionType.FuncSubstringAfter, 2, 2, temparray5));
hashtable.Add("substring", new ParamInfo(Function.FunctionType.FuncSubstring, 2, 3, temparray6));
hashtable.Add("string-length", new ParamInfo(Function.FunctionType.FuncStringLength, 0, 1, temparray4));
hashtable.Add("normalize-space", new ParamInfo(Function.FunctionType.FuncNormalize, 0, 1, temparray4));
hashtable.Add("translate", new ParamInfo(Function.FunctionType.FuncTranslate, 3, 3, temparray7));
hashtable.Add("boolean", new ParamInfo(Function.FunctionType.FuncBoolean, 1, 1, temparray3));
hashtable.Add("not", new ParamInfo(Function.FunctionType.FuncNot, 1, 1, temparray8));
hashtable.Add("true", new ParamInfo(Function.FunctionType.FuncTrue, 0, 0, temparray8));
hashtable.Add("false", new ParamInfo(Function.FunctionType.FuncFalse, 0, 0, temparray8));
hashtable.Add("lang", new ParamInfo(Function.FunctionType.FuncLang, 1, 1, temparray4));
hashtable.Add("number", new ParamInfo(Function.FunctionType.FuncNumber, 0, 1, temparray3));
hashtable.Add("sum", new ParamInfo(Function.FunctionType.FuncSum, 1, 1, temparray2));
hashtable.Add("floor", new ParamInfo(Function.FunctionType.FuncFloor, 1, 1, temparray9));
hashtable.Add("ceiling", new ParamInfo(Function.FunctionType.FuncCeiling, 1, 1, temparray9));
hashtable.Add("round", new ParamInfo(Function.FunctionType.FuncRound, 1, 1, temparray9));
return hashtable;
}
示例9: GetSiteDetails
public Hashtable GetSiteDetails()
{
Hashtable _SiteDetails = new Hashtable();
try
{
Logger.Debug("Refreshing Site details:GetSiteDetails");
ISingleResult<rsp_EventTransmitter_GetSiteDetailsResult> ResultSet = _ExchangeContext.rsp_EventTransmitter_GetSiteDetails();
foreach (rsp_EventTransmitter_GetSiteDetailsResult oInst in ResultSet)
{
_SiteDetails.Add("Area", oInst.sub_company_area_name);
_SiteDetails.Add("Company", oInst.Company_name);
_SiteDetails.Add("District", oInst.sub_company_District_Name);
_SiteDetails.Add("Region", oInst.Sub_Company_Region_Name);
_SiteDetails.Add("Sub_Company", oInst.sub_company_Name);
}
}
catch (Exception Ex)
{
Logger.Error("DataAdapter", "GetSiteDetails()", Ex);
_SiteDetails.Clear();
_SiteDetails.Add("Area", string.Empty);
_SiteDetails.Add("Company", string.Empty);
_SiteDetails.Add("District", string.Empty);
_SiteDetails.Add("Region", string.Empty);
_SiteDetails.Add("Sub_Company", string.Empty);
}
return _SiteDetails;
}
示例10: Abandon
public void Abandon(int masterSysNo, int userSysNo)
{
TransactionOptions options = new TransactionOptions();
options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
options.Timeout = TransactionManager.DefaultTimeout;
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
{
//�����dz�ʼ״̬
POInfo dbInfo = LoadPO(masterSysNo);
if ( dbInfo == null )
throw new BizException("does not exist this po sysno");
if ( dbInfo.Status != (int)AppEnum.POStatus.Origin )
throw new BizException("status is not origin now, abandon failed");
//���� ���š�״̬�������
Hashtable ht = new Hashtable(4);
ht.Add("SysNo", masterSysNo);
ht.Add("Status", (int)AppEnum.POStatus.Abandon);
if ( 1!=new PODac().UpdateMaster(ht))
throw new BizException("expected one-row update failed, verify failed ");
ProductIDManager.GetInstance().AbandonProductIDsByPO(masterSysNo);
scope.Complete();
}
}
示例11: InitLoad
public void InitLoad()
{
int page = Convert.ToInt32(Request["page"].ToString());
int rows = Convert.ToInt32(Request["rows"].ToString());
DataTable dt = bll.GetReportTableList(tableName, " 1=1", (page - 1) * rows + 1, page * rows);
count = bll.GetReportCount(tableName);
IList<Hashtable> list = new List<Hashtable>();
int index = 0;
foreach (DataRow item in dt.Rows)
{
Hashtable ht = new Hashtable();
index++;
ht.Add("KEY", index);
ht.Add("ID", item["ID_KEY"].ToString());
ht.Add("UID", item["T_UNITID"].ToString());
ht.Add("UNAME", item["T_UNITDESC"].ToString());
list.Add(ht);
}
object obj = new
{
total = count,
rows = list
};
string result = JsonConvert.SerializeObject(obj);
Response.Write(result);
Response.End();
}
示例12: ButtonAdd2Cart_Click
/// <summary>
/// "放入购物车"按钮单击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ButtonAdd2Cart_Click(object sender, System.EventArgs e)
{
if (Session["user_id"] == null)
Page.Response.Redirect("Login.aspx?in=1");
Cart cart = new Cart();
Hashtable ht = new Hashtable();
ArrayList selectedBooks = this.GetSelected();
//如果用户没有选择,就单击该按钮,则给出警告
if (selectedBooks.Count == 0)
{
Response.Write("<Script Language=JavaScript>alert('请选择图书!');</Script>");
return;
}
//循环将选择的图书加入到购物篮中
foreach (int bookId in selectedBooks)
{
ht.Clear();
ht.Add("UserId", Session["user_id"].ToString());
ht.Add("BookId", bookId);
ht.Add("Amount", TextBoxAmount.Text.Trim());
cart.Add(ht);
}
Response.Redirect("CartView.aspx");
}
示例13: GetAverageHoldings
public static IList GetAverageHoldings(IDalSession session, IAccountTypeInternal account, DateTime startDate, DateTime endDate, ValuationTypesFilterOptions filterOption)
{
Hashtable parameters = new Hashtable(1);
parameters.Add("account", account);
parameters.Add("startDate", startDate);
parameters.Add("endDate", endDate);
string instrumentFilter = "";
switch (filterOption)
{
case ValuationTypesFilterOptions.Security:
instrumentFilter = "and I.Key in (select S.Key from TradeableInstrument S) ";
break;
case ValuationTypesFilterOptions.Monetary:
instrumentFilter = "and I.Key in (select C.Key from Currency C) ";
break;
}
string hql = string.Format(@"from AverageHolding A
left join fetch A.Instrument I
where A.Account = :account
and (A.BeginDate between :startDate
and :endDate ) {0}
order by I.Key, A.BeginDate", instrumentFilter);
return session.GetListByHQL(hql, parameters);
}
示例14: ToHashtable
internal Hashtable ToHashtable()
{
Hashtable hashtable = new Hashtable();
if (!this.Enabled)
{
hashtable.Add("enabled", false);
}
if (!string.IsNullOrEmpty(this.FillCollor))
{
hashtable.Add("fillColor", this.FillCollor);
}
if (this.LineColor != "#FFFFFF")
{
hashtable.Add("lineColor", this.LineColor);
}
if (this.LineWidth != 0)
{
hashtable.Add("lineWidth", this.LineWidth);
}
if (this.Radius != 0)
{
hashtable.Add("radius", this.Radius);
}
if (!string.IsNullOrEmpty(this.Symbol))
{
hashtable.Add("symbol", this.Symbol);
}
return hashtable;
}
示例15: GetLeftTree
/// 修改:李东峰 日期:2014-2-28
/// 修改内容:增加根据visible属性判断是否显示该菜单
public void GetLeftTree(string id)
{
string userId = Request.Cookies["T_USERID"].Value.ToString();
string roleId = bl.GetRoleId(userId);
dt = new DataTable();
GetTreeList();
DataRow[] _dr = dt.Select("PID='" + id + "'");
IList<Hashtable> list = new List<Hashtable>();
for (int i = 0; i < _dr.Length; i++)
{
string[] nodeRoleId = _dr[i][5].ToString().TrimStart(',').TrimEnd(',').Split(',');
if (nodeRoleId.Contains(roleId) && _dr[i][4].ToString() == "1")
{
Hashtable ht = new Hashtable();
ht.Add("ID", _dr[i][0].ToString());
ht.Add("NAME", _dr[i][1].ToString());
DataRow[] _dr_judge = dt.Select("PID='" + _dr[i][0].ToString() + "'");
if (_dr_judge.Length > 0)
ht.Add("JUDGE", "1");
else
ht.Add("JUDGE", "0");
list.Add(ht);
}
}
object obj = new
{
list = list
};
string result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
Response.Write(result);
Response.End();
}