Пример #1
0
        public static MemberClientSet PopulateMemberClientSet(IDataReader reader)
        {
            if (reader == null)
            {
                return(null);
            }
            MemberClientSet set = new MemberClientSet {
                ClientTypeId = (int)reader["ClientTypeId"]
            };

            if (DateTime.Compare((DateTime)reader["StartTime"], Convert.ToDateTime("1900-01-01")) != 0)
            {
                set.StartTime = new DateTime?((DateTime)reader["StartTime"]);
            }
            if (DateTime.Compare((DateTime)reader["EndTime"], Convert.ToDateTime("1900-01-01")) != 0)
            {
                set.EndTime = new DateTime?((DateTime)reader["EndTime"]);
            }
            set.LastDay = (int)reader["LastDay"];
            if (reader["ClientChar"] != DBNull.Value)
            {
                set.ClientChar = (string)reader["ClientChar"];
            }
            set.ClientValue = (decimal)reader["ClientValue"];
            return(set);
        }
Пример #2
0
        protected void btnSaveClientSettings_Click(object sender, System.EventArgs e)
        {
            System.Collections.Generic.Dictionary <int, MemberClientSet> clientset = new System.Collections.Generic.Dictionary <int, MemberClientSet>();
            MemberClientSet set = new MemberClientSet();

            if (this.radnewtime.Checked)
            {
                set.ClientTypeId = 1;
                if (this.calendarStartDate.SelectedDate.HasValue)
                {
                    set.StartTime = new System.DateTime?(this.calendarStartDate.SelectedDate.Value);
                }
                if (this.calendarEndDate.SelectedDate.HasValue)
                {
                    set.EndTime = new System.DateTime?(this.calendarEndDate.SelectedDate.Value);
                }
            }
            else
            {
                set.ClientTypeId = 2;
                set.LastDay      = int.Parse(this.slsnewregist.Value);
            }
            clientset.Add(set.ClientTypeId, set);
            set = new MemberClientSet();
            if (this.radioactivyorder.Checked)
            {
                set.ClientTypeId = 6;
                set.LastDay      = int.Parse(this.slsactivyorder.Value);
                set.ClientChar   = this.slsactivyorderchar.Value;
                if (!string.IsNullOrEmpty(this.txtactivyorder.Value))
                {
                    set.ClientValue = decimal.Parse(this.txtactivyorder.Value);
                }
            }
            else
            {
                set.ClientTypeId = 7;
                set.LastDay      = int.Parse(this.slsactivymoney.Value);
                set.ClientChar   = this.slsactivymoneychar.Value;
                if (!string.IsNullOrEmpty(this.txtactivymoney.Value))
                {
                    set.ClientValue = decimal.Parse(this.txtactivymoney.Value);
                }
            }
            clientset.Add(set.ClientTypeId, set);
            set = new MemberClientSet
            {
                ClientTypeId = 11,
                LastDay      = int.Parse(this.slssleep.Value)
            };
            clientset.Add(set.ClientTypeId, set);
            if (MemberHelper.InsertClientSet(clientset))
            {
                this.ShowMsg("保存成功", true);
            }
            else
            {
                this.ShowMsg("保存失败", false);
            }
        }
Пример #3
0
 protected MemberQuery SetClient(MemberQuery query)
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["type"]))
     {
         System.Collections.Generic.Dictionary <int, MemberClientSet> memberClientSet = MemberHelper.GetMemberClientSet();
         int[] array = new int[memberClientSet.Count];
         memberClientSet.Keys.CopyTo(array, 0);
         if (memberClientSet.Count > 0)
         {
             MemberClientSet memberClientSet2 = new MemberClientSet();
             string          text             = base.Request.QueryString["type"];
             query.ClientType = text;
             string a;
             if ((a = text) != null)
             {
                 if (!(a == "new"))
                 {
                     if (a == "activy")
                     {
                         memberClientSet2  = memberClientSet[array[1]];
                         this.litType.Text = "活跃客户";
                         if (!(memberClientSet2.ClientValue > 0m))
                         {
                             return(query);
                         }
                         query.StartTime  = new System.DateTime?(System.DateTime.Now.AddDays((double)(-(double)memberClientSet2.LastDay)));
                         query.EndTime    = new System.DateTime?(System.DateTime.Now);
                         query.CharSymbol = memberClientSet2.ClientChar;
                         if (memberClientSet2.ClientTypeId == 6)
                         {
                             query.OrderNumber = new int?((int)memberClientSet2.ClientValue);
                             return(query);
                         }
                         query.OrderMoney = new decimal?(memberClientSet2.ClientValue);
                         return(query);
                     }
                 }
                 else
                 {
                     memberClientSet2  = memberClientSet[array[0]];
                     this.litType.Text = "新客户";
                     query.StartTime   = memberClientSet2.StartTime;
                     query.EndTime     = memberClientSet2.EndTime;
                     if (memberClientSet2.LastDay > 0)
                     {
                         query.StartTime = new System.DateTime?(System.DateTime.Now.AddDays((double)(-(double)memberClientSet2.LastDay)));
                         query.EndTime   = new System.DateTime?(System.DateTime.Now);
                         return(query);
                     }
                     return(query);
                 }
             }
             memberClientSet2  = memberClientSet[array[2]];
             this.litType.Text = "睡眠客户";
             query.StartTime   = new System.DateTime?(System.DateTime.Now.AddDays((double)(-(double)memberClientSet2.LastDay)));
             query.EndTime     = new System.DateTime?(System.DateTime.Now);
         }
     }
     return(query);
 }
