Beispiel #1
0
        public void SendOrder()
        {
            ////查是否有舊有的
            EpaperEmail existEpaperEmail = m_FTISService.GetEpaperEmailByEmail(this.Email);

            this.Status = this.UserStatus;
            if ("1".Equals(this.UserStatus))
            {
                ////訂閱
                if (existEpaperEmail == null)
                {
                    Insert();
                }
                else
                {
                    EntityId = existEpaperEmail.EpaperEmailId;
                    Save(existEpaperEmail);
                }
            }
            else if ("0".Equals(this.UserStatus))
            {
                ////退閱
                if (existEpaperEmail != null)
                {
                    existEpaperEmail.Status  = this.Status;
                    existEpaperEmail.RegDate = DateTime.Now;
                    m_FTISService.UpdateEpaperEmail(existEpaperEmail);
                }
            }
            this.SendOrderOk = true;
        }
Beispiel #2
0
        private void Save(EpaperEmail entity)
        {
            entity.Name    = Name;
            entity.Status  = Status;
            entity.RegDate = DateTime.Now;

            if (InTypeList != null && InTypeList.Count() > 0)
            {
                entity.InType = String.Join(", ", InTypeList);
            }
            else
            {
                entity.InType = string.Empty;
            }
            entity.Company = Company;
            entity.Email   = Email;
            entity.Sex     = Sex;
            entity.ReceiveOtherFreeInfo = ReceiveOtherFreeInfo;

            if (entity.EpaperEmailId == 0)
            {
                m_FTISService.CreateEpaperEmail(entity);
            }
            else
            {
                m_FTISService.UpdateEpaperEmail(entity);
            }

            LoadEntity(entity.EpaperEmailId);
        }
Beispiel #3
0
 protected void LoadEntity(EpaperEmail entity)
 {
     if (entity != null)
     {
         EntityId             = entity.EpaperEmailId;
         Name                 = entity.Name;
         Status               = entity.Status;
         RegDate              = entity.RegDate;
         InType               = entity.InType;
         Company              = entity.Company;
         Email                = entity.Email;
         Sex                  = entity.Sex;
         ReceiveOtherFreeInfo = entity.ReceiveOtherFreeInfo;
     }
 }
Beispiel #4
0
        public ActionResult Delete(int id)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                EpaperEmail entity = m_FTISService.GetEpaperEmailById(id);

                m_FTISService.DeleteEpaperEmail(entity);

                result.ErrorCode = AjaxResultStatus.Success;
                result.Message   = string.Format("{0}刪除成功", entity.Name);
            }
            catch (Exception ex)
            {
                result.ErrorCode = AjaxResultStatus.Exception;
                result.Message   = ex.Message;
            }

            return(this.Json(result));
        }
Beispiel #5
0
        public ActionResult MultiDelete(string allId)
        {
            AjaxResult    result = new AjaxResult(AjaxResultStatus.Success, string.Empty);
            StringBuilder sbMsg  = new StringBuilder();

            string[] ids = allId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string id in ids)
            {
                try
                {
                    EpaperEmail entity = m_FTISService.GetEpaperEmailById(Convert.ToInt32(id));
                    m_FTISService.DeleteEpaperEmail(entity);
                }
                catch (Exception ex)
                {
                    result.ErrorCode = AjaxResultStatus.Fail;
                    sbMsg.AppendFormat(ex.Message + "<br/>");
                }
            }

            result.Message = sbMsg.ToString();
            return(this.Json(result));
        }
Beispiel #6
0
        protected void LoadEntity(int id)
        {
            EpaperEmail entity = m_FTISService.GetEpaperEmailById(id);

            LoadEntity(entity);
        }
Beispiel #7
0
        public void Update()
        {
            EpaperEmail entity = m_FTISService.GetEpaperEmailById(EntityId);

            Save(entity);
        }
Beispiel #8
0
        public void Insert()
        {
            EpaperEmail entity = new EpaperEmail();

            Save(entity);
        }