Exemplo n.º 1
0
 public DocumentReferenceWrapper(DocumentReference documentReference)
 {
     _documentReference = documentReference;
 }
 public DocumentReferenceWrapper(DocumentReference reference)
 {
     Wrapped = reference;
 }
 public static async Task AddAuthCode(string code)
 {
     //TODO: should probably not allow key clobbering
     DocumentReference codeDataRef = Db.Document("_authorizeKeys").Collection(code).Document("data");
     await codeDataRef.SetAsync(new AuthorizationStatus { used = false, sid = 0 });
 }
        //This method help to store the data in the Firebase and generates the Otp for the user for the user verification
        public async void registerNewUser(UserRegister user)
        {
            try
            {
                //connection to the Database
                Boolean connectionResult = connectToFirebase();

                //creating secret key of the user
                string key = new string((user.Email_Address + user.Password).ToCharArray().OrderBy(x => Guid.NewGuid()).ToArray());
                //inserting secret key to database

                //Create the Instance for the Document reference
                DocumentReference           doc2  = db.Collection("UserKeys").Document(user.Email_Address);
                Dictionary <string, object> data2 = new Dictionary <string, object>()
                {
                    { "email", user.Email_Address },
                    { "userKey", key },
                };
                await doc2.SetAsync(data2);

                //send the OTP to the User
                await sendOTP(user.Email_Address, user.First_Name + " " + user.Last_Name, false);

                user_Email    = user.Email_Address;
                user_Password = user.Password;


                //Hash the password
                string[] hash_password = Password.giveHashPassword(user.Password);

                //Creating the User Instance for the persistance of the user data in the database
                //user is the object which contains the information retrieved by the user windows application

                DocumentReference doc1 = db.Collection("User").Document(user.Email_Address);
                //Create the Dictonary to Intialiaze the Object to be stored on the firestore

                //get the secure access Pin for the user
                PIN = GenerateRandomInt(000001, 999999);
                string bcrypt_PIN = Password.Bcrpyt_Password(PIN.ToString());
                Dictionary <string, object> data1 = new Dictionary <string, object>()
                {
                    { "email", user.Email_Address },
                    { "firstName", user.First_Name },
                    { "lastName", user.Last_Name },
                    { "dateOfBirth", user.Date_Of_Birth },
                    { "password", hash_password[1] },
                    { "questionSelected", user.Question_Number_Selected },
                    { "questionAnswered", user.Question_Answered },
                    { "salt", hash_password[0] },
                    { "verified", false },
                    { "accessPIN", bcrypt_PIN },
                    { "dateOfRegistration", System.DateTime.Now.ToString() },
                };
                //Set the account asynchronously on firestore database
                await doc1.SetAsync(data1);
            }
            catch (Exception ex)
            {
                //catch the exception and throw to the client side
                CustomException customException = new CustomException();
                customException.errorTitleName     = ex.Message;
                customException.errorMessageToUser = "******" +
                                                     "Please Try Again Later!!";

                throw new FaultException <CustomException>(customException);
            }
        }
        public async Task <OTP_Verified> verifyUser(UserOtpVerification userOtpObj)
        {
            OTP_Verified verification_status = new OTP_Verified();

            try
            {
                //connect to the Firebase
                Boolean connectionResult = connectToFirebase();
                if (connectionResult)
                {
                    DocumentReference docRef1  = db.Collection("UserKeys").Document(userOtpObj.Email_Address);
                    DocumentSnapshot  docSnap1 = await docRef1.GetSnapshotAsync();

                    DBUserKeys DBuserKeyObj = docSnap1.ConvertTo <DBUserKeys>();
                    var        bytes        = Encoding.ASCII.GetBytes(DBuserKeyObj.userKey);
                    bool       otpValid     = false;
                    DateTime   otp_obtained_time_from_user = System.DateTime.Now;
                    //Comapre the otp obtained from the user
                    if (otpString.Equals(userOtpObj.OTP.ToString()))
                    {
                        TimeSpan ts = otp_obtained_time_from_user - otp_generated_time;
                        if (ts.TotalMinutes <= 2)
                        {
                            otpValid = true;
                        }
                    }
                    //If OTP is verified then
                    if (otpValid)
                    {
                        //update the Verification Status of the User on the Database
                        DocumentReference           docRef2 = db.Collection("User").Document(DBuserKeyObj.email);
                        Dictionary <string, object> data2   = new Dictionary <string, object>()
                        {
                            { "verified", true },
                        };
                        //DocumentSnapshot docSnap2 = await docRef2.GetSnapshotAsync();
                        await docRef2.UpdateAsync(data2);

                        verification_status.Verification_Result = true;

                        //send the email for secure access Pin to the user
                        await SendPDFEmail(PIN, user_Email, user_Password);

                        //Create Encryption key for the user
                        try
                        {
                            //This class create the encyrption key for the user for the further security features
                            AzureEncryptDecrypt azureEncryptDecrypt = new AzureEncryptDecrypt();
                            string encryptionKeyName = await azureEncryptDecrypt.createEncryptionRSAKey();

                            DocumentReference           documentReference_for_keys = db.Collection("UserEncryptionKeys").Document(userOtpObj.Email_Address);
                            Dictionary <string, object> userKeyValues = new Dictionary <string, object>()
                            {
                                {
                                    "userEmailAddress", userOtpObj.Email_Address
                                },
                                {
                                    "userKeyName", encryptionKeyName
                                },
                                {
                                    "keyGenerationDate", DateTime.Now.ToString()
                                }
                            };

                            await documentReference_for_keys.SetAsync(userKeyValues);
                        }
                        catch (Exception ex)
                        {
                            //catch the exception and throw the error on the client
                            CustomException customException = new CustomException();
                            customException.errorTitleName     = ex.Message;
                            customException.errorMessageToUser = "******";
                            throw new FaultException <CustomException>(customException);
                        }
                        return(verification_status);
                    }
                }
            }
            catch (Exception ex)
            {
                //catch the exception and throw the error on the client
                CustomException customException = new CustomException();
                customException.errorTitleName     = ex.Message;
                customException.errorMessageToUser = "******";
                throw new FaultException <CustomException>(customException);
            }
            //make false if the code reaches upto this
            verification_status.Verification_Result = false;
            //return the verification status to the user
            return(verification_status);
        }
Exemplo n.º 6
0
 public CollectionReferencePayload(CollectionReference collectionReference, DocumentReference selectedDocument) :
     this(collectionReference, ToEnumerable(selectedDocument))
 {
 }
