Exemple #1
0
    private void Chongzhi()
    {
        var count      = card_count.Value;
        var m001_key   = txt_m001_key.Value;
        var m00203_key = DNTRequest.GetString("card_name").Trim();

        if (!string.IsNullOrEmpty(count))
        {
            if (m00203_key != "19591")
            {
                string sql2 = "ucbmp.M101_M00203(" + m00203_key + "," + m001_key + "," + count + ",'" + user_id + "','888801',0,'0')";
                db.BeginTransaction();
                int i = db.ExecuteNonQuery(sql2, CommandType.Text);
                db.Commit();
                if (i == 1)
                {
                    card_count.Value = "";
                    MessageBox.ShowAndBack("充值成功!");
                    return;
                }
                else
                {
                    MessageBox.ShowAndBack("充值失败!");
                    return;
                }
            }
            else
            {
                string sql0 = "select * from a007 where a007_id='" + user_id + "'";
                db.ExcuteDataTable(dt_a007, sql0, CommandType.Text);
                if (dt_a007.Rows.Count != 0)
                {
                    m002_key = dt_a007.Rows[0]["m002_key"].ToString();
                }

                string sql2 = "ucbmp.Acct_Proc(" + m001_key + "," + count + ",'888801','" + m002_key + "','1001')";
                db.BeginTransaction();
                int i = db.ExecuteNonQuery(sql2, CommandType.Text);
                db.Commit();
                if (i == 1)
                {
                    card_count.Value = "";
                    MessageBox.ShowAndBack("充值成功!");
                    return;
                }
                else
                {
                    MessageBox.ShowAndBack("充值失败!");
                    return;
                }
            }
        }
    }
Exemple #2
0
 public string  saveLogin(string inorout)
 {
     try
     {
         string logintype = System.Web.HttpContext.Current.Session["logintype"].ToString();
         string clientip  = getClientIp();
         string user_id   = System.Web.HttpContext.Current.Session["user_id"].ToString();
         string m002_key  = "-";
         try
         {
             m002_key = System.Web.HttpContext.Current.Session["m002_key"].ToString();
         }
         catch
         {
             m002_key = "-";
         }
         string log_sql = "Proc_login_log('" + logintype + "','" + m002_key + "','" + user_id + "','" + clientip + "','" + inorout + "')";
         Oracle db      = new Oracle();
         db.BeginTransaction();
         int li_db = db.ExecuteNonQuery(log_sql, CommandType.Text);
         if (li_db < 0)
         {
             db.Rollback();
         }
         else
         {
             db.Commit();
         }
         return(li_db.ToString());
     }
     catch
     {
         return("-1");
     }
 }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!ispost)
     {
         Objid   = Request.QueryString["KEY"] == null ? "" : Request.QueryString["KEY"].ToString();
         User_Id = Request.QueryString["USER"] == null ? "" : Request.QueryString["USER"].ToString();
         string sql = "select * from M00101 t where t.m00101_key='" + Objid + "'";
         db.ExcuteDataTable(dt_m00101, sql, CommandType.Text);
     }
     else
     {
         string old_card = DNTRequest.GetString("old_card").Trim();
         string new_card = DNTRequest.GetString("new_card").Trim();
         if (old_card == new_card)
         {
             MessageBox.ShowAndBack("新卡卡号和原卡号相同!");
             return;
         }
         string description = DNTRequest.GetString("description").Trim();
         string m00101_key  = DNTRequest.GetString("m00101_key").Trim();
         string user_id     = DNTRequest.GetString("user_id").Trim();
         string sql0        = "select * from m000 t where t.ucid='" + new_card + "' and t.state='0'";
         db.ExcuteDataTable(dt_count, sql0, CommandType.Text);
         if (dt_count.Rows.Count == 0)
         {
             MessageBox.ShowAndBack("系统不存在新卡卡号或者已被使用!");
             return;
         }
         string sql = "pkg_m00101.ReplaceCard__(" + m00101_key + ",'" + old_card + "','" + new_card + "','" + description + "','" + user_id + "')";
         db.BeginTransaction();
         int i = db.ExecuteNonQuery(sql, CommandType.Text);
         db.Commit();
         if (i == 1)
         {
             MessageBox.ShowAndBack("补换卡成功!");
             return;
         }
         else
         {
             MessageBox.ShowAndBack("补换卡失败!");
             return;
         }
     }
 }
