Пример #1
0
        public CMemberType get_MemberType(string cmd_str)
        {
            CMemberType memberType = null;
            SqlConnection sqlCn = null;

            try
            {
                sqlCn = new SqlConnection(_con_str);
                sqlCn.Open();

                cmd_str = "Select * from [MemberType] where (" + cmd_str + ")";
                SqlCommand cmdSelect = new SqlCommand(cmd_str, sqlCn);
                using (SqlDataReader dr = cmdSelect.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        memberType = new CMemberType();

                        memberType.id = (int)dr["id"];
                        memberType.name = dr["name"].ToString();
                        memberType.timSpan = dr["timSpan"].ToString();
                        memberType.times = ToInt(dr["times"]);
                        memberType.money = ToDouble(dr["money"]);
                        memberType.maxOpenMoney = ToDouble(dr["maxOpenMoney"]);
                        memberType.expireDate = ToDateTime(dr["expireDate"]);
                        memberType.offerId = ToInt(dr["offerId"]);
                        memberType.credits = (bool)dr["credits"];
                        memberType.smsAfterUsing = ToBool(dr["smsAfterUsing"]);
                        memberType.userOneTimeOneDay = ToBool(dr["userOneTimeOneDay"]);
                        memberType.LimitedTimesPerMonth = ToBool(dr["LimitedTimesPerMonth"]);
                        memberType.TimesPerMonth = ToInt(dr["TimesPerMonth"]);

                        break;
                    }
                }

            }
            catch (System.Exception e)
            {
                BathClass.printErrorMsg(e.Message);
            }
            finally
            {
                close_connection(sqlCn);
            }

            return memberType;
        }
Пример #2
0
        //获取会员卡
        private void get_member()
        {
            string card_data = "";
            string company_code = LogIn.options.companyCode;

            bool st = false;
            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);
            else if (cardType == "CT")
            {
                card_data = id.Text;
                st = true;
            }
            if (!st)
                return;

            //card_data = "000000";
            m_member = dao.get_CardInfo("CI_CardNo='" + card_data + "'");
            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;

            cmemberType = dao.get_MemberType("id='" + m_member.CI_CardTypeNo + "'");
            if (memberType != null)
                memberType.Text = cmemberType.name;

            var cc = dao.get_CardCharges("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(memberSetting.money, 0);
            int cs = (int)(lend / cu - c);
            credits.Text = cs.ToString();
            btnOk.Text = "会员打折";
        }