示例#1
0
    public string fnCount(ClientTran clientTran)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[client_id]", clientTran.client_id);

        string sCountSql =
            "          SELECT COUNT(client_id)   " +
            "          FROM   [MNDTclient_tran]   " +
            "          WHERE  1 = 1 " + sCondition;
        string sPageSize = PublicApi.fnGetValue(sCountSql, "MNDT");

        return(sPageSize);
    }
示例#2
0
    public string fnDeletes(Client client, string sIP, string sId)
    {
        string sSql = " UPDATE [dbo].[MNDTclient] " +
                      "       SET [status] = 'D' " +
                      " WHERE [client_id] IN (" + client.client_id + ")";
        ClientTran clientTran = new ClientTran();

        clientTran.ClientId(client.client_id)
        .IP(sIP)
        .Status("D")
        .CreateId(sId);
        sSql += fnInsertsSql(clientTran);

        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
示例#3
0
    private string fnInsertSql(ClientTran clientTran)
    {
        string sSql =
            "  INSERT INTO [MNDTclient_tran]  " +
            "             ([client_id]  " +
            "             ,[ip]  " +
            "             ,[status]  " +
            "             ,[create_id]  " +
            "             ,[create_datetime])  " +
            "       VALUES  " +
            "             ('" + clientTran.client_id + "'  " +
            "             , '" + clientTran.ip + "'  " +
            "             , '" + clientTran.status + "'  " +
            "             , '" + clientTran.create_id + "'  " +
            "             , GETDATE())  ";

        return(sSql);
    }
示例#4
0
    private string fnInsertsSql(ClientTran clientTran)
    {
        string sSql =
            "  INSERT INTO [MNDTclient_tran]  " +
            "             ([client_id]  " +
            "             ,[ip]  " +
            "             ,[status]  " +
            "             ,[create_id]  " +
            "             ,[create_datetime])  " +
            "  SELECT [client_id]  " +
            "        , '" + clientTran.ip + "'  " +
            "        , '" + clientTran.status + "'  " +
            "        , '" + clientTran.create_id + "'  " +
            "        , GETDATE()  " +
            "  FROM [MNDTclient]  " +
            " WHERE [client_id] IN (" + clientTran.client_id + ")";

        return(sSql);
    }
示例#5
0
    // iPage 第N頁
    // iSize 最大顯示數量
    public DataTable fnSelects(ClientTran clientTran, int iPage, int iSize)
    {
        int    iStart     = (iPage - 1) * iSize + 1;
        int    iEnd       = iPage * iSize;
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[client_id]", clientTran.client_id);
        string sInquireSql =
            "  SELECT [client_tran].[client_id],   " +
            "         [client_tran].[ip],   " +
            "         [client_tran].[status],   " +
            "         [client_tran].[create_id],   " +
            "         CONVERT(char, [client_tran].[create_datetime], 120) 'create_datetime'   " +
            "  FROM   (SELECT Row_number() OVER (ORDER BY [create_datetime] ASC) NUM,   " +
            "                  *   " +
            "          FROM   [MNDTclient_tran]   " +
            "          WHERE  1 = 1 " + sCondition + ") AS [client_tran]  " +
            "  WHERE  NUM BETWEEN " + iStart.ToString() + " AND " + iEnd.ToString() + "   ";

        return(PublicApi.fnGetDt(sInquireSql, "MNDT"));
    }
示例#6
0
    public string fnUpdate(Client client, string sIP, string sId)
    {
        string sSql =
            "  UPDATE [dbo].[MNDTclient]  " +
            "     SET [password] = '" + client.encrypt_password + "'  " +
            "        ,[name] = '" + client.name + "'  " +
            "        ,[email] = '" + client.email + "'  " +
            "        ,[address] = '" + client.address + "'  " +
            "        ,[phone] = '" + client.phone + "'  " +
            "        ,[tel] = '" + client.tel + "'  " +
            "        ,[description] = '" + client.description + "'  " +
            "        ,[status] = '" + client.status + "'  " +
            "  WHERE [client_id] = '" + client.client_id + "' ";
        ClientTran clientTran = new ClientTran();

        clientTran.ClientId(client.client_id)
        .IP(sIP)
        .Status("M")
        .CreateId(sId);
        sSql += fnInsertSql(clientTran);

        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }