Exemplo n.º 1
0
    // iPage 第N頁
    // iSize 最大顯示數量
    public DataTable fnSelects(SReturnM sreturnM, int iPage, int iSize)
    {
        int iStart = (iPage - 1) * iSize + 1;
        int iEnd   = iPage * iSize;

        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[order_id]", sreturnM.order_id);
        sCondition += PublicApi.fnAddCondition("[return_id]", sreturnM.return_id);
        sCondition += PublicApi.fnAddCondition("[id]", sreturnM.id);
        sCondition += PublicApi.fnAddCondition("CONVERT(varchar(10), [datetime], 126)", sreturnM.datetime);

        string sInquireSql =
            "  SELECT [return_m].[NUM],   " +
            "         [return_m].[return_id],   " +
            "         [return_m].[order_id],   " +
            "         [return_m].[id],   " +
            "         [return_m].[complete],   " +
            "         CONVERT(CHAR, [return_m].[datetime], 111) [datetime]   " +
            "  FROM   (SELECT Row_number() OVER(ORDER BY[" + sreturnM.order + "] ASC) NUM, " +
            "                  *   " +
            "          FROM   [MNDTSreturn_master]   " +
            "          WHERE  1 = 1 " + sCondition + ") AS [return_m]  " +
            "  WHERE  NUM BETWEEN " + iStart.ToString() + " AND " + iEnd.ToString();

        return(PublicApi.fnGetDt(sInquireSql, "MNDT"));
    }
Exemplo n.º 2
0
    public bool fnIsExist(SReturnM sreturnM)
    {
        string sSql = "  SELECT COUNT([return_id])   " +
                      "  FROM   [MNDTSreturn_master]   " +
                      "  WHERE  [return_id] = '" + sreturnM.return_id + "'   ";

        return(PublicApi.fnGetValue(sSql, "MNDT") == "1");
    }
Exemplo n.º 3
0
    public string fnDelete(SReturnM sreturnM, string sIP)
    {
        string sSql =
            " UPDATE [MNDTSreturn_master] " +
            " SET [status] = 'D' " +
            " WHERE [return_id] = '" + sreturnM.return_id + "' ";
        SReturnMTran sreturnMTran = new SReturnMTran();

        sreturnMTran.ReturnId(sreturnM.return_id)
        .IP(sIP)
        .Status("D")
        .CreateId(sreturnM.create_id);
        sSql += fnInsertSql(sreturnMTran);
        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
Exemplo n.º 4
0
    public DataTable fnSelect(SReturnM sreturnM)
    {
        string sSql = "  SELECT TOP 1 [return_id]  " +
                      "        ,[order_id]  " +
                      "        ,[id]  " +
                      "        ,CONVERT(varchar(10), [datetime], 126) [datetime]  " +
                      "        ,[complete]  " +
                      "        ,[status]  " +
                      "        ,[description]  " +
                      "        ,[create_id]  " +
                      "        ,CONVERT(char, [create_datetime], 120) [create_datetime]  " +
                      "  FROM [MNDTSreturn_master]  " +
                      "  WHERE [return_id] = '" + sreturnM.return_id + "' ";

        return(PublicApi.fnGetDt(sSql, "MNDT"));
    }
Exemplo n.º 5
0
    public string fnCount(SReturnM sreturnM)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[order_id]", sreturnM.order_id);
        sCondition += PublicApi.fnAddCondition("[return_id]", sreturnM.return_id);
        sCondition += PublicApi.fnAddCondition("[id]", sreturnM.id);
        sCondition += PublicApi.fnAddCondition("CONVERT(varchar(10), [datetime], 126)", sreturnM.datetime);

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

        return(sPageSize);
    }
Exemplo n.º 6
0
    // sNum 排行
    public string fnSelectReturnId(SReturnM sreturnM, string sNum)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[order_id]", sreturnM.order_id);
        sCondition += PublicApi.fnAddCondition("[return_id]", sreturnM.return_id);
        sCondition += PublicApi.fnAddCondition("[id]", sreturnM.id);
        sCondition += PublicApi.fnAddCondition("CONVERT(varchar(10), [datetime], 126)", sreturnM.datetime);

        string sSql = "  SELECT [return_m].[return_id]  " +
                      "  FROM   (SELECT Row_number() OVER (ORDER BY [" + sreturnM.order + "] ASC) NUM,   " +
                      "                  *   " +
                      "          FROM   [MNDTSreturn_master]   " +
                      "          WHERE  1 = 1" + sCondition + ") AS [return_m]  " +
                      "  WHERE [return_m].[NUM] = '" + sNum + "' ";

        return(PublicApi.fnGetValue(sSql, "MNDT"));
    }
Exemplo n.º 7
0
    public string fnUpdate(SReturnM sreturnM, string sIP)
    {
        string sSql = "  UPDATE [dbo].[MNDTSreturn_master]  " +
                      "     SET [id] = '" + sreturnM.id + "'  " +
                      "        ,[order_id] = '" + sreturnM.order_id + "'  " +
                      "        ,[datetime] = '" + sreturnM.datetime + "'  " +
                      "        ,[complete] = '" + sreturnM.complete + "'  " +
                      "        ,[status] = '" + sreturnM.status + "'  " +
                      "        ,[description] = '" + sreturnM.description + "'  " +
                      "  WHERE [return_id] = '" + sreturnM.return_id + "' ";
        SReturnMTran sreturnMTran = new SReturnMTran();

        sreturnMTran.ReturnId(sreturnM.return_id)
        .IP(sIP)
        .Status("M")
        .CreateId(sreturnM.create_id);
        sSql += fnInsertSql(sreturnMTran);
        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
Exemplo n.º 8
0
    public string fnInsert(SReturnM sreturnM)
    {
        string sSql =
            "  INSERT INTO [dbo].[MNDTSreturn_master]  " +
            "             ([return_id]  " +
            "             ,[order_id]  " +
            "             ,[id]  " +
            "             ,[datetime]  " +
            "             ,[complete]  " +
            "             ,[description]  " +
            "             ,[create_id]  " +
            "             ,[create_datetime])  " +
            "       VALUES  " +
            "             ('" + sreturnM.return_id + "'  " +
            "             ,'" + sreturnM.order_id + "'  " +
            "             ,'" + sreturnM.id + "'  " +
            "             ,'" + sreturnM.datetime + "'  " +
            "             ,'N' " +
            "             ,'" + sreturnM.description + "'  " +
            "             ,'" + sreturnM.create_id + "'  " +
            "             ,GETDATE())  ";

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