Exemplo n.º 7
0
        private async void uploadInvoice(String file)
        {
            Excel.Application xlApp      = new Excel.Application();
            Excel.Workbook    xlWorkBook = xlApp.Workbooks.Open(file);
            object            misValue   = System.Reflection.Missing.Value;

            foreach (Excel.Worksheet xlWorkSheet in xlWorkBook.Worksheets)
            {
                try
                {
                    string temp;
                    temp = xlWorkSheet.Range["Vendor_Name"].Value2.ToString();
                    temp = xlWorkSheet.Range["Invoice_Number"].Value2.ToString();
                    temp = xlWorkSheet.Range["Invoice_Date"].Value2.ToString();
                    temp = xlWorkSheet.Range["Item_Number"].Value2.ToString();
                    temp = xlWorkSheet.Range["Item_Desc"].Value2.ToString();
                    temp = xlWorkSheet.Range["Item_Quantity"].Value2.ToString();
                    temp = xlWorkSheet.Range["Item_Price"].Value2.ToString();
                    temp = xlWorkSheet.Range["Item_Total_Price"].Value2.ToString();
                    temp = xlWorkSheet.Range["Total_Balance"].Value2.ToString();

                    CollectionReference icoll = db.Collection("invoice");
                    Query         iquery      = icoll.WhereEqualTo("invoice_num", xlWorkSheet.Range["Invoice_Number"].Value2.ToString());
                    QuerySnapshot isnap       = await iquery.GetSnapshotAsync();

                    Query         iquery2 = icoll.OrderByDescending("invoice_id").Limit(1);
                    QuerySnapshot isnap2  = await iquery2.GetSnapshotAsync();

                    int invoiceid = isnap2.Documents[0].ConvertTo <Invoice>().invoice_id;

                    if (isnap.Count == 0)
                    {
                        try
                        {
                            for (int count = 0; ; count++)
                            {
                                newInvoiceStock.Add(xlWorkSheet.Cells[xlWorkSheet.Range["Item_Desc"].Row + count, xlWorkSheet.Range["Item_Desc"].Column].Value2.ToString());
                            }
                        }
                        catch
                        {
                            CollectionReference coll = db.Collection("stock");

                            Query         query2    = coll.OrderByDescending("item_id").Limit(1);
                            QuerySnapshot stocksnap = await query2.GetSnapshotAsync();

                            int stockid = stocksnap.Documents[0].ConvertTo <Stock>().item_id;

                            int vendor_id = await updateVendorDb(xlWorkSheet.Range["Vendor_Name"].Value2.ToString());

                            DateTime date = DateTime.FromOADate(Convert.ToDouble(xlWorkSheet.Range["Invoice_Date"].Value2.ToString()));
                            DateTime.SpecifyKind(date, DateTimeKind.Utc);

                            invoiceid = invoiceid + 1;

                            Dictionary <string, object> idata = new Dictionary <string, object>()
                            {
                                //auto generate invoice id
                                { "invoice_date", Timestamp.FromDateTimeOffset(date) },
                                { "invoice_id", invoiceid },
                                { "invoice_num", xlWorkSheet.Range["Invoice_Number"].Value2.ToString() },
                                { "vendor_id", vendor_id }
                            };
                            DocumentReference idoc = await icoll.AddAsync(idata);

                            for (int i = 0; i < newInvoiceStock.Count; i++)
                            {
                                //query need to repeat to verify existence of item
                                Query query = coll
                                              .WhereEqualTo("item_name", newInvoiceStock[i].ToString())
                                              .WhereEqualTo("vendor_id", vendor_id);

                                QuerySnapshot snap = await query.GetSnapshotAsync();

                                if (snap.Documents.Count <= 0)
                                {
                                    //add new item
                                    Stock stock = new Stock();

                                    stockid = stockid + 1;

                                    stock.item_id         = stockid;
                                    stock.item_name       = xlWorkSheet.Cells[xlWorkSheet.Range["Item_Desc"].Row + i, xlWorkSheet.Range["Item_Desc"].Column].Value2.ToString();
                                    stock.vendor_id       = vendor_id;
                                    stock.wholesale_price = Double.Parse(xlWorkSheet.Cells[xlWorkSheet.Range["Item_Price"].Row + i, xlWorkSheet.Range["Item_Price"].Column].Value2.ToString());
                                    stock.quantity        = Int32.Parse(xlWorkSheet.Cells[xlWorkSheet.Range["Item_Quantity"].Row + i, xlWorkSheet.Range["Item_Quantity"].Column].Value2.ToString());

                                    add_coll.Add(stock);

                                    Dictionary <string, object> idata2 = new Dictionary <string, object>()
                                    {
                                        { "item_id", stock.item_id },
                                        { "item_name", stock.item_name },
                                        { "quantity", stock.quantity },
                                        { "wholesale_price", stock.wholesale_price }
                                    };

                                    await idoc.Collection("invoice_items").AddAsync(idata2);
                                }
                                else
                                {
                                    //edit existing item
                                    string id = snap.Documents[0].Id;

                                    Stock stock = snap.Documents[0].ConvertTo <Stock>();

                                    DocumentReference docref = coll.Document(id);

                                    Dictionary <string, object> data = new Dictionary <string, object>()
                                    {
                                        { "quantity", stock.quantity + Convert.ToInt32(xlWorkSheet.Cells[xlWorkSheet.Range["Item_Quantity"].Row + i, xlWorkSheet.Range["Item_Quantity"].Column].Value2) }
                                    };

                                    await docref.UpdateAsync(data);

                                    Dictionary <string, object> idata2 = new Dictionary <string, object>()
                                    {
                                        { "item_id", stock.item_id },
                                        { "item_name", stock.item_name },
                                        { "quantity", Convert.ToInt32(xlWorkSheet.Cells[xlWorkSheet.Range["Item_Quantity"].Row + i, xlWorkSheet.Range["Item_Quantity"].Column].Value2) },
                                        { "wholesale_price", stock.wholesale_price }
                                    };

                                    await idoc.Collection("invoice_items").AddAsync(idata2);
                                }
                            }

                            if (add_coll.Count > 0)
                            {
                                PriceEntryForm form = new PriceEntryForm(add_coll);

                                form.Show();

                                form.FormClosed += new FormClosedEventHandler(Form_Closed);
                            }
                            else
                            {
                                refreshDGV();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invoice duplicate detected!");
                    }
                }
                catch
                {
                    failedUpload.Add(Path.GetFileName(file));
                }
            }

            xlWorkBook.Close(false, misValue, misValue);
            xlApp.Quit();

            releaseObject(xlWorkBook);
            releaseObject(xlApp);

            finishLoad();
        }
Exemplo n.º 8
0
        public void Paste()
        {
            IProject project = this.Services.ProjectManager().ItemSelectionSet.SelectedProjects.SingleOrNull <IProject>();

            if (project == null)
            {
                return;
            }
            CutBuffer.ProjectCopyInformation copyInformation = this.GetCopyInformation();
            if (copyInformation == null)
            {
                CutBuffer.AddImageDataFromClipboard(this.Services.ProjectManager(), project);
            }
            else
            {
                IProject project1 = null;
                if (copyInformation.IsCut)
                {
                    project1 = this.Services.ProjectManager().CurrentSolution.Projects.FindMatchByUrl <IProject>(copyInformation.ProjectUrl);
                }
                if (copyInformation.Items != null && copyInformation.Items.Count > 0)
                {
                    string str = this.Services.ProjectManager().TargetFolderForProject(project);
                    if (str != null)
                    {
                        IEnumerable <CutBuffer.CopyInformation> copyInformations = copyInformation.Items.Where <CutBuffer.ItemCopyInformation>((CutBuffer.ItemCopyInformation itemToCopy) => {
                            if (project1 == null)
                            {
                                return(true);
                            }
                            return(!Microsoft.Expression.Framework.Documents.PathHelper.ArePathsEquivalent(Microsoft.Expression.Framework.Documents.PathHelper.GetParentDirectory(itemToCopy.ItemUrl), str));
                        }).Select <CutBuffer.ItemCopyInformation, CutBuffer.CopyInformation>((CutBuffer.ItemCopyInformation itemToCopy) => new CutBuffer.CopyInformation(itemToCopy.ItemUrl, this.DetermineFileUrlForCopy(itemToCopy.ItemUrl, str)));
                        if (!this.CopyItems(project, copyInformations))
                        {
                            return;
                        }
                    }
                    if (project1 != null)
                    {
                        foreach (CutBuffer.ItemCopyInformation item in copyInformation.Items)
                        {
                            IProjectItem projectItem = project1.FindItem(DocumentReference.Create(item.ItemUrl));
                            if (projectItem == null)
                            {
                                continue;
                            }
                            if (Microsoft.Expression.Framework.Documents.PathHelper.ArePathsEquivalent(Microsoft.Expression.Framework.Documents.PathHelper.GetParentDirectory(item.ItemUrl), str))
                            {
                                projectItem.IsCut = false;
                            }
                            else
                            {
                                IProjectItem codeBehindItem = projectItem.CodeBehindItem;
                                if (codeBehindItem != null)
                                {
                                    IProject       project2         = project1;
                                    IProjectItem[] projectItemArray = new IProjectItem[] { codeBehindItem };
                                    project2.RemoveItems(true, projectItemArray);
                                }
                                IProject       project3          = project1;
                                IProjectItem[] projectItemArray1 = new IProjectItem[] { projectItem };
                                project3.RemoveItems(true, projectItemArray1);
                            }
                        }
                        ClipboardService.SetDataObject(new DataObject());
                        this.LastCut = null;
                        return;
                    }
                }
            }
        }
Exemplo n.º 9
0
 public override void Execute()
 {
     this.HandleBasicExceptions(() => {
         string str = base.SelectProject(this.DisplayName);
         if (!string.IsNullOrEmpty(str))
         {
             IProjectStore projectStore = ProjectStoreHelper.CreateProjectStore(DocumentReference.Create(str), base.Services, ProjectStoreHelper.ResilientProjectCreationChain);
             if (projectStore == null)
             {
                 return;
             }
             UpgradeWizard upgradeWizard = new UpgradeWizard(this.Solution() as ISolutionManagement,
                                                             from project in this.Solution().Projects.OfType <ProjectBase>()
                                                             select project.ProjectStore, projectStore, null, base.Services);
             try
             {
                 if (!upgradeWizard.Upgrade())
                 {
                     return;
                 }
             }
             finally
             {
                 projectStore.Dispose();
                 projectStore = null;
             }
             projectStore = ProjectStoreHelper.CreateProjectStore(DocumentReference.Create(str), base.Services, ProjectStoreHelper.DefaultProjectCreationChain);
             if (projectStore == null)
             {
                 return;
             }
             INamedProject namedProject = null;
             try
             {
                 namedProject = this.ProjectManager().AddProject(projectStore);
                 if (namedProject != null)
                 {
                     base.UpdateSourceControl(EnumerableExtensions.AsEnumerable <INamedProject>(namedProject));
                     base.ActivateProjectPane();
                 }
             }
             finally
             {
                 if (namedProject == null && projectStore != null)
                 {
                     projectStore.Dispose();
                     projectStore = null;
                 }
             }
         }
     });
 }
Exemplo n.º 10
0
 public DocumentUpdated(DocumentReference documentReference)
 {
     DocumentReference = documentReference;
 }
Exemplo n.º 11
0
        private void Buybtn_Click(object sender, EventArgs e)
        {
            selectedProduct.amount -= 1;

            database = databaseservice.GetDataBase();

            DocumentReference docRef = database.Collection("products").Document(selectedProduct.ID);

            docRef.Update("amount", selectedProduct.amount);

            //SecondPageActivity loggedinuser = new SecondPageActivity();



            var chars = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890";

            var stringchars = new char[5];

            var rand = new Random();

            for (int i = 0; i < stringchars.Length; i++)
            {
                stringchars[i] = chars[rand.Next(chars.Length)];
            }

            var orderidstring = new String(stringchars);


            HashMap map = new HashMap();

            map.Put("orderid", orderidstring);
            map.Put("buyername", username);
            map.Put("productname", selectedProduct.productname);
            map.Put("productamount", 1);
            map.Put("productprice", 250);
            map.Put("buyerlocation", "Debere Abay St.");
            map.Put("buyerphone", "0944194561");
            //map.Put("profileimage", Profileimg);

            docRef = database.Collection("orders").Document();

            docRef.Set(map);

            var SMSMessenger = CrossMessaging.Current.SmsMessenger;

            if (SMSMessenger.CanSendSmsInBackground)
            {
                SMSMessenger.SendSmsInBackground("251921538060", $"This is from Burnos Clothes.\n\nYour Order number is {orderidstring.ToUpper()}.");
            }
            //if (emailMessenger.CanSendEmail)
            //{
            ////    // Send simple e-mail to single receiver without attachments, bcc, cc etc.
            ////    emailMessenger.SendEmail("*****@*****.**", "Selvaj Clothes Order Successful", $"Well hello there { username}. This is from Selvaj clothes.\nThis is ur Order ID:\n\n{ orderidstring}\n\nUse this id to recieve ur package from our store when ur products arrives");
            ////    //  .Buil");

            ////    // Alternatively use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc.
            //var email = new EmailMessageBuilder().To("*****@*****.**").Subject("Burnos Clothes Order Successful").Body($"Well hello there {username}. This is from Selvaj clothes.\nThis is ur Order ID:\n\n{orderidstring}\n\nUse this id to recieve ur package from our store when ur products arrives").Build();
            ////    //  .Cc("*****@*****.**")
            ////    //  .Bcc(new[] { "*****@*****.**", "*****@*****.**" })
            ////    //
            ////    //

            //    emailMessenger.SendEmail(email);
            //}

            try
            {
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");

                mail.From = new MailAddress("*****@*****.**");
                mail.To.Add("*****@*****.**");
                mail.Subject = "Burnos Clothes Order Successful";
                mail.Body    = $"Well hello there {username}. This is from Selvaj clothes.\nThis is ur Order ID:\n\n{orderidstring}\n\nUse this id to recieve ur package from our store when ur products arrives";

                SmtpServer.Port        = 587;
                SmtpServer.Host        = "smtp.gmail.com";
                SmtpServer.EnableSsl   = true;
                SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "burnos123");

                ServicePointManager.ServerCertificateValidationCallback = delegate(object zsender, X509Certificate certificate, X509Chain chain, System.Net.Security.SslPolicyErrors sslpolicyerrors)
                {
                    return(true);
                };

                SmtpServer.Send(mail);
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.ToString(), ToastLength.Long);
            }


            Console.WriteLine("Buyer name: " + username);
            Console.WriteLine("Buyer name: " + username);
            Console.WriteLine("Buyer name: " + username);
            Console.WriteLine("Buyer name: " + username);
            Console.WriteLine("Buyer name: " + username);
            Console.WriteLine("Buyer name: " + username);
            Console.WriteLine("Buyer name: " + username);
            Console.WriteLine("Buyer name: " + username);
            Console.WriteLine("Buyer name: " + username);
            Console.WriteLine("Buyer name: " + username);



            var trans = SupportFragmentManager.BeginTransaction();
            var buyproductfragment = new BuyFragment();

            buyproductfragment.Show(trans, "buyproduct");
        }
