Example #1
0
    protected void btnUnSubscription_OnClick(object sender, EventArgs e)
    {
        SendService sendService = new SendService();
        string      endUserId   = string.Empty;



        try
        {
            endUserId = Request.QueryString["endUserId"].ToString();
        }
        catch (Exception exception)
        {
            endUserId = "";
        }
        string query = @"SELECT subscriptionId
  FROM[DPDP].[dbo].[tblBase]
  where ServiceId = '13' and MSISDN = '" + endUserId + "' and RegStatus = 1";

        object subscriptionId = new CDA().getSingleValue(query, "DPDP");

        string json = new JavaScriptSerializer().Serialize(new
        {
            Id             = "",
            servicekey     = "afef69c7cbbe4b55bb10d47dd5969677",
            endUserId      = endUserId,
            subscriptionId = subscriptionId.ToString(),
            accesschannel  = "WAP"
        });

        sendService.Send("http://192.168.14.16/DPDPClient/api/Unsubscribe", json);
        Thread.Sleep(5000);
        Response.Redirect("~/Default.aspx");
    }
        public void WhenHealthVaultCdaToFhirToHealthVault_ThenValuesEqual()
        {
            string inputCdaXmlRaw = SampleUtil.GetSampleContent("CDA.xml");

            XPathDocument xpDoc = DocumentReferenceHelper.GetXPathDocumentFromXml(inputCdaXmlRaw);

            CDA inputCda = new CDA();

            inputCda.TypeSpecificData = xpDoc;

            var documentReference = inputCda.ToFhir() as DocumentReference;

            var cda = documentReference.ToHealthVault() as CDA;

            XPathDocument cdaXPathDoc = DocumentReferenceHelper.GetXPathDocumentFromXml(inputCdaXmlRaw) ?? throw new Exception("Invalid XML");

            // XML gets generated using a common method in order to use in Assert.AreEqual
            string inputCdaXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(cdaXPathDoc.CreateNavigator());

            Assert.IsNotNull(cda);
            Assert.IsNotNull(cda.TypeSpecificData);

            string cdaXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(cda.TypeSpecificData.CreateNavigator());

            Assert.AreEqual(inputCdaXml, cdaXml);
        }
        public void sendPush()
        {
            SendService sendService = new SendService();


            DataSet ds = new CDA().GetDataSet("EXEC [Firebase].dbo.spGetTokenForDesktop_ForAllApps", "MYCHOICE");

            if (ds != null)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string res = Post.SendPushNotification(dr["Token"].ToString(), dr["ContentCode"].ToString(), dr["PushTblId"].ToString(),
                                                           dr["Refid"].ToString());

                    FirebaseResult.Rootobject r = Newtonsoft.Json.JsonConvert.DeserializeObject <FirebaseResult.Rootobject>(res);

                    string json = new JavaScriptSerializer().Serialize(new
                    {
                        token = dr["Token"],
                        Id    = dr["RefId"]
                    });
                    new CDA().ExecuteNonQuery("EXEC [Firebase].dbo.spUpdateTokenForDesktop_ForAllApps '" + dr["Id"] + "'", "MYCHOICE");
                    if (r.success == 1)
                    {
                        sendService.Send("https://wap.shabox.mobi/fbandroid/api/TokenManage/SendLog", json);
                    }
                    else
                    {
                        sendService.Send("https://wap.shabox.mobi/fbandroid/api/TokenManage/FailedLog", json);
                        sendService.Send("https://wap.shabox.mobi/fbandroid/api/TokenManage/DeactiveToken", json);
                    }
                }
            }
        }
Example #4
0
        public JsonResult GetResult(string fromDate, string toDate)
        {
            DataSet dataSet = null;

            var clickQuery = "SELECT CAST(TimeStamp as date) date, COUNT(*) click " +
                             " from UrlClickLogs_ForAllApps" +
                             " where CAST(TimeStamp as date) between '" + fromDate + "' and '" + toDate + "' " +
                             " group by CAST(TimeStamp as date) " +
                             " order by CAST(TimeStamp as date) desc";

            var sendQuery = " SELECT CAST(TimeStamp as date) date, COUNT(Id) Send " +
                            " FROM SendLogTables_ForAllApps " +
                            " where CAST(TimeStamp as date) between '" + fromDate + "' and '" + toDate + "' " +
                            " group by CAST(TimeStamp as date) " +
                            " order by CAST(TimeStamp as date) desc";

            List <Click> clicks = new List <Click>();
            List <Send>  sends  = new List <Send>();

            string db = "fb";

            dataSet = new CDA().GetReportData(clickQuery, db);

            if (dataSet != null)
            {
                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    Click click = new Click();
                    click.Id        = clicks.Count + 1;
                    click.TimeStamp = row["date"].ToString();
                    click.Count     = Int32.Parse(row["click"].ToString());
                    clicks.Add(click);
                }
            }

            dataSet = null;

            dataSet = new CDA().GetReportData(sendQuery, db);

            if (dataSet != null)
            {
                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    Send send = new Send();
                    send.Id        = clicks.Count + 1;
                    send.TimeStamp = row["date"].ToString();
                    send.Count     = Int32.Parse(row["Send"].ToString());
                    sends.Add(send);
                }
            }

            var q =
                from c in clicks
                join s in sends on c.TimeStamp equals s.TimeStamp into ps
                from p in ps.DefaultIfEmpty()
                select new { TimeStamp = c, Send = p == null ? "(No send)" : p.Count.ToString() };

            return(Json(q, JsonRequestBehavior.AllowGet));
        }
