Ejemplo n.º 1
0
        //设置会员卡参数
        private void set_status()
        {
            memberId.Text = m_Member.CI_CardNo;
            name.Text     = m_Member.CI_Name;
            phone.Text    = m_Member.CI_Telephone;
            type.Text     = db.MemberType.FirstOrDefault(x => x.id == m_Member.CI_CardTypeNo).name;

            var    cc    = db.CardCharge.Where(x => x.CC_CardNo == m_Member.CI_CardNo);
            double debit = BathClass.ToInt(cc.Sum(x => x.CC_DebitSum));
            double lend  = BathClass.ToInt(cc.Sum(x => x.CC_LenderSum));

            balance.Text = (debit - lend).ToString();

            var c  = BathClass.ToInt(m_Member.CI_CreditsUsed);
            var cu = BathClass.ToInt(db.MemberSetting.FirstOrDefault().money);
            int cs = (int)(lend / cu - c);

            credits.Text = cs.ToString();

            if (m_Member.state != "挂失")
            {
                btnOk.Text = "挂失";
            }
            else
            {
                btnOk.Text = "启用";
            }
        }
Ejemplo n.º 2
0
 //构造函数
 public PayForm(List <HotelRoom> seats, List <bool> keeps, CardInfo member, double discount_money)
 {
     db           = new BathDBDataContext(LogIn.connectionString);
     m_wipe_limit = BathClass.ToInt(db.Options.FirstOrDefault().抹零限制);
     m_Seats.AddRange(db.HotelRoom.Where(x => seats.Contains(x)));
     m_keeps            = new List <bool>(keeps);
     m_promotion_Member = member;
     m_discount_money   = discount_money;
     InitializeComponent();
 }
Ejemplo n.º 3
0
        //获取会员卡
        private void get_member()
        {
            string card_data    = "";
            string company_code = db.Options.FirstOrDefault().companyCode;

            bool st       = false;
            var  cardType = db.MemberSetting.FirstOrDefault().cardType;

            if (cardType == "SLE4442")
            {
                st = ICCard.read_data_4442(company_code, ref card_data);
            }
            else if (cardType == "M1")
            {
                st = ICCard.read_data_M1(company_code, ref card_data);
            }
            if (!st)
            {
                return;
            }

            m_member = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == card_data);
            //m_member = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == "05302");
            if (m_member == null)
            {
                BathClass.printErrorMsg("非本公司卡!");
                return;
            }

            id.Text    = m_member.CI_CardNo;
            name.Text  = m_member.CI_Name;
            phone.Text = m_member.CI_Telephone;
            var t = db.MemberType.FirstOrDefault(x => x.id == m_member.CI_CardTypeNo);

            if (t != null)
            {
                memberType.Text = t.name;
            }

            var    cc    = db.CardCharge.Where(x => x.CC_CardNo == m_member.CI_CardNo);
            double debit = BathClass.ToInt(cc.Sum(x => x.CC_DebitSum));
            double lend  = BathClass.ToInt(cc.Sum(x => x.CC_LenderSum));

            balance.Text = (debit - lend).ToString();

            var c  = BathClass.ToInt(m_member.CI_CreditsUsed);
            var cu = BathClass.ToInt(db.MemberSetting.FirstOrDefault().money);
            int cs = (int)(lend / cu - c);

            credits.Text = cs.ToString();
            btnOk.Text   = "会员打折";
        }
Ejemplo n.º 4
0
        //补卡
        private bool resumCard()
        {
            var    cc_new = db.CardCharge.Where(x => x.CC_CardNo == id.Text);
            double debit  = BathClass.ToInt(cc_new.Sum(x => x.CC_DebitSum));
            double lend   = BathClass.ToInt(cc_new.Sum(x => x.CC_LenderSum));

            if (BathClass.printAskMsg("卡号:" + id.Text + "已有金额:" + (debit - lend).ToString() + "元,确认补卡?") != DialogResult.OK)
            {
                return(false);
            }

            var cc = db.CardCharge.Where(x => x.CC_CardNo == m_Member.CI_CardNo);

            foreach (var c in cc)
            {
                c.CC_CardNo = id.Text;
            }

            var ci = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == id.Text);

            bool newCi = false;

            if (ci == null)
            {
                newCi        = true;
                ci           = new CardInfo();
                ci.CI_CardNo = id.Text;//前台发卡
            }

            ci.CI_CardTypeNo       = m_Member.CI_CardTypeNo;
            ci.CI_Name             = m_Member.CI_Name;
            ci.CI_Sexno            = m_Member.CI_Sexno;
            ci.CI_SendCardDate     = m_Member.CI_SendCardDate;
            ci.CI_SendCardOperator = LogIn.m_User.id.ToString();
            ci.state = "在用";

            if (newCi)
            {
                db.CardInfo.InsertOnSubmit(ci);
            }

            var cm = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == m_Member.CI_CardNo);

            if (cm != null)
            {
                db.CardInfo.DeleteOnSubmit(cm);
            }

            db.SubmitChanges();
            return(true);
        }
Ejemplo n.º 5
0
        //设置会员卡参数
        private void set_status()
        {
            old_id.Text = m_Member.CI_CardNo;
            name.Text   = m_Member.CI_Name;
            phone.Text  = m_Member.CI_Telephone;
            type.Text   = db.MemberType.FirstOrDefault(x => x.id == m_Member.CI_CardTypeNo).name;

            var    cc    = db.CardCharge.Where(x => x.CC_CardNo == m_Member.CI_CardNo);
            double debit = BathClass.ToInt(cc.Sum(x => x.CC_DebitSum));
            double lend  = BathClass.ToInt(cc.Sum(x => x.CC_LenderSum));

            balance.Text = (debit - lend).ToString();

            var c  = BathClass.ToInt(m_Member.CI_CreditsUsed);
            var cu = BathClass.ToInt(db.MemberSetting.FirstOrDefault().money);
            int cs = (int)(lend / cu - c);

            credits.Text = cs.ToString();

            string card_data    = "";
            string company_code = db.Options.FirstOrDefault().companyCode;

            bool st       = false;
            var  cardType = db.MemberSetting.FirstOrDefault().cardType;

            if (cardType == "SLE4442")
            {
                st = ICCard.read_data_4442(company_code, ref card_data);
            }
            else if (cardType == "M1")
            {
                st = ICCard.read_data_M1(company_code, ref card_data);
            }
            if (!st)
            {
                return;
            }

            id.Text    = card_data;
            btnOk.Text = "补卡";
        }
Ejemplo n.º 6
0
        //换积分
        private void btnCredits_Click(object sender, EventArgs e)
        {
            if (dgv.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要选择会员卡!");
                return;
            }
            string id     = dgv.CurrentRow.Cells[0].Value.ToString();
            var    member = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == id);
            var    mt     = db.MemberType.FirstOrDefault(x => x.id == member.CI_CardTypeNo);

            if (!mt.credits)
            {
                BathClass.printErrorMsg("所选择的卡类型不能积分!");
                return;
            }

            double cs       = 0;
            var    cu       = db.MemberSetting.FirstOrDefault().money.Value;
            var    cexpense = db.CardCharge.Where(y => y.CC_CardNo == id);
            var    cvs      = cexpense.Sum(y => y.expense);

            if (cvs.HasValue)
            {
                double cds = cvs.Value;
                if (member.CI_CreditsUsed == null)
                {
                    cs = cds / cu;
                }
                else
                {
                    cs = cds / cu - member.CI_CreditsUsed.Value;
                }
            }

            if (creditsUsing.Text == "")
            {
                BathClass.printErrorMsg("需要输入积分!");
                return;
            }
            int csu = BathClass.ToInt(creditsUsing.Text);

            if (csu > cs)
            {
                BathClass.printErrorMsg("积分不够");
                return;
            }
            //cs -= csu;

            if (member.CI_CreditsUsed == null)
            {
                member.CI_CreditsUsed = csu;
            }
            else
            {
                member.CI_CreditsUsed += csu;
            }
            db.SubmitChanges();
            dgv_show();
            //this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 7
0
        //添加储值卡
        private void btnAdd_Click(object sender, EventArgs e)
        {
            double paid_money = get_paid_money();

            if (paid_money >= m_money)
            {
                BathClass.printErrorMsg("刷卡金额已经足够!");
                return;
            }

            if (id.Text != "")
            {
                m_member = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == id.Text);
            }
            else
            {
                string card_data    = "";
                string company_code = db.Options.FirstOrDefault().companyCode;

                bool st       = false;
                var  cardType = db.MemberSetting.FirstOrDefault().cardType;
                if (cardType == "SLE4442")
                {
                    st = ICCard.read_data_4442(company_code, ref card_data);
                }
                else if (cardType == "M1")
                {
                    st = ICCard.read_data_M1(company_code, ref card_data);
                }
                if (!st)
                {
                    return;
                }

                m_member = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == card_data);
            }

            if (m_member == null)
            {
                BathClass.printErrorMsg("非本公司卡!");
                return;
            }
            if (m_member.state == "挂失")
            {
                BathClass.printErrorMsg("卡已挂失,无法使用!");
                return;
            }
            if (m_memberList.Keys.Contains(m_member.CI_CardNo))
            {
                BathClass.printErrorMsg("已经添加卡号为" + m_member.CI_CardNo + "的会员卡,不能重复添加!");
                return;
            }

            string memberType = "";
            var    t          = db.MemberType.FirstOrDefault(x => x.id == m_member.CI_CardTypeNo);

            if (t != null)
            {
                memberType = t.name;
            }

            var    cc      = db.CardCharge.Where(x => x.CC_CardNo == m_member.CI_CardNo);
            double debit   = BathClass.ToInt(cc.Sum(x => x.CC_DebitSum));
            double lend    = BathClass.ToInt(cc.Sum(x => x.CC_LenderSum));
            double balance = debit - lend;

            var c  = BathClass.ToInt(m_member.CI_CreditsUsed);
            var cu = BathClass.ToInt(db.MemberSetting.FirstOrDefault().money);
            int cs = (int)(lend / cu - c);

            double hasto_money = 0;

            if (balance <= m_money - paid_money)
            {
                hasto_money = balance;
            }
            else
            {
                hasto_money = m_money - paid_money;
            }

            m_memberList[m_member.CI_CardNo] = hasto_money;
            dgv.Rows.Add(m_member.CI_CardNo, m_member.CI_Name, m_member.CI_Telephone, memberType, balance, cs, hasto_money);

            id.Text = "";
        }