Пример #4
0
        public override Dictionary <int, MemberClientSet> GetMemberClientSet()
        {
            Dictionary <int, MemberClientSet> dictionary = new Dictionary <int, MemberClientSet>();

            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_MemberClientSet");
            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (dataReader.Read())
                {
                    MemberClientSet memberClientSet = DataMapper.PopulateMemberClientSet(dataReader);
                    dictionary.Add(memberClientSet.ClientTypeId, memberClientSet);
                }
            }
            return(dictionary);
        }
Пример #5
0
        public Dictionary <int, MemberClientSet> GetMemberClientSet()
        {
            Dictionary <int, MemberClientSet> dictionary = new Dictionary <int, MemberClientSet>();
            DbCommand       sqlStringCommand             = this.database.GetSqlStringCommand("SELECT * FROM Hishop_MemberClientSet");
            MemberClientSet set = null;

            using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
            {
                while (reader.Read())
                {
                    set = DataMapper.PopulateMemberClientSet(reader);
                    dictionary.Add(set.ClientTypeId, set);
                }
            }
            return(dictionary);
        }
Пример #6
0
        protected MemberQuery SetClient(MemberQuery query)
        {
            Dictionary <int, MemberClientSet> memberClientSet;

            int[]           numArray;
            MemberClientSet set;

            if (!string.IsNullOrEmpty(base.Request.QueryString["type"]))
            {
                memberClientSet = MemberHelper.GetMemberClientSet();
                numArray        = new int[memberClientSet.Count];
                memberClientSet.Keys.CopyTo(numArray, 0);
                if (memberClientSet.Count <= 0)
                {
                    return(query);
                }
                set = new MemberClientSet();
                string str = base.Request.QueryString["type"];
                query.ClientType = str;
                string str2 = str;
                if (str2 == null)
                {
                    goto Label_01AC;
                }
                if (!(str2 == "new"))
                {
                    if (str2 == "activy")
                    {
                        set = memberClientSet[numArray[1]];
                        this.litType.Text = "活跃客户";
                        if (set.ClientValue > 0M)
                        {
                            query.StartTime  = new DateTime?(DateTime.Now.AddDays((double)-set.LastDay));
                            query.EndTime    = new DateTime?(DateTime.Now);
                            query.CharSymbol = set.ClientChar;
                            if (set.ClientTypeId == 6)
                            {
                                query.OrderNumber = new int?((int)set.ClientValue);
                                return(query);
                            }
                            query.OrderMoney = new decimal?(set.ClientValue);
                        }
                        return(query);
                    }
                    goto Label_01AC;
                }
                set = memberClientSet[numArray[0]];
                this.litType.Text = "新客户";
                query.StartTime   = set.StartTime;
                query.EndTime     = set.EndTime;
                if (set.LastDay > 0)
                {
                    query.StartTime = new DateTime?(DateTime.Now.AddDays((double)-set.LastDay));
                    query.EndTime   = new DateTime?(DateTime.Now);
                }
            }
            return(query);

Label_01AC:
            set = memberClientSet[numArray[2]];
            this.litType.Text = "睡眠客户";
            query.StartTime   = new DateTime?(DateTime.Now.AddDays((double)-set.LastDay));
            query.EndTime     = new DateTime?(DateTime.Now);
            return(query);
        }
