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


C# Manager.OpenCbsCommand类代码示例

本文整理汇总了C#中OpenCBS.Manager.OpenCbsCommand的典型用法代码示例。如果您正苦于以下问题:C# OpenCbsCommand类的具体用法?C# OpenCbsCommand怎么用?C# OpenCbsCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OpenCbsCommand类属于OpenCBS.Manager命名空间,在下文中一共展示了OpenCbsCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteDatasFromTable

 protected void DeleteDatasFromTable(string tableName, SqlTransaction transaction)
 {
     const string deleteSql = "DELETE FROM {0}";
     string query = string.Format(deleteSql, tableName);
     using (OpenCbsCommand command = new OpenCbsCommand(query, transaction.Connection, transaction))
         command.ExecuteNonQuery();
 }
开发者ID:TalasZh,项目名称:opencbs,代码行数:7,代码来源:Manager.cs

示例2: AddUser

        public int AddUser(User pUser)
        {
            const string sqlText = @"INSERT INTO [Users] (
                                       [deleted],
                                       [role_code],
                                       [user_name],
                                       [user_pass],
                                       [first_name],
                                       [last_name],
                                       [mail],
                                       [sex],
                                       [phone])
                                     VALUES(
                                       @deleted,
                                       @roleCode,
                                       @username,
                                       @userpass,
                                       @firstname,
                                       @lastname,
                                       @mail,
                                       @sex,
                                       @phone)
                                     SELECT SCOPE_IDENTITY()";

            using (SqlConnection conn = GetConnection())
            using (OpenCbsCommand sqlCommand = new OpenCbsCommand(sqlText, conn))
            {
                sqlCommand.AddParam("@deleted", false);
                SetUser(sqlCommand, pUser);
                pUser.Id = int.Parse(sqlCommand.ExecuteScalar().ToString());
                SaveUsersRole(pUser.Id, pUser.UserRole.Id);
            }
            return pUser.Id;
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:34,代码来源:UserManager.cs

