예제 #1
0
파일: Gt.cs 프로젝트: sosgzj/Gtcs
        public static string GetVipinfo(string s_card, int i)
        {
            string    str = "select cardvalue,dzratio from t_card where carddh='" + s_card + "'";
            Gtsqlvip  r1  = new Gtsqlvip();
            DataTable d1  = new DataTable();

            d1 = r1.ExecuteQuery(str);
            string s_vipinfo = "0.0";

            if (d1 != null && d1.Rows.Count > 0)    //查询有结果
            {
                switch (i)
                {
                case 1:
                    s_vipinfo = d1.Rows[0]["cardvalue"].ToString();
                    break;

                case 2:
                    s_vipinfo = d1.Rows[0]["dzratio"].ToString();
                    break;

                default:
                    s_vipinfo = "";
                    break;
                }
            }

            return(s_vipinfo);
        }
예제 #2
0
파일: w_Getvip.cs 프로젝트: sosgzj/Gtcs
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            switch (keyData)
            {
            case Keys.Escape:

                this.Close();
                return(true);

            case Keys.Enter:

                if (tbVipCode.Text.Trim() != "" && tbVipName.Text.Trim() == "")
                {
                    String    str1 = "select carddh,xm,cardvalue,cardflag FROM t_card WHERE carddh='" + tbVipCode.Text.Trim() + "'";    //编写sql语句;
                    Gtsqlvip  r1   = new Gtsqlvip();
                    DataTable d1   = new DataTable();
                    d1 = r1.ExecuteQuery(str1);              //使用ExecuteQuery()执行sql语句;
                    if (d1 != null && d1.Rows.Count > 0)     //找到
                    {
                        if (d1.Rows[0]["cardflag"].ToString() == "1")
                        {
                            tbVipCode.Text  = d1.Rows[0]["carddh"].ToString();
                            tbVipName.Text  = d1.Rows[0]["xm"].ToString();
                            Global.s_vip    = tbVipCode.Text;
                            Global.d_svipje = decimal.Parse(d1.Rows[0]["cardvalue"].ToString());
                        }
                        else
                        {
                            MessageBox.Show("此卡不是有效卡!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            tbVipCode.Focus();
                            tbVipCode.Select(0, tbVipCode.TextLength);
                        }
                    }
                    else     //找不到
                    {
                        MessageBox.Show("无此卡信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        tbVipCode.Text = "";
                    }
                }
                else
                {
                    this.Close();
                    return(true);
                }
                return(true);

            default:
                return(base.ProcessCmdKey(ref msg, keyData));
            }
        }
예제 #3
0
파일: Gt.cs 프로젝트: sosgzj/Gtcs
        public static int UpdateVip(string s_card, decimal cardvalue, string rec_key, int i_valueflag, string s_valueflagtext)
        {
            //---------------------------------------------------------------------------------
            //	arg_carddh 卡号
            //	arg_cardvalue   dec 扣除钱数
            //	arg_rec_key    标识码
            //	arg_valueflag   int 充值类型代号
            //	arg_valueflagtext 充值类型
            //----------------------------------
            //insert into t_card_fillvalue(carddh, cardvalue, who, who_name, rec_key, is_act_fill, v_mac, now_cardvalue, valueflag, valueflagtext, bm)
            //    values(:arg_carddh,:arg_cardvalue,:s_user.dh,:s_user.xm,:arg_rec_key, "0",:s_user.mac,:c_cardvalue,:arg_valueflag,:s_valueflagtext,:arg_bm)
            //    using sqlcb;
            //update t_card set cardvalue = :c_cardvalue,totalcost = :c_totalcost where carddh = :arg_carddh using sqlcb;
            int     i_flag;
            decimal d_cardvalue, d_totalcost;

            d_cardvalue = Global.d_svipje - cardvalue;

            String    str3 = "select carddh,xm,cardvalue,totalcost from t_card where carddh ='" + s_card + "'";
            Gtsqlvip  r3   = new Gtsqlvip();
            DataTable d3   = new DataTable();

            d3          = r3.ExecuteQuery(str3);
            d_totalcost = decimal.Parse(d3.Rows[0]["totalcost"].ToString()) + cardvalue;


            String str = "insert into t_card_fillvalue(carddh,cardvalue,who,who_name,rec_key,valueflag,valueflagtext,v_mac,bm,now_cardvalue) values('"
                         + s_card + "','" + (cardvalue * -1).ToString() + "','" + Global.s_dh + "','" + Global.s_xm + "','" + rec_key + "','" + i_valueflag + "','"
                         + s_valueflagtext + "','" + Global.s_mac + "','" + Global.s_bm + "','" + Global.d_svipje + "')";
            Gtsqlvip r1 = new Gtsqlvip();

            i_flag = r1.ExecuteUpdate(str);



            String   str2 = "update t_card set cardvalue = '" + d_cardvalue + "',totalcost = '" + d_totalcost + "' where carddh ='" + s_card + "'";
            Gtsqlvip r2   = new Gtsqlvip();

            i_flag = r2.ExecuteUpdate(str2);

            if (i_flag == 1)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }