Ejemplo n.º 1
0
        //通过读数据库获取会员卡
        private bool get_member_by_db()
        {
            if (phone.Text != "")
                m_Member = db.CardInfo.FirstOrDefault(x => x.CI_Telephone == phone.Text);
            else if (name.Text != "")
            {
                var members = db.CardInfo.Where(x => x.CI_Name == name.Text);
                if (members.Count() != 1)
                {
                    BathClass.printErrorMsg("名称不唯一或者不存在!");
                    return false;
                }
                m_Member = members.FirstOrDefault();
            }
            else if (old_id.Text != "")
                m_Member = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == old_id.Text);

            if (m_Member == null)
            {
                BathClass.printErrorMsg("该会员卡不在本店登记!");
                return false;
            }

            return true;
        }
Ejemplo n.º 2
0
        //获取会员卡
        private void get_member()
        {
            string card_data = "";
            string company_code = db.Options.FirstOrDefault().companyCode;
            if (!ICCard.read_data(company_code, ref card_data))
                return;

            id.Text = card_data;
            m_member = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == card_data);
            //m_member = db.CardInfo.FirstOrDefault(x => x.CI_CardNo == "80120");
            if (m_member == null)
            {
                BathClass.printErrorMsg("非本公司卡!");
                return;
            }
            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 = MConvert<int>.ToTypeOrDefault(cc.Sum(x => x.CC_DebitSum), 0);
            double lend = MConvert<int>.ToTypeOrDefault(cc.Sum(x => x.CC_LenderSum), 0);
            balance.Text = (debit - lend).ToString();

            var c = MConvert<int>.ToTypeOrDefault(m_member.CI_CreditsUsed, 0);
            var cu = MConvert<int>.ToTypeOrDefault(db.MemberSetting.FirstOrDefault().money, 0);
            int cs = (int)(lend / cu - c);
            credits.Text = cs.ToString();
            btnOk.Text = "刷卡";
        }
 //会员打折
 private void btnDiscount_Click(object sender, EventArgs e)
 {
     ////修改
     //BathClass.sendMessageToCamera(db, m_Seat.systemId);
     MemberPromotionForm memberPromotionForm = new MemberPromotionForm(m_Seat);
     memberPromotionForm.ShowDialog();
     m_Member = memberPromotionForm.m_member;
     this.Close();
 }
 //会员打折
 private void btnDiscount_Click(object sender, EventArgs e)
 {
     BathClass.sendMessageToCamera(db, m_Seats[0].systemId);
     var id = string.Join("|", m_Seats.Select(x => x.systemId).ToArray());
     MemberPromotionForm memberPromotionForm = new MemberPromotionForm(m_Seats, id);
     memberPromotionForm.ShowDialog();
     m_Member = memberPromotionForm.m_member;
     this.Close();
 }
Ejemplo n.º 5
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.º 6
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.º 7
0
        //宾客付款
        private void payTool_Click(object sender, EventArgs e)
        {
            BathDBDataContext dc = new BathDBDataContext(LogIn.connectionString);

            HintForm hintForm = new HintForm("请插入会员卡...");
            if (hintForm.ShowDialog() != DialogResult.OK)
                return;

            MemberCardUsingForm memberCardUsingForm = new MemberCardUsingForm(Convert.ToDouble(moneyPayable.Text));
            if (memberCardUsingForm.ShowDialog() != DialogResult.OK)
                return;

            if (m_Member == null)
                m_Member = memberCardUsingForm.m_member;

            Account account = new Account();
            account.text = m_Seat.text;
            account.systemId = m_Seat.systemId;
            account.openTime = m_Seat.openTime.ToString();
            account.openEmployee = m_Seat.openEmployee;
            account.payTime = DateTime.Now;
            account.payEmployee = LogIn.m_User.id.ToString();
            account.macAddress = PCUtil.getMacAddr_Local();
            if (m_promotion_Member != null)
            {
                account.promotionMemberId = m_promotion_Member.CI_CardNo;
                account.promotionAmount = discount_money;
            }
            if (m_Member != null)
                account.memberId = memberCardUsingForm.m_member.CI_CardNo;

            account.creditCard = Convert.ToInt32(moneyPayable.Text);
            db.Account.InsertOnSubmit(account);

            db.SubmitChanges();

            var orderList = db.Orders.Where(x => x.systemId == m_Seat.systemId && !x.paid);
            foreach (Orders order in orderList)
            {
                order.paid = true;
                order.accountId = account.id;
            }

            m_Seat.status = 3;
            var room = db.Room.FirstOrDefault(x => x.seat == m_Seat.text);
            if (room != null)
                room.status = "等待清洁";

            insert_member_infor(account);
            db.SubmitChanges();

            var act_old = dc.Account.FirstOrDefault(x => x.systemId == m_Seat.systemId && x.abandon != null);
            if (act_old == null)
            {
                printTool_Click("结账单");
                printTool_Click("存根单");
            }
            else
            {
                printTool_Click("补救单");
            }

            var act = dc.Account.FirstOrDefault(x => x.systemId == m_Seat.systemId && x.abandon == null);
        }
Ejemplo n.º 8
0
 partial void DeleteCardInfo(CardInfo instance);
Ejemplo n.º 9
0
 partial void UpdateCardInfo(CardInfo instance);