示例3: AddRole

        /// <summary>
        /// Add Role in database
        /// </summary>
        /// <param name="pRole"></param>
        /// <returns>Role id</returns>
        public int AddRole(Role pRole)
        {
            const string q = @"INSERT INTO [Roles]
                                     ([deleted], [code], [description], [role_of_loan], [role_of_saving], [role_of_teller])
                                     VALUES(@deleted, @code, @description, @role_of_loan, @role_of_saving, @role_of_teller)
                                     SELECT SCOPE_IDENTITY()";

            using (SqlConnection conn = GetConnection())
            {
                using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
                {
                    c.AddParam("@deleted", false);
                    c.AddParam("@code", pRole.RoleName);
                    c.AddParam("@description", pRole.Description);
                    c.AddParam("@role_of_loan", pRole.IsRoleForLoan);
                    c.AddParam("@role_of_saving", pRole.IsRoleForSaving);
                    c.AddParam("@role_of_teller", pRole.IsRoleForTeller);

                    pRole.Id = int.Parse(c.ExecuteScalar().ToString());
                    SaveRoleMenu(pRole);
                    SaveAllowedActionsForRole(pRole);
                }
            }
            return pRole.Id;
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:30,代码来源:RoleManager.cs

示例4: AddCollateralProduct

        /// <summary>
        /// Method to add a package into database. We use the NullableTypes to make the correspondance between
        /// nullable int, decimal and double types in database and our own objects
        /// </summary>
        /// <param name="colProduct">Package Object</param>
        /// <returns>The id of the package which has been added</returns>
        public int AddCollateralProduct(CollateralProduct colProduct)
        {
            string sqlText = @"INSERT INTO [CollateralProducts]
                                (
                                    [name]
                                    ,[desc]
                                    ,[deleted]
                                )
                                VALUES
                                (
                                    @name
                                    ,@desc
                                    ,@deleted
                                 )
                                 SELECT CONVERT(int, SCOPE_IDENTITY())";

            using (SqlConnection connection = GetConnection())
            using (OpenCbsCommand cmd = new OpenCbsCommand(sqlText, connection))
            {
                cmd.AddParam("@name", colProduct.Name);
                cmd.AddParam("@desc", colProduct.Description);
                cmd.AddParam("@deleted", colProduct.Delete);
                colProduct.Id = int.Parse(cmd.ExecuteScalar().ToString());
            }

            foreach (CollateralProperty collateralProperty in colProduct.Properties)
                AddCollateralProperty(colProduct.Id, collateralProperty);

            return colProduct.Id;
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:36,代码来源:CollateralProductManager.cs

示例5: RunSQL

 public void RunSQL(string sqlText, SqlTransaction tran)
 {
     using (OpenCbsCommand sqlCommand = new OpenCbsCommand(sqlText, tran.Connection, tran))
     {
         sqlCommand.ExecuteNonQuery();
     }
 }
开发者ID:TalasZh,项目名称:opencbs,代码行数:7,代码来源:SQLToolManager.cs

示例6: AddPicture

 /// <summary>
 /// Add a new picture in the database.<br/>
 /// If pName is null or empty, an automatic name will be generated.
 /// </summary>
 /// <param name="pGroup">Picture group</param>
 /// <param name="pId">Picture Id</param>
 /// <param name="pictureSubId">Picture subId</param>
 /// <param name="pPicture">PNG picture binary data</param>
 /// <param name="pThumbnail">PNG thumbnail picture binary data</param>
 /// <param name="pName">Picture name</param>
 /// <returns></returns>
 public int AddPicture(string pGroup, int pId, int pictureSubId, byte[] pPicture, byte[] pThumbnail, string pName)
 {
     // Find the first available subid
     List<int> subIds = GetPictureSubIds(pGroup, pId);
     int foundPlace = subIds.Count;
     for (int i = 0; i < subIds.Count; i++)
     {
         if (subIds[i] != i)
         {
             foundPlace = i;
             break;
         }
     }
     // Add row
     string q =
         @"INSERT INTO Pictures ([group], [id] ,[subid] ,[picture] ,[thumbnail] ,[name])
         VALUES (@group ,@id ,@subid ,@picture ,@thumbnail ,@name)";
     using (OpenCbsCommand c = new OpenCbsCommand(q, AttachmentsConnection))
     {
         c.AddParam("group", pGroup);
         c.AddParam("id", pId);
         c.AddParam("subid", pictureSubId);
         c.AddParam("picture", pPicture);
         c.AddParam("thumbnail", pThumbnail);
         if (pName.Length < 50)
             c.AddParam("name", pName);
         else
             c.AddParam("name", pName.Substring(0, 49));
         c.ExecuteNonQuery();
     }
     return foundPlace;
 }
开发者ID:aelhadi,项目名称:opencbs,代码行数:43,代码来源:PicturesManager.cs

示例7: DeleteInstallmentType

        public void DeleteInstallmentType(InstallmentType installmentType)
        {
            const string q = @"DELETE FROM [InstallmentTypes] WHERE id = @id";

            using (SqlConnection conn = GetConnection())
            using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
            {
                c.AddParam("@id", installmentType.Id);
                c.ExecuteNonQuery();
            }
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:11,代码来源:InstallmentTypeManager.cs

示例8: AddPublicHoliday

 public void AddPublicHoliday(DictionaryEntry entry)
 {
     const string sqlText = "INSERT INTO [PublicHolidays]([date], [name]) VALUES(@date, @name)";
     using(SqlConnection connection = GetConnection())
     using (OpenCbsCommand cmd = new OpenCbsCommand(sqlText, connection))
     {
         cmd.AddParam("@date",Convert.ToDateTime(entry.Key));
         cmd.AddParam("@name", entry.Value.ToString());
         cmd.ExecuteNonQuery();
     }
 }
开发者ID:aelhadi,项目名称:opencbs,代码行数:11,代码来源:NonWorkingDateManagement.cs

示例9: AddDistrict

 public int AddDistrict(District pDistrict)
 {
     const string q = "INSERT INTO [Districts]([name], [province_id],[deleted]) VALUES(@name,@provinceId,0) SELECT SCOPE_IDENTITY()";
     using (SqlConnection conn = GetConnection())
     using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
     {
         c.AddParam("@name", pDistrict.Name);
         c.AddParam("@provinceId", pDistrict.Province.Id);
         c.AddParam("@deleted", false);
         return int.Parse(c.ExecuteScalar().ToString());
     }
 }
开发者ID:aelhadi,项目名称:opencbs,代码行数:12,代码来源:LocationsManager.cs

示例10: AddInstallmentType

        public int AddInstallmentType(InstallmentType installmentType)
        {
            const string q = @"INSERT INTO [InstallmentTypes]([name], [nb_of_days], [nb_of_months])
                                     VALUES(@name, @days, @months) SELECT SCOPE_IDENTITY()";

            using (SqlConnection conn = GetConnection())
            using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
            {
                SetInstallmentType(c, installmentType);
                return int.Parse(c.ExecuteScalar().ToString());
            }
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:12,代码来源:InstallmentTypeManager.cs

示例11: AddCity

 public int AddCity(City pCity)
 {
     const string q = "INSERT INTO [City] ([name], [district_id],[deleted]) VALUES (@name,@district_id,0) SELECT SCOPE_IDENTITY()";
     using (SqlConnection conn = GetConnection())
     using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
     {
         c.AddParam("@name", pCity.Name);
         c.AddParam("@district_id", pCity.DistrictId);
         c.AddParam("@deleted", pCity.Deleted);
         return int.Parse(c.ExecuteScalar().ToString());
     }
 }
开发者ID:aelhadi,项目名称:opencbs,代码行数:12,代码来源:LocationsManager.cs

示例12: AddCollectionItem

 public void AddCollectionItem(int fieldId, string colItem)
 {
     string sqlListText = @"INSERT INTO [AdvancedFieldsCollections]
                             ([field_id], [value])
                            VALUES (@field_id, @col_item)";
     using (SqlConnection conn = GetConnection())
     using (OpenCbsCommand insertCmd = new OpenCbsCommand(sqlListText, conn))
     {
         insertCmd.AddParam("@field_id", fieldId);
         insertCmd.AddParam("@col_item", colItem);
         insertCmd.ExecuteNonQuery();
     }
 }
开发者ID:TalasZh,项目名称:opencbs,代码行数:13,代码来源:CustomizableFieldsManager.cs

示例13: EditInstallmentType

        public void EditInstallmentType(InstallmentType installmentType)
        {
            const string q = @"UPDATE [InstallmentTypes] SET [name] = @name, [nb_of_days] = @days, [nb_of_months] = @months
                                     WHERE id = @id";

            using (SqlConnection conn = GetConnection())
            using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
            {
                SetInstallmentType(c, installmentType);
                c.AddParam("@id", installmentType.Id);
                c.ExecuteNonQuery();
            }
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:13,代码来源:InstallmentTypeManager.cs

示例14: AddPaymentMethodToBranch

 public void AddPaymentMethodToBranch(PaymentMethod paymentMethod)
 {
     const string q =
         @"INSERT INTO LinkBranchesPaymentMethods (branch_id, payment_method_id, account_id)
                                     VALUES (@branch_id, @payment_method_id, @account_id)";
     using (SqlConnection conn = GetConnection())
     using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
     {
         c.AddParam("@branch_id", paymentMethod.Branch.Id);
         c.AddParam("@payment_method_id", paymentMethod.Id);
         c.AddParam("@account_id", paymentMethod.Account.Id);
         c.ExecuteNonQuery();
     }
 }
开发者ID:TalasZh,项目名称:opencbs,代码行数:14,代码来源:PaymentMethodManager.cs

示例15: CodeExists

 public bool CodeExists(int id, string code)
 {
     const string q =
         @"select count(*)
     from dbo.Branches
     where code = @code and id <> @id";
     using (SqlConnection conn = GetConnection())
     using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
     {
         c.AddParam("@id", id);
         c.AddParam("@code", code);
         return Convert.ToBoolean(c.ExecuteScalar());
     }
 }
开发者ID:TalasZh,项目名称:opencbs,代码行数:14,代码来源:BranchManager.cs


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