当前位置: 首页>>代码示例>>C#>>正文


C# Database.GetStoredProcCommand方法代码示例

本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Data.Database.GetStoredProcCommand方法的典型用法代码示例。如果您正苦于以下问题:C# Database.GetStoredProcCommand方法的具体用法?C# Database.GetStoredProcCommand怎么用?C# Database.GetStoredProcCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Practices.EnterpriseLibrary.Data.Database的用法示例。


在下文中一共展示了Database.GetStoredProcCommand方法的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;
        }
开发者ID:nirshandileep,项目名称:RHP,代码行数:32,代码来源:PhotoDAO.cs

示例2: 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);
        }
开发者ID:VAllens,项目名称:EntLibContrib.Data.Oracle.ManagedDataAccess,代码行数:14,代码来源:OracleDataSetHelper.cs

示例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;
        }
开发者ID:nirshandileep,项目名称:HotelManagement,代码行数:31,代码来源:CustomerDAO.cs

示例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;
 }
开发者ID:harvey-chennnnn,项目名称:Customs-,代码行数:7,代码来源:SQLServerUtiles.cs

示例5: 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);
            }
        }
开发者ID:alonsovb,项目名称:jazz-taller,代码行数:29,代码来源:RegistrosDAL.cs

示例6: 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;
        }
开发者ID:nirshandileep,项目名称:RHP,代码行数:33,代码来源:SchoolDAO.cs

示例7: 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;
        }
开发者ID:nirshandileep,项目名称:RHP,代码行数:27,代码来源:PartialUserDAO.cs

示例8: 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;
        }
开发者ID:nirshandileep,项目名称:RHP,代码行数:27,代码来源:PropertyOptionDAO.cs

示例9: 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;
 }
开发者ID:nirshandileep,项目名称:DairyManager,代码行数:7,代码来源:RoleDAO.cs

示例10: Update

        public bool Update(Spotlight spotlight, Database db, DbTransaction transaction)
        {
            DbCommand command = db.GetStoredProcCommand("usp_SpotlightUpdate");

            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, "UpdatedBy", DbType.Guid, spotlight.UpdatedBy);

            db.AddOutParameter(command, "UpdatedDate", DbType.DateTime, 30);

            db.ExecuteNonQuery(command, transaction);

            spotlight.CreatedDate = Convert.ToDateTime(db.GetParameterValue(command, "UpdatedDate").ToString());
            spotlight.UpdatedDate = spotlight.CreatedDate;

            return true;
        }
开发者ID:nirshandileep,项目名称:RHP,代码行数:26,代码来源:SpotlightDAO.cs

示例11: 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;
        }
开发者ID:nirshandileep,项目名称:RHP,代码行数:26,代码来源:StudentDAO.cs

示例12: 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();
            }
        }
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:30,代码来源:AutoGenerated.cs

示例13: 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;
        }
开发者ID:nirshandileep,项目名称:RHP,代码行数:25,代码来源:PropertyOptionItemDAO.cs

示例14: 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;
        }
开发者ID:nirshandileep,项目名称:RHP,代码行数:8,代码来源:OptionCategoryDAO.cs

示例15: 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;
        }
开发者ID:nirshandileep,项目名称:DairyManager,代码行数:12,代码来源:RoleDAO.cs


注:本文中的Microsoft.Practices.EnterpriseLibrary.Data.Database.GetStoredProcCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。