Пример #1
0
 public static bool AddBalance(BalanceDetailInfo balanceDetails)
 {
     if (null == balanceDetails)
     {
         return(false);
     }
     EventLogs.WriteOperationLog(Privilege.DistributorReCharge, string.Format(CultureInfo.InvariantCulture, "给分销商\"{0}\"添加预付款\"{1}\"", new object[] { balanceDetails.UserName, balanceDetails.Balance }));
     return(DistributorProvider.Instance().InsertBalanceDetail(balanceDetails, null));
 }
Пример #2
0
 public static DataTable GetDistributionProductSalesNoPage(SaleStatisticsQuery productSale, out int totalProductSales)
 {
     if (productSale == null)
     {
         totalProductSales = 0;
         return(null);
     }
     return(DistributorProvider.Instance().GetDistributionProductSalesNoPage(productSale, out totalProductSales));
 }
Пример #3
0
        public static bool DealDistributorBalanceDrawRequest(int userId, bool agree)
        {
            bool flag = DistributorProvider.Instance().DealDistributorBalanceDrawRequest(userId, agree);

            if (flag)
            {
                Users.ClearUserCache(Users.GetUser(userId));
            }
            return(flag);
        }
Пример #4
0
 public static bool AcceptDistributorRequest(Distributor distributor, IList <int> lineIds)
 {
     if (Users.UpdateUser(distributor))
     {
         DistributorProvider.Instance().AddDistributorProductLines(distributor.UserId, lineIds);
         EventLogs.WriteOperationLog(Privilege.DistributorRequests, string.Format(CultureInfo.InvariantCulture, "接受了用户名为 “{0}” 的分销商", new object[] { distributor.Username }));
         return(true);
     }
     return(false);
 }
Пример #5
0
        public static bool AddDistributorGrade(DistributorGradeInfo distributorGrade)
        {
            Globals.EntityCoding(distributorGrade, true);
            bool flag = DistributorProvider.Instance().AddDistributorGrade(distributorGrade);

            if (flag)
            {
                EventLogs.WriteOperationLog(Privilege.AddDistributorGrade, string.Format(CultureInfo.InvariantCulture, "添加了名为 “{0}” 的分销商等级", new object[] { distributorGrade.Name }));
            }
            return(flag);
        }
Пример #6
0
        public static bool Delete(int userId)
        {
            ManagerHelper.CheckPrivilege(Privilege.DeleteDistributor);
            IUser user = Users.GetUser(userId);
            bool  flag = DistributorProvider.Instance().Delete(userId);

            if (flag)
            {
                Users.ClearUserCache(user);
                EventLogs.WriteOperationLog(Privilege.DeleteDistributor, string.Format(CultureInfo.InvariantCulture, "终止了编号为 “{0}”的分销商的合作", new object[] { userId }));
            }
            return(flag);
        }
Пример #7
0
        public static bool AddSiteSettings(SiteSettings siteSettings, int requestId, int siteQty)
        {
            Database database = DatabaseFactory.CreateDatabase();
            bool     result;

            using (System.Data.Common.DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                System.Data.Common.DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    DistributorProvider distributorProvider = DistributorProvider.Instance();
                    if (!distributorProvider.AcceptSiteRequest(siteQty, requestId, dbTransaction))
                    {
                        dbTransaction.Rollback();
                        result = false;
                    }
                    else
                    {
                        if (!distributorProvider.AddSiteSettings(siteSettings, requestId, dbTransaction))
                        {
                            dbTransaction.Rollback();
                            result = false;
                        }
                        else
                        {
                            if (!DistributorProvider.Instance().AddInitData(siteSettings.UserId.Value, dbTransaction))
                            {
                                dbTransaction.Rollback();
                                result = false;
                            }
                            else
                            {
                                dbTransaction.Commit();
                                result = true;
                            }
                        }
                    }
                }
                catch
                {
                    dbTransaction.Rollback();
                    result = false;
                }
                finally
                {
                    dbConnection.Close();
                }
            }
            return(result);
        }
Пример #8
0
 public static System.Data.DataTable GetDistributionProductSalesNoPage(SaleStatisticsQuery productSale, out int totalProductSales)
 {
     System.Data.DataTable result;
     if (productSale == null)
     {
         totalProductSales = 0;
         result            = null;
     }
     else
     {
         result = DistributorProvider.Instance().GetDistributionProductSalesNoPage(productSale, out totalProductSales);
     }
     return(result);
 }
Пример #9
0
        public static bool UpdateDistributorGrade(DistributorGradeInfo distributorGrade)
        {
            Globals.EntityCoding(distributorGrade, true);
            bool result;

            if (result = DistributorProvider.Instance().UpdateDistributorGrade(distributorGrade))
            {
                EventLogs.WriteOperationLog(Privilege.EditDistributorGrade, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的分销商等级", new object[]
                {
                    distributorGrade.GradeId
                }));
            }
            return(result);
        }
