コード例 #1
0
        public async Task <bool> viewDocument(string selectedDocName)
        {
            await Isfavourite(selectedDocName);

            if (!isFavorite)//!isFavorite
            {
                DocumentDownloadModel.DocumentRequest dr = new DocumentDownloadModel.DocumentRequest();
                dr.Path = "";
                dr.Name = selectedDocName;// "GEHSI E07.23 - Cleanup of PCB Spills.pdf";//"";GEHSI E02.01 - Spill Reporting.pdf
                if (returnOS == "Available")
                {
                    string statusCode = ServiceBusRelay.DownloadFile("api/policies/DownloadFile", dr);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
コード例 #2
0
        public void UpdateLastModified(List <Policies> OfflineList)
        {
            try
            {
                foreach (var item in OfflineList)
                {
                    //check here for existing record in sqlite
                    string docName = item.DocName;
                    //docName = docName.Remove(docName.Length - 4);

                    List <Policies> plist    = dbConnSync.Table <Policies>().Where(c => c.DocName == docName).ToList();
                    int             docCount = plist.Count();
                    if (docCount > 0)
                    {
                        string dateval = item.ModifiedDate;
                        //dbConn.UpdateAsync("update policies set ModifiedDate=" + item.ModifiedDate + " where DocName=" + docName);

                        //String[] args = new String[] { dateval, docName };
                        //string qry = "update Policies set ModifiedDate=? where DocName=?";
                        //////dbConn.update(TABLE_LATLONG, values, "Loc_lati=? AND Loc_longi=?", args);
                        //////dbConn.ExecuteAsync("Policies", values,"", args);
                        //dbConn.ExecuteScalarAsync<Policies>(qry,args);
                        //string sss = "Delete from policies where DocName='" + docName + "'";
                        dbConn.ExecuteAsync("Delete from policies where DocName='" + docName + "'");
                        //dbConnSync.Execute("Delete from policies where DocName='" + docName + "'");
                        Policies ps = new Policies();
                        ps.DocId        = plist[0].DocId;
                        ps.DocName      = docName;
                        ps.DocSubType   = plist[0].DocSubType;
                        ps.DocSubTypeID = plist[0].DocSubTypeID;
                        ps.DocType      = plist[0].DocType;
                        ps.IsFavourite  = plist[0].IsFavourite;
                        ps.ModifiedBy   = item.ModifiedBy;
                        ps.ModifiedDate = dateval;

                        //dbConn.InsertAsync(new Policies {  DocId= plist[0].DocId, DocSubType= plist[0].DocSubType, DocSubTypeID= plist[0].DocSubTypeID, DocType= plist[0].DocType, IsFavourite= plist[0].IsFavourite, DocName = item.DocName, ModifiedDate= item.ModifiedDate, ModifiedBy= item.ModifiedBy });
                        dbConn.InsertAsync(ps);
                        //dbConn.UpdateAsync(ps);

                        if (plist[0].IsFavourite)
                        {
                            DocumentDownloadModel.DocumentRequest dr = new DocumentDownloadModel.DocumentRequest();
                            dr.Path = "";
                            dr.Name = docName;
                            /* network check*/

                            ServiceBusRelay.DownloadFile("api/policies/DownloadFile", dr);
                        }
                        ps = null;
                    }
                    else
                    {
                        dbConn.InsertAsync(item);
                    }
                }
                SetLastModifiedDate();
            }
            catch (Exception ex)
            {
                //docName = ex.Message;
                throw;
            }
        }