public MemberDto(MemberVO memberVO)
 {
     this.MemberId = memberVO.MemberId;
     this.LoginId = memberVO.LoginId;
     this.Password = memberVO.Password;
     this.Name = memberVO.Name;
     this.Company = memberVO.Company;
     this.CompanyNo = memberVO.CompanyNo;
     this.Dept = memberVO.Dept;
     this.JobTitle = memberVO.JobTitle;
     this.Phone = memberVO.Phone;
     this.Mobile = memberVO.Mobile;
     this.Fax = memberVO.Fax;
     this.Email = memberVO.Email;
     this.CreatedDate = memberVO.CreatedDate;
     this.UpdatedDate = memberVO.UpdatedDate;
     this.CreateIP = memberVO.CreateIP;
     this.Sex = memberVO.Sex;
     this.Status = memberVO.Status;
     this.UserConfirm = memberVO.UserConfirm;
     this.Token = memberVO.Token;
     this.ApplyDate = memberVO.ApplyDate;
     this.DueDate = memberVO.DueDate;
     this.Birthday = memberVO.Birthday;
     this.BirthdayYear = memberVO.BirthdayYear;
     this.BirthdayMonth = memberVO.BirthdayMonth;
     this.BirthdayDay = memberVO.BirthdayDay;
     this.Project = memberVO.Project;
     this.Product = memberVO.Product;
     this.PhoneSer = memberVO.PhoneSer;
     this.PhonePrice = memberVO.PhonePrice;
     this.PhoneSellPrice = memberVO.PhoneSellPrice;
     this.Commission = memberVO.Commission;
     this.ReturnCommission = memberVO.ReturnCommission;
     this.BreakMoney = memberVO.BreakMoney;
     this.Compensation = memberVO.Compensation;
     this.ContractMonths = memberVO.ContractMonths;
     this.Sales = memberVO.Sales;
     this.Note = memberVO.Note;
     this.WarrantySuppliers = memberVO.WarrantySuppliers;
     this.MobileWholesalers = memberVO.MobileWholesalers;
     this.ApplyDate2 = memberVO.ApplyDate2;
     this.PID = memberVO.PID;
     this.Store = memberVO.Store;
     this.OnlineWholesalers = memberVO.OnlineWholesalers;
     this.SimNo = memberVO.SimNo;
     this.Project1 = memberVO.Project1;
     this.Project2 = memberVO.Project2;
     this.Project3 = memberVO.Project3;
     this.GetCommission = memberVO.GetCommission;
     this.Prepayment = memberVO.Prepayment;
     this.SelfPrepayment = memberVO.SelfPrepayment;
     this.ServerId = memberVO.ServerId;
     this.NeedUpdate = memberVO.NeedUpdate;
     this.UpdateId = memberVO.UpdateId;
     this.CreatedBy = memberVO.CreatedBy;
     this.UpdatedBy = memberVO.UpdatedBy;
 }
    /// <summary>
    /// 發確認信給會員
    /// </summary>
    /// <param name="messageVO"></param>
    public void SendConfirmMail_ToMember(MemberVO memberVO)
    {
        try
        {
            SystemParamVO mailVO = m_SystemService.GetSystemParamByRoot();
            MailService mailService = new MailService(mailVO.MailSmtp, int.Parse(mailVO.MailPort), mailVO.EnableSSL, mailVO.Account, mailVO.Password);

            string mailTitle = "收到一封從網站的會員認證信。";
            string mailContent = GenMailContent(memberVO);

            mailService.SendMail(mailVO.SendEmail, memberVO.Email, mailTitle, mailContent);
        }
        catch (Exception ex)
        {
            m_Log.Error(ex);
        }
    }
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     MemberVO memberVO = new MemberVO();
     UIHelper.FillVO(pnlContent, memberVO);
     //postVO.PicFileName = m_PicFileName;
     memberVO.Status = "1";
     memberVO.CreateIP = m_HttpHelper.GetUserIp(Context);
     memberVO.NeedUpdate = true;
     memberVO.CreatedBy = m_SessionHelper.LoginUser.FullNameInChinese;
     memberVO.UpdatedBy = m_SessionHelper.LoginUser.FullNameInChinese;
     memberVO.CreatedDate = DateTime.Now;
     memberVO.UpdatedDate = DateTime.Now;
     memberVO = m_MemberService.CreateMember(memberVO);
     new Thread(new ThreadStart(ApiUtil.UpdateMemberToServer)).Start();
     m_WebLogService.AddSystemLog(MsgVO.Action.新增, memberVO);
     UpdateProductByPhoneSer(memberVO.MemberId);
     ClearUI();
     fillGridView();
 }
        private void FixTimeZone(MemberVO memberVO)
        {
            int addHours = m_ConfigHelper.AddHours;

            if (memberVO.ApplyDate.HasValue)
            {
                memberVO.ApplyDate = memberVO.ApplyDate.Value.AddHours(addHours);
            }
            if (memberVO.ApplyDate2.HasValue)
            {
                memberVO.ApplyDate2 = memberVO.ApplyDate2.Value.AddHours(addHours);
            }
            if (memberVO.DueDate.HasValue)
            {
                memberVO.DueDate = memberVO.DueDate.Value.AddHours(addHours);
            }
        }
        //// GET api/<controller>/5
        //public string Get(int id)
        //{
        //    return "value";
        //}
        // POST api/<controller>
        public HttpResponseMessage Post(MemberDto memberDto)
        {
            if (memberDto != null)
            {
                try
                {
                    MemberVO memberVO = null;

                    memberVO = new MemberVO(memberDto);
                    memberVO.MemberId = 0;
                    memberVO.ServerId = 0;
                    memberVO.NeedUpdate = false;
                    memberVO.UpdateId = "系統API";
                    FixTimeZone(memberVO);
                    memberVO = m_MemberService.CreateMember(memberVO);
                    memberVO.ServerId = memberVO.MemberId;

                    //檢查是否有ServerId 有的話把狀態改成刪除, 重新建立一筆
                    if (memberDto.ServerId != 0)
                    {
                        MemberVO oldMemberVO = m_MemberService.GetMemberById(memberDto.ServerId);
                        if (oldMemberVO != null)
                        {
                            oldMemberVO.NeedUpdate = false;
                            oldMemberVO.Status = "0";
                            oldMemberVO.UpdateId = "系統API";
                            m_MemberService.UpdateMember(oldMemberVO);

                            //檢查庫存有沒有關聯這個memberid, 有的話庫存要更新memberid
                            Dictionary<string, string> conditions = new Dictionary<string, string>();
                            conditions.Add("Flag", "1");
                            conditions.Add("NodeId", "2");
                            conditions.Add("MemberId", memberVO.MemberId.ToString());

                            if (m_PostService.GetPostCount(conditions) > 0)
                            {
                                conditions.Add("PageIndex", "0");
                                conditions.Add("PageSize", "1");
                                IList<PostVO> postVOList = m_PostService.GetPostList(conditions);
                                PostVO postVO = m_PostService.GetPostById(postVOList[0].PostId);
                                postVO.MemberId = memberVO.MemberId.ToString();
                                m_PostService.UpdatePost(postVO);
                            }
                        }
                    }

                    return Request.CreateResponse<MemberDto>(HttpStatusCode.Created, new MemberDto(memberVO));
                }
                catch (Exception ex)
                {
                    return Request.CreateResponse(HttpStatusCode.NoContent, ex.ToString());
                }
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.NoContent);
            }
        }
 private void CalculateFranchiseesCommission()
 {
     if (m_ConfigHelper.ShowFranchiseesCommission)
     {
         MemberVO memberVO = new MemberVO();
         UIHelper.FillVO(pnlContent, memberVO);
         lblCommissionToBoss.Text = memberVO.CommissionToBoss.ToString();
         lblFranchiseesCommission.Text = memberVO.FranchiseesCommission.ToString();
     }
 }
 /// <summary>
 /// 刪除會員
 /// </summary>
 /// <param name="member">被刪除的會員</param>
 public void DeleteMember(MemberVO member)
 {
     NHibernateDao.Delete(member);
 }
    private string GenMailContent(MemberVO memberVO)
    {
        StringBuilder sbContent = new StringBuilder();

        sbContent.Append(string.Format("時  間:{0}<br />", memberVO.CreatedDate.Value.ToString()));
        sbContent.Append(string.Format("姓  名:{0}<br />", memberVO.Name));
        sbContent.Append(string.Format("電  話:{0}<br />", memberVO.Phone));
        sbContent.Append(string.Format("性  別:{0}<br />", memberVO.Sex));
        sbContent.Append(string.Format("電子信箱:{0}<br />", memberVO.Email));
        sbContent.Append(string.Format("<a href='{0}/memberConfirm.aspx?id={1}&token={2}'>請點此連結完成會員認證</a>"
            , m_ConfigHelper.Host, memberVO.MemberId, memberVO.Token));

        return sbContent.ToString();
    }
 /// <summary>
 /// 會員
 /// </summary>
 /// <param name="member">被新增的會員</param>
 /// <returns>新增後的會員</returns>
 public MemberVO CreateMember(MemberVO member)
 {
     NHibernateDao.Insert(member);
     return member;
 }
        /// <summary>
        /// 更新會員
        /// </summary>
        /// <param name="member">被更新的會員</param>
        /// <returns>更新後的會員</returns>
        public MemberVO UpdateMember(MemberVO member)
        {
            NHibernateDao.Update(member);

            return member;
        }
 /// <summary>
 /// 刪除會員
 /// </summary>
 /// <param name="member">被刪除的會員</param>
 public void DeleteMember(MemberVO member)
 {
     MemberDao.DeleteMember(member);
 }
 /// <summary>
 /// 會員
 /// </summary>
 /// <param name="member">被新增的會員</param>
 /// <returns>新增後的會員</returns>
 public MemberVO CreateMember(MemberVO member)
 {
     return MemberDao.CreateMember(member);
 }
 /// <summary>
 /// 更新會員
 /// </summary>
 /// <param name="member">被更新的會員</param>
 /// <returns>更新後的會員</returns>
 public MemberVO UpdateMember(MemberVO member)
 {
     return MemberDao.UpdateMember(member);
 }