Ejemplo n.º 10
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.º 11
0
 //读会员卡
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (btnOk.Text == "读卡")
     {
         m_member = null;
         get_member();
         //if (m_member == null)
         //{
         //    BathClass.printErrorMsg("输入卡不存在");
         //}
     }
     else if (btnOk.Text == "重置")
     {
         reset_form();
     }
 }
Ejemplo n.º 12
0
        //通过读卡获取会员卡
        private void get_member_by_card()
        {
            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)
                return;

            set_member();
        }
Ejemplo n.º 13
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 = "";
        }
Ejemplo n.º 14
0
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (db.CardInfo.FirstOrDefault(x => x.CI_CardNo == id.Text) != null)
            {
                BathClass.printErrorMsg("已经发行卡号为" + id.Text + "的卡");
                return;
            }

            bool st = false;
            var ct = db.MemberSetting.FirstOrDefault().cardType;
            if (ct == "SLE4442")
                st = ICCard.destribute_card_4442(company_code, id.Text);
            else if (ct == "M1")
                st = ICCard.destribute_card_M1(company_code, id.Text);
            else if (ct == "CT")
                st = true;
            if (!st)
                return;

            CardInfo m_Element = new CardInfo();
            m_Element.CI_CardNo = id.Text;
            m_Element.CI_CardTypeNo = db.MemberType.FirstOrDefault(x => x.name == memberType.Text).id;
            m_Element.state = "入库";
            db.CardInfo.InsertOnSubmit(m_Element);

            CardCharge cardCharge = new CardCharge();
            cardCharge.CC_CardNo = m_Element.CI_CardNo;
            cardCharge.CC_ItemExplain = "售卡收";
            if (money.Text != "")
                cardCharge.CC_DebitSum = Convert.ToDouble(money.Text);
            cardCharge.CC_LenderSum = 0;
            cardCharge.CC_InputOperator = LogIn.m_User.id.ToString();
            cardCharge.CC_InputDate = DateTime.Now;
            db.CardCharge.InsertOnSubmit(cardCharge);

            //if (money.Text != "")
            //{
            //    int sale_money = find_card_sale();
            //    if (sale_money != 0)
            //    {
            //        //CardCharge cardChargeSale = new CardCharge();
            //        //cardChargeSale.CC_CardNo = m_Element.CI_CardNo;
            //        //cardChargeSale.CC_ItemExplain = "优惠送";
            //        //cardChargeSale.CC_DebitSum = sale_money;
            //        //cardChargeSale.CC_LenderSum = 0;
            //        //cardChargeSale.CC_InputOperator = LogIn.m_User.id.ToString();
            //        //cardChargeSale.CC_InputDate = GeneralClass.Now;
            //        //cardChargeSale.systemId = m_Seat.systemId;
            //        //db.CardCharge.InsertOnSubmit(cardChargeSale);

            //        BathClass.printInformation("送" + sale_money + "元");
            //    }

            //    //CardSale cardSale = new CardSale();
            //    //cardSale.memberId = m_Element.CI_CardNo;
            //    //cardSale.balance = 0;
            //    //if (payType.Text == "现金")
            //        //cardSale.cash = Convert.ToDouble(money.Text);
            //    //else if (payType.Text == "银联")
            //        //cardSale.bankUnion = Convert.ToDouble(money.Text);

            //    //cardSale.payTime = GeneralClass.Now;
            //    //cardSale.payEmployee = LogIn.m_User.id.ToString();
            //    //cardSale.macAddress = PCUtil.getMacAddr_Local();
            //    //db.CardSale.InsertOnSubmit(cardSale);

            //    //var menu = db.Menu.FirstOrDefault(x => x.name == memberType.Text);
            //    //Orders order = new Orders();
            //    //order.menu = menu.name;
            //    //order.text = m_Seat.text;
            //    //order.systemId = m_Seat.systemId;
            //    //order.number = 1;
            //    //order.inputTime = BathClass.Now(LogIn.connectionString);
            //    //order.inputEmployee = LogIn.m_User.id.ToString();
            //    //order.paid = false;

            //    //if (money.Text == "")
            //    //    order.money = menu.price;
            //    //else
            //    //order.money = Convert.ToDouble(money.Text);

            //    //db.Orders.InsertOnSubmit(order);
            //}

            db.SubmitChanges();
            //this.DialogResult = DialogResult.OK;

            id.Text = "";
            money.Text = "";
        }
Ejemplo n.º 15
0
 partial void InsertCardInfo(CardInfo instance);
Ejemplo n.º 16
0
        //会员打折
        private void memberTool_Click(object sender, EventArgs e)
        {
            double money_pre = Convert.ToDouble(moneyPayable.Text);
            MemberPromotionOptionForm memberPromotionOptionForm = new MemberPromotionOptionForm(m_Seats);
            if (memberPromotionOptionForm.ShowDialog() != DialogResult.OK)
                return;

            var dc = new BathDBDataContext(LogIn.connectionString);
            m_Member = memberPromotionOptionForm.m_Member;
            double money = BathClass.get_rooms_expenses(dc, m_Seats, LogIn.connectionString);
            moneyPayable.Text = money.ToString();
            discount_money = money_pre - money;

            dgvExpense_show(dc);
        }
Ejemplo n.º 17
0
 //构造函数
 public EditMemberForm(BathDBDataContext dc, CardInfo ci)
 {
     db = dc;
     m_Card = ci;
     InitializeComponent();
 }