本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Data.Database.AddInParameter方法的典型用法代码示例。如果您正苦于以下问题:C# Database.AddInParameter方法的具体用法?C# Database.AddInParameter怎么用?C# Database.AddInParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Practices.EnterpriseLibrary.Data.Database
的用法示例。
在下文中一共展示了Database.AddInParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Insert
public bool Insert(Photo photo, Database db, DbTransaction transaction = null)
{
DbCommand command = db.GetStoredProcCommand("usp_PhotoInsert");
photo.PhotoId = Guid.NewGuid();
db.AddInParameter(command, "PhotoId", DbType.Guid, photo.PhotoId);
db.AddInParameter(command, "FileName", DbType.String, photo.FileName);
db.AddInParameter(command, "FilePath", DbType.String, photo.FilePath);
db.AddInParameter(command, "ContextId", DbType.Guid, photo.ContextId);
db.AddInParameter(command, "Description", DbType.String, photo.Description);
db.AddInParameter(command, "ContextTypeId", DbType.Int32, (int)photo.ContextType);
db.AddInParameter(command, "ContextSubTypeId", DbType.Int32, photo.ContextSubTypeId);
db.AddInParameter(command, "PhotoCategoryId", DbType.Int32, (int)photo.PhotoCategory);
db.AddInParameter(command, "IsDeleted", DbType.String, photo.IsDeleted);
db.AddInParameter(command, "CreatedBy", DbType.Guid, photo.CreatedBy);
db.AddOutParameter(command, "CreatedDate", DbType.DateTime, 30);
if (transaction == null)
{
db.ExecuteNonQuery(command);
}
else
{
db.ExecuteNonQuery(command, transaction);
}
photo.CreatedDate = Convert.ToDateTime(db.GetParameterValue(command, "CreatedDate").ToString());
photo.UpdatedDate = photo.CreatedDate;
return true;
}
示例2: Insert
public bool Insert(OptionItem OptionItem, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_OptionItemInsert");
db.AddInParameter(command, "Name", DbType.String, OptionItem.Name);
db.AddInParameter(command, "Description", DbType.String, OptionItem.Description);
db.AddInParameter(command, "IsDeleted", DbType.Boolean, OptionItem.IsDeleted);
db.AddInParameter(command, "OptionId", DbType.Int16, OptionItem.OptionId);
db.AddInParameter(command, "CreatedBy", DbType.Guid, OptionItem.CreatedBy);
db.AddOutParameter(command, "OptionItemId", DbType.Int16, 3);
if (transaction == null)
{
db.ExecuteNonQuery(command);
}
else
{
db.ExecuteNonQuery(command, transaction);
}
OptionItem.OptionItemId = Convert.ToInt16(db.GetParameterValue(command, "OptionItemId").ToString());
return true;
}
示例3: InsertUpdateDelete
public bool InsertUpdateDelete(Customer customer, Database db, DbTransaction transaction)
{
DbCommand commandInsert = db.GetStoredProcCommand("usp_CustomerGroupInsert");
db.AddInParameter(commandInsert, "@GroupId", DbType.Int32, customer.CustomerId);
db.AddInParameter(commandInsert, "@CompanyId", DbType.Int32, customer.CompanyId);
db.AddInParameter(commandInsert, "@CustomerName", DbType.String, "CustomerName", DataRowVersion.Current);
db.AddInParameter(commandInsert, "@PassportNumber", DbType.String, "PassportNumber", DataRowVersion.Current);
db.AddInParameter(commandInsert, "@Gender", DbType.String, "Gender", DataRowVersion.Current);
db.AddInParameter(commandInsert, "@GuestTypeId", DbType.Int32, "GuestTypeId", DataRowVersion.Current);
db.AddInParameter(commandInsert, "@Phone", DbType.String, "Phone", DataRowVersion.Current);
db.AddInParameter(commandInsert, "@StatusId", DbType.Int32, (int)HBM.Common.Enums.HBMStatus.Active);
db.AddInParameter(commandInsert, "@IsGroupCustomer", DbType.Boolean, customer.IsGroupCustomer);
db.AddInParameter(commandInsert, "@CreatedUser", DbType.Int32, "CreatedUser", DataRowVersion.Current);
DbCommand commandUpdate = db.GetStoredProcCommand("usp_CustomerGroupUpdate");
db.AddInParameter(commandUpdate, "@CustomerId", DbType.Int32, "CustomerId", DataRowVersion.Current);
db.AddInParameter(commandUpdate, "@CustomerName", DbType.String, "CustomerName", DataRowVersion.Current);
db.AddInParameter(commandUpdate, "@PassportNumber", DbType.String, "PassportNumber", DataRowVersion.Current);
db.AddInParameter(commandUpdate, "@Gender", DbType.String, "Gender", DataRowVersion.Current);
db.AddInParameter(commandUpdate, "@GuestTypeId", DbType.Int32, "GuestTypeId", DataRowVersion.Current);
db.AddInParameter(commandUpdate, "@Phone", DbType.String, "Phone", DataRowVersion.Current);
db.AddInParameter(commandUpdate, "@StatusId", DbType.Int32, (int)HBM.Common.Enums.HBMStatus.Active);
db.AddInParameter(commandUpdate, "@UpdatedUser", DbType.Int32, "UpdatedUser", DataRowVersion.Current);
DbCommand commandDelete = db.GetStoredProcCommand("usp_CustomerDelete");
db.AddInParameter(commandDelete, "@CustomerId", DbType.Int32, "CustomerId", DataRowVersion.Current);
db.UpdateDataSet(customer.DsGroupCustomers, customer.DsGroupCustomers.Tables[0].TableName, commandInsert, commandUpdate, commandDelete, transaction);
return true;
}
示例4: Get_SP_ExecuteSQL
public static DbCommand Get_SP_ExecuteSQL(Database db, string stmtStr, string paramsStr)
{
DbCommand command = db.GetStoredProcCommand("sp_executesql");
db.AddInParameter(command, "stmt", DbType.String, stmtStr);
db.AddInParameter(command, "params", DbType.String, paramsStr);
return command;
}
示例5: InsertRoleRights
public bool InsertRoleRights(Role roles, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_RoleRightInsert");
db.AddInParameter(command, "@RoleId", DbType.Guid, roles.RoleId);
db.AddInParameter(command, "@RightId", DbType.Int32, roles.RightId);
db.AddInParameter(command, "@CreatedBy", DbType.Guid, roles.CreatedBy);
db.ExecuteNonQuery(command, transaction);
return true;
}
示例6: Delete
public bool Delete(User user, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_UserDelete");
db.AddInParameter(command, "UpdatedBy", DbType.Guid, user.UpdatedBy);
db.AddInParameter(command, "UserId", DbType.Guid, user.UserId);
db.ExecuteNonQuery(command, transaction);
user.UpdatedDate = Convert.ToDateTime(db.GetParameterValue(command, "UpdatedDate").ToString());
return true;
}
示例7: CreateDataAdapterCommands
public static void CreateDataAdapterCommands(Database db, ref DbCommand insertCommand, ref DbCommand updateCommand, ref DbCommand deleteCommand)
{
insertCommand = db.GetStoredProcCommand("RegionInsert");
updateCommand = db.GetStoredProcCommand("RegionUpdate");
deleteCommand = db.GetStoredProcCommand("RegionDelete");
db.AddInParameter(insertCommand, "vRegionID", DbType.Int32, "RegionID", DataRowVersion.Default);
db.AddInParameter(insertCommand, "vRegionDescription", DbType.String, "RegionDescription", DataRowVersion.Default);
db.AddInParameter(updateCommand, "vRegionID", DbType.Int32, "RegionID", DataRowVersion.Default);
db.AddInParameter(updateCommand, "vRegionDescription", DbType.String, "RegionDescription", DataRowVersion.Default);
db.AddInParameter(deleteCommand, "vRegionID", DbType.Int32, "RegionID", DataRowVersion.Default);
}
示例8: Insert
public bool Insert(Role roles, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_RoleInsert");
roles.RoleId = Guid.NewGuid();
db.AddInParameter(command, "@RoleName", DbType.String, roles.RoleName);
db.AddInParameter(command, "@RoleDescription", DbType.String, roles.RoleDescription);
db.AddInParameter(command, "@CreatedBy", DbType.Guid, roles.CreatedBy);
db.AddInParameter(command, "@RoleId", DbType.Guid, roles.RoleId);
db.ExecuteNonQuery(command, transaction);
return true;
}
示例9: Admin1
/// <summary>
/// Instanciates a Admin1 object from the database via the admin1ID
/// </summary>
public Admin1(int admin1ID)
{
db = DatabaseFactory.CreateDatabase();
DbCommand dbCommand = db.GetStoredProcCommand("AG_GetAdmin1Byadmin1ID");
db.AddInParameter(dbCommand, "admin1ID", DbType.Int32, admin1ID);
//execute the stored procedure
using (IDataReader dr = db.ExecuteReader(dbCommand))
{
ColumnFieldList list = new ColumnFieldList(dr);
if (dr.Read())
{
if (list.IsColumnPresent("admin1ID")) { this._admin1ID = (int)dr["admin1ID"]; }
if (list.IsColumnPresent("CountryID")) { this._countryID = (int)dr["CountryID"]; }
if (list.IsColumnPresent("admin1CD")) { this._admin1CD = (string)dr["admin1CD"]; }
if (list.IsColumnPresent("Name")) { this._name = (string)dr["Name"]; }
}
else
{
throw new Exception("There is no Admin1 in the database with the ID " + admin1ID);
}
dr.Close();
}
}
示例10: DeleteRoleRightsByRoleId
public bool DeleteRoleRightsByRoleId(Role roles, Database db, DbTransaction transaction)
{
DbCommand dbCommand = db.GetStoredProcCommand("usp_RoleRightDelete");
db.AddInParameter(dbCommand, "RoleId", DbType.Guid, roles.RoleId);
db.ExecuteNonQuery(dbCommand, transaction);
return true;
}
示例11: Delete
public bool Delete(OptionCategory ropertyOptionCategory, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_OptionCategoryDelete");
db.AddInParameter(command, "OptionCategoryId", DbType.Guid, ropertyOptionCategory.OptionCategoryId);
db.ExecuteNonQuery(command, transaction);
return true;
}
示例12: Insert
public bool Insert(Option Option, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_OptionInsert");
db.AddInParameter(command, "Name", DbType.String, Option.Name);
db.AddInParameter(command, "Description", DbType.String, Option.Description);
db.AddInParameter(command, "OptionCategoryId", DbType.Int16, Option.OptionCategoryId);
db.AddInParameter(command, "ParentOptionId", DbType.Int16, Option.ParentOptionId);
db.AddInParameter(command, "IsDeleted", DbType.Boolean, Option.IsDeleted);
db.AddInParameter(command, "IsMultiSelect", DbType.Boolean, Option.IsMultiSelect);
db.AddInParameter(command, "Points", DbType.Int16, Option.Points);
db.AddOutParameter(command, "OptionId", DbType.Int16, 3);
if (transaction == null)
{
db.ExecuteNonQuery(command);
}
else
{
db.ExecuteNonQuery(command, transaction);
}
Option.OptionId = Convert.ToInt16(db.GetParameterValue(command, "OptionId").ToString());
return true;
}
示例13: Insert
public bool Insert(StudentHouseLeave studentHouseLeave, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_StudentHouseLeaveInsert");
db.AddInParameter(command, "HouseId", DbType.Guid, studentHouseLeave.HouseId);
db.AddInParameter(command, "BaseHouseRoomId", DbType.Guid, studentHouseLeave.BaseHouseRoomId);
db.AddInParameter(command, "RequestBy", DbType.Guid, studentHouseLeave.RequestBy);
db.AddInParameter(command, "RequestTo", DbType.Guid, studentHouseLeave.RequestTo);
db.AddInParameter(command, "status", DbType.Int16, studentHouseLeave.status);
db.AddOutParameter(command, "RequestDate", DbType.DateTime, 30);
if (transaction == null)
{
db.ExecuteNonQuery(command);
}
else
{
db.ExecuteNonQuery(command, transaction);
}
studentHouseLeave.RequestDate = Convert.ToDateTime(db.GetParameterValue(command, "RequestDate").ToString());
studentHouseLeave.ResponseDate = studentHouseLeave.RequestDate;
return true;
}
示例14: Delete
public bool Delete(OptionItem OptionItem, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_OptionItemDelete");
db.AddInParameter(command, "OptionItemId", DbType.Guid, OptionItem.OptionItemId);
db.AddInParameter(command, "IsDeleted", DbType.Guid, OptionItem.IsDeleted);
db.ExecuteNonQuery(command, transaction);
return true;
}
示例15: GetCreateAttachmentCommand
public static DbCommand GetCreateAttachmentCommand(Database database, RegisterAttachmentEntityNewLogic attach)
{
DbCommand cmd = database.GetStoredProcCommand("P_CreateRegisterAttachment");
database.AddOutParameter(cmd, "Id", DbType.String, 36);
database.AddInParameter(cmd, "RegisterId", DbType.String, attach.RegisterId);
database.AddInParameter(cmd, "SaveName", DbType.String, attach.SaveName);
database.AddInParameter(cmd, "ShowName", DbType.String, attach.ShowName);
return cmd;
}