Пример #1
0
        public bool Delete(Subscribes subscribe)
        {
            QuaintDatabaseManager db = new QuaintDatabaseManager(true);

            try
            {
                bool flag = false;
                db.AddParameters("EmailId", subscribe.EmailId);
                int affectedRows = db.ExecuteNonQuery("Delete_Email", true);

                if (affectedRows > 0)
                {
                    flag = true;
                }

                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                db.Disconnect();
            }
        }
        private bool IsEmailExist(Subscribes subscribe)
        {
            try
            {
                DataTable dtList = GetAll();
                var       rows   = dtList.AsEnumerable().Where(x => ((string)x["Email"]).ToString() == subscribe.Email);
                DataTable dt     = rows.Any() ? rows.CopyToDataTable() : dtList.Clone();

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Subscribes subscribes = db.Subscribes.Find(id);

            db.Subscribes.Remove(subscribes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #4
0
 public int Subscriptions(Subscribes subscribes)
 {
     return(subscribes switch
     {
         Subscribes.Trades => subscribeTrades.Subscriptions,
         Subscribes.OrderBook => subscribeOrderBook.Subscriptions,
         Subscribes.Candlesticks => subscribeCandlesticks.Subscriptions,
         _ => throw new NotImplementedException($"{this.GetType().Name}.Subscriptions({subscribes})"),
     });
        public ActionResult Create([Bind(Include = "SubID,email")] Subscribes subscribes)
        {
            if (ModelState.IsValid)
            {
                db.Subscribes.Add(subscribes);
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }

            return(null);
        }
Пример #6
0
 public void Delete()
 {
     Images.Clear();
     Subscribes.Clear();
     PendingBooks.Clear();
     PendingFilms.Clear();
     PendingSerials.Clear();
     Selections.Clear();
     Privacy.Clear();
     IsDeleted = true;
 }
 public bool Delete(Subscribes subscribe)
 {
     try
     {
         SubscribeDAL subscribeDAL = new SubscribeDAL();
         return(subscribeDAL.Delete(subscribe));
     }
     catch (Exception)
     {
         throw;
     }
 }
        // GET: Subscribes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Subscribes subscribes = db.Subscribes.Find(id);

            if (subscribes == null)
            {
                return(HttpNotFound());
            }
            return(View(subscribes));
        }
        public async Task <ActionResult <Subscribes> > Subscribe(Subscribes dto)
        {
            var item = _entityService.DbContext.Subscribes.Where(t => t.Email == dto.Email.ToLower()).FirstOrDefault();

            if (item == null)
            {
                dto.Email          = dto.Email.ToLower();
                dto.InsertDateTime = DateTime.Now;
                _entityService.DbContext.Subscribes.Add(dto);
                await _entityService.DbContext.SaveChangesAsync();

                return(dto);
            }
            else
            {
                new AppException("This email has already been subscribed.");
                return(item);
            }
        }
        public bool Save(Subscribes subscribe)
        {
            try
            {
                SubscribeDAL subscribeDAL = new SubscribeDAL();

                if (IsEmailExist(subscribe))
                {
                    throw new Exception("Email already exist.");
                }
                else
                {
                    return(subscribeDAL.Save(subscribe));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #11
0
        protected void btnSubscribe_Click(object sender, EventArgs e)
        {
            try
            {
                QuaintLibraryManager lib = new QuaintLibraryManager();
                string email             = Convert.ToString(txtEmail.Text);

                SubscribeBLL subscribeBLL = new SubscribeBLL();
                Subscribes   subscribe    = new Subscribes();

                subscribe.EmailCode = this.ModelCode;
                subscribe.Email     = email;

                if (subscribeBLL.Save(subscribe))
                {
                    ClearFields();
                    GenerateCode();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #12
0
 public int Update(Subscribes t)
 {
     throw new NotImplementedException();
 }
Пример #13
0
 public int Subscriptions(Subscribes subscribe)
 {
     return(subscribeAccountInfo.Subscriptions);
 }
Пример #14
0
        private void LoadData(AccountPO entity)
        {
            if (entity != null)
            {
                this.FillFrom(entity);

                Avatars   = Utility.DataCache.AccountAvatars.CacheList(entity.Id);
                Contacts  = Utility.DataCache.AccountContacts.CacheList(entity.Id);
                Logs      = Utility.DataCache.AccountLog.CacheList(entity.Id);
                Messages  = Utility.DataCache.AccountMessages.CacheList(entity.Id);
                Notes     = Utility.DataCache.AccountNote.CacheList(entity.Id);
                Relations = Utility.DataCache.AccountRelation.CacheList(entity.Id);

                Styles = Utility.DataCache.DataStyle.CacheList(entity.Id);

                OrganizationRelations = Utility.DataCache.OrganizationMember.CacheList(0, entity.Id);

                Organizations = Utility.DataCache.Organization.CacheList()
                                .FindAll(o => OrganizationRelations.Any(x => x.OrganizationId == o.Id));

                Subscribes = Utility.DataCache.Subscribe.CacheList(entity.Id, 0);

                Projects = Utility.DataCache.Project.CacheList()
                           .FindAll(o => o.IsPublic || o.CreatorAccountId == entity.Id || Subscribes.Any(x => x.ProjectId == o.Id));
                Schedules = new List <SchedulePO>();
                foreach (var projectPo in Projects)
                {
                    Schedules.AddRange(Utility.DataCache.Schedule.CacheList(projectPo.Id));
                }
            }
            else
            {
                Avatars   = new List <AccountAvatarsPO>();
                Contacts  = new List <AccountContactsPO>();
                Logs      = new List <AccountLogPO>();
                Messages  = new List <AccountMessagesPO>();
                Notes     = new List <AccountNotePO>();
                Relations = new List <AccountRelationPO>();

                Styles = new List <DataStylePO>();

                OrganizationRelations = new List <OrganizationMemberPO>();
                Organizations         = new List <OrganizationPO>();
                Projects   = new List <ProjectPO>();
                Schedules  = new List <SchedulePO>();
                Subscribes = new List <SubscribePO>();
            }
        }
Пример #15
0
        private List <TimeDuration> GetDurations(SchedulePO schedule)
        {
            var subscribe = Subscribes.FindLast(o => o.ProjectId == schedule.ProjectId);
            var planStart = subscribe == null ? DateTime.Now : subscribe.CreateTime;
            var planEnd   = planStart.AddYears(1);

            var data = new List <TimeDuration>();

            switch (schedule.Cycle)
            {
            case 0:    //一次
                data.Add(new TimeDuration
                {
                    Begin = new DateTime(
                        schedule.BeginDate.Year,
                        schedule.BeginDate.Month,
                        schedule.BeginDate.Day,
                        schedule.BeginTime.Hour,
                        schedule.BeginTime.Minute,
                        schedule.BeginTime.Second
                        ),
                    End = new DateTime(
                        schedule.EndDate.Year,
                        schedule.EndDate.Month,
                        schedule.EndDate.Day,
                        schedule.EndTime.Hour,
                        schedule.EndTime.Minute,
                        schedule.EndTime.Second
                        )
                });
                break;

            case 1:    //每天
                var currentDay1 = planStart;
                while (currentDay1 <= planEnd)
                {
                    data.Add(new TimeDuration
                    {
                        Begin = new DateTime(
                            currentDay1.Year,
                            currentDay1.Month,
                            currentDay1.Day,
                            schedule.BeginTime.Hour,
                            schedule.BeginTime.Minute,
                            schedule.BeginTime.Second
                            ),
                        End = new DateTime(
                            currentDay1.Year,
                            currentDay1.Month,
                            currentDay1.Day,
                            schedule.EndTime.Hour,
                            schedule.EndTime.Minute,
                            schedule.EndTime.Second
                            )
                    });

                    currentDay1 = currentDay1.AddDays(1);
                }
                break;

            case 2:
                var currentDay2 = planStart;
                while (currentDay2 <= planEnd)
                {
                    var appendDay2 = false;
                    var d2         = new TimeDuration();

                    if ((int)currentDay2.DayOfWeek == schedule.BeginDay)
                    {
                        d2.Begin = new DateTime(
                            currentDay2.Year,
                            currentDay2.Month,
                            currentDay2.Day,
                            schedule.BeginTime.Hour,
                            schedule.BeginTime.Minute,
                            schedule.BeginTime.Second
                            );
                    }

                    if ((int)currentDay2.DayOfWeek == schedule.EndDay)
                    {
                        appendDay2 = true;
                        d2.End     = new DateTime(
                            currentDay2.Year,
                            currentDay2.Month,
                            currentDay2.Day,
                            schedule.EndTime.Hour,
                            schedule.EndTime.Minute,
                            schedule.EndTime.Second
                            );
                    }

                    currentDay2 = currentDay2.AddDays(1);
                    if (appendDay2)
                    {
                        data.Add(d2);
                    }
                }

                break;

            case 3:
                var currentDay3 = planStart;
                while (currentDay3 <= planEnd)
                {
                    var appendDay3 = false;
                    var d3         = new TimeDuration();

                    if (currentDay3.Day % 10 == schedule.BeginDay)
                    {
                        d3.Begin = new DateTime(
                            currentDay3.Year,
                            currentDay3.Month,
                            currentDay3.Day,
                            schedule.BeginTime.Hour,
                            schedule.BeginTime.Minute,
                            schedule.BeginTime.Second
                            );
                    }

                    if (currentDay3.Day % 10 == schedule.EndDay)
                    {
                        appendDay3 = true;
                        d3.End     = new DateTime(
                            currentDay3.Year,
                            currentDay3.Month,
                            currentDay3.Day,
                            schedule.EndTime.Hour,
                            schedule.EndTime.Minute,
                            schedule.EndTime.Second
                            );
                    }

                    currentDay3 = currentDay3.AddDays(1);
                    if (appendDay3)
                    {
                        data.Add(d3);
                    }
                }
                break;


            case 4:
                var currentDay4 = planStart;
                while (currentDay4 <= planEnd)
                {
                    var appendDay4 = false;
                    var d4         = new TimeDuration();

                    if (currentDay4.Day % 15 == schedule.BeginDay)
                    {
                        d4.Begin = new DateTime(
                            currentDay4.Year,
                            currentDay4.Month,
                            currentDay4.Day,
                            schedule.BeginTime.Hour,
                            schedule.BeginTime.Minute,
                            schedule.BeginTime.Second
                            );
                    }

                    if (currentDay4.Day % 15 == schedule.EndDay)
                    {
                        appendDay4 = true;
                        d4.End     = new DateTime(
                            currentDay4.Year,
                            currentDay4.Month,
                            currentDay4.Day,
                            schedule.EndTime.Hour,
                            schedule.EndTime.Minute,
                            schedule.EndTime.Second
                            );
                    }

                    currentDay4 = currentDay4.AddDays(1);
                    if (appendDay4)
                    {
                        data.Add(d4);
                    }
                }
                break;


            case 5:
                var currentDay5 = planStart;
                while (currentDay5 <= planEnd)
                {
                    var appendDay5 = false;
                    var d5         = new TimeDuration();

                    if (currentDay5.Day == schedule.BeginDay)
                    {
                        d5.Begin = new DateTime(
                            currentDay5.Year,
                            currentDay5.Month,
                            currentDay5.Day,
                            schedule.BeginTime.Hour,
                            schedule.BeginTime.Minute,
                            schedule.BeginTime.Second
                            );
                    }

                    if (currentDay5.Day == schedule.EndDay)
                    {
                        appendDay5 = true;
                        d5.End     = new DateTime(
                            currentDay5.Year,
                            currentDay5.Month,
                            currentDay5.Day,
                            schedule.EndTime.Hour,
                            schedule.EndTime.Minute,
                            schedule.EndTime.Second
                            );
                    }

                    currentDay5 = currentDay5.AddDays(1);
                    if (appendDay5)
                    {
                        data.Add(d5);
                    }
                }
                break;


            case 6:
                var currentDay6 = planStart;
                while (currentDay6 <= planEnd)
                {
                    var appendDay6 = false;
                    var d6         = new TimeDuration();

                    if (currentDay6.DayOfYear == schedule.BeginDay)
                    {
                        d6.Begin = new DateTime(
                            currentDay6.Year,
                            currentDay6.Month,
                            currentDay6.Day,
                            schedule.BeginTime.Hour,
                            schedule.BeginTime.Minute,
                            schedule.BeginTime.Second
                            );
                    }

                    if (currentDay6.DayOfYear == schedule.EndDay)
                    {
                        appendDay6 = true;
                        d6.End     = new DateTime(
                            currentDay6.Year,
                            currentDay6.Month,
                            currentDay6.Day,
                            schedule.EndTime.Hour,
                            schedule.EndTime.Minute,
                            schedule.EndTime.Second
                            );
                    }

                    currentDay6 = currentDay6.AddDays(1);
                    if (appendDay6)
                    {
                        data.Add(d6);
                    }
                }
                break;
            }

            return(data);
        }
Пример #16
0
 public int Subscriptions(Subscribes subscribe)
 {
     throw new System.NotImplementedException();
 }
Пример #17
0
        /// <summary>
        /// 订阅章节
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public int Add(Subscribes t)
        {
            var result = iSubscribes_DAL.Add(t);

            return(result);
        }