Пример #10
0
        public static bool DeleteDistributorGrade(int gradeId)
        {
            ManagerHelper.CheckPrivilege(Privilege.DeleteDistributorGrade);
            bool flag = false;

            if (!DistributorProvider.Instance().ExistDistributor(gradeId))
            {
                flag = DistributorProvider.Instance().DeleteDistributorGrade(gradeId);
            }
            if (flag)
            {
                EventLogs.WriteOperationLog(Privilege.DeleteDistributorGrade, string.Format(CultureInfo.InvariantCulture, "删除了编号为 “{0}” 的分销商等级", new object[] { gradeId }));
            }
            return(flag);
        }
Пример #11
0
        public static bool AddBalance(BalanceDetailInfo balanceDetails, decimal addmoney)
        {
            bool result;

            if (null == balanceDetails)
            {
                result = false;
            }
            else
            {
                EventLogs.WriteOperationLog(Privilege.DistributorReCharge, string.Format(CultureInfo.InvariantCulture, "给分销商\"{0}\"添加预付款\"{1}\"", new object[]
                {
                    balanceDetails.UserName,
                    addmoney
                }));
                result = DistributorProvider.Instance().InsertBalanceDetail(balanceDetails, null);
            }
            return(result);
        }
Пример #12
0
        public static bool AddSiteSettings(SiteSettings siteSettings, int requestId, int siteQty)
        {
            bool flag;

            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    DistributorProvider provider = DistributorProvider.Instance();
                    if (!provider.AcceptSiteRequest(siteQty, requestId, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    if (!provider.AddSiteSettings(siteSettings, requestId, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    if (!DistributorProvider.Instance().AddInitData(siteSettings.UserId.Value, dbTran))
                    {
                        dbTran.Rollback();
                        return(false);
                    }
                    dbTran.Commit();
                    flag = true;
                }
                catch
                {
                    dbTran.Rollback();
                    flag = false;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(flag);
        }
Пример #13
0
 public static DbQueryResult GetDistributorBalanceDrawRequests(BalanceDrawRequestQuery query)
 {
     return(DistributorProvider.Instance().GetDistributorBalanceDrawRequests(query));
 }
Пример #14
0
 public static bool RefuseSiteRequest(int requestId, string reason)
 {
     return(DistributorProvider.Instance().RefuseSiteRequest(requestId, reason));
 }
Пример #15
0
 public static DistributorGradeInfo GetDistributorGradeInfo(int gradeId)
 {
     return(DistributorProvider.Instance().GetDistributorGradeInfo(gradeId));
 }
Пример #16
0
 public static decimal GetYearDistributionTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return(DistributorProvider.Instance().GetYearDistributionTotal(year, saleStatisticsType));
 }
Пример #17
0
 public static bool RefuseDistributorRequest(int userId)
 {
     return(DistributorProvider.Instance().Delete(userId));
 }
Пример #18
0
 public static IList <Distributor> GetDistributors()
 {
     return(DistributorProvider.Instance().GetDistributors());
 }
Пример #19
0
 public static SiteRequestInfo GetSiteRequestInfo(int requestId)
 {
     return(DistributorProvider.Instance().GetSiteRequestInfo(requestId));
 }
Пример #20
0
 public static DataTable GetDomainRequests(Pagination pagination, string name, out int total)
 {
     return(DistributorProvider.Instance().GetDomainRequests(pagination, name, out total));
 }
Пример #21
0
 public static DataTable GetMonthDistributionTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return(DistributorProvider.Instance().GetMonthDistributionTotal(year, saleStatisticsType));
 }
Пример #22
0
 public static OrderStatisticsInfo GetDistributorStatistics(SaleStatisticsQuery query, out int totalDistributors)
 {
     return(DistributorProvider.Instance().GetDistributorStatistics(query, out totalDistributors));
 }
Пример #23
0
 public static OrderStatisticsInfo GetDistributorStatisticsNoPage(SaleStatisticsQuery query)
 {
     return(DistributorProvider.Instance().GetDistributorStatisticsNoPage(query));
 }
Пример #24
0
 public static DataTable GetDistributorsNopage(IList <string> fields)
 {
     return(DistributorProvider.Instance().GetDistributorsNopage(fields));
 }
Пример #25
0
 public static DataTable GetDistributorGrades()
 {
     return(DistributorProvider.Instance().GetDistributorGrades());
 }
Пример #26
0
 public static DbQueryResult GetDistributors(DistributorQuery query)
 {
     return(DistributorProvider.Instance().GetDistributors(query));
 }
Пример #27
0
 public static bool AddDistributorProductLines(int userId, IList <int> lineIds)
 {
     return(DistributorProvider.Instance().AddDistributorProductLines(userId, lineIds));
 }
Пример #28
0
 public static OrderStatisticsInfo GetPurchaseOrdersNoPage(UserOrderQuery order)
 {
     return(DistributorProvider.Instance().GetPurchaseOrdersNoPage(order));
 }
Пример #29
0
 public static DataTable GetDistributorSites(Pagination pagination, string name, string trueName, out int total)
 {
     return(DistributorProvider.Instance().GetDistributorSites(pagination, name, trueName, out total));
 }
Пример #30
0
 public static IList <int> GetDistributorProductLines(int userId)
 {
     return(DistributorProvider.Instance().GetDistributorProductLines(userId));
 }