Example #1
0
        public Data_AppUserWallet RetrieveOne(string email, IMyLog log)
        {
            string filePath = getWalletFullPath(email);

            Data_AppUserWallet o      = Data_AppUserWallet.CreateBlank();
            Stream             stream = OpenFile.ForRead(filePath, false, false, log);

            if (stream == null)
            {
                return(null);
            }
            using (BinaryReader br = new BinaryReader(stream))
            {
                o.ReadFromStream(br);
            }
            return(o);
        }
Example #2
0
        public void UpdateAll(
            string Email,
            string Title,
            string[] DisplayLines,
            Data_AppUserFile.eUserStatus RequestedType,
            AmountAndPrice Numbers,
            AmountAndPrice Messages,
            AmountAndPrice Month,
            AmountAndPrice Setup,
            AmountAndPrice FullPayment,
            IMyLog log)
        {
            string filePath = getWalletFullPath(Email);

            using (Stream stream = OpenFile.ForRead(filePath, true, true, log))
            {
                Data_AppUserWallet r = Data_AppUserWallet.CreateBlank();

                //1) read it in
                BinaryReader br = new BinaryReader(stream);
                r.ReadFromStream(br);

                //2) update values
                r.Email         = Email;
                r.Title         = Title;
                r.DisplayLines  = DisplayLines.MyClone();
                r.RequestedType = RequestedType;
                r.Numbers       = Numbers.Clone();
                r.Messages      = Messages.Clone();
                r.Month         = Month.Clone();
                r.Setup         = Setup.Clone();
                r.FullPayment   = FullPayment.Clone();

                //3) write it back
                stream.Seek(0, SeekOrigin.Begin);
                BinaryWriter bw = new BinaryWriter(stream);
                r.WriteToStream(bw);
            }
        }