Пример #7
0
        protected MemberQuery SetClient(MemberQuery query)
        {
            MemberQuery result;

            if (!string.IsNullOrEmpty(base.Request.QueryString["type"]))
            {
                System.Collections.Generic.Dictionary <int, MemberClientSet> memberClientSet = MemberHelper.GetMemberClientSet();
                int[] numArray = new int[memberClientSet.Count];
                memberClientSet.Keys.CopyTo(numArray, 0);
                if (memberClientSet.Count <= 0)
                {
                    result = query;
                    return(result);
                }
                MemberClientSet set = new MemberClientSet();
                string          str = base.Request.QueryString["type"];
                query.ClientType = str;
                string str2 = str;
                if (str2 != null)
                {
                    if (str2 == "new")
                    {
                        set = memberClientSet[numArray[0]];
                        this.litType.Text = "新客户";
                        query.StartTime   = set.StartTime;
                        query.EndTime     = set.EndTime;
                        if (set.LastDay > 0)
                        {
                            query.StartTime = new System.DateTime?(System.DateTime.Now.AddDays((double)(-(double)set.LastDay)));
                            query.EndTime   = new System.DateTime?(System.DateTime.Now);
                        }
                        goto IL_20F;
                    }
                    if (str2 == "activy")
                    {
                        set = memberClientSet[numArray[1]];
                        this.litType.Text = "活跃客户";
                        if (set.ClientValue > 0m)
                        {
                            query.StartTime  = new System.DateTime?(System.DateTime.Now.AddDays((double)(-(double)set.LastDay)));
                            query.EndTime    = new System.DateTime?(System.DateTime.Now);
                            query.CharSymbol = set.ClientChar;
                            if (set.ClientTypeId == 6)
                            {
                                query.OrderNumber = new int?((int)set.ClientValue);
                                result            = query;
                                return(result);
                            }
                            query.OrderMoney = new decimal?(set.ClientValue);
                        }
                        result = query;
                        return(result);
                    }
                }
                set = memberClientSet[numArray[2]];
                this.litType.Text = "睡眠客户";
                query.StartTime   = new System.DateTime?(System.DateTime.Now.AddDays((double)(-(double)set.LastDay)));
                query.EndTime     = new System.DateTime?(System.DateTime.Now);
                result            = query;
                return(result);
            }
IL_20F:
            result = query;
            return(result);
        }
Пример #8
0
        protected MemberQuery GetMemberQuery()
        {
            MemberQuery memberQuery = new MemberQuery();

            memberQuery.Username   = this.searchKey;
            memberQuery.Realname   = this.realName;
            memberQuery.GradeId    = this.rankId;
            memberQuery.PageIndex  = this.pager.PageIndex;
            memberQuery.IsApproved = this.approved;
            memberQuery.SortBy     = this.grdMemberList.SortOrderBy;
            memberQuery.PageSize   = this.pager.PageSize;
            if (this.grdMemberList.SortOrder.ToLower() == "desc")
            {
                memberQuery.SortOrder = SortAction.Desc;
            }
            if (!string.IsNullOrEmpty(base.Request.QueryString["type"]))
            {
                System.Collections.Generic.Dictionary <int, MemberClientSet> memberClientSet = MemberHelper.GetMemberClientSet();
                int[] array = new int[memberClientSet.Count];
                memberClientSet.Keys.CopyTo(array, 0);
                if (memberClientSet.Count > 0)
                {
                    MemberClientSet memberClientSet2 = new MemberClientSet();
                    string          text             = base.Request.QueryString["type"];
                    memberQuery.ClientType = text;
                    string a;
                    if ((a = text) != null)
                    {
                        if (!(a == "new"))
                        {
                            if (a == "activy")
                            {
                                memberClientSet2  = memberClientSet[array[1]];
                                this.litType.Text = "活跃客户";
                                if (!(memberClientSet2.ClientValue > 0m))
                                {
                                    return(memberQuery);
                                }
                                memberQuery.StartTime  = new System.DateTime?(System.DateTime.Now.AddDays((double)(-(double)memberClientSet2.LastDay)));
                                memberQuery.EndTime    = new System.DateTime?(System.DateTime.Now);
                                memberQuery.CharSymbol = memberClientSet2.ClientChar;
                                if (memberClientSet2.ClientTypeId == 6)
                                {
                                    memberQuery.OrderNumber = new int?(int.Parse(memberClientSet2.ClientValue.ToString()));
                                    return(memberQuery);
                                }
                                memberQuery.OrderMoney = new decimal?(memberClientSet2.ClientValue);
                                return(memberQuery);
                            }
                        }
                        else
                        {
                            memberClientSet2      = memberClientSet[array[0]];
                            this.litType.Text     = "新客户";
                            memberQuery.StartTime = memberClientSet2.StartTime;
                            memberQuery.EndTime   = memberClientSet2.EndTime;
                            if (memberClientSet2.LastDay > 0)
                            {
                                memberQuery.StartTime = new System.DateTime?(System.DateTime.Now.AddDays((double)(-(double)memberClientSet2.LastDay)));
                                memberQuery.EndTime   = new System.DateTime?(System.DateTime.Now);
                                return(memberQuery);
                            }
                            return(memberQuery);
                        }
                    }
                    memberClientSet2      = memberClientSet[array[2]];
                    this.litType.Text     = "睡眠客户";
                    memberQuery.StartTime = new System.DateTime?(System.DateTime.Now.AddDays((double)(-(double)memberClientSet2.LastDay)));
                    memberQuery.EndTime   = new System.DateTime?(System.DateTime.Now);
                }
            }
            return(memberQuery);
        }