コード例 #1
0
 private void FillData(CustomerLevelInfo entity)
 {
     entity.Name = txtName.Value;
     entity.Drtday = DataConvert.SafeInt(txtDrtday.Value);
     entity.Alarmday = DataConvert.SafeInt(txtAlarmday.Value);
     entity.CorporationID = GetInt("corpid");
 }
コード例 #2
0
ファイル: CustomerLevels.cs プロジェクト: shaohaiou/comopp
        public CustomerLevelInfo GetModel(int id, bool fromCache = false)
        {
            CustomerLevelInfo entity = null;

            List <CustomerLevelInfo> list = GetList(fromCache);

            entity = list.Find(c => c.ID == id);

            return(entity);
        }
コード例 #3
0
ファイル: CustomerLevels.cs プロジェクト: shaohaiou/comopp
        public string GetName(int id)
        {
            CustomerLevelInfo entity = GetModel(id, true);

            if (entity == null)
            {
                return(string.Empty);
            }
            return(entity.Name);
        }
コード例 #4
0
        public static CustomerLevelInfo PopulateCustomerLevelInfo(IDataReader reader)
        {
            CustomerLevelInfo entity = new CustomerLevelInfo()
            {
                ID            = (int)reader["ID"],
                Name          = reader["Name"] as string,
                Drtday        = (int)reader["Drtday"],
                Alarmday      = (int)reader["Alarmday"],
                CorporationID = (int)reader["CorporationID"],
                Sort          = DataConvert.SafeInt(reader["Sort"])
            };

            return(entity);
        }
コード例 #5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            CustomerLevelInfo entity = new CustomerLevelInfo();
            int id = GetInt("id");
            if (id > 0) entity = CustomerLevels.Instance.GetModel(id, true);
            FillData(entity);

            if (id > 0) CustomerLevels.Instance.Update(entity);
            else CustomerLevels.Instance.Add(entity);

            CustomerLevels.Instance.ReloadCustomerLevelListCache();

            Response.Redirect(string.IsNullOrEmpty(FromUrl) ? "customerlevelmg.aspx" : FromUrl);
        }
コード例 #6
0
        private void LoadData()
        {
            int id = GetInt("id");
            if (id > 0)
            {
                CurrentCustomerLevel = CustomerLevels.Instance.GetModel(id);
                if (CurrentCustomerLevel == null)
                    WriteMessage("/message.aspx", "系统提示", "无效客户等级!", "", "/index.aspx");
                else
                {
                    if (!Admin.Administrator && Admin.CorporationID != CurrentCustomerLevel.CorporationID)
                        WriteMessage("/message.aspx", "系统提示", "没有权限!", "", "/index.aspx");

                    txtName.Value = CurrentCustomerLevel.Name;
                    txtDrtday.Value = CurrentCustomerLevel.Drtday.ToString();
                    txtAlarmday.Value = CurrentCustomerLevel.Alarmday.ToString();
                }
            }
        }
コード例 #7
0
 public abstract void UpdateCustomerLevel(CustomerLevelInfo entity);
コード例 #8
0
 public abstract void AddCustomerLevel(CustomerLevelInfo entity);
コード例 #9
0
 public override void AddCustomerLevel(CustomerLevelInfo entity)
 {
     string sql = @"INSERT INTO ComOpp_CustomerLevel(
         [Name]
         ,[CorporationID]
         ,[Drtday]
         ,[Alarmday]
         ,[Sort]
     )VALUES(
         @Name
         ,@CorporationID
         ,@Drtday
         ,@Alarmday
         ,(SELECT ISNULL(MAX([Sort]),0) + 1 FROM ComOpp_CustomerLevel WHERE [CorporationID] = @CorporationID)
     )";
     SqlParameter[] p =
     {
         new SqlParameter("@Name",entity.Name),
         new SqlParameter("@CorporationID",entity.CorporationID),
         new SqlParameter("@Drtday",entity.Drtday),
         new SqlParameter("@Alarmday",entity.Alarmday)
     };
     SqlHelper.ExecuteNonQuery(_con, CommandType.Text, sql, p);
 }
コード例 #10
0
 public override void UpdateCustomerLevel(CustomerLevelInfo entity)
 {
     string sql = @"
     UPDATE ComOpp_CustomerLevel set
         Name = @Name
         ,Drtday = @Drtday
         ,Alarmday = @Alarmday
     WHERE ID=@ID";
     SqlParameter[] parameters =
     {
         new SqlParameter("@ID", entity.ID),
         new SqlParameter("@Name", entity.Name),
         new SqlParameter("@Drtday", entity.Drtday),
         new SqlParameter("@Alarmday", entity.Alarmday)
     };
     SqlHelper.ExecuteNonQuery(_con, CommandType.Text, sql, parameters);
 }
