コード例 #1
0
        private void button_Edit_Click(object sender, EventArgs e)
        {
            if (DialogResult.No == MessageBox.Show("确认修改持卡人信息吗?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                return;
            }

            //连接银石后台
            EbHttpClass objHttp = new EbHttpClass();
            string      szErr   = "";
            bool        bRst    = objHttp.ChgUserInf(textBox_Card.Text, textBox_Person.Text, textBox_Cell.Text, textBox_CertID.Text, ref szErr);

            if (!bRst)
            {
                MessageBox.Show("后台修改持卡人信息失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string szSql = "update base_ucard set user_name='" + textBox_Person.Text.Trim()
                           + "',USER_TEL='" + textBox_Cell.Text.Trim() + "',CERT_ID='" + textBox_CertID.Text.Trim()
                           + "',CHG_ID=" + MyStart.giUserID + ",user_addr='" + textBox_Addr.Text.Trim() + "',rmrk='" + textBox_rmrk.Text.Trim()
                           + "', CHG_DT=curtime() where user_card='" + textBox_Card.Text.Trim() + "'";
            DataSet ds = new DataSet();

            szErr = "";
            int iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);

            if (iRst < 1)
            {
                MessageBox.Show("修改持卡人信息出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MyIniFile.WriteLog("买方卡查询-修改", "SQL=" + szSql + ",Err=" + szErr);
            }
            MessageBox.Show("修改持卡人信息成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            button_Edit.Enabled = false;
        }
コード例 #2
0
        private bool GetCardBalance(string sCardID, ref int iBalance, ref int iTrade, ref string sErrMsg)
        {
            //银石后台
            objHttp = new EbHttpClass();
            bool bRst = objHttp.QryCard(sCardID, ref iBalance, ref iTrade, ref sErrMsg);

            return(bRst);
        }
コード例 #3
0
        private void button_Card_Old_Click(object sender, EventArgs e)
        {
            //读卡号
            ReadCardNo(MyStart.gszCardYtbFirst, button_Card_Old, textBox_Card_Old);

            //银石后台读余额
            EbHttpClass objHttp = new EbHttpClass();
            int         iVal    = 0;
            string      szErr   = "";
            bool        bRst    = objHttp.QryCard(textBox_Card_Old.Text, ref iVal, ref miUncofirmVal, ref szErr);

            if (!bRst)
            {
                MessageBox.Show("后台换卡失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            textBox_Val.Text = ((decimal)iVal / 100).ToString("#0.00");
        }
コード例 #4
0
        private void button_MinusValue_Click(object sender, EventArgs e)
        {
            float fValue   = 0.00f;
            float fBalance = 0;

            textBox_Value.Text  = textBox_Value.Text.Trim();
            textBox_Value2.Text = textBox_Value2.Text.Trim();
            try
            {
                fValue = float.Parse(textBox_Value.Text.Trim());
            }
            catch
            {
                MessageBox.Show("取款金额错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox_Value.Focus();
                return;
            }

            if (textBox_Value.Text != textBox_Value2.Text)
            {
                MessageBox.Show("两次输入的取款金额不相等!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox_Value.Focus();
                return;
            }

            if (fValue == 0)
            {
                MessageBox.Show("取款金额不能为0!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox_Value.Focus();
                return;
            }

            //// 检查密码
            //if ( CardPwd != textBox_Pwd.Text.Trim())
            //{
            //    MessageBox.Show("取款密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    textBox_Pwd.Focus();
            //    return;
            //}

            // 检查余额是否足够
            if (mszFlag.ToUpper() == "FIRM_CARD")
            {
                fBalance = float.Parse(textBox_FinishBalance.Text.Trim());
            }
            else
            {
                fBalance = float.Parse(textBox_OldBalance.Text.Trim());
            }

            if (fValue > fBalance)
            {
                MessageBox.Show("取款金额不足够!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox_Value.Focus();
                return;
            }

            // 取得TradeID
            if (!myRdr.ComOpen(frm_Main.sRdPort))
            {
                MessageBox.Show("打开串口失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                myRdr.ComClose();
                return;
            }

            int iReaderTradeID = 0;

            if (!myRdr.GetTradeID(ref iReaderTradeID))
            {
                MessageBox.Show("交易失败:不能从读写器获取交易流水。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                myRdr.ComClose();
                return;
            }
            myRdr.ComClose();

            //银石后台
            objHttp = new EbHttpClass();

            fValue *= -1;
            string szSysID = iReaderTradeID.ToString();
            string szErr   = "";
            bool   bRst    = false;

            if (mszFlag.ToUpper() == "USER_CARD")
            {
                bRst = objHttp.OperUserMoney("MinusVal", textBox_UserCardID.Text, fValue, szSysID, textBox_Pwd.Text.Trim(), ref szErr);
            }
            else
            {
                bRst = objHttp.OperFirmMoney(sStoreCard.Substring(1), textBox_UserCardID.Text, fValue, szSysID, textBox_Pwd.Text.Trim(), ref szErr);
            }

            if (bRst)
            {
                string sSql  = "";
                string szInf = "";
                float  f     = 0;
                int    i;

                // 余额显示
                fValue *= -1;
                f       = fBalance - fValue;
                textBox_NewBalance.Text = f.ToString("0.00");

                // 写入数据库
                if (mszFlag.ToUpper() == "USER_CARD")
                {
                    // 写入数据库
                    sSql = "INSERT INTO rec_user (Card_No, Oper_Time, Oper_Type,Oper_SubType, Before_Val, Chg_Val, After_Val, Oper_ID, Tmn_ID, Sys_ID) VALUE(" +
                           "'" + textBox_UserCardID.Text + "'," +
                           "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," +
                           "'CASH','" + comboBox_Type.Text.Trim() + "',";
                    f     = float.Parse(textBox_OldBalance.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + ",";

                    f     = float.Parse(textBox_Value.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + ",";

                    f     = float.Parse(textBox_NewBalance.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + "," +
                            MyStart.giUserID + "," +
                            "'" + frm_Main.POS_ID + "'," +
                            iReaderTradeID.ToString() + ")";
                }
                else
                {
                    sSql = "INSERT INTO rec_firm (Card_No, Rmrk, STORE_ID, Oper_Time, Oper_Type,Oper_SubType, Before_Val, Chg_Val, After_Val, Oper_ID, Tmn_ID, Sys_ID) VALUE(" +
                           "'" + textBox_UserCardID.Text + "'," +
                           "'" + sStoreCard + "'," +
                           sStoreID + "," +
                           "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," +
                           "'CASH','" + comboBox_Type.Text.Trim() + "',";

                    f     = float.Parse(textBox_OldBalance.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + ",";

                    f     = float.Parse(textBox_Value.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + ",";

                    f     = float.Parse(textBox_NewBalance.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + "," +
                            MyStart.giUserID + "," +
                            "'" + frm_Main.POS_ID + "'," + szSysID.ToString() + ")";
                }

                int iRst = MyStart.oMyDb.WriteData(sSql, ref szInf);
                if (iRst <= 0)
                {
                    textBox_Result.Text = "取款成功! 但写数据库失败(" + szInf + ")";
                }
                else
                {
                    textBox_Result.Text = "取款成功!";
                }
                // log
                if (mszFlag.ToUpper() == "USER_CARD")
                {
                    MyFunc.WriteToDbLog("买方资金-退款", "买方卡号=" + textBox_UserCardID.Text + ",取款=" + textBox_Value.Text + "元,时间=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "MSG", MyStart.giUserID);
                }
                else
                {
                    MyFunc.WriteToDbLog("卖方资金-提款", "卖方卡号=" + textBox_UserCardID.Text + ",取款=" + textBox_Value.Text + "元,时间=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "MSG", MyStart.giUserID);
                }

                MyStart.oMyDb.Close();

                //打印票据
                button_Print_Click(sender, e);
                button_Print_Click(sender, e);
            }
            else
            {
                textBox_Result.Text     = "取款失败 = " + szErr;
                textBox_NewBalance.Text = textBox_FinishBalance.Text;
            }

            groupBox_ThirdStep.Enabled  = false;
            groupBox_FourthStep.Visible = true;
            groupBox_FourthStep.Enabled = true;
            button_Retry.Focus();
        }
コード例 #5
0
ファイル: frm_Card_AddVal.cs プロジェクト: wl2019/EB_for_YTB
        private void button_CheckCard_Click(object sender, EventArgs e)
        {
            string  szInf   = "";
            string  sCardID = "";
            DataSet odt     = null;

            if (!frm_Main.bHaveRd)
            {
                MessageBox.Show("没有连接读写器,不能执行充值功能!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!myRdr.ComOpen(frm_Main.sRdPort))
            {
                MessageBox.Show("打开串口失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                myRdr.ComClose();
                return;
            }

            ((Button)sender).Enabled = false;
            if (!myRdr.ReadCardInf(out szInf))
            {
                if (textBox_CardID.Text.Trim() != "")
                {
                    sCardID = textBox_CardID.Text;
                }
                else
                {
                    MessageBox.Show("读卡失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    ((Button)sender).Enabled = true;
                    myRdr.ComClose();
                    return;
                }
            }
            else
            {
                sCardID = szInf.Substring(0, 16);
            }
            myRdr.ComClose();
            ((Button)sender).Enabled = true;
            textBox_CardID.Text      = sCardID;

            if (sCardID.Substring(0, 1) == MyStart.gszCardFirmFirst)
            {
                MessageBox.Show("不接受商户卡的充值,请换卡!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            odt = null;
            string sErrMsg = "";
            string sSql    = "";

            try
            {
                sSql = "SELECT * FROM base_ucard WHERE user_card = '" + sCardID + "'";

                int iRst = MyStart.oMyDb.ReadData(sSql, "TableA", ref odt, ref sErrMsg);
                if (iRst != 0)
                {
                    MessageBox.Show("后台查询卡余额失败( " + sErrMsg + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                if (odt.Tables[0].Rows.Count <= 0)
                {
                    MessageBox.Show("没有此用户卡的信息,请更换。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                sUserName = odt.Tables[0].Rows[0]["user_name"].ToString().Trim();

                //银石后台
                objHttp = new EbHttpClass();
                string szErr       = "";
                int    CardBalance = 0;
                int    iTrade      = 0;

                bool bRst = objHttp.QryCard(sCardID, ref CardBalance, ref iTrade, ref szErr);
                if (!bRst)
                {
                    MessageBox.Show("后台查询卡余额失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                float fi = CardBalance;
                fi = fi / 100;
                textBox_OldBalance.Text = fi.ToString("0.00");

                groupBox_FirstStep.Enabled  = false;
                groupBox_SecondStep.Visible = true;
                button_Retry.Enabled        = true;
                textBox_Value.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询卡片余额失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

Eend:
            if (odt != null)
            {
                odt.Clear();
            }

            MyStart.oMyDb.Close();
        }
コード例 #6
0
ファイル: frm_Card_QryVal.cs プロジェクト: wl2019/EB_for_YTB
        private void button_CheckCard_Click(object sender, EventArgs e)
        {
            string  szInf   = "";
            string  sCardID = "";
            DataSet odt     = null;
            string  sErrMsg = "";

            if (!frm_Main.bHaveRd)
            {
                if (textBox_CardID.Text.Trim() != "")
                {
                    sCardID = textBox_CardID.Text;
                }
                else
                {
                    MessageBox.Show("没有连接读写器,也没有输入卡号,不能执行查询余额功能!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                if (!myRdr.ComOpen(frm_Main.sRdPort))
                {
                    myRdr.ComClose();
                    if (textBox_CardID.Text.Trim() != "")
                    {
                        sCardID = textBox_CardID.Text;
                    }
                    else
                    {
                        MessageBox.Show("打开串口失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    if (!myRdr.ReadCardInf(out szInf))
                    {
                        if (textBox_CardID.Text.Trim() != "")
                        {
                            sCardID = textBox_CardID.Text;
                        }
                        else
                        {
                            MessageBox.Show("读卡失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            myRdr.ComClose();
                            goto Eend;
                        }
                    }
                    else
                    {
                        sCardID = szInf.Substring(0, 16);
                    }
                }
                myRdr.ComClose();
            }
            textBox_CardID.Text = sCardID;

            if (sCardID.Substring(0, 1) == MyStart.gszCardFirmFirst)
            {
                MessageBox.Show("不接受商户卡查询余额,请换卡!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                goto Eend;
            }

            try
            {
                string sSql = "";
                if (mszFlag.ToUpper() == "FIRM_CARD")
                {
                    sSql = "SELECT * FROM mng_card WHERE STORE_CARD = '" + sCardID + "' AND card_type = 3";
                }
                else  // if (mszFlag.ToUpper() == "USER_CARD")
                {
                    sSql = "SELECT * FROM base_ucard WHERE user_card = '" + sCardID + "'";
                }

                int iRst = MyStart.oMyDb.ReadData(sSql, "TableA", ref odt, ref sErrMsg);
                if (iRst != 0)
                {
                    MessageBox.Show("后台查询卡余额失败( " + sErrMsg + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                if (odt.Tables[0].Rows.Count <= 0)
                {
                    if (mszFlag.ToUpper() == "FIRM_CARD")
                    {
                        MessageBox.Show("这是错误的商户结算卡,请更换。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else  // if (mszFlag.ToUpper() == "USER_CARD")
                    {
                        MessageBox.Show("没有此用户卡的信息,请更换。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    goto Eend;
                }

                if (mszFlag.ToUpper() == "FIRM_CARD")
                {
                    sUserName = odt.Tables[0].Rows[0]["STORE_PERSON"].ToString().Trim();
                }
                else  // if (mszFlag.ToUpper() == "USER_CARD")
                {
                    sUserName = odt.Tables[0].Rows[0]["user_name"].ToString().Trim();
                }

                //银石后台
                objHttp = new EbHttpClass();
                string szErr       = "";
                int    iValue      = 0;
                int    iTrade      = 0;
                int    CardBalance = 0;
                float  fi          = 0.00f;

                if (mszFlag.ToUpper() == "FIRM_CARD")
                {
                    iTrade = 1;
                }
                else
                {
                    iTrade = 0;
                }

                bool bRst = objHttp.QryCard(sCardID, ref iValue, ref iTrade, ref szErr);
                if (!bRst)
                {
                    MessageBox.Show("后台查询卡余额失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //return;
                }
                else
                {
                    if (mszFlag.ToUpper() == "FIRM_CARD")
                    {
                        fi = iValue;
                        fi = fi / 100;
                        textBox_FinishBalance.Text = fi.ToString("0.00");

                        if (iTrade > 0)
                        {
                            fi = iTrade;
                        }
                        else
                        {
                            fi = 0;
                        }
                        fi = fi / 100;
                        textBox_UnFinishBalance.Text = fi.ToString("0.00");

                        CardBalance             = iValue + iTrade;
                        fi                      = CardBalance;
                        fi                      = fi / 100;
                        textBox_OldBalance.Text = fi.ToString("0.00");
                        MyFunc.WriteToDbLog("卖方资金-余额查询", " ", "MSG", MyStart.giUserID);
                    }
                    else
                    {
                        textBox_FinishBalance.Text   = "";
                        textBox_UnFinishBalance.Text = "";
                        fi = iValue;
                        fi = fi / 100;
                        textBox_OldBalance.Text = fi.ToString("0.00");
                        MyFunc.WriteToDbLog("买方资金-余额查询", " ", "MSG", MyStart.giUserID);
                    }

                    if (checkBox1.Checked)
                    {
                        int i = 0;
                        // 打印票据
                        MyTools.sPrintTopic = "余额查询票据";
                        MyTools.sPrintID    = "";

                        MyTools.oPrintData      = new string[10];
                        MyTools.oPrintData[i++] = "卡片号码:" + textBox_CardID.Text;
                        MyTools.oPrintData[i++] = "持卡人名:" + sUserName;
                        MyTools.oPrintData[i++] = "--------------------------------------";
                        MyTools.oPrintData[i++] = "可取金额:" + textBox_FinishBalance.Text;
                        MyTools.oPrintData[i++] = "未结余额:" + textBox_UnFinishBalance.Text;
                        MyTools.oPrintData[i++] = "合计余额:" + textBox_OldBalance.Text;

                        MyTools.iPrintData = i;
                        MyTools.PrintTicket();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询失败 = " + ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

Eend:
            if (odt != null)
            {
                odt.Clear();
            }
            MyStart.oMyDb.Close();

            button_CheckCard.Focus();
        }
コード例 #7
0
ファイル: frm_Client_Card.cs プロジェクト: wl2019/EB_for_YTB
        private void button_Save_Click(object sender, EventArgs e)
        {
            //if (MessageBox.Show("确认当前的发卡信息吗?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
            //    return;
            if (textBox_Person.TextLength == 0)
            {
                MessageBox.Show("姓名不能为空,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_Person.SelectAll();
                textBox_Person.Focus();
                return;
            }
            if (textBox_Card.Text.Length != 16)
            {
                MessageBox.Show("卡号长度错误(买方卡号长度为16),请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                button_Card.Focus();
                return;
            }

            DataSet ds    = new DataSet();
            string  szErr = "";
            string  szSql = "";

            try
            {
                szErr = "";
                szSql = "select * from base_ucard where user_card='" + textBox_Card.Text.Trim() + "'";
                int iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("发卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("发买方卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                int iNum = ds.Tables[0].Rows.Count;
                if (iNum > 0)
                {
                    MessageBox.Show("卡号重复,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    button_Card.Focus();
                    goto Eend;
                }

                szSql = "select * from base_ucard where card_type=1 and user_name='" + textBox_Person.Text.Trim() + "'";
                //+ "' and USER_TEL='" + textBox_Cell.Text.Trim() + "'";
                iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("发卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("发买方卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                iNum = ds.Tables[0].Rows.Count;
                int iPID = 0;
                if (iNum > 0)
                {
                    if (MessageBox.Show("该持卡人已有" + iNum + "张买方卡,确认发副卡吗?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
                    {
                        goto Eend;
                    }

                    checkBox_multy.Checked = true;
                    DataRow dr = ds.Tables[0].Rows[0];
                    textBox_Cell.Text   = dr["USER_TEL"].ToString();
                    textBox_CertID.Text = dr["CERT_ID"].ToString();
                    textBox_Addr.Text   = dr["user_addr"].ToString();
                    textBox_rmrk.Text   = dr["rmrk"].ToString();
                    string szTruck = dr["truck_no"].ToString();
                    if (szTruck.Length > 1)
                    {
                        comboBox_truck.Text = dr["truck_no"].ToString().Substring(0, 1);
                        textBox_truck.Text  = dr["truck_no"].ToString().Substring(1);
                    }
                    iPID = Convert.ToInt32(dr["ID"]);
                    if (dr["is_sign"].ToString() == "1")
                    {
                        checkBox_Sign.Checked = true;
                    }
                    else
                    {
                        checkBox_Sign.Checked = false;
                    }

                    //checkBox_Sign.Enabled = false;
                    //textBox_Addr.Enabled = false;
                    //comboBox_truck.Enabled = false;
                    //textBox_truck.Enabled = false;
                    if (MessageBox.Show("是否需要继续补齐资料?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        goto Eend;
                    }
                }
                else
                {
                    MessageBox.Show("该人未开过卡,只能开主卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    checkBox_multy.Checked = false;
                }

                if (textBox_Cell.TextLength == 0)
                {
                    MessageBox.Show("请输入联系电话", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox_Cell.SelectAll();
                    textBox_Cell.Focus();
                    return;
                }
                if (textBox_CertID.TextLength == 0)
                {
                    MessageBox.Show("身份证号不能为空,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox_CertID.SelectAll();
                    textBox_CertID.Focus();
                    return;
                }
                if (textBox_pwd.Text.Trim() != textBox_pwd2.Text.Trim())
                {
                    MessageBox.Show("两次输入的密码不同,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox_pwd.SelectAll();
                    textBox_pwd.Focus();
                    return;
                }
                if (textBox_pwd.TextLength == 0)
                {
                    MessageBox.Show("退款时需要密码,请输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox_pwd.SelectAll();
                    textBox_pwd.Focus();
                    goto Eend;
                }

                /*if (textBox_Cell.TextLength != 11)
                 * {
                 *  MessageBox.Show("请输入买方手机号码,长度为11", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 *  textBox_Cell.SelectAll();
                 *  textBox_Cell.Focus();
                 *  return;
                 * }*/

                //连接银石后台
                EbHttpClass objHttp = new EbHttpClass();
                string      szPwd   = "1," + textBox_pwd.Text;
                bool        bRst    = objHttp.IssueNewUserCard(textBox_Card.Text, textBox_Person.Text, textBox_Cell.Text, textBox_CertID.Text, ref szPwd, ref szErr);
                if (!bRst)
                {
                    MessageBox.Show("后台注册买方卡失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                //写入DB
                szSql = "INSERT INTO base_ucard (user_name,USER_TEL,CERT_ID,user_card,card_pwd,pwd_crypt,oper_time,ADD_ID,user_addr,rmrk,truck_no,is_sign,card_type,parent_ID) VALUES ('"
                        + textBox_Person.Text.Trim() + "','" + textBox_Cell.Text.Trim() + "','" + textBox_CertID.Text.Trim() + "','"
                        + textBox_Card.Text.Trim() + "',' ',' ',curtime()," + MyStart.giUserID + ",'" + textBox_Addr.Text.Trim() + "','" + textBox_rmrk.Text.Trim() + "','"
                        + comboBox_truck.Text + textBox_truck.Text.Trim() + "', ";
                if (checkBox_Sign.Checked)
                {
                    szSql += "1,";
                }
                else
                {
                    szSql += "0,";
                }

                if (checkBox_multy.Checked)
                {
                    szSql += "2," + iPID + ")";
                }
                else
                {
                    szSql += "1,0)";
                }
                iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("发买方卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("发买方卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                if (!checkBox_multy.Checked)
                {
                    szSql = "update base_ucard set parent_ID=id where card_type=1 and parent_ID=0";
                    iRst  = MyStart.oMyDb.WriteData(szSql, ref szErr);
                    if (iRst < 1)
                    {
                        MessageBox.Show("发买方卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("发买方卡", "SQL=" + szSql + ",Err=" + szErr);
                        goto Eend;
                    }
                }
                szSql = "持卡人" + textBox_Person.Text.Trim() + "-电话" + textBox_Cell.Text.Trim() + "-卡号" + textBox_Card.Text.Trim();
                MyFunc.WriteToDbLog("发买方卡", szSql, "MSG", MyStart.giUserID);
                GridDataRefresh();

                if (Convert.ToDecimal(textBox_Fee.Text) > 0)
                {
                    long lVal = (long)(Convert.ToDecimal(textBox_Fee.Text) * 100);
                    szSql = "insert into rec_user (card_no,oper_time,oper_type,chg_val,oper_id,tmn_id) values ('" + textBox_Card.Text.Trim()
                            + "',curtime(),'ISSU'," + lVal + "," + MyStart.giUserID + ",'" + frm_Main.POS_ID + "')";
                    iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                    if (iRst < 1)
                    {
                        MessageBox.Show("记录买方卡工本费出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("发买方卡", "SQL=" + szSql + ",Err=" + szErr);
                        goto Eend;
                    }
                }
                MessageBox.Show("发买方卡成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                textBox_Card.Text   = "";
                textBox_pwd.Text    = "";
                textBox_Person.Text = "";
                textBox_Cell.Text   = "";
                textBox_CertID.Text = "";
                textBox_Addr.Text   = "";
                textBox_rmrk.Text   = "";
                comboBox_truck.Text = "粤";
                textBox_truck.Text  = "";
                goto Eend;
            }
            catch (Exception ex)
            {
                MessageBox.Show("发买方卡失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
コード例 #8
0
ファイル: frm_Firm_Card.cs プロジェクト: wl2019/EB_for_YTB
        private void button_SaveM_Click(object sender, EventArgs e)
        {
            if (textBox_CardM.Text.Length != 15)
            {
                MessageBox.Show("第一副卡卡号长度错误(卖方卡号长度为15),请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                button_CardM.Focus();
                return;
            }
            if (textBox_CardV.Text.Length != 16)
            {
                MessageBox.Show("结算卡卡号长度错误(卖方卡号长度为16),请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                button_CardM.Focus();
                return;
            }
            if (textBox_pwd.Text.Trim() != textBox_pwd2.Text.Trim())
            {
                MessageBox.Show("两次输入的密码不同,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_pwd.SelectAll();
                textBox_pwd.Focus();
                return;
            }


            DataSet ds    = new DataSet();
            string  szErr = "";

            string[] szFirmInf = comboBox_NameM.Text.Split('-');
            int      iFirmID   = Convert.ToInt16(szFirmInf[0]);
            string   szSql     = "select * from mng_card where STORE_CARD='" + MyStart.gszCardFirmFirst + textBox_CardM.Text.Trim() + "'";

            try
            {
                int iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("发卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("发卖方卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                int iNum = ds.Tables[0].Rows.Count;
                if (iNum > 0)
                {
                    MessageBox.Show("卡号重复,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    button_CardM.Focus();
                    goto Eend;
                }

                szSql = "select * from mng_card a where CARD_TYPE = 1 and store_id = " + iFirmID;
                iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("发卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("发卖方卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                iNum = ds.Tables[0].Rows.Count;
                if (iNum > 0)
                {
                    MessageBox.Show("该卖方已发第一副卡和结算卡,请换卖方", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    comboBox_NameM.Focus();
                    goto Eend;
                }

                //必须同时发第一副卡和结算卡
                if (textBox_CardM.TextLength == 0 || textBox_CardV.TextLength == 0)
                {
                    MessageBox.Show("第一副卡和结算卡必须同时发放,请输入卡号", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    button_CardM.Focus();
                    goto Eend;
                }
                if (textBox_pwd.TextLength != 6)
                {
                    MessageBox.Show("必须设置提款密码!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox_pwd.Focus();
                    goto Eend;
                }
                //连接银石后台
                EbHttpClass objHttp = new EbHttpClass();
                string      szPwd   = "1," + textBox_pwd.Text;
                bool        bRst    = objHttp.IssueNewUserCard(textBox_CardV.Text, szFirmInf[1], textBox_TelM.Text, textBox_CertIDM.Text, ref szPwd, ref szErr);
                if (!bRst)
                {
                    MessageBox.Show("后台注册结算卡失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                //EbHttpClass objHttp = new EbHttpClass();
                szPwd = textBox_pwd.Text;
                bRst  = objHttp.IssueNewFirmCard(textBox_CardM.Text, textBox_CardV.Text, szFirmInf[1], textBox_TelM.Text, textBox_CertIDM.Text, ref szPwd, ref szErr);
                if (!bRst)
                {
                    MessageBox.Show("后台注册卖方卡失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                //写入DB
                szPwd = textBox_pwd.Text + "," + szPwd;
                szSql = "INSERT INTO mng_card (STORE_ID,STORE_PERSON,USER_TEL,CERT_ID,CARD_TYPE,STORE_CARD,RMRK,ADD_DT,ADD_ID) VALUES ("
                        + iFirmID + ",'" + textBox_PersonM.Text.Trim() + "','" + textBox_TelM.Text.Trim() + "','"
                        + textBox_CertIDM.Text.Trim() + "',1,'"
                        + MyStart.gszCardFirmFirst + textBox_CardM.Text.Trim() + "',' ',curtime()," + MyStart.giUserID + ")";
                iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("发卖方第一副卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("发卖方卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                szSql = iFirmID + "-持卡人" + textBox_PersonM.Text.Trim() + "-电话" + textBox_TelM.Text.Trim() + "-卡号"
                        + textBox_CardM.Text.Trim();
                MyFunc.WriteToDbLog("发卖方第一副卡", szSql, "MSG", MyStart.giUserID);

                szSql = "INSERT INTO mng_card (STORE_ID,STORE_PERSON,USER_TEL,CERT_ID,CARD_TYPE,STORE_CARD,RMRK,ADD_DT,ADD_ID) VALUES ("
                        + iFirmID + ",'" + textBox_PersonM.Text.Trim() + "','" + textBox_TelM.Text.Trim() + "','"
                        + textBox_CertIDM.Text.Trim() + "',3,'"
                        + textBox_CardV.Text.Trim() + "',' ',curtime()," + MyStart.giUserID + ")";
                iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("发卖方结算卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("发卖方卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }

                szSql = iFirmID + "-持卡人" + textBox_PersonM.Text.Trim() + "-电话" + textBox_TelM.Text.Trim() + "-卡号"
                        + textBox_CardV.Text.Trim();
                MyFunc.WriteToDbLog("发卖方结算卡", szSql, "MSG", MyStart.giUserID);

                if (Convert.ToDecimal(textBox_Fee_M.Text) > 0)
                {
                    long lVal = (long)(Convert.ToDecimal(textBox_Fee_M.Text) * 100);
                    szSql = "insert into rec_firm (card_no,rmrk,store_id,oper_time,oper_type,chg_val,oper_id,tmn_id) values ('"
                            + textBox_CardV.Text.Trim() + "','" + MyStart.gszCardFirmFirst + textBox_CardM.Text.Trim() + "'," + iFirmID + ",curtime(),'ISSU',"
                            + lVal + "," + MyStart.giUserID + ",'" + frm_Main.POS_ID + "')";
                    iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                    if (iRst < 1)
                    {
                        MessageBox.Show("记录卖方第一副卡与结算卡工本费出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("发卖方第一副卡与结算卡收费", "SQL=" + szSql + ",Err=" + szErr);
                        goto Eend;
                    }
                }

                MessageBox.Show("发卖方卡成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                GridDataRefresh(iFirmID, 0);
                //GridDataRefresh(miFirmID, miStallID);
                textBox_CardM.Text   = "";
                textBox_CardV.Text   = "";
                textBox_PersonM.Text = "";
                textBox_TelM.Text    = "";
                textBox_CertIDM.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("发卖方卡失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
            return;
        }
コード例 #9
0
        private void button_unlost_Click(object sender, EventArgs e)
        {
            mszTip = "解挂";
            string szSql = "";

            if (radioButton_unlost_card.Checked)
            {
                if (textBox_unlost_card.TextLength != 16)
                {
                    MessageBox.Show("请输入" + mszTip + "卡的卡号", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (mszFlag.ToUpper() == "USER_CARD")//买方卡
                {
                    szSql = "select user_name,user_tel,cert_id,card_flag,card_pwd from base_ucard where user_card='" + textBox_unlost_card.Text.Trim() + "'";
                }
                else//卖方结算卡
                {
                    szSql = "select STORE_PERSON, user_tel, cert_id,CARD_STAT,RMRK from mng_card where CARD_TYPE = 3 and STORE_CARD = '" + textBox_unlost_card.Text.Trim() + "'";
                }
            }
            if (radioButton_unlost_cell.Checked)
            {
                if (textBox_unlost_cell.TextLength <= 0)
                {
                    MessageBox.Show("手机号不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (mszFlag.ToUpper() == "USER_CARD")//买方卡
                {
                    szSql = "select user_name,user_card,cert_id,card_flag,card_pwd from base_ucard where user_tel='" + textBox_unlost_cell.Text.Trim() + "'";
                }
                else//卖方结算卡
                {
                    szSql = "select STORE_PERSON, STORE_CARD, cert_id,CARD_STAT,RMRK from mng_card where CARD_TYPE = 3 and user_tel = '" + textBox_unlost_cell.Text.Trim() + "'";
                }
            }
            if (radioButton_unlost_cert.Checked)
            {
                if (textBox_unlost_cert.TextLength <= 0)
                {
                    MessageBox.Show("身份证号不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (mszFlag.ToUpper() == "USER_CARD")//买方卡
                {
                    szSql = "select user_name,user_tel,user_card,card_flag,card_pwd from base_ucard where cert_id='" + textBox_unlost_cert.Text.Trim() + "'";
                }
                else//卖方结算卡
                {
                    szSql = "select STORE_PERSON, user_tel, STORE_CARD,CARD_STAT,RMRK from mng_card where CARD_TYPE = 3 and  cert_id= '" + textBox_unlost_cert.Text.Trim() + "'";
                }
            }

            //确认卡片信息
            //if (mszFlag.ToUpper() == "USER_CARD")//买方卡
            //{
            //    szSql = "select user_name,user_tel,cert_id,card_flag from base_ucard where user_card='" + textBox_Card_Lost.Text + "'";
            //}
            //else//卖方结算卡
            //{
            //    szSql = "select STORE_PERSON, user_tel, cert_id,CARD_STAT from mng_card where CARD_TYPE = 3 and STORE_CARD = '" + textBox_Card_Lost.Text + "'";
            //}
            try
            {
                DataSet ds    = new DataSet();
                string  szErr = "";
                int     iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("卡片查询出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(this.Text + mszTip + "卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                int iNum = ds.Tables[0].Rows.Count;
                if (iNum < 1)
                {
                    MessageBox.Show("查不到卡片信息,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                if (iNum > 1)
                {
                    MessageBox.Show("卡号关联多买方,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                DataRow dr    = ds.Tables[0].Rows[0];
                string  szPwd = "";
                if (mszFlag.ToUpper() == "USER_CARD")//买方卡
                {
                    szPwd = dr[4].ToString();
                }
                else//卖方结算卡
                {
                    string[] szX = dr[4].ToString().Split(',');
                    szPwd = szX[0];
                }
                if (dr[3].ToString().ToUpper() == "BGN")
                {
                    MessageBox.Show("非挂失状态,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                //bool bLost = (mszTip == "挂失" ? true : false);
                //if(bLost)
                //{
                //if (dr[3].ToString().ToUpper() == "LOST")
                //{
                //    MessageBox.Show("卡号已挂失,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //    return;
                //}
                //}
                //else
                //{
                //}
                string szCard = "";
                if (radioButton_unlost_card.Checked)
                {
                    szCard = textBox_unlost_card.Text.Trim();
                    label_unLostCard.Text = "卡号:" + szCard + "\r\n" + "持卡人:" + dr[0].ToString() + "\r\n" + "联系电话:" + dr[1].ToString() + "\r\n" + "身份证号:" + dr[2].ToString();
                }
                if (radioButton_unlost_cell.Checked)
                {
                    szCard = dr[1].ToString();
                    label_unLostCard.Text = "卡号:" + szCard + "\r\n" + "持卡人:" + dr[0].ToString() + "\r\n" + "联系电话:" + textBox_unlost_cell.Text + "\r\n" + "身份证号:" + dr[2].ToString();
                }
                if (radioButton_unlost_cert.Checked)
                {
                    szCard = dr[2].ToString();
                    label_unLostCard.Text = "卡号:" + szCard + "\r\n" + "持卡人:" + dr[0].ToString() + "\r\n" + "联系电话:" + dr[1].ToString() + "\r\n" + "身份证号:" + textBox_unlost_cert.Text;
                }
                if (DialogResult.No == MessageBox.Show("是否继续" + mszTip + "卡操作?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
                {
                    goto Eend;
                }

                ////银石后台验密
                //EbHttpClass objHttp = new EbHttpClass();
                //bool bRst = objHttp.CheckPwd(szCard, textBox_unlost_pwd.Text.Trim(), ref szErr);
                //if (!bRst)//szPwd != textBox_unlost_pwd.Text)
                //{
                //    MessageBox.Show("验密失败(后台"+szErr+"),不能解挂", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //    //MessageBox.Show("卡号密码错误,不能解挂", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //    return;
                //}

                //银石后台修改
                EbHttpClass objHttp = new EbHttpClass();
                bool        bRst    = objHttp.LostCard(false, szCard, ref szErr);
                if (!bRst)
                {
                    MessageBox.Show("后台" + mszTip + "卡失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                //新卡写DB
                string szField = "BGN";               // (bLost ? "LOST" : "BGN");
                if (mszFlag.ToUpper() == "USER_CARD") //换买方卡
                {
                    szSql = "update base_ucard set card_flag = '" + szField + "',CHG_DT=curtime(),CHG_ID=" + MyStart.giUserID
                            + " where user_card = '" + szCard + "'";
                }
                else//换卖方结算卡
                {
                    szSql = "update mng_card set CARD_STAT = '" + szField + "',CHG_DT=curtime(),CHG_ID=" + MyStart.giUserID
                            + " where CARD_TYPE = 3 and STORE_CARD = '" + szCard + "'";
                }
                iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show(mszTip + "卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(this.Text + mszTip + "卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                MyFunc.WriteToDbLog(this.Text + mszTip + "卡", "卡号" + textBox_Card_Lost.Text, "MSG", MyStart.giUserID);
                MessageBox.Show(mszTip + "卡成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("解挂卡片失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
コード例 #10
0
        private void button_ChgCard_Click(object sender, EventArgs e)
        {
            if (textBox_Card_New.TextLength != 16)
            {
                MessageBox.Show("请输入换卡后,新卡卡号", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string szSql = "";

            if (radioButton_chg_card.Checked)
            {
                if (textBox_Card_Old.TextLength != 16)
                {
                    MessageBox.Show("请输入换卡前,旧卡卡号", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (mszFlag.ToUpper() == "USER_CARD")//买方卡
                {
                    szSql = "select user_name,user_tel,cert_id,card_flag,card_pwd from base_ucard where user_card='" + textBox_Card_Old.Text.Trim() + "'";
                }
                else//卖方结算卡
                {
                    szSql = "select STORE_PERSON, user_tel, cert_id,STORE_ID,RMRK from mng_card where CARD_TYPE = 3 and STORE_CARD = '" + textBox_Card_Old.Text.Trim() + "'";
                }
            }
            if (radioButton_chg_cell.Checked)
            {
                if (textBox_chg_cell.TextLength <= 0)
                {
                    MessageBox.Show("手机号不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (mszFlag.ToUpper() == "USER_CARD")//买方卡
                {
                    szSql = "select user_name,user_card,cert_id,card_flag,card_pwd from base_ucard where user_tel='" + textBox_chg_cell.Text.Trim() + "'";
                }
                else//卖方结算卡
                {
                    szSql = "select STORE_PERSON, STORE_CARD, cert_id,STORE_ID,RMRK from mng_card where CARD_TYPE = 3 and user_tel = '" + textBox_chg_cell.Text.Trim() + "'";
                }
            }
            if (radioButton_chg_cert.Checked)
            {
                if (textBox_chg_cert.TextLength <= 0)
                {
                    MessageBox.Show("身份证号不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (mszFlag.ToUpper() == "USER_CARD")//买方卡
                {
                    szSql = "select user_name,user_tel,user_card,card_flag,card_pwd from base_ucard where cert_id='" + textBox_chg_cert.Text.Trim() + "'";
                }
                else//卖方结算卡
                {
                    szSql = "select STORE_PERSON, user_tel, STORE_CARD,STORE_ID,RMRK from mng_card where CARD_TYPE = 3 and  cert_id= '" + textBox_chg_cert.Text.Trim() + "'";
                }
            }

            //确认卡片信息
            //if (mszFlag.ToUpper() == "USER_CARD")//买方卡
            //{
            //    szSql = "select user_name,user_tel,cert_id from base_ucard where user_card='" + textBox_Card_Old.Text + "'";
            //}
            //else//卖方结算卡
            //{
            //    szSql = "select STORE_PERSON, user_tel, cert_id,STORE_ID from mng_card where CARD_TYPE = 3 and STORE_CARD = '" + textBox_Card_Old.Text + "'";
            //}
            try
            {
                DataSet ds    = new DataSet();
                string  szErr = "";
                int     iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("卡片查询出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(this.Text + "换卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                int iNum = ds.Tables[0].Rows.Count;
                if (iNum < 1)
                {
                    MessageBox.Show("查不到卡片信息,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                if (iNum > 1)
                {
                    MessageBox.Show("卡号关联多买方,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                DataRow dr    = ds.Tables[0].Rows[0];
                string  szPwd = "";
                if (mszFlag.ToUpper() == "USER_CARD")//买方卡
                {
                    szPwd = dr[4].ToString();
                }
                else//卖方结算卡
                {
                    string[] szItem = dr[4].ToString().Split(',');
                    szPwd = szItem[0];
                }


                //}
                string szCard = "";
                if (radioButton_chg_card.Checked)
                {
                    szCard             = textBox_Card_Old.Text.Trim();
                    label_ChgCard.Text = "卡号:" + szCard + "\r\n" + "持卡人:" + dr[0].ToString() + "\r\n" + "联系电话:" + dr[1].ToString() + "\r\n" + "身份证号:" + dr[2].ToString();
                }
                if (radioButton_chg_cell.Checked)
                {
                    szCard             = dr[1].ToString();
                    label_ChgCard.Text = "卡号:" + szCard + "\r\n" + "持卡人:" + dr[0].ToString() + "\r\n" + "联系电话:" + textBox_chg_cell.Text + "\r\n" + "身份证号:" + dr[2].ToString();
                }
                if (radioButton_chg_cert.Checked)
                {
                    szCard             = dr[2].ToString();
                    label_ChgCard.Text = "卡号:" + szCard + "\r\n" + "持卡人:" + dr[0].ToString() + "\r\n" + "联系电话:" + dr[1].ToString() + "\r\n" + "身份证号:" + textBox_chg_cert.Text;
                }
                //银石后台验密
                EbHttpClass objHttp = new EbHttpClass();
                bool        bRst    = objHttp.CheckPwd(szCard, textBox_chg_pwd.Text.Trim(), ref szErr);
                if (!bRst)//if (szPwd != textBox_chg_pwd.Text)
                {
                    MessageBox.Show("卡号密码错误,不能换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                if (DialogResult.No == MessageBox.Show("是否继续换卡操作?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
                {
                    goto Eend;
                }

                //EbHttpClass objHttp = new EbHttpClass();
                /*bool*/
                bRst = false;

                /*int iVal = 0;// Convert.ToInt16(Convert.ToDecimal( textBox_Val.Text)*100)/100;
                 * int iFee = miFee * 100;// Convert.ToInt16(Convert.ToDecimal(textBox_Fee.Text)*100);
                 * if (iFee > 0)
                 * {
                 *  if (iVal == 0)
                 *  {//银石后台读余额
                 *      bRst = objHttp.QryCard(MyStart.gszCardYtbFirst + textBox_Card_Old.Text, ref iVal,ref miUncofirmVal, ref szErr);
                 *      if (!bRst)
                 *      {
                 *          MessageBox.Show("后台读余额失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 *          return;
                 *      }
                 *      textBox_Val.Text = (Convert.ToDecimal(iVal) /100).ToString("0.00");
                 *  }
                 *  if(iVal<iFee)
                 *  {
                 *      if(DialogResult.No== MessageBox.Show("卡内余额不足,是否继续?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                 *          return;
                 *  }
                 *
                 *  //扣费 -- not code yet
                 *  ;
                 * }*/

                //银石后台修改
                string   szNewPwd = "888888";// + textBox_New_Pwd.Text;
                string[] szX      = comboBox_Why.Text.Split('-');
                decimal  dFee     = Convert.ToDecimal(textBox_Fee.Text);
                bRst = objHttp.ChangeCard(szCard, textBox_Card_New.Text, szX[0], dFee, ref szNewPwd, ref szErr);
                if (!bRst)
                {
                    MessageBox.Show("后台换卡失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                if (mszFlag.ToUpper() != "USER_CARD")//重新捆绑
                {
                    miStoreID = Convert.ToInt16(dr[3]);
                    //read
                    szSql = "select STORE_CARD, STORE_NAME,USER_TEL, a.cert_id from mng_card a,base_store b "
                            + "where a.STORE_ID = b.STORE_ID and CARD_TYPE = 1 and a.STORE_ID = " + miStoreID;
                    iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                    if (iRst != 0)
                    {
                        MessageBox.Show("换卖方卡查询出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog(this.Text + "换卖方卡", "SQL=" + szSql + ",Err=" + szErr);
                        goto Eend;
                    }
                    iNum = ds.Tables[0].Rows.Count;
                    if (iNum < 1)
                    {
                        MessageBox.Show("查不到卖方卡信息,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        goto Eend;
                    }

                    dr   = ds.Tables[0].Rows[0];
                    bRst = objHttp.IssueNewFirmCard(dr[0].ToString().Substring(1, 15), textBox_Card_New.Text, dr[1].ToString(), dr[2].ToString(), dr[3].ToString(), ref szNewPwd, ref szErr);
                    if (!bRst)
                    {
                        MessageBox.Show("后台绑定新的结算卡失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        goto Eend;
                    }
                }

                //旧卡写DB
                if (mszFlag.ToUpper() == "USER_CARD")//换买方卡
                {
                    szSql = "update base_ucard CHG_DT=curtime(),CHG_ID=" + MyStart.giUserID + ",card_flag='STOP' where user_card = '" + szCard + "'";
                }
                else//换卖方结算卡
                {
                    szSql = "update mng_card set CHG_DT=curtime(),CHG_ID=" + MyStart.giUserID + ",card_flag='STOP' where CARD_TYPE = 3 and STORE_CARD = '" + szCard + "'";
                }
                iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("换卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(this.Text + "换卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                //新卡写DB
                if (mszFlag.ToUpper() == "USER_CARD")//换买方卡
                {
                    //szSql = "update base_ucard set user_card = '" + textBox_Card_New.Text
                    //    + "',CHG_DT=curtime(),CHG_ID=" + MyStart.giUserID + " where user_card = '" + szCard + "'";
                    szSql = "insert into base_ucard(user_card, user_name, oper_time, USER_TEL, card_flag, CERT_ID, ADD_ID, rmrk, user_addr, card_type, parent_ID) "
                            + "(select '" + textBox_Card_New.Text + "', user_name, curtime(), USER_TEL, 'BGN', CERT_ID, " + MyStart.giUserID + ", rmrk, user_addr, card_type, parent_ID " +
                            "from base_ucard where user_card = '" + szCard + "')";
                }
                else//换卖方结算卡
                {
                    //szSql = "update mng_card set STORE_CARD = '" + textBox_Card_New.Text
                    //    + "',CHG_DT=curtime(),CHG_ID=" + MyStart.giUserID + " where CARD_TYPE = 3 and STORE_CARD = '" + szCard + "'";
                    szSql = "insert into mng_card(STORE_ID, STALL_ID, STORE_PERSON, USER_TEL, CARD_TYPE, STORE_CARD, CARD_STAT, ADD_DT, ADD_ID, CERT_ID, STALL_INF) "
                            + "(select STORE_ID, STALL_ID, STORE_PERSON, USER_TEL, 3, '" + szCard + "', 'BGN', curtime(),  " + MyStart.giUserID + ", CERT_ID, STALL_INF " +
                            "from mng_card where STORE_CARD = '" + szCard + "')";
                }
                iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("换卡出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(this.Text + "换卡", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                MyFunc.WriteToDbLog(this.Text + "-换卡", "旧卡号" + szCard + ",新卡号" + textBox_Card_New.Text, "MSG", MyStart.giUserID);
                MessageBox.Show("换卡成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //收费记录
                if (checkBox_Fee.Checked && Convert.ToDecimal(textBox_Fee.Text) > 0)
                {
                    long lVal = (long)(Convert.ToDecimal(textBox_Fee.Text) * 100);
                    if (mszFlag.ToUpper() == "USER_CARD")//换买方卡
                    {
                        szSql = "insert into rec_user (card_no,oper_time,oper_type,chg_val,oper_id,tmn_id) values ('" + szCard
                                + "',curtime(),'CHG'," + lVal + "," + MyStart.giUserID + ",'" + frm_Main.POS_ID + "')";
                        iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                        if (iRst < 1)
                        {
                            MessageBox.Show("记录买方换卡工本费出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            MyIniFile.WriteLog("买方换卡", "SQL=" + szSql + ",Err=" + szErr);
                            goto Eend;
                        }
                    }
                    else//换卖方结算卡
                    {
                        szSql = "select STORE_ID from mng_card where STORE_CARD='" + szCard + "'";
                        szErr = "";
                        iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                        if (iRst < 1)
                        {
                            MessageBox.Show("查找卖方换卡记录出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            MyIniFile.WriteLog("卖方换卡", "SQL=" + szSql + ",Err=" + szErr);
                            goto Eend;
                        }
                        dr = ds.Tables[0].Rows[0];
                        int iFirmID = Convert.ToInt32(dr[0]);

                        szSql = "insert into rec_firm (card_no,store_id,oper_time,oper_type,chg_val,oper_id,tmn_id) values ('"
                                + MyStart.gszCardFirmFirst + szCard + "'," + iFirmID + ",curtime(),'CHG',"
                                + lVal + "," + MyStart.giUserID + ",'" + frm_Main.POS_ID + "')";
                        iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                        if (iRst < 1)
                        {
                            MessageBox.Show("记录卖方换卡工本费出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            MyIniFile.WriteLog("卖方换卡", "SQL=" + szSql + ",Err=" + szErr);
                            goto Eend;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("更换卡片失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
コード例 #11
0
        private void button_ChgPwd_Click(object sender, EventArgs e)
        {
            /*if (textBox_Old_Pwd.Text.Trim().ToUpper().CompareTo(MyStart.gszUserPwd.ToUpper()) != 0)
             * {
             *  MessageBox.Show("旧密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             *  textBox_Old_Pwd.Focus();
             *  return;
             * }*/

            if (textBox_New_Pwd.Text.CompareTo(textBox_2nd_Pwd.Text) != 0)
            {
                MessageBox.Show("两次输入的新密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_New_Pwd.Focus();
                return;
            }

            //读旧卡密码密文
            //string szSql = "";
            string szErr    = "";
            string szOldPwd = "";
            //if (mszFlag.ToUpper() == "USER_CARD")
            //{
            //    szSql = "select card_pwd,pwd_crypt from base_ucard where user_card='" + textBox_Card_ChgPwd.Text + "'";
            //}
            //else
            //{
            //    szSql = "select RMRK from mng_card where STORE_CARD='" + textBox_Card_ChgPwd.Text + "'";
            //}
            //DataSet ds = new DataSet();
            //int iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
            //if (iRst != 0)
            //{
            //    MessageBox.Show("读取卡片信息出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    MyIniFile.WriteLog(this.Text + "-更改密码", "SQL=" + szSql + ",Err=" + szErr);
            //    return;
            //}
            //int iNum = ds.Tables[0].Rows.Count;
            //if (iNum < 1)
            //{
            //    MessageBox.Show("查不到卡片信息,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    button_Card_ChgPwd.Focus();
            //    return;
            //}
            //if (iNum > 1)
            //{
            //    MessageBox.Show("卡片信息错误,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    button_Card_ChgPwd.Focus();
            //    return;
            //}

            //DataRow dr = ds.Tables[0].Rows[0];
            //string[] szX;
            //if (mszFlag.ToUpper() == "USER_CARD")
            //{
            //    if (textBox_Old_Pwd.Text.Trim().ToUpper().CompareTo(dr[0].ToString().ToUpper()) != 0)
            //    {
            //        MessageBox.Show("旧密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //        textBox_Old_Pwd.Focus();
            //        return;
            //    }
            //    szOldPwd = dr[1].ToString();
            //}
            //else
            //{
            //    szX = dr[0].ToString().Split(',');
            //    if (textBox_Old_Pwd.Text.Trim().ToUpper().CompareTo(szX[0].ToString().ToUpper()) != 0)
            //    {
            //        MessageBox.Show("旧密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //        textBox_Old_Pwd.Focus();
            //        return;
            //    }
            //    szOldPwd = szX[1];
            //}
            //银石后台验密
            EbHttpClass objHttp = new EbHttpClass();
            bool        bRst    = objHttp.GetPwdCrypt(textBox_Card_ChgPwd.Text.Trim(), textBox_Old_Pwd.Text.Trim(), ref szOldPwd, ref szErr);

            if (!bRst)//szPwd != textBox_unlost_pwd.Text)
            {
                MessageBox.Show("旧密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_Old_Pwd.Focus();
                return;
            }

            //银石后台修改
            string szNewPwd = "1," + textBox_New_Pwd.Text;

            //EbHttpClass objHttp = new EbHttpClass();
            /*bool*/ bRst = objHttp.ChgPwd(textBox_Card_ChgPwd.Text, szOldPwd, ref szNewPwd, ref szErr);
            if (!bRst)
            {
                MessageBox.Show("后台修改卡片密码失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            /*新密码和密文写DB
             * //szNewPwd = textBox_New_Pwd.Text  + "," + szNewPwd;
             * if (mszFlag.ToUpper() == "USER_CARD")
             * {
             *  szSql = "update base_ucard set card_pwd='" + textBox_New_Pwd.Text + "',pwd_crypt='"
             + szNewPwd + "',CHG_DT=curtime(),CHG_ID=" + MyStart.giUserID
             + " where user_card='" + textBox_Card_ChgPwd.Text + "'";
             + }
             + else
             + {
             +  szNewPwd = textBox_New_Pwd.Text + "," + szNewPwd;
             +  szSql = "update mng_card set RMRK='" + szNewPwd + "',CHG_DT=curtime(),CHG_ID=" + MyStart.giUserID
             + " where CARD_TYPE=3 " + "and STORE_CARD='" + textBox_Card_ChgPwd.Text + "'";
             + }
             + try
             + {
             +  int iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
             +  if (iRst < 1)
             +  {
             +      MessageBox.Show("更改密码失败(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             +      MyIniFile.WriteLog(this.Text + "-更改密码", "SQL=" + szSql + ",Err=" + szErr);
             +      goto Eend;
             +  }
             +
             + }
             + catch (Exception ex)
             + {
             +  MessageBox.Show("更改密码失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             + }
             + Eend:
             + MyStart.oMyDb.Close();*/
            MyFunc.WriteToDbLog(this.Text + "-更改密码", "卡号" + textBox_Card_ChgPwd.Text, "MSG", MyStart.giUserID);
            MessageBox.Show("更改密码成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #12
0
ファイル: frm_Firm_Trans.cs プロジェクト: wl2019/EB_for_YTB
        private void button_JK_Click(object sender, EventArgs e)
        {
            string sErr = "";

            //if (textBox_Pwd.Text.Trim() != CardPwd)
            //{
            //    MessageBox.Show("密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    return;
            //}

            //银石后台
            objHttp = new EbHttpClass();
            //bool bRst = objHttp.TransMoney(textBox_CustCardID.Text.Substring(1), textBox_UserCardID.Text, ref sErr);
            bool bRst = objHttp.TransMoney(sStoreCard.Substring(1), textBox_UserCardID.Text, textBox_Pwd.Text.Trim(), ref sErr);

            if (!bRst)
            {
                MessageBox.Show("结算失败:" + sErr, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                int    iB          = 0;
                int    iT          = 0;
                int    iOldBalance = 0;
                float  fi          = 0;
                string szInf       = "";
                string sSql        = "";

                if (!GetCardBalance(textBox_UserCardID.Text, ref iB, ref iT, ref szInf))
                {
                    MessageBox.Show("读数据库错误 = " + szInf, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    goto Eend;
                }
                //fi = iB;
                //fi /= 100;
                //textBox_FinishBalance.Text = fi.ToString("0.00");

                //if (iT <= 0)
                //{
                //    iT = 0;
                //}
                //fi = iT;
                //fi /= 100;
                //textBox_UnFinishBalance.Text = fi.ToString("0.00");

                iOldBalance             = iB + iT;
                fi                      = iOldBalance;
                fi                     /= 100;
                textBox_NewBalance.Text = fi.ToString("0.00");

                // 写入数据库
                sSql = "INSERT INTO rec_firm (Card_No, Rmrk, STORE_ID, Oper_Time, Oper_Type, Before_Val, Chg_Val, After_Val, Oper_ID, Tmn_ID, Sys_ID) VALUE(" +
                       "'" + textBox_UserCardID.Text + "'," +
                       "'" + sStoreCard + "'," +
                       sStoreID + "," +
                       "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," +
                       "'SETT',";
                float f = float.Parse(textBox_OldBalance.Text);
                f *= 100;
                int i = (int)(f + 0.5);
                sSql += i.ToString() + ", 0,";

                i     = iOldBalance;
                sSql += i.ToString() + "," +
                        MyStart.giUserID + "," +
                        "'" + frm_Main.POS_ID + "'," +
                        "0)";

                int iRst = MyStart.oMyDb.WriteData(sSql, ref szInf);
                if (iRst < 0)
                {
                    textBox_Result.Text = "结算成功! 但写数据库失败(" + szInf + ")";
                    MessageBox.Show("结算成功! 但写数据库失败(" + szInf + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    textBox_Result.Text = "结算成功! ";
                    MessageBox.Show("结算成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                // log
                MyFunc.WriteToDbLog("卖方资金-结算", " ", "MSG", MyStart.giUserID);


                // 打印
                // button_Print_Click(sender, e);

                groupBox_ThirdStep.Enabled  = false;
                groupBox_FourthStep.Enabled = true;

Eend:
                MyStart.oMyDb.Close();
            }
        }