Exemple #4
0
    private void recharge()
    {
        recharge_money = DNTRequest.GetString("recharge_money").Trim();
        ucid           = DNTRequest.GetString("card_no").Trim();
        string sql = "ucbmp.Acct_Proc('" + ucid + "'," + recharge_money + ",'888805'," + m002_key + ",'0001')";

        db.BeginTransaction();
        int i = db.ExecuteNonQuery(sql, CommandType.Text);

        db.Commit();
        if (i == 1)
        {
            string url = Request.Url.ToString();
            MessageBox.ShowAndRedirect("充值成功!", url);
            //MessageBox.ShowAndBack("充值成功!");
            return;
        }
        else
        {
            MessageBox.ShowAndBack("充值失败!");
            return;
        }
    }
Exemple #5
0
    public string SaveTextPic(string divid, string id, string txetorpic, string v)
    {
        Oracle db = new Oracle();

        //在配置表中插入一条记录 返回 主键
        try
        {
            string sql = "update m01502 set '' where  m015_key= ";
            db.BeginTransaction();
            db.ExecuteNonQuery(sql, CommandType.Text);
            db.Commit();

            //执行insert into 把数据写入表中
            return("1");
        }
        catch (Exception ex)
        {
            return(ex.Message);
        }
        finally
        {
            db.GetDBConnection().Dispose();
        }
    }
