コード例 #1
0
    // iPage 第N頁
    // iSize 最大顯示數量
    public DataTable fnSelects(ReturnM returnM, int iPage, int iSize)
    {
        int iStart = (iPage - 1) * iSize + 1;
        int iEnd   = iPage * iSize;

        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[order_id]", returnM.order_id);
        sCondition += PublicApi.fnAddCondition("[return_id]", returnM.return_id);
        sCondition += PublicApi.fnAddCondition("[id]", returnM.id);
        sCondition += PublicApi.fnAddCondition("CONVERT(varchar(10), [datetime], 126)", returnM.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[" + returnM.order + "] ASC) NUM, " +
            "                  *   " +
            "          FROM   [MNDTreturn_master]   " +
            "          WHERE  1 = 1 " + sCondition + ") AS [return_m]  " +
            "  WHERE  NUM BETWEEN " + iStart.ToString() + " AND " + iEnd.ToString();

        return(PublicApi.fnGetDt(sInquireSql, "MNDT"));
    }
コード例 #2
0
    public bool fnIsExist(ReturnM returnM)
    {
        string sSql = "  SELECT COUNT([return_id])   " +
                      "  FROM   [MNDTreturn_master]   " +
                      "  WHERE  [return_id] = '" + returnM.return_id + "'   ";

        return(PublicApi.fnGetValue(sSql, "MNDT") == "1");
    }
コード例 #3
0
    public string fnDelete(ReturnM returnM, string sIP)
    {
        string sSql =
            " UPDATE [MNDTreturn_master] " +
            " SET [status] = 'D' " +
            " WHERE [return_id] = '" + returnM.return_id + "' ";
        ReturnMTran returnMTran = new ReturnMTran();

        returnMTran.ReturnId(returnM.return_id)
        .IP(sIP)
        .Status("D")
        .CreateId(returnM.create_id);
        sSql += fnInsertSql(returnMTran);
        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
コード例 #4
0
    public DataTable fnSelect(ReturnM returnM)
    {
        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 [MNDTreturn_master]  " +
                      "  WHERE [return_id] = '" + returnM.return_id + "' ";

        return(PublicApi.fnGetDt(sSql, "MNDT"));
    }
コード例 #5
0
    public string fnCount(ReturnM returnM)
    {
        string sCondition = "";

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

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

        return(sPageSize);
    }
コード例 #6
0
    // sNum 排行
    public string fnSelectReturnId(ReturnM returnM, string sNum)
    {
        string sCondition = "";

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

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

        return(PublicApi.fnGetValue(sSql, "MNDT"));
    }
コード例 #7
0
    public string fnUpdate(ReturnM returnM, string sIP)
    {
        string sSql = "  UPDATE [dbo].[MNDTreturn_master]  " +
                      "     SET [id] = '" + returnM.id + "'  " +
                      "        ,[order_id] = '" + returnM.order_id + "'  " +
                      "        ,[datetime] = '" + returnM.datetime + "'  " +
                      "        ,[complete] = '" + returnM.complete + "'  " +
                      "        ,[status] = '" + returnM.status + "'  " +
                      "        ,[description] = '" + returnM.description + "'  " +
                      "  WHERE [return_id] = '" + returnM.return_id + "' ";
        ReturnMTran returnMTran = new ReturnMTran();

        returnMTran.ReturnId(returnM.return_id)
        .IP(sIP)
        .Status("M")
        .CreateId(returnM.create_id);
        sSql += fnInsertSql(returnMTran);
        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
コード例 #8
0
    public string fnInsert(ReturnM returnM)
    {
        string sSql =
            "  INSERT INTO [dbo].[MNDTreturn_master]  " +
            "             ([return_id]  " +
            "             ,[order_id]  " +
            "             ,[id]  " +
            "             ,[datetime]  " +
            "             ,[complete]  " +
            "             ,[description]  " +
            "             ,[create_id]  " +
            "             ,[create_datetime])  " +
            "       VALUES  " +
            "             ('" + returnM.return_id + "'  " +
            "             ,'" + returnM.order_id + "'  " +
            "             ,'" + returnM.id + "'  " +
            "             ,'" + returnM.datetime + "'  " +
            "             ,'N' " +
            "             ,'" + returnM.description + "'  " +
            "             ,'" + returnM.create_id + "'  " +
            "             ,GETDATE())  ";

        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
コード例 #9
0
 public ValuesController(DatabaseContext context)
 {
     this._context  = context;
     this.retornoVM = new ReturnM();
 }