Example #1
0
        /// <summary>
        /// 通过登录名或邮箱获取登录信息
        /// </summary>
        /// <param name="mailName"></param>
        /// <param name="vt">条件类别</param>
        /// <returns></returns>
        public List<Membership> GetMemberByMailName(string checkName, ValidType vt)
        {
            MembershipDao md = new MembershipDao();
            Membership ms = new Membership();
            if (string.IsNullOrEmpty(checkName))
                return null;

            switch (vt)
            {
                case ValidType.All:
                    ms.Where = string.Format("LoweredLoginName = {0} OR LoweredEmail= {0}", checkName.ToLower());
                    break;
                case ValidType.Mail:
                    ms.Where = string.Format("LoweredEmail= {0}", checkName.ToLower());
                    break;
                case ValidType.LoginName:
                    ms.Where = string.Format("LoweredLoginName = {0}", checkName.ToLower());
                    break;
                default:
                    ms.Where = string.Format("LoweredLoginName = {0} OR LoweredEmail= {0}", checkName.ToLower());
                    break;
            }

            return md.Select(ms);
        }
Example #2
0
        private void cardSearchButton_Click(object sender, EventArgs e)
        {
            try
            {
                membershipDiscountReportDataGridView.DataSource = null;
                DataTable reportDataTable = new DataTable();
                MembershipDao aMembershipDao = new MembershipDao();
                reportDataTable = aMembershipDao.GetMembershipDiscountReport();

                string cardNumber = txtCode.Text;

                if (reportDataTable != null)
                {
                    DataTable selectedTable = reportDataTable.AsEnumerable()
                        .Where(r => r.Field<string>("CardNumber") == cardNumber)
                        .CopyToDataTable();

                    membershipDiscountReportDataGridView.DataSource = selectedTable;
                }
            }
            catch (Exception)
            {

            }
        }
Example #3
0
        /// <summary>
        /// 获取所有登录用户信息
        /// </summary>
        /// <param name="where">查询条件</param>
        /// <returns></returns>
        public List<Membership> GetAllMembers(string where)
        {
            MembershipDao md = new MembershipDao();
            Membership ms = new Membership();

            return md.Select(ms);
        }
Example #4
0
        /// <summary>
        /// 创建登录用户(注册)
        /// </summary>
        /// <param name="ms"></param>
        /// <returns></returns>
        public bool CreateMember(Membership ms)
        {
            MembershipDao md = new MembershipDao();
            if (md.Insert(ms) > 0)
                return true;

            return false;
        }
Example #5
0
        private void LoadMembershipDiscount()
        {
            try
            {
                DataTable reportDataTable = new DataTable();
                MembershipDao aMembershipDao = new MembershipDao();
                reportDataTable = aMembershipDao.GetMembershipDiscountReport();
                membershipDiscountReportDataGridView.DataSource = reportDataTable;
            }
            catch (Exception)
            {

            }
        }
Example #6
0
 /// <summary>
 /// 更新登录信息
 /// </summary>
 /// <param name="ms"></param>
 /// <returns></returns>
 public bool UpdatePassword(Membership ms)
 {
     MembershipDao md = new MembershipDao();
     return md.Update(ms) > 0;
 }