Exemple #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            clientip = Fun.getClientIp();
            save_request();
            Stream       RequestStream       = Request.InputStream;
            StreamReader RequestStreamReader = new StreamReader(RequestStream);
            RequestXml = RequestStreamReader.ReadToEnd();
            RequestStream.Close();
            //RequestXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
            //RequestXml = RequestXml + "<MIAP>";
            //RequestXml = RequestXml + "<MIAP-Header>";
            //RequestXml = RequestXml + "<TransactionID>20110909090909000001</TransactionID>";
            //RequestXml = RequestXml + "<Version>1.0</Version>";
            //RequestXml = RequestXml + "<MessageName>ActiveTestReq</MessageName>";
            //RequestXml = RequestXml + "<TestFlag>1</TestFlag>";
            //RequestXml = RequestXml + "</MIAP-Header>";
            //RequestXml = RequestXml + "<MIAP-Body>";
            //RequestXml = RequestXml + "<ActiveTestReq>";
            //RequestXml = RequestXml + "<BPID>110110</BPID>";
            //RequestXml = RequestXml + "</ActiveTestReq>";
            //RequestXml = RequestXml + "</MIAP-Body>";
            //RequestXml = RequestXml + "</MIAP>";

            li_db = 1;

            try
            {
                HeaderXml = Fun.getAllHyperLinks(RequestXml, "<MIAP-Header>", "</MIAP-Header>")[0].Value;
                BPID      = Fun.getAllHyperLinks(RequestXml, "<BPID>", "</BPID>")[0].Value;
                //检测ip是否是合理的ip地址

                Boolean lb_check = checkClient(BPID, clientip);
                if (lb_check == false)
                {
                    li_db         = -1;
                    ReturnCode    = "1";
                    ReturnMessage = "错误格式的XML";//ex.Message ;

                    Response.Write("错误的BPID" + BPID + "和客户端" + clientip);
                    return;
                }
                getRequestHead(HeaderXml);
                if (li_db == 1)
                {
                    body = Fun.getAllHyperLinks(RequestXml, "<MIAP-Body>", "</MIAP-Body>")[0].Value;
                    //根据body 获取对应的数据  ActiveTestReq <BPID>110110</BPID>
                    getM106(MessageName);
                    if (dt_m106.Rows.Count == 0)
                    {
                        li_db         = -1;
                        ReturnCode    = "1";
                        ReturnMessage = MessageName + "接口未定义";
                    }
                    else
                    {
                        string    key_Sql = "Select S_M905.nextval as c from dual ";
                        DataTable dt_key  = new DataTable();
                        db.ExcuteDataTable(dt_key, key_Sql, CommandType.Text);
                        m905_key = dt_key.Rows[0][0].ToString();

                        string send_xml   = Fun.getAllHyperLinks(body, "<" + MessageName + ">", "</" + MessageName + ">")[0].Value; //<ActiveTestReq>
                        string where_sql  = dt_m106.Rows[0]["WHERE_SQL"].ToString();
                        string select_sql = dt_m106.Rows[0]["SELECT_SQL"].ToString();
                        string update_sql = dt_m106.Rows[0]["UPDATE_SQL"].ToString();
                        where_sql  = where_sql.Replace("[LOG_KEY]", m905_key);
                        select_sql = select_sql.Replace("[LOG_KEY]", m905_key);
                        if (update_sql.IndexOf("SQL=") == 0)
                        {
                            update_sql = update_sql.Replace("SQL=", "");
                            #region 获取传入的参数值 并校验 参数的准确性
                            /*获取传入的参数值 并校验 参数的准确性 */
                            for (int i = 0; i < dt_m10601.Rows.Count; i++)
                            {
                                string col = dt_m10601.Rows[i]["COL"].ToString();

                                MatchCollection colls = Fun.getAllHyperLinks(body, "<" + col + ">", "</" + col + ">");

                                string data = string.Empty;
                                if (colls != null && colls.Count > 0)
                                {
                                    data = Fun.getAllHyperLinks(body, "<" + col + ">", "</" + col + ">")[0].Value;
                                }

                                string NECESSARY = dt_m10601.Rows[i]["NECESSARY"].ToString();
                                if (NECESSARY == "1" && (data == "" || data == null))
                                {
                                    li_db         = -1;
                                    ReturnCode    = "1";
                                    ReturnMessage = col + ":字段不允许为空 ";
                                    break;
                                }
                                dt_m10601.Rows[i]["col_data"] = data;
                                update_sql = update_sql.Replace("[" + col + "]", data);
                            }
                            #endregion


                            DataTable dt_sql = new DataTable();
                            db.ExcuteDataTable(dt_sql, update_sql, CommandType.Text);
                            update_sql = dt_sql.Rows[0][0].ToString();
                        }

                        if (update_sql.IndexOf("M107_KEY=") == 0)
                        {
                            #region 处理 M107

                            // --先 M106 从M10601找列  替换到M107的Get_SQL 然后用Get_SQl 的数据替换 sendxml的数据 作为请求
                            //--请求的结果在日志表M10702中  如果成功以后执行 update_sql 组 M106的返回包
                            string    M107_KEY = update_sql.Replace("M107_KEY=", "");
                            DataTable dt_m107  = new DataTable();
                            string    Sql      = "Select t.* from M107 t where m107_key=" + M107_KEY;
                            db.ExcuteDataTable(dt_m107, Sql, CommandType.Text);
                            if (dt_m107.Rows.Count == 0)
                            {
                                ReturnCode    = "1";
                                ReturnMessage = "M107_KEY=" + M107_KEY + "不存在 ";
                            }
                            else
                            {
                                #region 开始处理 M107
                                string Get_Sql    = dt_m107.Rows[0]["GET_SQL"].ToString();
                                string Update_SQL = dt_m107.Rows[0]["UPDATE_SQL"].ToString();


                                /*格式化SQL*/
                                #region 获取传入的参数值 并校验 参数的准确性
                                /*获取传入的参数值 并校验 参数的准确性 */
                                for (int i = 0; i < dt_m10601.Rows.Count; i++)
                                {
                                    string col = dt_m10601.Rows[i]["COL"].ToString();

                                    MatchCollection colls = Fun.getAllHyperLinks(body, "<" + col + ">", "</" + col + ">");

                                    string data = string.Empty;
                                    if (colls != null && colls.Count > 0)
                                    {
                                        data = Fun.getAllHyperLinks(body, "<" + col + ">", "</" + col + ">")[0].Value;
                                    }

                                    string NECESSARY = dt_m10601.Rows[i]["NECESSARY"].ToString();
                                    if (NECESSARY == "1" && (data == "" || data == null))
                                    {
                                        li_db         = -1;
                                        ReturnCode    = "1";
                                        ReturnMessage = col + ":字段不允许为空 ";
                                        break;
                                    }
                                    dt_m10601.Rows[i]["col_data"] = data;

                                    Get_Sql    = Get_Sql.Replace("[" + col + "]", data);
                                    Update_SQL = Update_SQL.Replace("[" + col + "]", data);
                                    where_sql  = where_sql.Replace("[" + col + "]", data);
                                    select_sql = select_sql.Replace("[" + col + "]", data);
                                }
                                #endregion

                                if (li_db != -1)
                                {
                                    #region 写M905日志
                                    string log_sql = "Insert into M905(M905_KEY,SEND_XML,enter_date,BPID)";
                                    log_sql = log_sql + " Select " + m905_key + ",'" + RequestXml + "',sysdate,'" + BPID + "' from dual";
                                    db.BeginTransaction();
                                    li_db = db.ExecuteNonQuery(log_sql, CommandType.Text);
                                    if (li_db < 0)
                                    {
                                        ReturnCode    = "1";
                                        ReturnMessage = "M905日志失败 ";
                                        db.Rollback();
                                    }
                                    else
                                    {
                                        /*开始执行sql*/
                                        db.Commit();
                                    }
                                    #endregion
                                    Get_Sql    = Get_Sql.Replace("[M905_KEY]", m905_key);
                                    Update_SQL = Update_SQL.Replace("[M905_KEY]", m905_key);
                                    if (li_db != -1)
                                    {
                                        #region 处理M107
                                        string    m107_send_xml = dt_m107.Rows[0]["send_xml"].ToString();
                                        DataTable dt_send       = new DataTable();
                                        db.ExcuteDataTable(dt_send, Get_Sql, CommandType.Text);



                                        if (dt_send.Rows.Count != 1)
                                        {
                                            ReturnCode    = "1";
                                            ReturnMessage = "M107_KEY=" + M107_KEY + " ,GET_SQL错误 ";
                                        }
                                        else
                                        {
                                            string CHECKMSG = "";
                                            try
                                            {
                                                CHECKMSG = dt_send.Rows[0]["CHECKMSG"].ToString();
                                            }
                                            catch
                                            {
                                                CHECKMSG = "";
                                            }
                                            if (CHECKMSG.Length <= 1)
                                            {
                                                string M107_type   = dt_m107.Rows[0]["M107_TYPE"].ToString();
                                                string m107_http   = dt_m107.Rows[0]["LINK_URL"].ToString();
                                                bool   lb_open     = false;
                                                string receivexml_ = "";

                                                // if M107_type == "SOCKET"

                                                #region 组HTTP包
                                                string sendxml_ = m107_send_xml;
                                                for (int c = 0; c < dt_send.Columns.Count; c++)
                                                {
                                                    string col_data = dt_send.Rows[0][c].ToString();
                                                    string col      = dt_send.Columns[c].ColumnName.ToUpper();
                                                    sendxml_ = sendxml_.Replace("[" + col + "]", col_data);
                                                }

                                                #endregion
                                                #region 发送http请求
                                                if (M107_type == "WEBSERVICES")
                                                {
                                                    try
                                                    {
                                                        string url = m107_http;                                                           //wsdl地址

                                                        string name   = Fun.getAllHyperLinks(sendxml_, "<Method>", "</Method>")[0].Value; //javaWebService开放的接口
                                                        int    ccount = int.Parse(Fun.getAllHyperLinks(sendxml_, "<ParmCount>", "</ParmCount>")[0].Value);
                                                        TPSVService.WebServiceProxy wsd = new TPSVService.WebServiceProxy(url, name);
                                                        string[] str = new string[ccount];
                                                        for (int rr_ = 0; rr_ < ccount; rr_++)
                                                        {
                                                            str[rr_] = Fun.getAllHyperLinks(sendxml_, "<P" + rr_.ToString() + ">", "</P" + rr_.ToString() + ">")[0].Value;
                                                        }

                                                        receivexml_ = (string)wsd.ExecuteQuery(name, str).ToString();
                                                        lb_open     = true;
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        lb_open = false;
                                                    }

                                                    if (lb_open == false)
                                                    {
                                                        ReturnCode    = "1";
                                                        ReturnMessage = "M107_KEY=" + M107_KEY + "发送请求失败 ";
                                                    }
                                                    else
                                                    {
                                                        ReturnMessage = "";
                                                    }
                                                }

                                                if (M107_type == "HTTP" || M107_type == "HTTP_GET")
                                                {
                                                    Bm.HttpRequest http_ = new Bm.HttpRequest();
                                                    http_.CharacterSet     = "utf-8";
                                                    http_.RequestUriString = m107_http;
                                                    if (M107_type == "HTTP_GET")
                                                    {
                                                        lb_open = http_.OpenRequest(m107_http + "?" + sendxml_, m107_http + "?" + sendxml_);
                                                    }
                                                    else
                                                    {
                                                        lb_open = http_.OpenRequest(m107_http, m107_http, sendxml_);
                                                    }
                                                    if (lb_open == false)
                                                    {
                                                        ReturnCode    = "1";
                                                        ReturnMessage = "M107_KEY=" + M107_KEY + "发送请求失败 ";
                                                    }
                                                    else
                                                    {
                                                        receivexml_ = http_.HtmlDocument;
                                                    }
                                                }
                                                if (M107_type == "SOCKET")
                                                {
                                                    lb_open = true;
                                                    try
                                                    {
                                                        Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                                                        string[] ipport = m107_http.Split(':');


                                                        IPEndPoint ie = new IPEndPoint(IPAddress.Parse(ipport[0]), int.Parse(ipport[1]));//服务器的IP和端口

                                                        client.Connect(ie);

                                                        client.Send(Encoding.Default.GetBytes(sendxml_));

                                                        byte[] data1      = new byte[1024];
                                                        int    recv       = client.Receive(data1);
                                                        string stringdata = Encoding.Default.GetString(data1, 0, recv);


                                                        receivexml_ = stringdata;
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        lb_open       = false;
                                                        ReturnCode    = "1";
                                                        ReturnMessage = "M107_KEY=" + M107_KEY + "发送请求失败 :" + ex.Message;
                                                    }
                                                }


                                                if (lb_open == true)
                                                {
                                                    #region 执行 http请求以后 的处理

                                                    string m10702_key = save_log(M107_KEY, sendxml_, receivexml_, "0");
                                                    Update_SQL = Update_SQL.Replace("[M10702_KEY]", m10702_key);


                                                    db.BeginTransaction();
                                                    li_db = db.ExecuteNonQuery(Update_SQL, CommandType.Text);
                                                    if (li_db < 0)
                                                    {
                                                        li_db          = -1;
                                                        ReturnCode     = "1";
                                                        ReturnMessage += "Deal failed";
                                                        db.Rollback();
                                                        //  break;
                                                    }
                                                    else
                                                    {
                                                        db.Commit();
                                                        log_sql = "Select t.XML_RES,t.XML_MSG from M905 t where M905_KEY = " + m905_key;
                                                        DataTable dt_m905 = new DataTable();
                                                        db.ExcuteDataTable(dt_m905, log_sql, CommandType.Text);
                                                        ReturnCode     = dt_m905.Rows[0]["XML_RES"].ToString();
                                                        ReturnMessage += dt_m905.Rows[0]["XML_MSG"].ToString();
                                                    }
                                                    #endregion

                                                    string selSq = select_sql + " " + where_sql;
                                                    db.ExcuteDataTable(dt_resp, selSq, CommandType.Text);
                                                }
                                                #endregion
                                            }
                                            else
                                            {
                                                ReturnCode    = "1";
                                                ReturnMessage = CHECKMSG;
                                            }
                                        }
                                        #endregion
                                    }
                                }
                                #endregion
                            }

                            #endregion
                        }
                        else
                        {
                            where_sql  = where_sql.Replace("[LOG_KEY]", m905_key);
                            select_sql = select_sql.Replace("[LOG_KEY]", m905_key);

                            #region 获取传入的参数值 并校验 参数的准确性
                            /*获取传入的参数值 并校验 参数的准确性 */
                            for (int i = 0; i < dt_m10601.Rows.Count; i++)
                            {
                                string col = dt_m10601.Rows[i]["COL"].ToString();

                                MatchCollection colls = Fun.getAllHyperLinks(body, "<" + col + ">", "</" + col + ">");

                                string data = string.Empty;
                                if (colls != null && colls.Count > 0)
                                {
                                    data = Fun.getAllHyperLinks(body, "<" + col + ">", "</" + col + ">")[0].Value;
                                }

                                string NECESSARY = dt_m10601.Rows[i]["NECESSARY"].ToString();
                                if (NECESSARY == "1" && (data == "" || data == null))
                                {
                                    li_db         = -1;
                                    ReturnCode    = "1";
                                    ReturnMessage = col + ":字段不允许为空 ";
                                    break;
                                }
                                dt_m10601.Rows[i]["col_data"] = data;

                                where_sql  = where_sql.Replace("[" + col + "]", data);
                                select_sql = select_sql.Replace("[" + col + "]", data);
                                update_sql = update_sql.Replace("[" + col + "]", data);
                            }
                            #endregion

                            dt_m106.Rows[0]["WHERE_SQL_N"]  = where_sql;
                            dt_m106.Rows[0]["SELECT_SQL_N"] = select_sql;

                            #region

                            string log_sql = "Insert into M905(M905_KEY,SEND_XML,enter_date,BPID)";
                            log_sql = log_sql + " Select " + m905_key + ",'" + RequestXml + "',sysdate,'" + BPID + "' from dual";
                            db.BeginTransaction();
                            li_db = db.ExecuteNonQuery(log_sql, CommandType.Text);
                            if (li_db < 0)
                            {
                                #region
                                li_db          = -1;
                                ReturnCode     = "1";
                                ReturnMessage += "Deal failed";
                                db.Rollback();
                                //  break;
                                #endregion
                            }
                            else
                            {
                                /*开始执行sql*/
                                db.Commit();
                                #region 处理 update_SQL
                                if (update_sql.Length > 10)
                                {
                                    exec_sql   = update_sql;
                                    update_sql = update_sql.Replace("[LOG_KEY]", m905_key);
                                    db.BeginTransaction();
                                    try
                                    {
                                        li_db = db.ExecuteNonQuery(update_sql, CommandType.Text);
                                        if (li_db < 0)
                                        {
                                            li_db          = -1;
                                            ReturnCode     = "1";
                                            ReturnMessage += "Deal failed";
                                            db.Rollback();
                                            //  break;
                                        }
                                        else
                                        {
                                            db.Commit();
                                            log_sql = "Select t.XML_RES,t.XML_MSG from M905 t where M905_KEY = " + m905_key;
                                            DataTable dt_m905 = new DataTable();
                                            db.ExcuteDataTable(dt_m905, log_sql, CommandType.Text);
                                            ReturnCode     = dt_m905.Rows[0]["XML_RES"].ToString();
                                            ReturnMessage += dt_m905.Rows[0]["XML_MSG"].ToString();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        db.Rollback();
                                        li_db         = -1;
                                        ReturnCode    = "1";
                                        ReturnMessage = GetOracleMsg(ex.Message);
                                    }
                                }
                                #endregion
                                string selSq = select_sql + " " + where_sql;
                                db.ExcuteDataTable(dt_resp, selSq, CommandType.Text);
                                /* 和 组成要返回的xm*/
                            }
                            #endregion
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                li_db         = -1;
                ReturnCode    = "1";
                ReturnMessage = "错误格式的XML" + ex.Message;
                ReturnMessage = GetOracleMsg(ex.Message);
                //  ReturnCode = "2";
                //   ReturnMessage = "Part of the process is successful";
            }
            try
            {
                string ls_url = SetXml();

                /* if (ls_url != null && ls_url != "")
                 * {
                 *  Response.Redirect(ls_url);
                 * }
                 * else
                 * {
                 *  Response.Write(ResponseXml);
                 * }
                 */
                Response.Write(ResponseXml);
            }
            catch
            {
                Response.Write(ResponseXml);
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }