Example #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string password = this.txtOldPassword.Text.Trim();          // 原密码
            string newPassword = this.txtNewPassword.Text.Trim();       // 新密码
            string reNewPassword = this.txtReNewPassword.Text.Trim();   // 重复新密码

            if (newPassword != reNewPassword)  // 检查两次输入的新密码是否一致
            {
                MessageBox.Show("两次输入的新密码不一致!");
                return;
            }

            DB db = new DB();
            DataTable dt = new DataTable();
            dt = db.ExecuteReturnSQL("SELECT password FROM operators WHERE operator_no = '" + MainForm.current_operator + "'");
            if (dt.Rows.Count > 0)
            {
                if (password == dt.Rows[0][0].ToString().Trim())
                {
                    db.ExecuteNoReturnSQL("UPDATE operators SET password = '******' WHERE operator_no = '" + MainForm.current_operator + "'");
                }
                else
                {
                    MessageBox.Show("原密码不正确!");
                }
            }
            else
            {
                MessageBox.Show("操作员不存在!");
            }
        }
Example #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string password      = this.txtOldPassword.Text.Trim();   // 原密码
            string newPassword   = this.txtNewPassword.Text.Trim();   // 新密码
            string reNewPassword = this.txtReNewPassword.Text.Trim(); // 重复新密码

            if (newPassword != reNewPassword)                         // 检查两次输入的新密码是否一致
            {
                MessageBox.Show("两次输入的新密码不一致!");
                return;
            }

            DB        db = new DB();
            DataTable dt = new DataTable();

            dt = db.ExecuteReturnSQL("SELECT password FROM operators WHERE operator_no = '" + MainForm.current_operator + "'");
            if (dt.Rows.Count > 0)
            {
                if (password == dt.Rows[0][0].ToString().Trim())
                {
                    db.ExecuteNoReturnSQL("UPDATE operators SET password = '******' WHERE operator_no = '" + MainForm.current_operator + "'");
                }
                else
                {
                    MessageBox.Show("原密码不正确!");
                }
            }
            else
            {
                MessageBox.Show("操作员不存在!");
            }
        }
Example #3
0
        /*
         *  冲正交易
         */
        private void do_reversal(int reversal_times)
        {
            DB        db = new DB();
            DataTable dt = new DataTable();

            dt = db.ExecuteReturnSQL("SELECT id, card_no, batch_no, trace_no FROM trans WHERE state='p' AND trans_name IN ('payment', 'deposit', 'cancel_trans', 'points_payment', 'points_deposit')");
            if (dt.Rows.Count > 0)
            {
                this.statusTransText.Text = "冲正";
                this.Refresh();

                String id           = dt.Rows[0]["id"].ToString();
                String card_no      = dt.Rows[0]["card_no"].ToString();
                String old_batch_no = dt.Rows[0]["batch_no"].ToString();
                String old_trace_no = dt.Rows[0]["trace_no"].ToString();

                trans.init();
                trans.Action       = "reversal";
                trans.Old_Batch_No = old_batch_no;
                trans.Old_Trace_No = old_trace_no;
                trans.Card_No      = card_no;

                trans.Batch_No = Utils.getBatchNum();
                trans.Trace_No = Utils.getTraceNum();

                string   dataPackage = trans.Build_Trans_String();
                MySocket mSocket     = new MySocket();
                string   rtnString   = mSocket.Send(dataPackage);
                // 处理返回结果
                Hashtable hashTable = new Hashtable();
                hashTable = trans.GetReturnPackage(rtnString);
                // 如果返回成功,则更新本地数据表中的交易记录状态为"s"
                string result_code = "";
                foreach (DictionaryEntry de in hashTable)
                {
                    if (de.Key.ToString().Trim() == "result_code")
                    {
                        result_code = de.Value.ToString().Trim();
                    }
                }

                if (result_code == "1")
                {
                    db.ExecuteNoReturnSQL(String.Format("UPDATE trans SET state='s' WHERE id='{0}'", id));
                }

                this.statusTransText.Text = "";
                this.Refresh();
            }
            else
            {
                return;
            }
        }
Example #4
0
 public static String getTraceNum()
 {
     DB db = new DB();
     DataTable traceData = db.ExecuteReturnSQL("SELECT val FROM settings WHERE setting = 'current_trace_no'");
     if (traceData.Rows.Count > 0)
     {
         String traceNum = traceData.Rows[0][0].ToString() ;
         return Convert.ToString(traceNum);
     }
     else
     {
         return "1";
     }
 }
Example #5
0
 public static String getBatchNum()
 {
     DB db = new DB();
     DataTable batchData = db.ExecuteReturnSQL("SELECT val FROM settings WHERE setting = 'current_batch_no'");
     if (batchData.Rows.Count > 0)
     {
         String batchNum = batchData.Rows[0][0].ToString();
         return Convert.ToString(batchNum);
     }
     else
     {
         return "1";
     }
 }