コード例 #11
0
 public abstract void UpdateCustomerLevel(CustomerLevelInfo entity);
コード例 #12
0
 public abstract void AddCustomerLevel(CustomerLevelInfo entity);
コード例 #13
0
        public static CustomerLevelInfo PopulateCustomerLevelInfo(IDataReader reader)
        {
            CustomerLevelInfo entity = new CustomerLevelInfo()
            {
                ID = (int)reader["ID"],
                Name = reader["Name"] as string,
                Drtday = (int)reader["Drtday"],
                Alarmday = (int)reader["Alarmday"],
                CorporationID = (int)reader["CorporationID"],
                Sort = DataConvert.SafeInt(reader["Sort"])
            };

            return entity;
        }
コード例 #14
0
ファイル: CustomerLevels.cs プロジェクト: shaohaiou/comopp
 public void Add(CustomerLevelInfo entity)
 {
     CommonDataProvider.Instance().AddCustomerLevel(entity);
 }
コード例 #15
0
ファイル: CustomerLevels.cs プロジェクト: shaohaiou/comopp
 public void Update(CustomerLevelInfo entity)
 {
     CommonDataProvider.Instance().UpdateCustomerLevel(entity);
 }
コード例 #16
0
ファイル: CustomerLevels.cs プロジェクト: shaohaiou/comopp
 public void Add(CustomerLevelInfo entity)
 {
     CommonDataProvider.Instance().AddCustomerLevel(entity);
 }
コード例 #17
0
ファイル: Customers.cs プロジェクト: shaohaiou/comopp
        /// <summary>
        /// 客户降级(每天凌晨1点5分开始执行)
        /// </summary>
        public void CustomerDegrade()
        {
            if (DateTime.Now.Hour == 1 && DateTime.Now.Minute == 5)
            {
                if (!hasruncustomerdegrade)
                {
                    hasruncustomerdegrade = true;
                    try
                    {
                        EventLogs.JobLog("开始作业-客户降级");
                        List <CorporationInfo> list = Corporations.Instance.GetList(true);
                        foreach (CorporationInfo corpinfo in list)
                        {
                            bool hasdeeldata = false;
                            List <CustomerInfo>      clist     = GetCustomerListByCorporation(corpinfo.ID, true);
                            List <CustomerLevelInfo> levellist = CustomerLevels.Instance.GetListByCorpid(corpinfo.ID, true);

                            foreach (CustomerInfo cinfo in clist)
                            {
                                if (cinfo.LastCustomerLevelID > 0)
                                {
                                    CustomerLevelInfo level    = CustomerLevels.Instance.GetModel(cinfo.LastCustomerLevelID, true);
                                    InfoTypeInfo      infotype = InfoTypes.Instance.GetModel(cinfo.InfoTypeID);

                                    //如果已经是最低一级则不处理
                                    if (levellist.FindIndex(l => l.ID == cinfo.LastCustomerLevelID) == levellist.Count - 1)
                                    {
                                        continue;
                                    }

                                    if (level != null && level.Drtday > 0)
                                    {
                                        DateTime lastconnecttime = DateTime.Now;
                                        if (DateTime.TryParse(cinfo.LastConnectTime, out lastconnecttime))
                                        {
                                            if (infotype != null && infotype.Locked == 1)
                                            {
                                                double days = DateTime.Now.Subtract(lastconnecttime).TotalDays;
                                                //锁定级别判断
                                                if (infotype.Locklevel.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Contains(level.ID.ToString()))
                                                {
                                                    if (days <= infotype.Lockday)
                                                    {
                                                        continue;
                                                    }
                                                }

                                                //做降级处理
                                                if (days > level.Drtday)
                                                {
                                                    SetCustomerLevel(cinfo.ID, levellist[levellist.FindIndex(l => l.ID == cinfo.LastCustomerLevelID) + 1].ID);

                                                    hasdeeldata = true;
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            if (hasdeeldata)
                            {
                                ReloadCustomerListByCorporationCache(corpinfo.ID);
                            }
                        }
                        EventLogs.JobLog("完成作业-客户降级");
                    }
                    catch (Exception ex)
                    {
                        EventLogs.JobError("作业发生错误-客户降级", EventLogs.EVENTID_JOB_ERROR, 0, ex);
                        ExpLog.Write(ex);
                    }
                }
            }
            else
            {
                hasruncustomerdegrade = false;
            }
        }
コード例 #18
0
ファイル: CustomerLevels.cs プロジェクト: shaohaiou/comopp
 public void Update(CustomerLevelInfo entity)
 {
     CommonDataProvider.Instance().UpdateCustomerLevel(entity);
 }