Example #5
0
        internal static DocumentReference ToFhirInternal(CDA cda, DocumentReference documentReference)
        {
            string xml = ThingBaseToFhirDocumentReference.GetXmlFromXPathNavigator(cda.TypeSpecificData.CreateNavigator());

            ThingBaseToFhirDocumentReference.XmlToDocumentReference(documentReference, xml);

            return(documentReference);
        }
        internal static CDA ToCDA(this DocumentReference documentReference)
        {
            var contentComponent = documentReference.GetFirstContentComponentWithData();

            CDA cda = documentReference.ToThingBase <CDA>();

            string        xml   = Encoding.UTF8.GetString(contentComponent.Attachment.Data);
            XPathDocument xpDoc = ThingBaseToFhirDocumentReference.GetXPathNavigatorFromXml(xml);

            cda.TypeSpecificData = xpDoc;

            return(cda);
        }
Example #7
0
        public ActionResult Index(Logins lg)
        {
            DataSet ds = new CDA().GetDataSet("exec [WapPortal_CMS].[dbo].spUserLogin '" + lg.UserName + "','" + lg.Password + "'", "HR");

            if (ds != null)
            {
                Session["Uid"] = lg.UserName;

                return(RedirectToAction("Index", "Report"));
            }
            else
            {
                ModelState.AddModelError("", @"Invalid user Name/Password");
                return(View(lg));
            }
        }
Example #8
0
    private void BaseCheck()
    {
        // SetSMsisdn();

        string query = @"SELECT top 1 1
  FROM[DPDP].[dbo].[tblBase]

  where ServiceId = '13' and MSISDN = '" + sMsisdn + "' and RegStatus = 1";

        DataSet dataSet = new CDA().GetDataSet(query, "DPDP");

        if (dataSet != null)
        {
            //   Response.Redirect("ErrorMessage.aspx");
        }
        else
        {
            Response.Redirect("Default.aspx");
        }
    }
        private List <ADQ> CabeceraADQ(RFNCCAB model)
        {
            ADQ        mADQ  = new ADQ();
            List <ADQ> lmADQ = new List <ADQ>();
            ICR        mICR  = new ICR();
            List <ICR> lmICR = new List <ICR>();
            CDA        mCDA  = new CDA();
            List <CDA> lmCDA = new List <CDA>();

            mADQ.ADQ_1  = model.SUFD13;
            mADQ.ADQ_2  = (model.SUFD19 != "") ? model.SUFD19 : model.FNIT;
            mADQ.ADQ_3  = model.SUFD17;
            mADQ.ADQ_4  = model.SUFD14;
            mADQ.ADQ_5  = model.FCLIENT;
            mADQ.ADQ_6  = (model.SUFD13 != "2") ? model.FNOMCLI : "";
            mADQ.ADQ_8  = (model.SUFD13 == "2") ? model.SUFD06 : "";
            mADQ.ADQ_9  = (model.SUFD13 == "2") ? model.SUFD05 : "";
            mADQ.ADQ_10 = model.FDIRCLI1;
            mADQ.ADQ_11 = model.FDEPCLI;
            mADQ.ADQ_13 = model.FDIRCLI3;
            mADQ.ADQ_15 = model.FPAICLI;
            mADQ.ADQ_18 = model.FDIRCLI1;

            mICR.ICR_3 = model.FDIRCLI3;
            mICR.ICR_5 = model.FDEPCLI;
            mICR.ICR_6 = model.FDIRCLI1;
            mICR.ICR_7 = model.FPAICLI;
            lmICR.Add(mICR);
            mADQ.LMdlICR = lmICR;

            mCDA.CDA_1 = "1";
            mCDA.CDA_2 = model.CCON;
            mCDA.CDA_3 = model.CPHON;
            mCDA.CDA_4 = model.CMAD6;
            lmCDA.Add(mCDA);
            mADQ.LMdlCDA = lmCDA;

            lmADQ.Add(mADQ);

            return(lmADQ);
        }
Example #10
0
    private void BaseCheck()
    {
        SetSMsisdn();

        string query = @"SELECT top 1 1
  FROM[DPDP].[dbo].[tblBase]

  where ServiceId = '13' and MSISDN = '" + sMsisdn + "' and RegStatus = 1";

        DataSet dataSet = new CDA().GetDataSet(query, "DPDP");

        if (dataSet != null)
        {
            subDiv.Visible            = false;
            btnUnSubscription.Visible = true;
        }
        else
        {
            subDiv.Visible            = true;
            btnUnSubscription.Visible = false;
        }
    }
