public string fnChangeInsert(SalesM salesM)
    {
        string sSql = "  INSERT INTO [dbo].[MNDTsales_master]  " +
                      "             ([order_id]  " +
                      "             ,[id]  " +
                      "             ,[pay]  " +
                      "             ,[order_status]  " +
                      "             ,[datetime]  " +
                      "             ,[complete]  " +
                      "             ,[description]  " +
                      "             ,[create_id]  " +
                      "             ,[create_datetime])  " +
                      "  SELECT TOP 1 [order_id]  " +
                      "             ,'" + salesM.create_id + "'  " +
                      "             ,''  " +
                      "             ,''  " +
                      "             ,GETDATE()  " +
                      "             ,'N' " +
                      "             ,''  " +
                      "             ,'" + salesM.create_id + "'  " +
                      "             ,GETDATE()  " +
                      "  FROM [MNDTquotes_master]  " +
                      "  WHERE order_id = '" + salesM.order_id + "'  ";

        sSql +=
            "  INSERT INTO [MNDTsales_details]  " +
            "             ([seq]  " +
            "             ,[order_id]  " +
            "             ,[product_id]  " +
            "             ,[warehouse_id]  " +
            "             ,[amount]  " +
            "             ,[price]  " +
            "             ,[description]  " +
            "             ,[create_id]  " +
            "             ,[create_datetime] " +
            "             ,[modify_id]  " +
            "             ,[modify_datetime])  " +
            "  SELECT Row_number() OVER(ORDER BY[product_id] ASC) NUM  " +
            "        ,[order_id]  " +
            "        ,[product_id]  " +
            "        ,''  " +
            "        ,[modify_amount]  " +
            "        ,[modify_price]  " +
            "        ,''  " +
            "        ,'" + salesM.create_id + "'  " +
            "        ,GETDATE()  " +
            "        ,'" + salesM.create_id + "'  " +
            "        ,GETDATE()  " +
            "  FROM [MNDTquotes_details]  " +
            "  WHERE order_id = '" + salesM.order_id + "'  ";
        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
    public string fnDelete(KindM kindM)
    {
        string sDetailsSql = " SELECT COUNT([kind_id]) FROM [MNDTkind_details] WHERE [kind_id] = '" + kindM.kind_id + "' ";
        string sCount      = PublicApi.fnGetValue(sDetailsSql, "MNDT");

        if (sCount == "0")
        {
            string sSql = " DELETE [MNDTkind_master] " +
                          " WHERE [kind_id] = '" + kindM.kind_id + "' ";
            return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
        }
        return("錯誤訊息:明細資料大於一筆。");
    }
Exemple #3
0
    public string fnGetSeq(string sReturnId)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[return_id]", sReturnId);

        string sSql =
            "  SELECT ISNULL(MAX([seq]), 0) + 1   " +
            "  FROM   [MNDTSreturn_details] AS [return_d]  " +
            "          WHERE  1 = 1 " + sCondition;

        return(PublicApi.fnGetValue(sSql, "MNDT"));
    }