Exemplo n.º 12
0
        public async Task AddData(Dictionary <string, object> paramDict)
        {
            DocumentReference docRef = db.Collection("data").Document();

            await docRef.SetAsync(paramDict);
        }
 public DocumentEntryControl(DocumentReference document, WindowController windowController = null) : this(
         windowController)
 {
     LoadDocument(document);
 }
Exemplo n.º 14
0
        public Monitoring3()
        {
            InitializeComponent();
            {
                //Konfigurasi Pengambilan data dari Database ke Monitoring untuk menampilkan data sensor Chiller dan Freezer
                #region
                string path = AppDomain.CurrentDomain.BaseDirectory + @"percobaanjson-firebase-adminsdk-7qk4t-80ed9d2f19.json";
                Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);
                database = FirestoreDb.Create("percobaanjson");

                async void DocumentCostum()
                {
                    DocumentReference docref = database.Collection("KTAD-1").Document("SensorAndScaleTime");
                    DocumentSnapshot  snap   = await docref.GetSnapshotAsync();

                    if (snap.Exists)
                    {
                        if (snap.Exists)
                        {
                            FirestoreMonitoring_3 firestore = snap.ConvertTo <FirestoreMonitoring_3>();
                            txtchillermonitoring3.Text = firestore.Chiller.ToString() + "°C";
                            txtfreezermonitoring3.Text = firestore.Freezer + "°C";
                        }
                    }
                }

                DocumentCostum();
                #endregion
            }

            //Program pembuatan Grafik
            #region
            graphchart.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Values = new ChartValues <ObservablePoint>
                    {
                        new ObservablePoint(00.01, 14),
                        new ObservablePoint(00.02, 14.2),
                        new ObservablePoint(00.03, 13.8),
                        new ObservablePoint(00.04, 13.5),
                        new ObservablePoint(00.06, 14.2),
                        new ObservablePoint(00.07, 14.5),
                        new ObservablePoint(00.08, 14.8),
                        new ObservablePoint(00.09, 15),
                        new ObservablePoint(00.10, 13),
                    },
                    PointGeometrySize = 15
                },
                new LineSeries
                {
                    Values = new ChartValues <ObservablePoint>
                    {
                        new ObservablePoint(00.01, 3),
                        new ObservablePoint(00.02, 2.5),
                        new ObservablePoint(00.03, 2.8),
                        new ObservablePoint(00.04, 2.3),
                        new ObservablePoint(00.06, 2.5),
                        new ObservablePoint(00.07, 3.2),
                        new ObservablePoint(00.08, 2.8),
                        new ObservablePoint(00.09, 3),
                        new ObservablePoint(00.10, 3.1),
                    },
                    PointGeometrySize = 15
                },
                new LineSeries
                {
                    Values = new ChartValues <ObservablePoint>
                    {
                        new ObservablePoint(00.01, 6),
                        new ObservablePoint(00.02, 5),
                        new ObservablePoint(00.03, 6.5),
                        new ObservablePoint(00.04, 5.5),
                        new ObservablePoint(00.06, 6),
                        new ObservablePoint(00.07, 6.3),
                        new ObservablePoint(00.08, 6.8),
                        new ObservablePoint(00.09, 7),
                        new ObservablePoint(00.10, 5.8),
                    },
                    PointGeometrySize = 15
                }
            };
            #endregion
        }
Exemplo n.º 15
0
        public bool TryAddUrl(Document document)
        {
            similarity.LoadShingles(document, document.HTML);

            bool known = false;

            foreach (var s in sites)
            {
                double simi = similarity.CalculateSimilarity(s, document);
                if (simi >= 0.9)
                {
                    known = true;
                    break;
                }
            }

            if (!known)
            {
                sites.Add(document);

                foreach (var term in stemmer.GetAllStems(document.HTML))
                {
                    DocumentReference reference = new DocumentReference(document, term.Item2);
                    if (stems.ContainsKey(term.Item1))
                    {
                        var list = stems[term.Item1];
                        int index = list.BinarySearch(reference.Document.Id, (x, y) => x.CompareTo(y), doc => doc.Document.Id);

                        if (index > 0)
                            throw new NotImplementedException("Index is not yet capable of handling count updates for documents.");
                        else
                            list.Insert(~index, reference);
                    }
                    else
                    {
                        List<DocumentReference> l = new List<DocumentReference>();
                        l.Add(reference);
                        stems.Add(term.Item1, l);
                    }
                }
            }

            return !known;
        }