Example #11
0
        public void WhenHealthVaultCdaTransformedToFhir_ThenValuesEqual()
        {
            string cdaXmlRaw = SampleUtil.GetSampleContent("CDA.xml");

            XPathDocument xpDoc = DocumentReferenceHelper.GetXPathDocumentFromXml(cdaXmlRaw);

            Assert.IsNotNull(xpDoc);

            CDA cda = new CDA();

            cda.TypeSpecificData = xpDoc;

            var documentReference = cda.ToFhir() as DocumentReference;

            Assert.IsNotNull(documentReference);
            Assert.IsNotNull(documentReference.Type);
            Assert.AreEqual(documentReference.Content.Count, 1);
            Assert.IsNotNull(documentReference.Content[0].Attachment);
            Assert.IsNotNull(documentReference.Content[0].Attachment.Data);
            Assert.IsNotNull(documentReference.Content[0].Attachment.ContentType, "application/xml");

            string cdaXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(cda.TypeSpecificData.CreateNavigator());
            string cdaContentBase64Encoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(cdaXml));

            string fhirXmlRaw = Encoding.UTF8.GetString(documentReference.Content[0].Attachment.Data);

            XPathDocument fhirXPathDoc;

            using (TextReader txtReader = new StringReader(fhirXmlRaw))
            {
                fhirXPathDoc = new XPathDocument(txtReader);
            }

            string fhirXml = DocumentReferenceHelper.GetXmlFromXPathNavigator(xpDoc.CreateNavigator());
            string fhirAttachmentDataBase64Encoded = Convert.ToBase64String(documentReference.Content[0].Attachment.Data);

            Assert.AreEqual(fhirAttachmentDataBase64Encoded, cdaContentBase64Encoded);
        }
Example #12
0
    public string ClosestMinimumFinder(string Dimension, string ContentType)
    {
        CDA     cmd     = new CDA();
        DataSet ds      = cmd.GetDataSet("Select Specification from tbl_ContentFormat Where title='" + ContentType + "'", "WAPDB");
        int     Input_W = 0;
        int     Input_H = 0;

        string strDimentionFromDB = string.Empty;
        int    Database_W         = 0;
        int    Database_H         = 0;

        string[] arrSplitedString = Dimension.Split('x');
        Input_W = Convert.ToInt32(arrSplitedString[0]);
        Input_H = Convert.ToInt32(arrSplitedString[1]);

        int    TempDifference      = -1;
        int    MinimumDifference   = -1;
        int    MinimumClosestWidth = 0;
        string MinimumDimention    = "Default";

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            strDimentionFromDB = dr.ItemArray[0].ToString();
            arrSplitedString   = strDimentionFromDB.Split('x');

            Database_W = Convert.ToInt32(arrSplitedString[0].Split('D')[1]);

            TempDifference = Input_W - Database_W;

            if (TempDifference == 0)
            {
                MinimumDifference   = TempDifference;
                MinimumClosestWidth = Database_W;
                break;
            }
            else if (TempDifference > 0)
            {
                if (MinimumDifference != -1)
                {
                    if (TempDifference < MinimumDifference)
                    {
                        MinimumDifference   = TempDifference;
                        MinimumClosestWidth = Database_W;
                    }
                }
                else
                {
                    MinimumDifference   = TempDifference;
                    MinimumClosestWidth = Database_W;
                }
            }
        }

        if (MinimumDifference >= 0)
        {
            DataSet objDataSet = cmd.GetDataSet("SELECT Specification FROM tbl_ContentFormat WHERE title='" + ContentType + "' AND Specification LIKE 'D" + MinimumClosestWidth + "x%'", "WAPDB");
            TempDifference    = -1;
            MinimumDifference = -1;

            if (objDataSet.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dataRaw in objDataSet.Tables[0].Rows)
                {
                    strDimentionFromDB = dataRaw.ItemArray[0].ToString();
                    arrSplitedString   = strDimentionFromDB.Split('x');

                    Database_H = Convert.ToInt32(arrSplitedString[1]);

                    TempDifference = Input_H - Database_H;

                    if (TempDifference == 0)
                    {
                        MinimumDifference = TempDifference;
                        MinimumDimention  = strDimentionFromDB;
                        break;
                    }
                    else if (TempDifference > 0)
                    {
                        if (MinimumDifference != -1)
                        {
                            if (TempDifference < MinimumDifference)
                            {
                                MinimumDifference = TempDifference;
                                MinimumDimention  = strDimentionFromDB;
                            }
                        }
                        else
                        {
                            MinimumDifference = TempDifference;
                            MinimumDimention  = strDimentionFromDB;
                        }
                    }
                }
            }
        }
        return(MinimumDimention);
    }
Example #13
0
 // Register the type on the generic ThingToFhir partial class
 public static DocumentReference ToFhir(this CDA cda)
 {
     return(CdaToFhir.ToFhirInternal(cda, ToFhirInternal <DocumentReference>(cda)));
 }