本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Data.Database.AddOutParameter方法的典型用法代码示例。如果您正苦于以下问题:C# Database.AddOutParameter方法的具体用法?C# Database.AddOutParameter怎么用?C# Database.AddOutParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Practices.EnterpriseLibrary.Data.Database
的用法示例。
在下文中一共展示了Database.AddOutParameter方法的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: RegistrarAutos
//Funcion para registrar autos
public int RegistrarAutos(Autos DatosA, DbTransaction tran, Database db)
{
string sqlCommand = "dbo.insertar_autos";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
try {
db.AddInParameter(dbCommand, "@INTplaca", DbType.Int32, Utilerías.ObtenerValor(DatosA.Placa));
db.AddInParameter(dbCommand, "@STRmarca", DbType.String, Utilerías.ObtenerValor(DatosA.Marca));
db.AddInParameter(dbCommand, "@STRmodelo", DbType.String, Utilerías.ObtenerValor(DatosA.Modelo));
db.AddInParameter(dbCommand, "@INTanno", DbType.Int32, Utilerías.ObtenerValor(DatosA.Año));
db.AddInParameter(dbCommand, "@INTnumero_vin", DbType.Int32, Utilerías.ObtenerValor(DatosA.Vin));
db.AddInParameter(dbCommand, "@STRcolor", DbType.String, Utilerías.ObtenerValor(DatosA.Color));
db.AddOutParameter(dbCommand, "@nStatus", DbType.Int16, 2);
db.AddOutParameter(dbCommand, "@strMessage", DbType.String, 250);
db.AddOutParameter(dbCommand, "@INTid_Auto", DbType.Int32, 4);
db.ExecuteNonQuery(dbCommand, tran);
if (int.Parse(db.GetParameterValue(dbCommand, "@nStatus").ToString()) > 0)
throw new Exception(db.GetParameterValue(dbCommand, "@strMessage").ToString());
//retorna el id del auto que acaba de registrar
return int.Parse(db.GetParameterValue(dbCommand, "@INTid_Auto").ToString());
} catch (Exception ex) {
throw new Exception(ex.Message);
}
}
示例3: Insert
public bool Insert(PartialUser partialUser, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_PartialUserInsert");
partialUser.PartialUserId = Guid.NewGuid();
db.AddInParameter(command, "PartialUserId", DbType.Guid, partialUser.PartialUserId);
db.AddInParameter(command, "Email", DbType.String, partialUser.Email);
db.AddInParameter(command, "FirstName", DbType.String, partialUser.FirstName);
db.AddInParameter(command, "MiddleName", DbType.String, partialUser.MiddleName);
db.AddInParameter(command, "LastName", DbType.String, partialUser.LastName);
db.AddInParameter(command, "Contact", DbType.String, partialUser.Contact);
db.AddInParameter(command, "RoleId", DbType.Guid, partialUser.RoleId);
db.AddInParameter(command, "UserId", DbType.Guid, partialUser.UserId);
db.AddInParameter(command, "PartialHouseId", DbType.Guid, partialUser.PartialHouseId);
db.AddInParameter(command, "IsDeleted", DbType.Boolean, partialUser.IsDeleted);
db.AddInParameter(command, "CreatedBy", DbType.Guid, partialUser.CreatedBy);
db.AddOutParameter(command, "CreatedDate", DbType.DateTime, 30);
db.ExecuteNonQuery(command, transaction);
partialUser.CreatedDate = Convert.ToDateTime(db.GetParameterValue(command, "CreatedDate").ToString());
partialUser.UpdatedDate = partialUser.CreatedDate;
return true;
}
示例4: Insert
public bool Insert(Student student, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_StudentInsert");
db.AddInParameter(command, "StudentId", DbType.Guid, Guid.NewGuid());
db.AddInParameter(command, "UserId", DbType.Guid, student.StudentUser.UserId);
db.AddInParameter(command, "SchoolId", DbType.Guid, student.School.SchoolId);
db.AddInParameter(command, "IsDeleted", DbType.Boolean, student.IsDeleted);
db.AddInParameter(command, "Year", DbType.String, student.School.Year);
db.AddInParameter(command, "StartYear", DbType.String, student.StartYear);
db.AddInParameter(command, "StartMonth", DbType.String, student.StartMonth);
db.AddInParameter(command, "Status", DbType.String, student.Status);
db.AddInParameter(command, "PreviousSchoolInfo", DbType.String, student.PreviousSchoolInfo);
db.AddInParameter(command, "PreviousSchool", DbType.String, student.PreviousSchool);
db.AddInParameter(command, "MajorId", DbType.Int16, student.MajorId);
db.AddInParameter(command, "CreatedBy", DbType.Guid, student.CreatedBy);
db.AddOutParameter(command, "CreatedDate", DbType.DateTime, 30);
db.ExecuteNonQuery(command, transaction);
student.CreatedDate = Convert.ToDateTime(db.GetParameterValue(command, "CreatedDate").ToString());
student.UpdatedDate = student.CreatedDate;
return true;
}
示例5: Insert
public bool Insert(School school, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_SchoolInsert");
db.AddInParameter(command, "SchoolId", DbType.Guid, Guid.NewGuid());
db.AddInParameter(command, "Name", DbType.String, school.Name);
db.AddInParameter(command, "StreetAddress", DbType.String, school.StreetAddress);
db.AddInParameter(command, "City", DbType.String, school.City);
db.AddInParameter(command, "State", DbType.String, school.State);
db.AddInParameter(command, "Zip", DbType.String, school.Zip);
db.AddInParameter(command, "ContactNumber", DbType.String, school.ContactNumber);
db.AddInParameter(command, "Email", DbType.String, school.Email);
db.AddInParameter(command, "Location", DbType.String, school.Location);
db.AddInParameter(command, "WebsiteURL", DbType.String, school.WebsiteURL);
db.AddInParameter(command, "RatingValue", DbType.Decimal, school.RatingValue);
db.AddInParameter(command, "CreatedBy", DbType.Guid, school.CreatedBy);
db.AddOutParameter(command, "CreatedDate", DbType.DateTime, 30);
if (transaction == null)
{
db.ExecuteNonQuery(command);
}
else
{
db.ExecuteNonQuery(command, transaction);
}
school.CreatedDate = Convert.ToDateTime(db.GetParameterValue(command, "CreatedDate").ToString());
school.UpdatedDate = school.CreatedDate;
return true;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: Insert
public bool Insert(Spotlight spotlight, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_SpotlightInsert");
db.AddInParameter(command, "UserId", DbType.Guid, spotlight.UserId);
db.AddInParameter(command, "Awards", DbType.String, spotlight.Awards);
db.AddInParameter(command, "Achievements", DbType.String, spotlight.Achievements);
db.AddInParameter(command, "CurentGPA", DbType.String, spotlight.CurentGPA);
db.AddInParameter(command, "OraganizationId", DbType.Int16, spotlight.OraganizationId);
db.AddInParameter(command, "Involvments", DbType.String, spotlight.Involvments);
db.AddInParameter(command, "FraternityId", DbType.Int16, spotlight.FraternityId);
db.AddInParameter(command, "SoroityId", DbType.Int16, spotlight.SoroityId);
db.AddInParameter(command, "GreekHonorSocitiesId", DbType.Int16, spotlight.GreekHonorSocitiesId);
db.AddInParameter(command, "GreakOrganizationId", DbType.Int16, spotlight.GreakOrganizationId);
db.AddInParameter(command, "IsDeleted", DbType.Boolean, spotlight.IsDeleted);
db.AddInParameter(command, "CreatedBy", DbType.Guid, spotlight.CreatedBy);
db.AddOutParameter(command, "CreatedDate", DbType.DateTime, 30);
db.ExecuteNonQuery(command, transaction);
spotlight.CreatedDate = Convert.ToDateTime(db.GetParameterValue(command, "CreatedDate").ToString());
spotlight.UpdatedDate = spotlight.CreatedDate;
return true;
}
示例10: DefaultParams
/// <summary>
/// Parametros para Base de Datos :
/// 1. @page (Número de página)
/// 2. @rowsPerPage (Filas por página)
/// 3. @sortDir (Ordenamiento ascendente ó descendente)
/// 4. @sortType (Ordenamiento por tipo de campo)
/// 5. @rowCount (Variable de salida de total de registros)
/// </summary>
/// <param name="oDatabase"></param>
/// <param name="oDbCommand"></param>
/// <param name="oPaginacion"></param>
/// <returns></returns>
public static Database DefaultParams(Database oDatabase, DbCommand oDbCommand, Paginacion oPaginacion)
{
oDatabase.AddInParameter(oDbCommand, "@page", DbType.Int32, oPaginacion.Page);
oDatabase.AddInParameter(oDbCommand, "@rowsPerPage", DbType.Int32, oPaginacion.RowsPerPage);
oDatabase.AddInParameter(oDbCommand, "@sortDir", DbType.String, oPaginacion.SortDir);
oDatabase.AddInParameter(oDbCommand, "@sortType", DbType.String, oPaginacion.SortType);
oDatabase.AddOutParameter(oDbCommand, "@rowCount", DbType.Int32, 0);
return oDatabase;
}
示例11: 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;
}
示例12: GetCreateStockCommand
public static DbCommand GetCreateStockCommand(Database database, StockEntity entity)
{
DbCommand cmd = database.GetStoredProcCommand("P_CreateStock");
database.AddOutParameter(cmd, "StockId", DbType.Int32, 4);
#region 参数赋值
database.AddInParameter(cmd, "StockNo", DbType.String, entity.StockNo);
database.AddInParameter(cmd, "StockName", DbType.String, entity.StockName);
database.AddInParameter(cmd, "CreateId", DbType.String, entity.CreateId);
database.AddInParameter(cmd, "Remark", DbType.String, entity.Remark);
#endregion
return cmd;
}
示例13: Insert
public bool Insert(Customer customer, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_CustomerInsert");
db.AddInParameter(command, "@CompanyId", DbType.Int32, customer.CompanyId);
db.AddInParameter(command, "@CustomerName", DbType.String, customer.CustomerName);
db.AddInParameter(command, "@Gender", DbType.String, customer.Gender);
db.AddInParameter(command, "@GuestTypeId", DbType.Int32, customer.GuestTypeId);
db.AddInParameter(command, "@Phone", DbType.String, customer.Phone);
db.AddInParameter(command, "@Fax", DbType.String, customer.Fax);
db.AddInParameter(command, "@Mobile", DbType.String, customer.Mobile);
db.AddInParameter(command, "@Email", DbType.String, customer.Email);
db.AddInParameter(command, "@CompanyName", DbType.String, customer.CompanyName);
db.AddInParameter(command, "@CompanyAddressLine1", DbType.String, customer.CompanyAddressLine1);
db.AddInParameter(command, "@CompanyAddressLine2", DbType.String, customer.CompanyAddressLine2);
db.AddInParameter(command, "@CompanyCity", DbType.String, customer.CompanyCity);
db.AddInParameter(command, "@CompanyState", DbType.String, customer.CompanyState);
db.AddInParameter(command, "@CompanyPostCode", DbType.String, customer.CompanyPostCode);
db.AddInParameter(command, "@CompanyCountryId", DbType.Int32, customer.CompanyCountryId);
db.AddInParameter(command, "@CompanyNotes", DbType.String, customer.CompanyNotes);
db.AddInParameter(command, "@BillingAddressLine1", DbType.String, customer.BillingAddressLine1);
db.AddInParameter(command, "@BillingAddressLine2", DbType.String, customer.BillingAddressLine2);
db.AddInParameter(command, "@BillingCity", DbType.String, customer.BillingCity);
db.AddInParameter(command, "@BillingState", DbType.String, customer.BillingState);
db.AddInParameter(command, "@BillingCountryId", DbType.Int32, customer.BillingCountryId);
db.AddInParameter(command, "@BillingPostCode", DbType.String, customer.BillingPostCode);
db.AddInParameter(command, "@PassportNumber", DbType.String, customer.PassportNumber);
db.AddInParameter(command, "@PassportCountryOfIssue", DbType.Int32, customer.PassportCountryOfIssue);
db.AddInParameter(command, "@PassportExpirationDate", DbType.DateTime, customer.PassportExpirationDate);
db.AddInParameter(command, "@CreditCardTypeId", DbType.Int32, customer.CreditCardTypeId);
db.AddInParameter(command, "@CCNo", DbType.String, customer.CCNo);
db.AddInParameter(command, "@CCExpirationDate", DbType.DateTime, customer.CCExpirationDate);
db.AddInParameter(command, "@CCNameOnCard", DbType.String, customer.CCNameOnCard);
db.AddInParameter(command, "@Car", DbType.String, customer.Car);
db.AddInParameter(command, "@CarLicensePlate", DbType.String, customer.CarLicensePlate);
db.AddInParameter(command, "@DriverLicense", DbType.String, customer.DriverLicense);
db.AddInParameter(command, "@CreatedUser", DbType.Int32, customer.CreatedUser);
db.AddInParameter(command, "@StatusId", DbType.Int32, customer.StatusId);
db.AddInParameter(command, "@CardSecurityCode", DbType.String, customer.CardSecurityCode);
db.AddInParameter(command, "@CardStartDate", DbType.DateTime, customer.CardStartDate);
db.AddInParameter(command, "@CardIssueNo", DbType.String, customer.CardIssueNo);
db.AddInParameter(command, "@UseSameBillingAddress", DbType.Boolean, customer.UseSameBillingAddress);
db.AddInParameter(command, "@IsGroupCustomer", DbType.Boolean, customer.IsGroupCustomer);
db.AddOutParameter(command, "@CustomerId", DbType.Int32, 8);
db.ExecuteNonQuery(command, transaction);
customer.CustomerId = int.Parse(db.GetParameterValue(command, "@CustomerId").ToString());
return true;
}
示例14: BuildDBParameter
/// <summary>
/// 加载参数
/// </summary>
public static void BuildDBParameter(Database db, DbCommand dbCommand, params IDataParameter[] cmdParms)
{
foreach (SqlParameter sp in cmdParms)
{
if (sp.Direction == ParameterDirection.InputOutput || sp.Direction == ParameterDirection.Output)
{
db.AddOutParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Size);
}
else
{
db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
}
}
}
示例15: Insert
public bool Insert(Roles roles, Database db, DbTransaction transaction)
{
DbCommand command = db.GetStoredProcCommand("usp_RolesInsert");
db.AddInParameter(command, "@CompanyId", DbType.Int32, roles.CompanyId);
db.AddInParameter(command, "@RoleName", DbType.String, roles.RoleName);
db.AddInParameter(command, "@RoleDescription", DbType.String, roles.RoleDescription);
db.AddInParameter(command, "@CreatedUser", DbType.Int32, roles.CreatedUser);
db.AddOutParameter(command, "@RolesId", DbType.Int32, 8);
db.ExecuteNonQuery(command, transaction);
roles.RolesId = Convert.ToInt32(db.GetParameterValue(command, "@RolesId").ToString());
return true;
}