Example #6
0
        public static String getTraceNum()
        {
            DB        db        = new DB();
            DataTable traceData = db.ExecuteReturnSQL("SELECT val FROM settings WHERE setting = 'current_trace_no'");

            if (traceData.Rows.Count > 0)
            {
                String traceNum = traceData.Rows[0][0].ToString();
                return(Convert.ToString(traceNum));
            }
            else
            {
                return("1");
            }
        }
Example #7
0
        public static String getBatchNum()
        {
            DB        db        = new DB();
            DataTable batchData = db.ExecuteReturnSQL("SELECT val FROM settings WHERE setting = 'current_batch_no'");

            if (batchData.Rows.Count > 0)
            {
                String batchNum = batchData.Rows[0][0].ToString();
                return(Convert.ToString(batchNum));
            }
            else
            {
                return("1");
            }
        }
Example #8
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string operatorNo = this.txtOperatorNo.Text.Trim();
            string password = this.txtPassword.Text.Trim();
            string rePassword = this.txtRePassword.Text.Trim();

            if (operatorNo == "")
            {
                MessageBox.Show("操作员号不能为空!");
                return;
            }

            if (password != rePassword)
            {
                MessageBox.Show("两次输入的密码不一致!");
                return;
            }


            DB db = new DB();
            DataTable dt = new DataTable();
            dt = db.ExecuteReturnSQL("SELECT * FROM operators WHERE operator_no = '" + operatorNo + "'");
            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("此操作员已存在!");
            }
            else
            {
                if (db.ExecuteNoReturnSQL("INSERT INTO operators (operator_no, password) VALUES ('" + operatorNo + "', '" + password + "')"))
                {
                    MessageBox.Show("添加操作员成功!");
                }
                else
                {
                    MessageBox.Show("添加操作员失败!");
                }
            }

        }
Example #9
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string operatorNo = this.txtOperatorNo.Text.Trim();
            string password   = this.txtPassword.Text.Trim();
            string rePassword = this.txtRePassword.Text.Trim();

            if (operatorNo == "")
            {
                MessageBox.Show("操作员号不能为空!");
                return;
            }

            if (password != rePassword)
            {
                MessageBox.Show("两次输入的密码不一致!");
                return;
            }


            DB        db = new DB();
            DataTable dt = new DataTable();

            dt = db.ExecuteReturnSQL("SELECT * FROM operators WHERE operator_no = '" + operatorNo + "'");
            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("此操作员已存在!");
            }
            else
            {
                if (db.ExecuteNoReturnSQL("INSERT INTO operators (operator_no, password) VALUES ('" + operatorNo + "', '" + password + "')"))
                {
                    MessageBox.Show("添加操作员成功!");
                }
                else
                {
                    MessageBox.Show("添加操作员失败!");
                }
            }
        }
Example #10
0
        /*
         *  冲正交易
         */
        private void do_reversal(int reversal_times)
        {
            DB db = new DB();
            DataTable dt = new DataTable();
            dt = db.ExecuteReturnSQL("SELECT id, card_no, batch_no, trace_no FROM trans WHERE state='p' AND trans_name IN ('payment', 'deposit', 'cancel_trans', 'points_payment', 'points_deposit')");
            if (dt.Rows.Count > 0)
            {
                this.statusTransText.Text = "冲正";
                this.Refresh();

                String id = dt.Rows[0]["id"].ToString();
                String card_no = dt.Rows[0]["card_no"].ToString();
                String old_batch_no = dt.Rows[0]["batch_no"].ToString();
                String old_trace_no = dt.Rows[0]["trace_no"].ToString();

                trans.init();
                trans.Action = "reversal";
                trans.Old_Batch_No = old_batch_no;
                trans.Old_Trace_No = old_trace_no;
                trans.Card_No = card_no;

                trans.Batch_No = Utils.getBatchNum();
                trans.Trace_No = Utils.getTraceNum();

                string dataPackage = trans.Build_Trans_String();
                MySocket mSocket = new MySocket();
                string rtnString = mSocket.Send(dataPackage);
                // 处理返回结果
                Hashtable hashTable = new Hashtable();
                hashTable = trans.GetReturnPackage(rtnString);
                // 如果返回成功,则更新本地数据表中的交易记录状态为"s"
                string result_code = "";
                foreach (DictionaryEntry de in hashTable)
                {
                    if (de.Key.ToString().Trim() == "result_code")
                    {
                        result_code = de.Value.ToString().Trim();
                    }
                }

                if (result_code == "1")
                {
                    db.ExecuteNoReturnSQL(String.Format("UPDATE trans SET state='s' WHERE id='{0}'", id));
                }

                this.statusTransText.Text = "";
                this.Refresh();
            }
            else
            {
                return;
            }
        }