Exemple #4
0
        public async Task TestGetGlobalDataAsync()
        {
            var globalData = await PublicApi.GetGlobalDataAsync();

            Assert.IsNotNull(globalData, "globalData is null");
            Assert.IsNotNull(globalData.TotalMarketCapUSD, "globalData.TotalMarketCapUSD is null");

            globalData = await PublicApi.GetGlobalDataAsync(currency : "INR");

            Assert.IsNotNull(globalData, "globalData is null");
            Assert.IsNotNull(globalData.TotalMarketCapUSD, "globalData.TotalMarketCapUSD is null");
            Assert.IsNotNull(globalData.TotalMarketCapINR, "globalData.TotalMarketCapINR is null");
        }
    public string fnGetSeq(ReceiveD receiveD)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[order_id]", receiveD.order_id);

        string sSql =
            "  SELECT ISNULL(MAX([seq]), 0) + 1   " +
            "  FROM   [MNDTreceive_details] AS [receive_d]  " +
            "          WHERE  1 = 1 " + sCondition;

        return(PublicApi.fnGetValue(sSql, "MNDT"));
    }
    public string fnVerifications(ReceiveD receiveD)
    {
        string sSql =
            "  UPDATE [MNDTreceive_details]  " +
            "     SET [complete] = '" + receiveD.complete + "'  " +
            "        ,[pay_complete] = '" + receiveD.pay_complete + "'  " +
            "        ,[modify_id] = '" + receiveD.create_id + "'  " +
            "        ,[modify_datetime] = GETDATE()  " +
            " WHERE [order_id] = '" + receiveD.order_id + "' " +
            "   AND [seq] = '" + receiveD.seq + "' ";

        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
Exemple #7
0
    public string fnDelete(GroupM groupM)
    {
        string sDetailsSql = " SELECT COUNT([group_id]) FROM [MNDTgroup_details] WHERE [group_id] = '" + groupM.group_id + "' ";
        string sCount      = PublicApi.fnGetValue(sDetailsSql, "MNDT");

        if (sCount == "0")
        {
            string sSql = " DELETE [MNDTgroup_master] " +
                          " WHERE [group_id] = '" + groupM.group_id + "' ";
            return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
        }
        return("錯誤訊息:明細資料大於一筆。");
    }
    public string fnChangeInsert(ReceiveM receiveM)
    {
        string sSql = "  INSERT INTO [dbo].[MNDTreceive_master]  " +
                      "             ([order_id]  " +
                      "             ,[id]  " +
                      "             ,[datetime]  " +
                      "             ,[complete]  " +
                      "             ,[description]  " +
                      "             ,[create_id]  " +
                      "             ,[create_datetime])  " +
                      "       VALUES  " +
                      "             ('" + receiveM.order_id + "'  " +
                      "             ,'" + receiveM.create_id + "'  " +
                      "             ,GETDATE()  " +
                      "             ,'N' " +
                      "             ,''  " +
                      "             ,'" + receiveM.create_id + "'  " +
                      "             ,GETDATE())  ";

        sSql +=
            "  INSERT INTO [MNDTreceive_details]  " +
            "             ([seq]  " +
            "             ,[order_id]  " +
            "             ,[material_id]  " +
            "             ,[warehouse_id]  " +
            "             ,[amount]  " +
            "             ,[price]  " +
            "             ,[complete]  " +
            "             ,[pay_complete]  " +
            "             ,[description]  " +
            "             ,[create_id]  " +
            "             ,[create_datetime] " +
            "             ,[modify_id]  " +
            "             ,[modify_datetime])  " +
            "  SELECT Row_number() OVER(ORDER BY[material_id] ASC) NUM  " +
            "        ,[order_id]  " +
            "        ,[material_id]  " +
            "        ,''  " +
            "        ,[modify_amount]  " +
            "        ,[modify_price]  " +
            "        ,'N'  " +
            "        ,'N'  " +
            "        ,''  " +
            "        ,'" + receiveM.create_id + "'  " +
            "        ,GETDATE()  " +
            "        ,'" + receiveM.create_id + "'  " +
            "        ,GETDATE()  " +
            "  FROM [MNDTpurchase_details]  " +
            "  WHERE order_id = '" + receiveM.order_id + "'  ";
        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
Exemple #9
0
    //private string fnInsertsSql(MaterialStockTran materialStockTran)
    //{
    //    string sSql =
    //                    "  INSERT INTO [MNDTmaterial_stock_tran]  " +
    //                    "             ([material_id]  " +
    //                    "             ,[ip]  " +
    //                    "             ,[status]  " +
    //                    "             ,[create_id]  " +
    //                    "             ,[create_datetime])  " +
    //                    "  SELECT [material_id]  " +
    //                    "        , '" + materialStockTran + "'  " +
    //                    "        , '" + materialStockTran.status + "'  " +
    //                    "        , '" + materialStockTran.create_id + "'  " +
    //                    "        , GETDATE()  " +
    //                    "  FROM [MNDTmaterial_stock]  " +
    //                    " WHERE [material_id] IN (" + materialStockTran.material_id + ")";
    //    return sSql;
    //}

    public string fnCount(MaterialStockTran materialStockTran)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[material_id]", materialStockTran.material_id);
        sCondition += PublicApi.fnAddCondition("[warehouse_id]", materialStockTran.warehouse_id);
        string sCountSql =
            "          SELECT COUNT(material_id)   " +
            "          FROM   [MNDTmaterial_stock_tran]   " +
            "          WHERE  1 = 1 " + sCondition;
        string sPageSize = PublicApi.fnGetValue(sCountSql, "MNDT");

        return(sPageSize);
    }
Exemple #10
0
    public string fnUpdate(QuotesD quotesD)
    {
        string sSql =
            "  UPDATE [MNDTquotes_details]  " +
            "     SET [modify_amount] = '" + quotesD.modify_amount + "'  " +
            "        ,[modify_price] = '" + quotesD.modify_price + "'  " +
            "        ,[description] = '" + quotesD.description + "'  " +
            "        ,[modify_id] = '" + quotesD.create_id + "'  " +
            "        ,[modify_datetime] = GETDATE()  " +
            " WHERE [order_id] = '" + quotesD.order_id + "' " +
            "   AND [product_id] = '" + quotesD.product_id + "' ";

        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
Exemple #11
0
    public string fnChange(QuotesM quotesM, string sIP)
    {
        string sSql = "  UPDATE [dbo].[MNDTquotes_master]  " +
                      "     SET [complete] = 'Y'  " +
                      "  WHERE [order_id] = '" + quotesM.order_id + "' ";
        QuotesMTran quotesMTran = new QuotesMTran();

        quotesMTran.OrderId(quotesM.order_id)
        .IP(sIP)
        .Status("M")
        .CreateId(quotesM.create_id);
        sSql += fnInsertSql(quotesMTran);
        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
Exemple #12
0
    public DataTable fnSelects(MaterialStock materialStock)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[material_id]", materialStock.material_id);
        sCondition += PublicApi.fnAddCondition("[warehouse_id]", materialStock.warehouse_id);
        sCondition += " ORDER BY [" + materialStock.order + "] ";
        string sInquireSql =
            "  SELECT *  " +
            "  FROM MNDTmaterial_stock  " +
            "  WHERE 1 = 1 " + sCondition;

        return(PublicApi.fnGetDt(sInquireSql, "MNDT"));
    }
        public async Task GetBoard()
        {
            var res1 = await PublicApi.GetBoard(ProductCode.BtcJpy);

            Assert.NotNull(res1);

            var res2 = await PublicApi.GetBoard(ProductCode.FxBtcJpy);

            Assert.NotNull(res2);

            var res3 = await PublicApi.GetBoard(ProductCode.EthBtc);

            Assert.NotNull(res3);
        }
Exemple #14
0
    public DataTable fnSelect(KindM kindM)
    {
        string sSql = "  SELECT TOP 1 [kind_id]  " +
                      "        ,[name]  " +
                      "        ,[description]  " +
                      "        ,[create_id]  " +
                      "        ,CONVERT(char, [create_datetime], 120) [create_datetime]  " +
                      "        ,[modify_id]  " +
                      "        ,CONVERT(char, [modify_datetime], 120) [modify_datetime]  " +
                      "  FROM [MNDTkind_master]  " +
                      "  WHERE [kind_id] = '" + kindM.kind_id + "' ";

        return(PublicApi.fnGetDt(sSql, "MNDT"));
    }
Exemple #15
0
    public string fnCount(SReturnD sreturnD)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[return_id]", sreturnD.return_id);

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

        return(sPageSize);
    }
Exemple #16
0
    public string fnCount(KindD kindD)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[kind_id]", kindD.kind_id);

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

        return(sPageSize);
    }