Example #7
0
        private void SearchMembership(int searchType)
        {
            if (searchType == 1)
            {
                if (txtMembershipCardName.Text == "" || txtMembershipCardName.Text.Length < 1)
                {
                    return;
                }
            }
            else if (searchType == 2)
            {
                if (txtCode.Text == "" || txtCode.Text.Length < 1)
                {
                    return;
                }
            }
            else if (searchType == 3)
            {
                if (txtCustomerName.Text == "" || txtCustomerName.Text.Length < 1)
                {
                    return;
                }
            }
            else if (searchType == 4)
            {
                if (txtPhoneNumber.Text == "" || txtPhoneNumber.Text.Length < 1)
                {
                    return;
                }
            }

            IMembershipDao membershipDao = new MembershipDao();

            try
            {
                List<Membership> membershipList = new List<Membership>();

                Membership membership = new Membership();

                if (searchType == 1)
                {
                    membershipList = membershipDao.GetMembershipByMembershipCardName(txtMembershipCardName.Text);
                }
                else if (searchType == 2)
                {
                    membership = membershipDao.GetMembershipByMembershipCardCode(txtCode.Text);
                    if (membership != null && membership.id>0)
                        membershipList.Add(membership);
                }
                else if (searchType == 2)
                {
                    membership = membershipDao.GetMembershipByCustomerPhone(txtPhoneNumber.Text);
                    if (membership != null && membership.id > 0)
                        membershipList.Add(membership);
                }

                if (membershipList.Count == 1)
                {
                    FillMembership(membershipList[0]);
                }
                else if (membershipList.Count > 1)
                {
                    CMemberShipForm objMemberShipForm = new CMemberShipForm();

                    objMemberShipForm.btnSelect.Visible = true;
                    objMemberShipForm.btnSelect.Location = new Point(654, 452);
                    objMemberShipForm.MembershipListData = membershipList;

                    objMemberShipForm.ISDialogBox = true;
                    objMemberShipForm.AddButton.Visible = false;
                    objMemberShipForm.UpdateButton.Visible = false;
                    objMemberShipForm.DeleteButton.Visible = false;

               //     CFormManager.Forms.Push(this);
              //      this.Hide();

                    objMemberShipForm.ShowDialog(this);

                    if (objMemberShipForm.DialogResult == DialogResult.OK)
                    {
                        FillMembership(objMemberShipForm.membershipData);

                    }
                }

                //CCustomerManager tempCustomerManager = new CCustomerManager();
                //CCustomerInfo tempCustomerInfo = new CCustomerInfo();
                //CResult oResult = tempCustomerManager.GetCustomerInfoByName(txtMembershipCardName.Text);
                //tempCustomerInfo = (CCustomerInfo)oResult.Data;
                //DataTable dtCustomerList = (DataTable)tempCustomerInfo.CustomerDataTable;
                //if (dtCustomerList.Rows.Count > 1)
                //{
                //    CustomerListForm objCustomerList = new CustomerListForm(dtCustomerList);
                //    objCustomerList.ShowDialog(this);
                //}
                //else if (dtCustomerList.Rows.Count == 1)
                //{
                //    string phoneNumber = dtCustomerList.Rows[0]["phone"].ToString();
                //    txtcDescription.Text = phoneNumber;
                //    btnSearchByPhone_Click(sender, e);
                //}
                //else
                //{
                //    MessageBox.Show("No customer has been found", RMSGlobal.MessageBoxTitle,
                //        MessageBoxButtons.OK, MessageBoxIcon.Information);
                //}

            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Example #8
0
        private void FinishButton_Click(object sender, EventArgs e)
        {
            IMembershipDao membershipDao = new MembershipDao();

            try
            {
                if (CheckEmpty())
                {
                    return;
                }

                if (isModify)
                {
                    membership = txtTitle.Tag as Membership;
                }
                else
                {
                    membership = new Membership();
                    membership.issueDate = System.DateTime.Now;
                }

                if (txtCustomerName.Tag != null)
                {
                    membership.customerID = (txtCustomerName.Tag as CCustomerInfo).CustomerID;
                }

                if (!isModify)
                {
                    if (txtCustomerName.Tag == null || membership.customerID == 0)
                    {
                        MessageBox.Show("Please select the customer");
                        return;
                    }
                }

                membership.customerName = txtCustomerName.Text;
                membership.customerPhone = txtPhoneNumber.Text;

                if (txtMembershipCardName.Tag != null)
                {
                    membership.mebershipCardID = (txtMembershipCardName.Tag as MembershipCard).id;
                }

                membership.membershipCardName = txtMembershipCardName.Text;
                membership.membershipCardType = cmbType.Text;
                membership.startDate = dtpStartDate.Value;
                membership.endDate = dtpEndDate.Value;

                membership.membershipCardTitle = txtTitle.Text;
                membership.membershipCardCode = txtCode.Text;

                membership.point = float.Parse(txtPoint.Text.ToString());
                membership.discountPercentRate = float.Parse(txtDiscountPercentRate.Text.ToString());

                if (rdbActive.Checked)
                {
                    membership.isActive = rdbActive.Checked;
                }
                else if (rdbInActive.Checked)
                {
                    membership.isActive = false;
                }

                if (isModify)
                {
                    membershipDao.UpdateMembership(membership);
                    MessageBox.Show("Membership  " + membership.id + " updated successfully");
                }
                else
                {
                    membershipDao.AddMembership(membership);
                    MessageBox.Show("Membership  " + membership.id + " created successfully");
                }

            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
                //Console.Write(exp.Message);
            }
        }