Exemplo n.º 16
0
        public async Task <HttpResponseMessage> EditBooking(MT_Patient_Booking PMD)
        {
            Db = con.SurgeryCenterDb(PMD.Slug);
            BookingResponse Response = new BookingResponse();

            try
            {
                MT_Patient_Booking booking = new MT_Patient_Booking();
                Query         Qty          = Db.Collection("MT_Patient_Booking").WhereEqualTo("PB_Unique_ID", PMD.PB_Unique_ID);
                QuerySnapshot ObjBooking   = await Qty.GetSnapshotAsync();

                if (ObjBooking != null)
                {
                    booking = ObjBooking.Documents[0].ConvertTo <MT_Patient_Booking>();
                    Dictionary <string, object> initialData = new Dictionary <string, object>
                    {
                        { "PB_Patient_Name", PMD.PB_Patient_Name },
                        { "PB_Patient_Last_Name", PMD.PB_Patient_Last_Name },
                        { "PB_Booking_Date", con.ConvertTimeZone(PMD.PB_TimeZone, Convert.ToDateTime(PMD.PB_Booking_Date)) },
                        { "PB_Booking_Surgery_Center_ID", PMD.PB_Booking_Surgery_Center_ID },
                        { "PB_Booking_Surgery_Center_Name", PMD.PB_Booking_Surgery_Center_Name },
                        { "PB_Booking_Time", PMD.PB_Booking_Time },
                        { "PB_Booking_Duration", PMD.PB_Booking_Duration },
                        { "PB_Alerts", PMD.PB_Alerts },
                        { "PB_Notes", PMD.PB_Notes },
                        { "PB_Status", PMD.PB_Status },
                        { "PB_Modify_Date", con.ConvertTimeZone(PMD.PB_TimeZone, Convert.ToDateTime(PMD.PB_Modify_Date)) },
                        { "PB_TimeZone", PMD.PB_TimeZone },
                    };

                    if (PMD.PB_Incient_Detail != null)
                    {
                        Dictionary <string, object> Incient_Detail;
                        if (booking.PB_Incient_Detail != null)
                        {
                            Incient_Detail = new Dictionary <string, object>
                            {
                                { "Inci_Type_ID", PMD.PB_Incient_Detail.Inci_Type_ID },
                                { "Inci_Type", PMD.PB_Incient_Detail.Inci_Type },
                                { "Inci_Claim_No", PMD.PB_Incient_Detail.Inci_Claim_No },
                                { "Inci_DOI", con.ConvertTimeZone(PMD.PB_Incient_Detail.Inci_TimeZone, Convert.ToDateTime(PMD.PB_Incient_Detail.Inci_DOI)) },
                                { "Inci_Employee_Name", PMD.PB_Incient_Detail.Inci_Employee_Name },
                                { "Inci_Employee_Address", PMD.PB_Incient_Detail.Inci_Employee_Address },
                                { "Inci_Employee_Phone_No", PMD.PB_Incient_Detail.Inci_Employee_Phone_No },
                                { "Inci_Is_This_Lien", PMD.PB_Incient_Detail.Inci_Is_This_Lien },
                                { "Inci_Attorney_Name", PMD.PB_Incient_Detail.Inci_Attorney_Name },
                                { "Inci_Attorney_Phone_No", PMD.PB_Incient_Detail.Inci_Attorney_Phone_No },
                                { "Inci_TimeOfIncident", PMD.PB_Incient_Detail.Inci_TimeOfIncident },
                                { "Inci_Comment", PMD.PB_Incient_Detail.Inci_Comment },
                                { "Inci_Modify_Date", con.ConvertTimeZone(PMD.PB_Incient_Detail.Inci_TimeZone, Convert.ToDateTime(PMD.PB_Incient_Detail.Inci_Modify_Date)) },
                                { "Inci_TimeZone", PMD.PB_Incient_Detail.Inci_TimeZone }
                            };
                        }
                        else
                        {
                            Incient_Detail = new Dictionary <string, object>
                            {
                                { "Inci_Unique_ID", con.GetUniqueKey() },
                                { "Inci_Type_ID", PMD.PB_Incient_Detail.Inci_Type_ID },
                                { "Inci_Type", PMD.PB_Incient_Detail.Inci_Type },
                                { "Inci_Claim_No", PMD.PB_Incient_Detail.Inci_Claim_No },
                                { "Inci_DOI", con.ConvertTimeZone(PMD.PB_Incient_Detail.Inci_TimeZone, Convert.ToDateTime(PMD.PB_Incient_Detail.Inci_DOI)) },
                                { "Inci_Employee_Name", PMD.PB_Incient_Detail.Inci_Employee_Name },
                                { "Inci_Employee_Address", PMD.PB_Incient_Detail.Inci_Employee_Address },
                                { "Inci_Employee_Phone_No", PMD.PB_Incient_Detail.Inci_Employee_Phone_No },
                                { "Inci_Is_This_Lien", PMD.PB_Incient_Detail.Inci_Is_This_Lien },
                                { "Inci_Attorney_Name", PMD.PB_Incient_Detail.Inci_Attorney_Name },
                                { "Inci_Attorney_Phone_No", PMD.PB_Incient_Detail.Inci_Attorney_Phone_No },
                                { "Inci_TimeOfIncident", PMD.PB_Incient_Detail.Inci_TimeOfIncident },
                                { "Inci_Comment", PMD.PB_Incient_Detail.Inci_Comment },
                                { "Inci_Created_By", PMD.PB_Incient_Detail.Inci_Created_By },
                                { "Inci_User_Name", PMD.PB_Incient_Detail.Inci_User_Name },
                                { "Inci_Create_Date", con.ConvertTimeZone(PMD.PB_Incient_Detail.Inci_TimeZone, Convert.ToDateTime(PMD.PB_Incient_Detail.Inci_Create_Date)) },
                                { "Inci_Modify_Date", con.ConvertTimeZone(PMD.PB_Incient_Detail.Inci_TimeZone, Convert.ToDateTime(PMD.PB_Incient_Detail.Inci_Modify_Date)) },
                                { "Inci_Is_Active", PMD.PB_Incient_Detail.Inci_Is_Active },
                                { "Inci_Is_Deleted", PMD.PB_Incient_Detail.Inci_Is_Deleted },
                                { "Inci_TimeZone", PMD.PB_Incient_Detail.Inci_TimeZone },
                            };
                        }

                        initialData.Add("PB_Incient_Detail", Incient_Detail);
                    }

                    if (PMD.PB_Surgical_Procedure_Information != null)
                    {
                        Dictionary <string, object> Surgical_Procedure_Information;
                        if (booking.PB_Surgical_Procedure_Information != null)
                        {
                            Surgical_Procedure_Information = new Dictionary <string, object>
                            {
                                { "SPI_Surgery_Center_ID", PMD.PB_Surgical_Procedure_Information.SPI_Surgery_Center_ID },
                                { "SPI_Surgery_Center_Name", PMD.PB_Surgical_Procedure_Information.SPI_Surgery_Center_Name },
                                { "SPI_Surgeon_ID", PMD.PB_Surgical_Procedure_Information.SPI_Surgeon_ID },
                                { "SPI_Surgeon_Name", PMD.PB_Surgical_Procedure_Information.SPI_Surgeon_Name },
                                { "SPI_Assi_Surgeon_ID", PMD.PB_Surgical_Procedure_Information.SPI_Assi_Surgeon_ID },
                                { "SPI_Assi_Surgeon_Name", PMD.PB_Surgical_Procedure_Information.SPI_Assi_Surgeon_Name },
                                { "SPI_Date", con.ConvertTimeZone(PMD.PB_Surgical_Procedure_Information.SPI_TimeZone, Convert.ToDateTime(PMD.PB_Surgical_Procedure_Information.SPI_Date), 1) },
                                { "SPI_Time", PMD.PB_Surgical_Procedure_Information.SPI_Time },
                                { "SPI_Duration", PMD.PB_Surgical_Procedure_Information.SPI_Duration },
                                { "SPI_Anesthesia_Type_ID", PMD.PB_Surgical_Procedure_Information.SPI_Anesthesia_Type_ID },
                                { "SPI_Anesthesia_Type", PMD.PB_Surgical_Procedure_Information.SPI_Anesthesia_Type },
                                { "SPI_Block_ID", PMD.PB_Surgical_Procedure_Information.SPI_Block_ID },
                                { "SPI_Block_Type", PMD.PB_Surgical_Procedure_Information.SPI_Block_Type },
                                { "SPI_Procedure_SelectedList", PMD.PB_Surgical_Procedure_Information.SPI_Procedure_SelectedList },
                                { "SPI_CPT_SelectedList", PMD.PB_Surgical_Procedure_Information.SPI_CPT_SelectedList },
                                { "SPI_ICD_SelectedList", PMD.PB_Surgical_Procedure_Information.SPI_ICD_SelectedList },
                                { "SPI_Modify_Date", con.ConvertTimeZone(PMD.PB_Surgical_Procedure_Information.SPI_TimeZone, Convert.ToDateTime(PMD.PB_Surgical_Procedure_Information.SPI_Modify_Date)) },
                                { "SPI_TimeZone", PMD.PB_Surgical_Procedure_Information.SPI_TimeZone }
                            };
                        }
                        else
                        {
                            Surgical_Procedure_Information = new Dictionary <string, object>
                            {
                                { "SPI_Unique_ID", con.GetUniqueKey() },
                                { "SPI_Surgery_Center_ID", PMD.PB_Surgical_Procedure_Information.SPI_Surgery_Center_ID },
                                { "SPI_Surgery_Center_Name", PMD.PB_Surgical_Procedure_Information.SPI_Surgery_Center_Name },
                                { "SPI_Surgeon_ID", PMD.PB_Surgical_Procedure_Information.SPI_Surgeon_ID },
                                { "SPI_Surgeon_Name", PMD.PB_Surgical_Procedure_Information.SPI_Surgeon_Name },
                                { "SPI_Assi_Surgeon_ID", PMD.PB_Surgical_Procedure_Information.SPI_Assi_Surgeon_ID },
                                { "SPI_Assi_Surgeon_Name", PMD.PB_Surgical_Procedure_Information.SPI_Assi_Surgeon_Name },
                                { "SPI_Date", con.ConvertTimeZone(PMD.PB_Surgical_Procedure_Information.SPI_TimeZone, Convert.ToDateTime(PMD.PB_Surgical_Procedure_Information.SPI_Date)) },
                                { "SPI_Time", PMD.PB_Surgical_Procedure_Information.SPI_Time },
                                { "SPI_Duration", PMD.PB_Surgical_Procedure_Information.SPI_Duration },
                                { "SPI_Anesthesia_Type_ID", PMD.PB_Surgical_Procedure_Information.SPI_Anesthesia_Type_ID },
                                { "SPI_Anesthesia_Type", PMD.PB_Surgical_Procedure_Information.SPI_Anesthesia_Type },
                                { "SPI_Block_ID", PMD.PB_Surgical_Procedure_Information.SPI_Block_ID },
                                { "SPI_Block_Type", PMD.PB_Surgical_Procedure_Information.SPI_Block_Type },
                                { "SPI_Procedure_SelectedList", PMD.PB_Surgical_Procedure_Information.SPI_Procedure_SelectedList },
                                { "SPI_CPT_SelectedList", PMD.PB_Surgical_Procedure_Information.SPI_CPT_SelectedList },
                                { "SPI_ICD_SelectedList", PMD.PB_Surgical_Procedure_Information.SPI_ICD_SelectedList },
                                { "SPI_Created_By", PMD.PB_Surgical_Procedure_Information.SPI_Created_By },
                                { "SPI_User_Name", PMD.PB_Surgical_Procedure_Information.SPI_User_Name },
                                { "SPI_Create_Date", con.ConvertTimeZone(PMD.PB_Surgical_Procedure_Information.SPI_TimeZone, Convert.ToDateTime(PMD.PB_Surgical_Procedure_Information.SPI_Create_Date)) },
                                { "SPI_Modify_Date", con.ConvertTimeZone(PMD.PB_Surgical_Procedure_Information.SPI_TimeZone, Convert.ToDateTime(PMD.PB_Surgical_Procedure_Information.SPI_Modify_Date)) },
                                { "SPI_Is_Active", PMD.PB_Surgical_Procedure_Information.SPI_Is_Active },
                                { "SPI_Is_Deleted", PMD.PB_Surgical_Procedure_Information.SPI_Is_Deleted },
                                { "SPI_TimeZone", PMD.PB_Surgical_Procedure_Information.SPI_TimeZone },
                            };
                        }

                        initialData.Add("PB_Surgical_Procedure_Information", Surgical_Procedure_Information);
                    }

                    if (PMD.PB_Preoprative_Medical_Clearance != null)
                    {
                        Dictionary <string, object> Preoprative_Medical_Clearance;
                        if (booking.PB_Preoprative_Medical_Clearance != null)
                        {
                            Preoprative_Medical_Clearance = new Dictionary <string, object>
                            {
                                { "PMC_Is_Require_Pre_Op_Medi_Clearance", PMD.PB_Preoprative_Medical_Clearance.PMC_Is_Require_Pre_Op_Medi_Clearance },
                                { "PMC_Clearing_Physician_Name", PMD.PB_Preoprative_Medical_Clearance.PMC_Clearing_Physician_Name },
                                { "PMC_Is_Require_EKG", PMD.PB_Preoprative_Medical_Clearance.PMC_Is_Require_EKG },
                                { "PMC_Modify_Date", con.ConvertTimeZone(PMD.PB_Preoprative_Medical_Clearance.PMC_TimeZone, Convert.ToDateTime(PMD.PB_Preoprative_Medical_Clearance.PMC_Modify_Date)) },
                                { "PMC_TimeZone", PMD.PB_Preoprative_Medical_Clearance.PMC_TimeZone }
                            };
                        }
                        else
                        {
                            Preoprative_Medical_Clearance = new Dictionary <string, object>
                            {
                                { "PMC_Unique_ID", con.GetUniqueKey() },
                                { "PMC_Is_Require_Pre_Op_Medi_Clearance", PMD.PB_Preoprative_Medical_Clearance.PMC_Is_Require_Pre_Op_Medi_Clearance },
                                { "PMC_Clearing_Physician_Name", PMD.PB_Preoprative_Medical_Clearance.PMC_Clearing_Physician_Name },
                                { "PMC_Is_Require_EKG", PMD.PB_Preoprative_Medical_Clearance.PMC_Is_Require_EKG },
                                { "PMC_Created_By", PMD.PB_Preoprative_Medical_Clearance.PMC_Created_By },
                                { "PMC_User_Name", PMD.PB_Preoprative_Medical_Clearance.PMC_User_Name },
                                { "PMC_Create_Date", con.ConvertTimeZone(PMD.PB_Preoprative_Medical_Clearance.PMC_TimeZone, Convert.ToDateTime(PMD.PB_Preoprative_Medical_Clearance.PMC_Create_Date)) },
                                { "PMC_Modify_Date", con.ConvertTimeZone(PMD.PB_Preoprative_Medical_Clearance.PMC_TimeZone, Convert.ToDateTime(PMD.PB_Preoprative_Medical_Clearance.PMC_Modify_Date)) },
                                { "PMC_Is_Active", PMD.PB_Preoprative_Medical_Clearance.PMC_Is_Active },
                                { "PMC_Is_Deleted", PMD.PB_Preoprative_Medical_Clearance.PMC_Is_Deleted },
                                { "PMC_TimeZone", PMD.PB_Preoprative_Medical_Clearance.PMC_TimeZone },
                            };
                        }

                        initialData.Add("PB_Preoprative_Medical_Clearance", Preoprative_Medical_Clearance);
                    }

                    if (PMD.PB_Special_Request != null)
                    {
                        Dictionary <string, object> Special_Request;
                        if (booking.PB_Special_Request != null)
                        {
                            Special_Request = new Dictionary <string, object>
                            {
                                { "SR_Is_Special_Equip_Req", PMD.PB_Special_Request.SR_Is_Special_Equip_Req },
                                { "SR_Equip_ID", PMD.PB_Special_Request.SR_Equip_ID },
                                { "SR_Equip_Name", PMD.PB_Special_Request.SR_Equip_Name },
                                { "SR_Supplies_ID", PMD.PB_Special_Request.SR_Supplies_ID },
                                { "SR_Supplies_Name", PMD.PB_Special_Request.SR_Supplies_Name },
                                { "SR_Instrumentation_ID", PMD.PB_Special_Request.SR_Instrumentation_ID },
                                { "SR_Instrumentation_Name", PMD.PB_Special_Request.SR_Instrumentation_Name },
                                { "SR_Other", PMD.PB_Special_Request.SR_Other },
                                { "SR_Modify_Date", con.ConvertTimeZone(PMD.PB_Special_Request.SR_TimeZone, Convert.ToDateTime(PMD.PB_Special_Request.SR_Modify_Date)) },
                                { "SR_TimeZone", PMD.PB_Special_Request.SR_TimeZone }
                            };
                        }
                        else
                        {
                            Special_Request = new Dictionary <string, object>
                            {
                                { "SR_Unique_ID", con.GetUniqueKey() },
                                { "SR_Is_Special_Equip_Req", PMD.PB_Special_Request.SR_Is_Special_Equip_Req },
                                { "SR_Equip_ID", PMD.PB_Special_Request.SR_Equip_ID },
                                { "SR_Equip_Name", PMD.PB_Special_Request.SR_Equip_Name },
                                { "SR_Supplies_ID", PMD.PB_Special_Request.SR_Supplies_ID },
                                { "SR_Supplies_Name", PMD.PB_Special_Request.SR_Supplies_Name },
                                { "SR_Instrumentation_ID", PMD.PB_Special_Request.SR_Instrumentation_ID },
                                { "SR_Instrumentation_Name", PMD.PB_Special_Request.SR_Instrumentation_Name },
                                { "SR_Other", PMD.PB_Special_Request.SR_Other },
                                { "SR_Created_By", PMD.PB_Special_Request.SR_Created_By },
                                { "SR_User_Name", PMD.PB_Special_Request.SR_User_Name },
                                { "SR_Create_Date", con.ConvertTimeZone(PMD.PB_Special_Request.SR_TimeZone, Convert.ToDateTime(PMD.PB_Special_Request.SR_Create_Date)) },
                                { "SR_Modify_Date", con.ConvertTimeZone(PMD.PB_Special_Request.SR_TimeZone, Convert.ToDateTime(PMD.PB_Special_Request.SR_Modify_Date)) },
                                { "SR_Is_Active", PMD.PB_Special_Request.SR_Is_Active },
                                { "SR_Is_Deleted", PMD.PB_Special_Request.SR_Is_Deleted },
                                { "SR_TimeZone", PMD.PB_Special_Request.SR_TimeZone },
                            };
                        }

                        initialData.Add("PB_Special_Request", Special_Request);
                    }

                    if (PMD.PB_Insurance_Precertification_Authorization != null)
                    {
                        Dictionary <string, object> Insurance_Precertification_Authorization;
                        if (booking.PB_Insurance_Precertification_Authorization != null)
                        {
                            Insurance_Precertification_Authorization = new Dictionary <string, object>
                            {
                                { "IPA_Insurace_Company_Phone_No", PMD.PB_Insurance_Precertification_Authorization.IPA_Insurace_Company_Phone_No },
                                { "IPA_Insurace_Company_Representative", PMD.PB_Insurance_Precertification_Authorization.IPA_Insurace_Company_Representative },
                                { "IPA_Authorization_Name", PMD.PB_Insurance_Precertification_Authorization.IPA_Authorization_Name },
                                { "IPA_DOA", con.ConvertTimeZone(PMD.PB_Insurance_Precertification_Authorization.IPA_TimeZone, Convert.ToDateTime(PMD.PB_Insurance_Precertification_Authorization.IPA_DOA)) },
                                { "IPA_Modify_Date", con.ConvertTimeZone(PMD.PB_Insurance_Precertification_Authorization.IPA_TimeZone, Convert.ToDateTime(PMD.PB_Insurance_Precertification_Authorization.IPA_Modify_Date)) },
                                { "IPA_TimeZone", PMD.PB_Insurance_Precertification_Authorization.IPA_TimeZone }
                            };
                        }
                        else
                        {
                            Insurance_Precertification_Authorization = new Dictionary <string, object>
                            {
                                { "IPA_Unique_ID", con.GetUniqueKey() },
                                { "IPA_Insurace_Company_Phone_No", PMD.PB_Insurance_Precertification_Authorization.IPA_Insurace_Company_Phone_No },
                                { "IPA_Insurace_Company_Representative", PMD.PB_Insurance_Precertification_Authorization.IPA_Insurace_Company_Representative },
                                { "IPA_Authorization_Name", PMD.PB_Insurance_Precertification_Authorization.IPA_Authorization_Name },
                                { "IPA_DOA", con.ConvertTimeZone(PMD.PB_Insurance_Precertification_Authorization.IPA_TimeZone, Convert.ToDateTime(PMD.PB_Insurance_Precertification_Authorization.IPA_DOA)) },
                                { "IPA_Created_By", PMD.PB_Insurance_Precertification_Authorization.IPA_Created_By },
                                { "IPA_User_Name", PMD.PB_Insurance_Precertification_Authorization.IPA_User_Name },
                                { "IPA_Create_Date", con.ConvertTimeZone(PMD.PB_Insurance_Precertification_Authorization.IPA_TimeZone, Convert.ToDateTime(PMD.PB_Insurance_Precertification_Authorization.IPA_Create_Date)) },
                                { "IPA_Modify_Date", con.ConvertTimeZone(PMD.PB_Insurance_Precertification_Authorization.IPA_TimeZone, Convert.ToDateTime(PMD.PB_Insurance_Precertification_Authorization.IPA_Modify_Date)) },
                                { "IPA_Is_Active", PMD.PB_Insurance_Precertification_Authorization.IPA_Is_Active },
                                { "IPA_Is_Deleted", PMD.PB_Insurance_Precertification_Authorization.IPA_Is_Deleted },
                                { "IPA_TimeZone", PMD.PB_Insurance_Precertification_Authorization.IPA_TimeZone },
                            };
                        }

                        initialData.Add("PB_Insurance_Precertification_Authorization", Insurance_Precertification_Authorization);
                    }
                    //Main section
                    DocumentReference docRef = Db.Collection("MT_Patient_Booking").Document(PMD.PB_Unique_ID);
                    WriteResult       Result = await docRef.UpdateAsync(initialData);

                    if (Result != null)
                    {
                        Response.Status  = con.StatusSuccess;
                        Response.Message = con.MessageSuccess;
                        Response.Data    = PMD;
                    }
                    else
                    {
                        Response.Status  = con.StatusNotInsert;
                        Response.Message = con.MessageNotInsert;
                        Response.Data    = null;
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Status  = con.StatusFailed;
                Response.Message = con.MessageFailed + ", Exception : " + ex.Message;
            }
            return(ConvertToJSON(Response));
        }
Exemplo n.º 17
0
        private void UpdateToolkitXmlNamespace()
        {
            string str;

            if (string.Compare(Path.GetExtension(this.currentXamlPath), ".xaml", StringComparison.OrdinalIgnoreCase) != 0)
            {
                return;
            }
            if (!this.ContainsWpfToolkitNamespace(this.currentXamlPath, out str))
            {
                return;
            }
            string str1 = File.ReadAllText(this.currentXamlPath, Encoding.UTF8);
            string str2 = this.ReplaceWpfToolkitNamespace(str1, str);

            if (str2 != null)
            {
                try
                {
                    if (this.context == null || ProjectPathHelper.AttemptToMakeWritable(DocumentReference.Create(this.currentXamlPath), this.context))
                    {
                        File.WriteAllText(this.currentXamlPath, str2, Encoding.UTF8);
                        ProjectLog.LogSuccess(this.currentXamlPath, StringTable.SaveAction, new object[0]);
                    }
                }
                catch (Exception exception1)
                {
                    Exception exception = exception1;
                    ProjectLog.LogError(this.currentXamlPath, exception, StringTable.SaveAction, new object[0]);
                }
            }
        }
Exemplo n.º 18
0
        public Task <Maybe <DocumentReference> > OpenEditDocument(DocumentReference document)
        {
            var result = _applicationInteraction.OpenEditDocument(document);

            return(Task.FromResult(Maybe <DocumentReference> .From(result ? document: null)));
        }
Exemplo n.º 19
0
 private static IEnumerable <DocumentReference> ToEnumerable(DocumentReference selectedDocument)
 {
     return(selectedDocument != null ? new[] { selectedDocument } : null);
 }
 /// <summary>
 /// This extension method transforms from a FHIR DocumentReference to a HealthVault Thing type
 /// </summary>
 /// <typeparam name="T">The HealthVault thing type to use for the transformation</typeparam>
 /// <param name="documentReference">The DocumentReference source</param>
 /// <returns>The HealthVault thing</returns>
 public static T ToHealthVault <T>(this DocumentReference documentReference) where T : ThingBase
 {
     return(documentReference.ToHealthVault(typeof(T)) as T);
 }
Exemplo n.º 21
0
        private async void simulateData()
        {
            CollectionReference orderColl   = db.Collection("order");
            CollectionReference invoiceColl = db.Collection("invoice");
            CollectionReference stockColl   = db.Collection("stock");

            QuerySnapshot stockSnap = await stockColl.GetSnapshotAsync();

            List <Stock> stockList = new List <Stock>();

            foreach (DocumentSnapshot stockDocsnap in stockSnap.Documents)
            {
                Stock stock = stockDocsnap.ConvertTo <Stock>();

                stockList.Add(stock);
            }

            Order order = new Order();

            order.order_id     = "";
            order.order_status = "";
            Invoice invoice = new Invoice();

            invoice.invoice_id  = -1;
            invoice.invoice_num = "dummyinvoicenumber";

            Random random = new Random();

            for (int year = 2020; year <= 2020; year++)
            {
                if (year == 2019)
                {
                    for (int month = 1; month <= 12; month++)
                    {
                        //simulate new invoices at start of every month
                        foreach (Stock stock in stockList)
                        {
                            Dictionary <string, object> data = new Dictionary <string, object>()
                            {
                                { "invoice_date", new DateTime(year, month, 1, 0, 0, 0, DateTimeKind.Utc) },
                                { "invoice_id", invoice.invoice_id },
                                { "invoice_num", invoice.invoice_num },
                                { "vendor_id", stock.vendor_id }
                            };

                            DocumentReference invoiceDocref = await invoiceColl.AddAsync(data);

                            Dictionary <string, object> data2 = new Dictionary <string, object>()
                            {
                                { "item_id", stock.item_id },
                                { "item_name", stock.item_name },
                                { "quantity", 100 },
                                { "wholesale_price", stock.wholesale_price }
                            };

                            await invoiceDocref.Collection("invoice_items").AddAsync(data2);
                        }

                        //simulate sales order everyday
                        for (int day = 1; day <= DateTime.DaysInMonth(year, month); day++)
                        {
                            //loop through stock
                            for (int i = 0; i < 10; i++)
                            {
                                int orderRand = random.Next(0, 10);
                                //if 0 means the item has no sales, else sell according to the number for quantity
                                if (orderRand > 0)
                                {
                                    Dictionary <string, object> data = new Dictionary <string, object>()
                                    {
                                        { "order_date", new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Utc) },
                                        { "order_id", "dummyorderid" },
                                        { "order_status", "dummy" },
                                    };

                                    DocumentReference orderDocref = await orderColl.AddAsync(data);

                                    Dictionary <string, object> data2 = new Dictionary <string, object>()
                                    {
                                        { "item_id", stockList[i].item_id },
                                        { "quantity", orderRand },
                                    };

                                    await orderDocref.Collection("order_items").AddAsync(data2);
                                }
                            }
                        }
                    }
                }
                else
                {
                    for (int month = 12; month <= 12; month++)
                    {
                        foreach (Stock stock in stockList)
                        {
                            Dictionary <string, object> data = new Dictionary <string, object>()
                            {
                                { "invoice_date", new DateTime(year, month, 1, 0, 0, 0, DateTimeKind.Utc) },
                                { "invoice_id", invoice.invoice_id },
                                { "invoice_num", invoice.invoice_num },
                                { "vendor_id", stock.vendor_id }
                            };

                            DocumentReference invoiceDocref = await invoiceColl.AddAsync(data);

                            Dictionary <string, object> data2 = new Dictionary <string, object>()
                            {
                                { "item_id", stock.item_id },
                                { "item_name", stock.item_name },
                                { "quantity", 100 },
                                { "wholesale_price", stock.wholesale_price }
                            };

                            await invoiceDocref.Collection("invoice_items").AddAsync(data2);
                        }

                        for (int day = 1; day <= DateTime.DaysInMonth(year, month); day++)
                        {
                            //loop through stock
                            for (int i = 0; i < 3; i++)
                            {
                                int orderRand = random.Next(0, 10);
                                //if 0 means the item has no sales, else sell according to the number for quantity
                                if (orderRand > 0)
                                {
                                    Dictionary <string, object> data = new Dictionary <string, object>()
                                    {
                                        { "order_date", new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Utc) },
                                        { "order_id", "dummyorderid" },
                                        { "order_status", "dummy" },
                                    };

                                    DocumentReference orderDocref = await orderColl.AddAsync(data);

                                    Dictionary <string, object> data2 = new Dictionary <string, object>()
                                    {
                                        { "item_id", stockList[i].item_id },
                                        { "quantity", orderRand },
                                    };

                                    await orderDocref.Collection("order_items").AddAsync(data2);
                                }
                            }
                        }
                    }
                }
            }
        }
 /// <summary>
 /// This extension method transforms from a FHIR DocumentReference to a HealthVault Thing type
 /// </summary>
 /// <param name="documentReference">The DocumentReference source</param>
 /// <returns>The HealthVault thing</returns>
 public static ThingBase ToHealthVault(this DocumentReference documentReference)
 {
     return(documentReference.ToHealthVault(CodeToHealthVaultHelper.DetectHealthVaultTypeFromDocumentReference(documentReference)));
 }
        public async Task <bool> sendOTP(string email, string userName, bool isForgetPassword)
        {
            try
            {
                //Connec to the Firestore Database
                Boolean connectionResult = connectToFirebase();
                //Create the instance to the document refernce and get to the path of the user document
                DocumentReference docRef1 = db.Collection("UserKeys").Document(email);
                //Snapshot for the same document
                DocumentSnapshot docSnap1 = await docRef1.GetSnapshotAsync();

                //Get the User Secret Keys
                DBUserKeys DBuserKeyObj = docSnap1.ConvertTo <DBUserKeys>();

                //var bytes= Base32Encoding.ToBytes(DBuserKeyObj.userKey);
                var bytes = Encoding.ASCII.GetBytes(DBuserKeyObj.userKey);
                //Creating otp
                var TotpObj = new Totp(bytes, step: 120);
                otpString          = TotpObj.ComputeTotp();
                otp_generated_time = System.DateTime.Now;
                //sending otp using email
                string      emailAddress = System.Configuration.ConfigurationManager.AppSettings["SecureDeskEmailAddress"];
                MailMessage mailMessage  = new MailMessage(emailAddress, email);


                //Get the connection string from the azure
                string connection_String = System.Configuration.ConfigurationManager.AppSettings["SecureDeskConnectionStringBlob"];

                //get the reference to the Blob Container of the secure Desk
                BlobContainerClient container = new BlobContainerClient(connection_String, "mysecuredeskcontainer");

                if (!isForgetPassword)
                {
                    mailMessage.Subject = "OTP for Secure Desk";
                    //mailMessage.Body = "Otp code is : " + otpString;

                    //get the refernence to the BlobClient to retrieve the file from the azure blob
                    BlobClient blobClient = container.GetBlobClient("SecureDeskEmailFormat.html");
                    //download the file
                    var response = await blobClient.DownloadAsync();

                    string htmlBody = "";

                    //read all the content from the file
                    using (var streamReader = new StreamReader(response.Value.Content))
                    {
                        while (!streamReader.EndOfStream)
                        {
                            htmlBody += await streamReader.ReadLineAsync();
                        }
                    }

                    htmlBody = htmlBody.Replace("#userName#", userName);
                    htmlBody = htmlBody.Replace("#otpNumber#", otpString);
                    mailMessage.IsBodyHtml = true;
                    mailMessage.Body       = htmlBody;
                    //Create the smtp Client and send the email to the user
                    SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
                    smtpClient.Credentials = new System.Net.NetworkCredential()
                    {
                        //Get the network credntials from the Azure Configuration
                        UserName = System.Configuration.ConfigurationManager.AppSettings["SecureDeskEmailAddress"],
                        Password = System.Configuration.ConfigurationManager.AppSettings["SecureDeskEmailPassword"]
                    };
                    //Enabling the SSL level of security of the email
                    smtpClient.EnableSsl = true;
                    //send the Email to the user
                    smtpClient.Send(mailMessage);
                }
                else
                {
                    mailMessage.Subject = "Reset Your Password For Secure Desk Account";
                    //mailMessage.Body = "Otp code is : " + otpString;

                    //get the refernence to the BlobClient to retrieve the file from the azure blob
                    BlobClient blobClient = container.GetBlobClient("ForgetPasswordSecureDeskEmail.html");
                    //download the file
                    var response = await blobClient.DownloadAsync();

                    string htmlBody = "";

                    //read all the content from the file
                    using (var streamReader = new StreamReader(response.Value.Content))
                    {
                        while (!streamReader.EndOfStream)
                        {
                            htmlBody += await streamReader.ReadLineAsync();
                        }
                    }

                    htmlBody = htmlBody.Replace("#userName#", userName);
                    htmlBody = htmlBody.Replace("#otpNumber#", otpString);
                    mailMessage.IsBodyHtml = true;
                    mailMessage.Body       = htmlBody;
                    //Create the smtp Client and send the email to the user
                    SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
                    smtpClient.Credentials = new System.Net.NetworkCredential()
                    {
                        //Get the network credntials from the Azure Configuration
                        UserName = System.Configuration.ConfigurationManager.AppSettings["SecureDeskEmailAddress"],
                        Password = System.Configuration.ConfigurationManager.AppSettings["SecureDeskEmailPassword"]
                    };
                    //Enabling the SSL level of security of the email
                    smtpClient.EnableSsl = true;
                    //send the Email to the user
                    smtpClient.Send(mailMessage);
                }

                return(true);
            }
            catch (Exception ex)
            {
                //catch and throw the exception
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 24
0
        // GET: Image
        public async Task <ActionResult> Index(string id, string patient)
        {
            ImageModel _objuserloginmodel = new ImageModel();

            ViewBag.SelectedId            = 0;
            TempData["SelectedId"]        = 0;
            TempData["appointmentAutoId"] = id;
            TempData["patientAutoId"]     = patient;

            List <ImageViewModel> ImageList = new List <ImageViewModel>();
            //string ClinicMobileNumber = GlobalSessionVariables.ClinicMobileNumber;
            //string ClinicMobileNumber = "9811035028";

            string Path = AppDomain.CurrentDomain.BaseDirectory + @"greenpaperdev-firebase-adminsdk-8k2y5-fb46e63414.json";

            Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", Path);
            FirestoreDb db = FirestoreDb.Create("greenpaperdev");
            int         i  = 1;


            Query QrefPrescriptions = db.Collection("clinics").Document(GlobalSessionVariables.ClinicDocumentAutoId).Collection("patientList").Document(patient).Collection("prescriptions").OrderByDescending("timeStamp");


            QuerySnapshot snapPres = await QrefPrescriptions.GetSnapshotAsync();

            if (snapPres.Count > 0)
            {
                foreach (DocumentSnapshot docsnapPres in snapPres)
                {
                    if (docsnapPres.Exists)
                    {
                        ImageViewModel img = new ImageViewModel();
                        img.Id       = i;
                        img.ImageUrl = "data:image/png;base64," + docsnapPres.GetValue <string>("file");
                        ImageList.Add(img);
                        i++;
                    }
                }
                _objuserloginmodel.SelectedImage = ImageList[0];
            }

            //_objuserloginmodel.SelectedImage = _objuserloginmodel.GetList()[0];
            TempData["CurrentSelectedId"]  = snapPres.Count;
            TempData["TotalPrescriptions"] = snapPres.Count;
            decimal totalprice = 0;

            List <Medicine> medicineList  = new List <Medicine>();
            Query           QrefMedicines = db.Collection("clinics").Document(GlobalSessionVariables.ClinicDocumentAutoId).Collection("appointments").Document(id).Collection("medicines");
            QuerySnapshot   snapMedicines = await QrefMedicines.GetSnapshotAsync();

            if (snapMedicines.Count > 0)
            {
                foreach (DocumentSnapshot docsnapMedicines in snapMedicines)
                {
                    if (docsnapMedicines.Exists)
                    {
                        Medicine med = new Medicine();
                        med.id           = docsnapMedicines.Id;
                        med.medicinename = docsnapMedicines.GetValue <string>("medicinename");
                        med.quantity     = docsnapMedicines.GetValue <string>("quantity");
                        med.Price        = (Convert.ToDecimal(docsnapMedicines.GetValue <string>("quantity")) * Convert.ToDecimal(docsnapMedicines.GetValue <string>("unitmrp"))).ToString();
                        med.inventoryid  = docsnapMedicines.GetValue <string>("inventoryid");
                        medicineList.Add(med);
                        totalprice = totalprice + Convert.ToDecimal(docsnapMedicines.GetValue <string>("quantity")) * Convert.ToDecimal(docsnapMedicines.GetValue <string>("unitmrp"));
                    }
                }
            }


            TempData["medicine"] = medicineList;


            QuerySnapshot snapSettings = await db.Collection("clinics").Document(GlobalSessionVariables.ClinicDocumentAutoId).Collection("settings").Limit(1).GetSnapshotAsync();

            if (snapSettings.Count > 0)
            {
                DocumentSnapshot docSnapSettings = snapSettings.Documents[0];

                if (docSnapSettings.Exists)
                {
                    try {
                        if (docSnapSettings.GetValue <Boolean>("inventoryon"))
                        {
                            TempData["inventoryon"] = "true";
                        }
                        else
                        {
                            TempData["inventoryon"] = "false";
                        }
                    }
                    catch
                    {
                        TempData["inventoryon"] = "false";
                    }
                }
                else
                {
                    TempData["inventoryon"] = "false";
                }
            }

            DocumentReference docRef  = db.Collection("clinics").Document(GlobalSessionVariables.ClinicDocumentAutoId).Collection("appointments").Document(id);
            DocumentSnapshot  docSnap = await docRef.GetSnapshotAsync();

            totalprice = totalprice + Convert.ToInt32(docSnap.GetValue <string>("fee"));

            if (totalprice == 0)
            {
                TempData["TotalPrice"] = 0;
            }
            else
            {
                TempData["TotalPrice"] = totalprice;
            }

            TempData["days"] = docSnap.GetValue <string>("days");
            TempData["fee"]  = docSnap.GetValue <string>("fee");


            if (docSnap.GetValue <Timestamp>("raisedDate").ToDateTime().Date < DateTime.Now.Date)
            {
                ViewData["DateType"] = "OldDate";
            }
            else
            {
                ViewData["DateType"] = "CurrentDate";
            }

            try {
                if (docSnap.GetValue <string>("statusChemist") == "Completed")
                {
                    ViewData["FromPage"] = "Completed";
                }
                else
                {
                    ViewData["FromPage"] = "Waiting";
                }
            }
            catch
            {
                ViewData["FromPage"] = "Waiting";
            }



            TempData.Keep();


            return(View(_objuserloginmodel));
        }
 public DocumentReferenceWrapper(DocumentReference documentReference)
 {
     _documentReference = documentReference ?? throw new ArgumentNullException(nameof(documentReference));
 }
Exemplo n.º 26
0
        /// <summary>
        /// Deserialize JSON into a FHIR DocumentReference
        /// </summary>
        public static void DeserializeJsonProperty(this DocumentReference current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "masterIdentifier":
                current.MasterIdentifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.MasterIdentifier).DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentReference error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"DocumentReference error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "status":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.DocumentReferenceStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.DocumentReferenceStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.DocumentReferenceStatus>(reader.GetString()));
                }
                break;

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.DocumentReferenceStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options);
                break;

            case "docStatus":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DocStatusElement = new Code <Hl7.Fhir.Model.CompositionStatus>();
                    reader.Skip();
                }
                else
                {
                    current.DocStatusElement = new Code <Hl7.Fhir.Model.CompositionStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.CompositionStatus>(reader.GetString()));
                }
                break;

            case "_docStatus":
                if (current.DocStatusElement == null)
                {
                    current.DocStatusElement = new Code <Hl7.Fhir.Model.CompositionStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.DocStatusElement).DeserializeJson(ref reader, options);
                break;

            case "type":
                current.Type = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Type).DeserializeJson(ref reader, options);
                break;

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentReference error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Category = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Category = new Hl7.Fhir.Model.CodeableConcept();
                    v_Category.DeserializeJson(ref reader, options);
                    current.Category.Add(v_Category);

                    if (!reader.Read())
                    {
                        throw new JsonException($"DocumentReference error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Category.Count == 0)
                {
                    current.Category = null;
                }
                break;

            case "subject":
                current.Subject = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Subject).DeserializeJson(ref reader, options);
                break;

            case "date":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DateElement = new Instant();
                    reader.Skip();
                }
                else
                {
                    current.DateElement = new Instant(DateTimeOffset.Parse(reader.GetString()));
                }
                break;

            case "_date":
                if (current.DateElement == null)
                {
                    current.DateElement = new Instant();
                }
                ((Hl7.Fhir.Model.Element)current.DateElement).DeserializeJson(ref reader, options);
                break;

            case "author":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentReference error reading 'author' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Author = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_Author = new Hl7.Fhir.Model.ResourceReference();
                    v_Author.DeserializeJson(ref reader, options);
                    current.Author.Add(v_Author);

                    if (!reader.Read())
                    {
                        throw new JsonException($"DocumentReference error reading 'author' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Author.Count == 0)
                {
                    current.Author = null;
                }
                break;

            case "authenticator":
                current.Authenticator = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Authenticator).DeserializeJson(ref reader, options);
                break;

            case "custodian":
                current.Custodian = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Custodian).DeserializeJson(ref reader, options);
                break;

            case "relatesTo":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentReference error reading 'relatesTo' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.RelatesTo = new List <DocumentReference.RelatesToComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DocumentReference.RelatesToComponent v_RelatesTo = new Hl7.Fhir.Model.DocumentReference.RelatesToComponent();
                    v_RelatesTo.DeserializeJson(ref reader, options);
                    current.RelatesTo.Add(v_RelatesTo);

                    if (!reader.Read())
                    {
                        throw new JsonException($"DocumentReference error reading 'relatesTo' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.RelatesTo.Count == 0)
                {
                    current.RelatesTo = null;
                }
                break;

            case "description":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DescriptionElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.DescriptionElement = new FhirString(reader.GetString());
                }
                break;

            case "_description":
                if (current.DescriptionElement == null)
                {
                    current.DescriptionElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.DescriptionElement).DeserializeJson(ref reader, options);
                break;

            case "securityLabel":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentReference error reading 'securityLabel' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.SecurityLabel = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_SecurityLabel = new Hl7.Fhir.Model.CodeableConcept();
                    v_SecurityLabel.DeserializeJson(ref reader, options);
                    current.SecurityLabel.Add(v_SecurityLabel);

                    if (!reader.Read())
                    {
                        throw new JsonException($"DocumentReference error reading 'securityLabel' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.SecurityLabel.Count == 0)
                {
                    current.SecurityLabel = null;
                }
                break;

            case "content":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentReference error reading 'content' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Content = new List <DocumentReference.ContentComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DocumentReference.ContentComponent v_Content = new Hl7.Fhir.Model.DocumentReference.ContentComponent();
                    v_Content.DeserializeJson(ref reader, options);
                    current.Content.Add(v_Content);

                    if (!reader.Read())
                    {
                        throw new JsonException($"DocumentReference error reading 'content' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Content.Count == 0)
                {
                    current.Content = null;
                }
                break;

            case "context":
                current.Context = new Hl7.Fhir.Model.DocumentReference.ContextComponent();
                ((Hl7.Fhir.Model.DocumentReference.ContextComponent)current.Context).DeserializeJson(ref reader, options);
                break;

            // Complex: DocumentReference, Export: DocumentReference, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Exemplo n.º 27
0
        void ConnectViews()
        {
            Fnametext   = (TextInputLayout)FindViewById(Resource.Id.fullnametext);
            emtext      = (TextInputLayout)FindViewById(Resource.Id.emailtext);
            passtext    = (TextInputLayout)FindViewById(Resource.Id.passwordtext);
            submit      = (Button)FindViewById(Resource.Id.submit_btn);
            login       = (Button)FindViewById(Resource.Id.login_btn);
            googlelogin = (Button)FindViewById(Resource.Id.googlelogin_btn);
            profimg     = (ImageView)FindViewById(Resource.Id.profileiv);

            gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn)
                  .RequestIdToken("228992356302-n0p15tka3tqvhps5e7ra7scrs6fqg0p0.apps.googleusercontent.com")
                  .RequestEmail().Build();

            googleapiclient = new GoogleApiClient.Builder(this).AddApi(Auth.GOOGLE_SIGN_IN_API, gso).Build();

            googleapiclient.Connect();


            submit.Click += (sender, e) =>
            {
                if (imageArray == null)
                {
                    imageArray = System.IO.File.ReadAllBytes("Resources/Images/DefaultUser.png");
                }

                storageReference = FirebaseStorage.Instance.GetReference($"users/{Fnametext.EditText.Text}_image");
                storageReference.PutBytes(imageArray);

                storageReference.GetDownloadUrl().AddOnSuccessListener(this);


                HashMap map = new HashMap();
                map.Put("fullname", Fnametext.EditText.Text);
                map.Put("email", emtext.EditText.Text);
                map.Put("password", passtext.EditText.Text);
                map.Put("profileimage", url);



                DocumentReference docRef = database.Collection("users").Document();

                docRef.Set(map);

                Toast.MakeText(this, "User Registered", ToastLength.Long).Show();
                FetchUserData();
            };


            login.Click += (sender, e) =>
            {
                string loginfname = Fnametext.EditText.Text.ToString();
                string loginemail = emtext.EditText.Text.ToString();
                string loginpass  = passtext.EditText.Text.ToString();

                //listOfUser=userservice.FetchUserData("user");

                //while (listOfUser.Count == 0)
                //{
                //}



                foreach (var item in listOfUser)
                {
                    Console.WriteLine("Fullname: " + item.Fullname);
                }
                foreach (var item in listOfUser)
                {
                    if (item.Fullname.Equals(loginfname) && item.Email.Equals(loginemail) && item.password.Equals(loginpass))
                    {
                        Intent secondpageintent = new Intent(this, typeof(SecondPageActivity));
                        secondpageintent.PutExtra("accepteduser", JsonConvert.SerializeObject(item));
                        StartActivity(secondpageintent);
                        return;
                    }
                }

                Toast.MakeText(this, "Invalid Credentials", ToastLength.Long).Show();
                return;
            };

            profimg.Click += (sender, e) =>
            {
                RequestPermissions(permissionGroup, 0);

                var trans = SupportFragmentManager.BeginTransaction();
                uploadimg = new UploadImageFragment();

                uploadimg.Show(trans, "profilepicmethod");

                uploadimg.uploadImage += (Bitmap bitmap, byte[] imgary) =>
                {
                    profimg.SetImageBitmap(bitmap);
                    imageArray = imgary;
                    uploadimg.Dismiss();
                };
            };



            googlelogin.Click += (sender, e) =>
            {
                var intent = Auth.GoogleSignInApi.GetSignInIntent(googleapiclient);
                StartActivityForResult(intent, 1);
            };
        }
Exemplo n.º 28
0
        /// <summary>
        /// Serialize a FHIR DocumentReference into JSON
        /// </summary>
        public static void SerializeJson(this DocumentReference current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            writer.WriteString("resourceType", "DocumentReference");
            // Complex: DocumentReference, Export: DocumentReference, Base: DomainResource (DomainResource)
            ((Hl7.Fhir.Model.DomainResource)current).SerializeJson(writer, options, false);

            if (current.MasterIdentifier != null)
            {
                writer.WritePropertyName("masterIdentifier");
                current.MasterIdentifier.SerializeJson(writer, options);
            }

            if ((current.Identifier != null) && (current.Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();
                foreach (Identifier val in current.Identifier)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            writer.WriteString("status", Hl7.Fhir.Utility.EnumUtility.GetLiteral(current.StatusElement.Value));

            if (current.DocStatusElement != null)
            {
                if (current.DocStatusElement.Value != null)
                {
                    writer.WriteString("docStatus", Hl7.Fhir.Utility.EnumUtility.GetLiteral(current.DocStatusElement.Value));
                }
                if (current.DocStatusElement.HasExtensions() || (!string.IsNullOrEmpty(current.DocStatusElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_docStatus", false, current.DocStatusElement.Extension, current.DocStatusElement.ElementId);
                }
            }

            if (current.Type != null)
            {
                writer.WritePropertyName("type");
                current.Type.SerializeJson(writer, options);
            }

            if ((current.Category != null) && (current.Category.Count != 0))
            {
                writer.WritePropertyName("category");
                writer.WriteStartArray();
                foreach (CodeableConcept val in current.Category)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (current.Subject != null)
            {
                writer.WritePropertyName("subject");
                current.Subject.SerializeJson(writer, options);
            }

            if (current.DateElement != null)
            {
                if (current.DateElement.Value != null)
                {
                    writer.WriteString("date", ((DateTimeOffset)current.DateElement.Value).ToString("yyyy-MM-dd'T'HH:mm:ss.FFFFFFFK", System.Globalization.CultureInfo.InvariantCulture));
                }
                if (current.DateElement.HasExtensions() || (!string.IsNullOrEmpty(current.DateElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_date", false, current.DateElement.Extension, current.DateElement.ElementId);
                }
            }

            if ((current.Author != null) && (current.Author.Count != 0))
            {
                writer.WritePropertyName("author");
                writer.WriteStartArray();
                foreach (ResourceReference val in current.Author)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (current.Authenticator != null)
            {
                writer.WritePropertyName("authenticator");
                current.Authenticator.SerializeJson(writer, options);
            }

            if (current.Custodian != null)
            {
                writer.WritePropertyName("custodian");
                current.Custodian.SerializeJson(writer, options);
            }

            if ((current.RelatesTo != null) && (current.RelatesTo.Count != 0))
            {
                writer.WritePropertyName("relatesTo");
                writer.WriteStartArray();
                foreach (DocumentReference.RelatesToComponent val in current.RelatesTo)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (current.DescriptionElement != null)
            {
                if (!string.IsNullOrEmpty(current.DescriptionElement.Value))
                {
                    writer.WriteString("description", current.DescriptionElement.Value);
                }
                if (current.DescriptionElement.HasExtensions() || (!string.IsNullOrEmpty(current.DescriptionElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_description", false, current.DescriptionElement.Extension, current.DescriptionElement.ElementId);
                }
            }

            if ((current.SecurityLabel != null) && (current.SecurityLabel.Count != 0))
            {
                writer.WritePropertyName("securityLabel");
                writer.WriteStartArray();
                foreach (CodeableConcept val in current.SecurityLabel)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if ((current.Content != null) && (current.Content.Count != 0))
            {
                writer.WritePropertyName("content");
                writer.WriteStartArray();
                foreach (DocumentReference.ContentComponent val in current.Content)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (current.Context != null)
            {
                writer.WritePropertyName("context");
                current.Context.SerializeJson(writer, options);
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Exemplo n.º 29
0
 public DocumentTreeItemsSource(DocumentReference document)
 {
     InstanceId = document.InstanceId;
     Nodes      = GetNodes(document.LiteDocument);
 }
Exemplo n.º 30
0
 private string CreateTitleFromItem(DocumentReference item)
 {
     return(String.Format("{0} {1}", item.ArtikelParagraphAnlage, item.Kurzinformation));
 }
Exemplo n.º 31
0
        public void Parse_throws_ArgumentException_for_invalid_input(string value)
        {
            Action act = () => DocumentReference.Parse(value);

            act.Should().ThrowExactly <ArgumentException>();
        }
Exemplo n.º 32
0
 public void LoadFile(DocumentReference docRef)
 {
     this.docRef = docRef;
     this.Content = File.ReadAllText(docRef.Name);
     this.Title = docRef.Name;
 }