Exemple #17
0
    public DataTable fnSelect(User user)
    {
        string sSql = "  SELECT TOP 1 [user].[id]  " +
                      "        ,[user].[account]  " +
                      "        ,[user].[password]  " +
                      "        ,[user].[name]  " +
                      "        ,[user].[address]  " +
                      "        ,[user].[phone]  " +
                      "        ,[user].[status]  " +
                      "  FROM   [MNDTuser] [user]  " +
                      "  WHERE [user].[id] = '" + user.id + "' ";

        return(PublicApi.fnGetDt(sSql, "MNDT"));
    }
Exemple #18
0
    public string fnCount(SReturnMTran sreturnMTran)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[return_id]", sreturnMTran.return_id);

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

        return(sPageSize);
    }
Exemple #19
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);
    }
Exemple #20
0
    public string fnCount(UserTran userTran)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[id]", userTran.id);

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

        return(sPageSize);
    }
        public async void DepthAsync_should_success(string jsonString, string currencyPair)
        {
            //arrange
            var response = TestHelper.CreateJsonResponse(jsonString);

            var obj = new PublicApi(TestHelper.CreateApiClientWithMockHttpAccessor(response));

            //act
            var actual = await obj.DepthAsync(currencyPair);

            //assert
            Assert.NotNull(actual);
            Assert.IsAssignableFrom <DepthResponse>(actual);
        }
    public DataTable fnSelects(ProductStock productStock)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[product_id]", productStock.product_id);
        sCondition += PublicApi.fnAddCondition("[warehouse_id]", productStock.warehouse_id);
        sCondition += " ORDER BY [" + productStock.order + "] ";
        string sInquireSql =
            "  SELECT *  " +
            "  FROM MNDTproduct_stock  " +
            "  WHERE 1 = 1 " + sCondition;

        return(PublicApi.fnGetDt(sInquireSql, "MNDT"));
    }
    //private string fnInsertsSql(ProductStockTran productStockTran)
    //{
    //    string sSql =
    //                    "  INSERT INTO [MNDTproduct_stock_tran]  " +
    //                    "             ([product_id]  " +
    //                    "             ,[ip]  " +
    //                    "             ,[status]  " +
    //                    "             ,[create_id]  " +
    //                    "             ,[create_datetime])  " +
    //                    "  SELECT [product_id]  " +
    //                    "        , '" + productStockTran + "'  " +
    //                    "        , '" + productStockTran.status + "'  " +
    //                    "        , '" + productStockTran.create_id + "'  " +
    //                    "        , GETDATE()  " +
    //                    "  FROM [MNDTproduct_stock]  " +
    //                    " WHERE [product_id] IN (" + productStockTran.product_id + ")";
    //    return sSql;
    //}

    public string fnCount(ProductStockTran productStockTran)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[product_id]", productStockTran.product_id);
        sCondition += PublicApi.fnAddCondition("[warehouse_id]", productStockTran.warehouse_id);
        string sCountSql =
            "          SELECT COUNT(product_id)   " +
            "          FROM   [MNDTproduct_stock_tran]   " +
            "          WHERE  1 = 1 " + sCondition;
        string sPageSize = PublicApi.fnGetValue(sCountSql, "MNDT");

        return(sPageSize);
    }
