⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientdelete.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.SqlServerDal.Crm
{
    using PowerEasy.Common;
    using PowerEasy.IDal.Crm;
    using PowerEasy.SqlServerDal;
    using System;
    using System.Collections.Generic;
    using System.Data;

    public class ClientDelete : IClientDelete
    {
        public bool DelBankrollItem(int clientId)
        {
            return Delete("PE_BankrollItem", clientId);
        }

        public bool DelBankrollItem(string userName)
        {
            return Delete("PE_BankrollItem", userName);
        }

        public bool DelCompany(int clientId)
        {
            return Delete("PE_Company", clientId);
        }

        public bool DelComplainItem(int clientId)
        {
            return Delete("PE_ComplainItem", clientId);
        }

        public bool DelContacter(int clientId)
        {
            return Delete("PE_Contacter", clientId);
        }

        public bool DelContacter(string userName)
        {
            return Delete("PE_Contacter", userName);
        }

        private static bool Delete(string tableName, int clientId)
        {
            return DBHelper.ExecuteSql("delete from " + tableName + " where ClientID=@ClientID", new Parameters("@ClientID", DbType.Int32, clientId));
        }

        private static bool Delete(string tableName, string userName)
        {
            return DBHelper.ExecuteSql("delete from " + tableName + " where UserName=@UserName", new Parameters("@UserName", DbType.String, userName));
        }

        public bool DelOrder(int clientId)
        {
            return Delete("PE_Orders", clientId);
        }

        public bool DelOrder(string userName)
        {
            return Delete("PE_Orders", userName);
        }

        public bool DelOrderItem(int orderId)
        {
            return DBHelper.ExecuteSql("delete from PE_OrderItem where OrderID = @OrderID", new Parameters("@OrderID", DbType.Int32, orderId));
        }

        public bool DelPaymentLog(string userName)
        {
            return Delete("PE_PaymentLog", userName);
        }

        public bool DelPointLog(string userName)
        {
            return Delete("PE_PointLog", userName);
        }

        public bool DelServiceItem(int clientId)
        {
            return Delete("PE_ServiceItem", clientId);
        }

        public bool DelUser(int clientId)
        {
            return Delete("PE_Users", clientId);
        }

        public bool DelValidLog(string userName)
        {
            return Delete("PE_ValidLog", userName);
        }

        public int GetBankrollItemCount(int clientId)
        {
            return GetCount("PE_BankrollItem", clientId);
        }

        public int GetComplainItemCount(int clientId)
        {
            return GetCount("PE_ComplainItem", clientId);
        }

        private static int GetCount(string tableName, int clientId)
        {
            return DataConverter.CLng(DBHelper.ExecuteScalarSql("select count(0) from " + tableName + " where ClientID=@ClientID", new Parameters("@ClientID", DbType.Int32, clientId)));
        }

        public int GetOrderCount(int clientId)
        {
            return GetCount("PE_Orders", clientId);
        }

        public IList<int> GetOrderId(string userName)
        {
            IList<int> list = new List<int>();
            using (NullableDataReader reader = DBHelper.ExecuteReaderSql("select OrderID from PE_Orders where UserName = @UserName", new Parameters("@UserName", DbType.String, userName)))
            {
                while (reader.Read())
                {
                    list.Add(reader.GetInt32("OrderID"));
                }
            }
            return list;
        }

        public int GetServiceItemCount(int clientId)
        {
            return GetCount("PE_ServiceItem", clientId);
        }

        public IDictionary<int, string> GetUserIdByClientId(int clientId)
        {
            IDictionary<int, string> dictionary = new Dictionary<int, string>();
            using (NullableDataReader reader = DBHelper.ExecuteReaderSql("select UserID,UserName from PE_Users where ClientID=@ClientID", new Parameters("@ClientID", DbType.Int32, clientId)))
            {
                if (reader.Read())
                {
                    dictionary.Add(reader.GetInt32("UserID"), reader.GetString("UserName"));
                }
            }
            return dictionary;
        }

        private static bool Update(string tableName, int clientId)
        {
            return DBHelper.ExecuteSql("update " + tableName + " set ClientID=0 where ClientID=@ClientID", new Parameters("@ClientID", DbType.Int32, clientId));
        }

        public bool UpdateBankrollItem(int clientId)
        {
            return Update("PE_BankrollItem", clientId);
        }

        public bool UpdateCompany(int clientId)
        {
            return Update("PE_Company", clientId);
        }

        public bool UpdateContacter(int clientId)
        {
            return Update("PE_Contacter", clientId);
        }

        public bool UpdateUser(int clientId)
        {
            return Update("PE_Users", clientId);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -