Exemplo n.º 1
0
    public void CreateListSendReport1(int[] idsend)
    {
        RenderTexture currentActiveRT = RenderTexture.active;

        RenderTexture.active = screenShot1;
        tx2d[0].ReadPixels(new Rect(0, 0, 1025, 2040), 0, 0);
        var pdf1 = tx2d[0].EncodeToPNG();

        tx2d[1].ReadPixels(new Rect(0, 2029, 1024, 2040), 0, 0);
        var    pdf2     = tx2d[1].EncodeToPNG();
        string sendLate = PlayerPrefs.GetString("DualCallLate", "");

        if (!string.IsNullOrEmpty(sendLate))
        {
            listLate = JsonMapper.ToObject <ClassListSendreportLate>(sendLate);
        }
        //check xem trong này có rep nay ko?
        l = new SendReportLate();
        l.fakeObjectId     = idsend[0];
        l.FakeACtivitiesID = idsend[1];
        if (controlpage.godc.longtermObject != null)
        {
            l.ObjectID = controlpage.godc.longtermObject.ObjectiveID;
        }
        else
        {
            l.ObjectID = 0;
        }
        l.ActivitiesID         = idsend[1];
        l.dcreport             = PublicClassDualCallToJson(controlpage.maindata, DateTime.Today.ToString(), controlpage.godc.rep);
        l.dualCallReportObject = controlpage.sendreport;     //ConvertToRePort(controlpage.maindata);
        l.dcthisDay            = controlpage.maindata;
        l.img1     = pdf1;
        l.img2     = pdf2;
        l.dateTime = DateTime.Today.ToString();
        l.Status   = 0;
        l.RepID    = controlpage.godc.rep.RepID;
        listLate.listReport.Add(l);
        RenderTexture.active = currentActiveRT;

        //  StartCoroutine(SendReportOffline(listLate.listReport, SendSuccess, SendFailed));
    }
Exemplo n.º 2
0
    void SendSuccess(string ss, int objectiveID, int ActivityID, SendReportLate reportLate)
    {
        ReportAnalytics ra = new ReportAnalytics();

        ra.ObjectiveID = objectiveID;
        ra.ActivityID  = ActivityID;
        ra.sms         = "send success";
        ra.dateTime    = reportLate.dateTime;
        // Debug.Log(ss + "" + objectiveID + "//acti" + ActivityID);
        numSuccess++;
        //  Debug.Log("failed " + numfailed + "/ success" + numSuccess + " / total" + totalsend);
        if (reportLate.dateTime == DateTime.Today.ToString())
        {
            controlpage.SaveDataTodayReport(reportLate.RepID, reportLate.dcthisDay);
        }
        if (numSuccess + numfailed == totalsend)
        {
            PopupWaiting.SetActive(false);
            string mes = "";
            if (numSuccess > 0)
            {
                mes = "Send succeed " + numSuccess.ToString() + " report. ";
            }
            if (numfailed > 0)
            {
                mes = "Failed to send" + numfailed.ToString() + " report. that report will be sent in the next time. ";
            }

            // controlpage.ShowMesage(mes);
            Debug.Log(resultsSend.ToString() + "ss");
            controlpage.ShowMesage(resultsSend.ToString());
            PopupWaiting.SetActive(false);

            SaveListLate();
            controlpage.SaveAfterReport();
        }
    }
Exemplo n.º 3
0
    public void CreateListSendReport(int[] idsend)
    {
        RenderTexture currentActiveRT = RenderTexture.active;

        RenderTexture.active = screenShot1;
        tx2d[0].ReadPixels(new Rect(0, 0, 1025, 2040), 0, 0);
        var pdf1 = tx2d[0].EncodeToPNG();

        tx2d[1].ReadPixels(new Rect(0, 2029, 1024, 2040), 0, 0); // test crash
        var    pdf2     = tx2d[1].EncodeToPNG();
        string sendLate = PlayerPrefs.GetString("DualCallLate", "");

        if (!string.IsNullOrEmpty(sendLate))
        {
            listLate = JsonMapper.ToObject <ClassListSendreportLate>(sendLate);
        }
        //check xem trong này có rep nay ko?


        //check xem rep này đã nhập ngày hôm nay chưa? neu nhap roi ko cho thay doi

        //if (CheckReportInlistLate(controlpage.godc.rep.RepID, DateTime.Today.ToString()))
        //{
        //    //delete neu no ton tai roi ma chua duoc gui di
        //  //  listLate.listReport.RemoveAll(m => m.RepID == l.RepID && m.dateTime == DateTime.Today.ToString());

        //    //chưa remove ben trong
        //}


        l = new SendReportLate();
        l.fakeObjectId     = idsend[0];
        l.FakeACtivitiesID = idsend[1];
        if (controlpage.godc.longtermObject != null)
        {
            l.ObjectID = controlpage.godc.longtermObject.ObjectiveID;
        }
        else
        {
            l.ObjectID = 0;
        }
        l.ActivitiesID         = idsend[1];
        l.dcreport             = PublicClassDualCallToJson(controlpage.maindata, DateTime.Today.ToString(), controlpage.godc.rep);
        l.dualCallReportObject = controlpage.sendreport; //ConvertToRePort(controlpage.maindata);
        l.dcthisDay            = controlpage.maindata;
        l.img1     = pdf1;
        l.img2     = pdf2;
        l.dateTime = DateTime.Today.ToString();
        l.Status   = 0;
        l.RepID    = controlpage.godc.rep.RepID;
        if (CheckReportInlistLate(l.RepID, DateTime.Today.ToString()))
        {
            //delete neu no ton tai roi ma chua duoc gui di
            listLate.listReport.RemoveAll(m => m.RepID == l.RepID && m.dateTime == DateTime.Today.ToString());

            //chưa remove ben trong
        }
        listLate.listReport.Add(l);
        RenderTexture.active = currentActiveRT;
        StartCoroutine(SendReportOffline(listLate.listReport, SendSuccess, SendFailed));
    }