Exemple #24
0
    public string fnSelect(KindD kindD)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[kind_id]", kindD.kind_id);
        sCondition += PublicApi.fnAddCondition("[code_id]", kindD.code_id);

        string sSql =
            "  SELECT TOP 1 [kind_d].[parameter]   " +
            "  FROM   [MNDTkind_details] AS [kind_d]   " +
            "          WHERE  1 = 1 " + sCondition;

        return(PublicApi.fnGetValue(sSql, "MNDT"));
    }
    public DataTable fnSelect(ReceiveD receiveD)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[order_id]", receiveD.order_id);
        sCondition += PublicApi.fnAddCondition("[seq]", receiveD.seq);

        string sInquireSql =
            "  SELECT [receive_d].*   " +
            "  FROM   [MNDTreceive_details] AS [receive_d]  " +
            "          WHERE  1 = 1 " + sCondition;

        return(PublicApi.fnGetDt(sInquireSql, "MNDT"));
    }
    public string fnCount(ReceiveD receiveD)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[order_id]", receiveD.order_id);

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

        return(sPageSize);
    }
Exemple #27
0
    public string fnUpdate(ProgramD programD)
    {
        string sSql =
            "  UPDATE [MNDTprogram_details]  " +
            "     SET [read] = '" + programD.read + "'  " +
            "        ,[write] = '" + programD.write + "'  " +
            "        ,[execute] = '" + programD.execute + "'  " +
            "        ,[modify_id] = '" + programD.create_id + "'  " +
            "        ,[modify_datetime] = GETDATE()  " +
            "  WHERE [program_id] = '" + programD.program_id + "'  " +
            "  	AND [group_id] = '" + programD.group_id + "'  ";

        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
    public string fnCount(ReceiveMTran receiveMTran)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[order_id]", receiveMTran.order_id);

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

        return(sPageSize);
    }
Exemple #29
0
        public static void CurrenciesJsonToCode(string fileName)
        {
            var api = new PublicApi();
            var res = api.Currencies("all").Result;

            //            var ordered = res.Result.OrderBy(c => c.CurrencyPairValue);
            using (var stream = File.AppendText(fileName))
            {
                foreach (var item in res)
                {
                    stream.WriteLine("        " + item.Name + ",");
                }
            }
        }
        public async Task GetExecutions()
        {
            var res1 = await PublicApi.GetExecutions(ProductCode.BtcJpy);

            Assert.NotNull(res1);

            var res2 = await PublicApi.GetExecutions(ProductCode.FxBtcJpy, 500, 272500, 272000);

            Assert.NotNull(res2);

            var res3 = await PublicApi.GetExecutions(ProductCode.EthBtc);

            Assert.NotNull(res3);
        }
 void Events_AfterCreate(PublicApi.PollAfterCreateEventArgs e)
 {
     if (e.IsEnabled)
     {
         var story = GetStory(e.Id);
         if (story == null)
         {
             _storyController.Create(new ActivityStoryCreateOptions
             {
                 ContentId = e.ContentId,
                 ContentTypeId = PublicApi.Polls.ContentTypeId,
                 LastUpdate = DateTime.UtcNow,
                 Actors = new List<ActivityStoryActor>
                 {
                     new ActivityStoryActor
                     {
                         UserId = e.AuthorUserId,
                         Verb = "Add",
                         Date = DateTime.UtcNow
                     }
                 }
             });
         }
     }
 }
 void Events_AfterCreate(PublicApi.PollVoteAfterCreateEventArgs e)
 {
     var story = GetStory(e.PollId);
     if (story != null)
     {
         _storyController.Update(story.StoryId, new ActivityStoryUpdateOptions
         {
             LastUpdate = DateTime.UtcNow
         });
     }
 }
 private ContextItem BuildPollContextItem(PublicApi.Poll poll)
 {
     var item = new ContextItem()
     {
         TypeName = "Poll",
         ApplicationId = poll.Group.ApplicationId,
         ApplicationTypeId = Telligent.Evolution.Components.ContentTypes.Group,
         ContainerId = poll.Group.ContainerId,
         ContainerTypeId = Telligent.Evolution.Components.ContentTypes.Group,
         ContentId = poll.ContentId,
         ContentTypeId = PublicApi.Polls.ContentTypeId,
         Id = poll.ContentId.ToString()
     };
     return item;
 }
 void Events_AfterUpdate(PublicApi.PollVoteAfterUpdateEventArgs e)
 {
     _metricController.QueueForCalculation(e.PollId, PublicApi.Polls.ContentTypeId);
 }
 void Events_AfterDelete(PublicApi.PollAfterDeleteEventArgs e)
 {
     if (_contentState != null)
         _contentState.Deleted(e.ContentId);
 }
        void PollVoteEvents_AfterDelete(PublicApi.PollVoteAfterDeleteEventArgs e)
        {
            var poll = PublicApi.Polls.Get(e.PollId);

            if (poll == null || !poll.Author.Id.HasValue || poll.Author.Id.Value == e.UserId)
                return;

            DeleteNotification(e.PollId, PublicApi.Polls.ContentTypeId, poll.Author.Id.Value, e.UserId);
        }
        void Events_Render(PublicApi.PollRenderEventArgs e)
        {
            if (e.RenderedProperty == "Description")
            {
                if (_hashTagController != null)
                    e.RenderedHtml = _hashTagController.FormatHashTagsForRendering(Get(e.ContentId), e.RenderedHtml, e.RenderTarget);

                if (_mentionController != null)
                    e.RenderedHtml = _mentionController.FormatMentionsForRendering(e.RenderedHtml, e.RenderTarget);
            }
        }
        void Events_AfterUpdate(PublicApi.PollAfterUpdateEventArgs e)
        {
            if (_hashTagController != null)
            {
                _hashTagController.AddUpdateHashTags(e.ContentId, "Description", e.Description("raw"));

                var tags = _hashTagController.GetHashTagsInUnRenderedHtml(e.Name);
                if (tags != null && tags.Length > 0)
                {
                    TEApi.Tags.Add(e.ContentId, e.ContentTypeId, null, string.Join(",", tags));
                    var name = _hashTagController.FormatHashTagsInUnRenderedHtml(e.Name);
                    PublicApi.Polls.Update(e.Id, name);
                }
            }

            if (_mentionController != null)
                _mentionController.AddUpdateLoggedMentions(e.ContentId, "Description", e.Description("raw"));
        }