Example #1
0
        /// <summary>
        /// btnUpdate_Click - for updating client record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                ClientModel clientModel = new ClientModel();
                clientModel.Name = txtClientName.Text.Trim();
                clientModel.PrimaryContactName  = txtClientPrimaryContactName.Text.Trim();
                clientModel.PrimaryContactCell  = txtClientPrimaryContactCell.Text.Trim();
                clientModel.PrimaryContactEmail = txtClientPrimaryContactEmail.Text.Trim();
                clientModel.IsDeleted           = rdoIsDeleted_Disabled.Checked ? true : false;

                try
                {
                    ClientDataAccess.UpdateClient(clientModel, int.Parse(txtClientId.Text));
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Runtime Error\n" + ex.Message, "Unexpected Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    this.Close();
                }
            }
        }
Example #2
0
        [TestMethod]//OK
        public void OK_dataservice_querysiteCodes_insertdatabase()
        {
            var siteCodes = DataServiceClient.CallQuerySiteCodes(1, 826, "100018P2826D2", 100);

            ClientDataAccess.InsertFileAsync(826, siteCodes);
            Thread.Sleep(1000);
        }
Example #3
0
        /// <summary>
        /// btnCreate_Click - for new client record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                ClientModel clientModel = new ClientModel();
                clientModel.Name = txtClientName.Text.Trim();
                clientModel.PrimaryContactName  = txtClientPrimaryContactName.Text.Trim();
                clientModel.PrimaryContactCell  = txtClientPrimaryContactCell.Text.Trim();
                clientModel.PrimaryContactEmail = txtClientPrimaryContactEmail.Text.Trim();

                try
                {
                    ClientDataAccess.SaveClient(clientModel);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Runtime Error\n" + ex.Message, "Unexpected Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    this.Close();
                }
            }
        }
Example #4
0
        /// <summary>
        /// Serializes value and saves it into config table
        /// </summary>
        /// <param name="key"></param>
        /// <param name="data"></param>
        public static void Save(string key, object data)
        {
            ObjectSerializer serializer = new ObjectSerializer(true);
            var buffer = serializer.Serialize(data);

            ClientDataAccess.InsertConfigValue(key, buffer);
        }
Example #5
0
        public override void Install(IDictionary stateSaver)
        {
#if ADD_DB_TO_SQL_SERVER_DATA
            //var targetdir = this.Context.Parameters["assemblypath"];
            //Debug.Assert(targetdir != null);
            //string path = Path.Combine(Path.GetPathRoot(targetdir), DBINSTALLPATH);
#else //INSTALL ON SYSTEM DRIVE
            string path = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), DBINSTALLPATH);
#endif
            try
            {
                if (ClientDataAccess.TestConnection() != null)
                {
                    string sql = string.Format(Resources.PTFLocalInstallScript, path);
                    ClientDataAccess.SetupDatabase(path, sql);
                }
            }
            catch (Exception ex)
            {
                ex.ShowDialog();
            }
            finally
            {
                base.Install(stateSaver);
            }
        }
        private static async Task HandleClient(TcpClient tcpClientSocket)
        {
            var isClientConnected = true;

            IClientDataAccess clientDataAccess = new ClientDataAccess();
            IClientService    clientService    = new ClientService(clientDataAccess);

            DateTime hour           = DateTime.Now;
            string   connectionHour = hour.Hour + ":" + hour.Minute;

            int token = clientService.AddClient(connectionHour);

            try
            {
                using (var networkStream = tcpClientSocket.GetStream())
                {
                    SendMenu(networkStream);

                    IFrameHandler frameHandler = new FrameHandler(networkStream);
                    while (isClientConnected)
                    {
                        var frame = await frameHandler.ReadDataAsync();

                        var printiame = Encoding.ASCII.GetString(frame);
                        Console.WriteLine("Now handeling: " + printiame);
                        isClientConnected = HandleRequest(frame, networkStream);
                    }
                    clientService.RemoveClient(token);
                }
            }
            catch (SocketException)
            {
                Console.WriteLine("The client connection was interrupted");
            }
        }
Example #7
0
        /// <summary>
        /// Update the already existing resource access claim
        /// </summary>
        /// <param name="id">Resource Access Claim Id</param>
        /// <param name="access">Client Resource Claims Access</param>
        /// <returns><![CDATA[ (bool IsSuccess, String Message) ]]></returns>
        public (bool IsSuccess, String Message) UpdateClaimAccess(int id, ClientResourceClaimsAccess access)
        {
            try
            {
                var dbClaim = ClientDataAccess.ClientResourceAccessClaim.GetById(id);
                if (dbClaim == null)
                {
                    return(false, ResourceManagerMessages.Error.CLAIM_UPDATE_NOT_FOUND);
                }

                dbClaim.Access = access;

                ClientDataAccess.ClientResourceAccessClaim.Update(dbClaim);
                ClientDataAccess.Save();

                return(true, ResourceManagerMessages.Success.CLAIM_UPDATED);
            }
            catch (DbEntityValidationException ex)
            {
#if (DEBUG)
                // for debuging entity framework
                foreach (var error in ex.EntityValidationErrors.SelectMany(valError => valError.ValidationErrors))
                {
                    Console.WriteLine(error.ErrorMessage);
                }
#endif
                throw;
            }
            catch
            {
                throw;
            }
        }
Example #8
0
        public static IMarketFileParser GetPrismParser(ImportFileContext context, ILogger logger)
        {
            var clientDataAccess = new ClientDataAccess(context.ClientConnectionString);

            var fileType = context.FileType;

            switch (fileType)
            {
            case "650":
                return(new Import650Prism(clientDataAccess, logger));

            case "810":
                return(new Import810Prism(clientDataAccess, logger));

            case "814":
                return(new Import814Prism(clientDataAccess, logger));

            case "820":
                return(new Import820Prism(clientDataAccess, logger));

            case "824":
                return(new Import824Prism(clientDataAccess, logger));

            case "867":
                return(new Import867Prism(clientDataAccess, logger));

            case "CBF":
                return(new ImportCustomerInfo(clientDataAccess, logger));
            }

            throw new ArgumentOutOfRangeException(fileType);
        }
Example #9
0
        private void QuerySiteCodes(DataServiceClient client)
        {
            //******************************************************************
            //  SELECT SITEIDS FROM THE SERVER
            //******************************************************************

            Trace.WriteLine("TransferringService: ClientDataAccess.SelectAvailableAuditIDsCount");
            int Ids = ClientDataAccess.SelectAvailableSiteCodeIDsCount();

            if (Ids < Program.MINIMUM_SITECODE_IDS_COUNT)
            {
                foreach (KeyValuePair <int, string> country in Settings.SiteCodeTable)
                {
                    Stopwatch w = Stopwatch.StartNew();

                    Trace.WriteLine("TransferringService: client.QuerySiteCodes");

                    string[] siteCodes = client.QuerySiteCodes(Auth.ClientID, country.Key, country.Value, Program.MINIMUM_SITECODE_IDS_COUNT);

                    Trace.WriteLine("TransferringService: ".concat(w.Elapsed));

                    Trace.WriteLine("TransferringService: ClientDataAccess.InsertAuditIdsAsync");

                    ClientDataAccess.InsertFileAsync(country.Key, siteCodes, Program.OnError);
                }
            }
            else
            {
                Trace.WriteLine("TransferringService: QUERYSITECODES (OK)");
            }
        }
Example #10
0
        protected override void OnActivated(EventArgs e)
        {
            base.OnActivated(e);

            var args = Environment.GetCommandLineArgs();

            if (args.Length == 2)
            {
                Guid key    = Guid.Parse(args[1]);
                var  buffer = ClientDataAccess.SelectBarcodeInfoData(key);

                using (MemoryStream mem = new MemoryStream(buffer))
                    using (Image img = Bitmap.FromStream(mem))
                    {
                        BarcodeReader reader = new BarcodeReader();
                        reader.BarcodesToRead = 1;
                        reader.BarcodeTypes   = BarcodeTypeEnum.BT_Inter2of5;
                        Barcode[]        barcodes = reader.ReadFromImage(img);
                        var              barArray = new BarcodeInfoArray(barcodes);
                        ObjectSerializer ser      = new ObjectSerializer(true);
                        var              buffer2  = ser.Serialize(barArray);
                        ClientDataAccess.UpdateBarcodeInfo(key, buffer2);
                    }
            }
            Close();
        }
Example #11
0
        /// <summary>
        /// Get Next Table Key from the local client keys cache.
        /// </summary>
        /// <param name="TableName">Table Name key</param>
        /// <param name="GoToServerIfEmpty">If no more keys in the client cache go to server to get next key</param>
        /// <returns></returns>
        public int NextClientTableKey(string TableName, bool GoToServerIfEmpty)
        {
            int KeyValue         = 0;
            ClientDataAccess cda = new ClientDataAccess();
            string           sql = "SELECT * FROM i9ClientTableKey WHERE " + TableName + " ";
            DataTable        dt  = cda.GetDataTable(sql, "i9ClientTableKey");

            if (dt != null)
            {
                //if(ds.Tables.Count > 0)
                if (dt.Rows.Count > 0)
                {
                    KeyValue = Convert.ToInt32(dt.Rows[0]["KeyValue"].ToString());
                }
            }

            if (KeyValue == 0)
            {
                if (GoToServerIfEmpty)
                {
                    KeyValue = NextServerTableKey(TableName);
                }
            }

            if (KeyValue == 0)
            {
                throw new Exception("Unable to get the next table key for: " + TableName);
            }

            return(KeyValue);
        }
        private static void OnError(object sender, ThreadExceptionEventArgs e)
        {
            Trace.WriteLine(e.Exception, "TransferringService: ERR");

            ClientDataAccess.InsertMessageAsync(e.Exception.Message, eSources.TransferringService,
                                                eMessageTypes.Error, e.Exception.StackTrace);
        }
Example #13
0
        public static void OnError(object sender, ThreadExceptionEventArgs e)
        {
            //Every exception is recordered but only application predefined
            //exceptions are shown in this scope
            Exception ex = e.Exception;

            //The exception comes from the ThreadPool dynamic Invoker.
            //The real exception is wrapped into it. Get it.
            if (ex is TargetInvocationException && ex.InnerException != null)
            {
                ex = ex.InnerException;
            }

            if (ex is ThreadAbortException || ex is ThreadInterruptedException)
            {
                return;
            }

            MessageBoxIcon icon = MessageBoxIcon.Error;

            if (e.Exception is AppInfoException)
            {
                icon = MessageBoxIcon.Information;
            }
            else if (ex is AppWarningException)
            {
                icon = MessageBoxIcon.Warning;
            }
            else if (ex is AppExclamationException)
            {
                icon = MessageBoxIcon.Exclamation;
            }
            else if (ex is AppStopException)
            {
                icon = MessageBoxIcon.Stop;
            }

            if (!(ex is ApplicationException))
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, icon);
            }

            //TODO: eMessageTypes.Error should be described more precisely
            ClientDataAccess.InsertMessageAsync(ex.Message, eSources.VScan,
                                                eMessageTypes.Error, ex.StackTrace);

            Delegate nextDelegate = ex.GetNext();

            if (nextDelegate != null && nextDelegate != default(Delegate))
            {
                nextDelegate.FireAndForget();
            }

            if (ex is AppStopException || ex is SecurityException)
            {
                Environment.Exit(10);
            }
        }
Example #14
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     dgvData.Rows.ForEach <DataGridViewRow>((r) => (r.Tag as IDisposable).DisposeSf());
     dgvData.Rows.Clear();
     foreach (var info in ClientDataAccess.SelectAllFiles())
     {
         new Action <DbObserverForm, DbClientFileInfo>((f, i) => InsertRecordAsync(f, i)).FireAndForget(this, info);
     }
 }
Example #15
0
 private void ControlTypeComboBox_DropDownOpened(object sender, EventArgs e)
 {
     if (ControlTypeComboBox.Items.Count <= 0)
     {
         ClientDataAccess cda = new ClientDataAccess();
         DataTable        dt  = cda.GetDataTable("SELECT CtrlTypeName, CtrlTypeDesc FROM i9DynamicEntryCtrlType ", "i9DynamicEntryCtrlType");
         i9ComboBox.PopulateCombobox(ControlTypeComboBox, dt, "CtrlTypeName");
     }
 }
Example #16
0
        /// <summary>
        /// Creates SelectAuditIds reloading delegate
        /// </summary>
        /// <returns></returns>
        public static Delegate CreateAuditIdReloadDelegate()
        {
            var method = new Action(() =>
            {
                int minimumAuditIdsInCache = SettingsTable.Get <int>(Strings.VScan_MinimumAuditIDsInCache, Program.ITEMS_IN_CACHE);
                AuditIDSTable.AddRange(ClientDataAccess.SelectAvailableSiteCodeIDs(minimumAuditIdsInCache), minimumAuditIdsInCache);
            });

            return(method);
        }
Example #17
0
        private void CleanDataBase()
        {
            int historyDays = (Settings != null && Settings.KeepHistoryDays > 0) ?
                              Settings.KeepHistoryDays :
                              Program.PURGE_RECORDS_OLDER_THAN_DAYS;

            Trace.WriteLine("TransferringService: ClientDataAccess.DeleteOlderSentFilesAsync");
            ClientDataAccess.DeleteOlderSentFilesAsync(historyDays);
            Trace.WriteLine("TransferringService: ClientDataAccess.DeleteOlderSentMessagesAsync");
            ClientDataAccess.DeleteOlderSentMessagesAsync(historyDays);
        }
Example #18
0
        public static Process StartBarcodeReader(Bitmap img, Guid g)
        {
            var buffer = img.ToArray();

            ClientDataAccess.InsertBarcodeInfo(g, buffer);

            string path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "ReaderProc.exe");
            var    p    = Process.Start(path, g.ToString());

            return(p);
        }
Example #19
0
        /// <summary>
        /// Used to insert voucher data to the database
        /// </summary>
        /// <returns></returns>
        public static VoucherProcessDelegate CreateInsertVoucherDelegate()
        {
            var method = new VoucherProcessDelegate((Voucher data, StateObj state) =>
            {
                Debug.Assert(state.Dib != IntPtr.Zero);
                Debug.Assert(state.Main != IntPtr.Zero);
                Debug.Assert(state.Scan != IntPtr.Zero);
                Debug.Assert(data != null);

                try
                {
                    data.Validate();

                    ClientDataAccess.UpdateFileAsync((DbClientVoucher)data,
                                                     new EventHandler((o, e) =>
                    {
                        string fileName = Path.ChangeExtension(
                            string.Format("{0}{1}", PTFUtils.GetMachine(), DateTime.Now).ReplaceAll(new char[] { '.', '/', '\\', '-' }, '_'), ".xml");

                        //Data has been saved successfully. Show message
                        string id = string.Concat(Strings.VScan_ItemSaved, fileName);
                        DataSlot.Set(id, data);
                        WinMsg.SendText(state.Main, id);
                    }),
                                                     new ThreadExceptionEventHandler((o, e) =>
                    {
                        //Data has failed to save.
                        var ex = new ApplicationException("Can't insert: ".concat(e.Exception.Message), e.Exception);
                        ex.AddNext(new MethodInvoker(() =>
                        {
                            string id    = Strings.VScan_EditItem.Uniqueue();
                            data.Message = ex.Message;
                            DataSlot.Set(id, data);
                            WinMsg.SendText(state.Scan, state.Main, id);
                        }));
                        throw ex;
                    }));
                }
                catch (Exception e)
                {
                    var ex = new ApplicationException("Err: ".concat(e.Message), e);
                    ex.AddNext(new MethodInvoker(() =>
                    {
                        string id    = Strings.VScan_EditItem.Uniqueue();
                        data.Message = ex.Message;
                        DataSlot.Set(id, data);
                        WinMsg.SendText(state.Main, id);
                    }));
                    throw ex;
                }
            });

            return(method);
        }
Example #20
0
        private void i9ComboBox_DropDownOpened(object sender, EventArgs e)
        {
            i9ComboBox i9cb = (i9ComboBox)sender;

            if (!String.IsNullOrEmpty(i9cb.i9BindCodeSetName) && i9cb.Items.Count <= 0)
            {
                ClientDataAccess cda = new ClientDataAccess();
                DataTable        dt  = cda.GetDataTable("SELECT Code, CodeText FROM i9Code WHERE Enabled <> 0 AND CodeSetName = " + DataAccessUtilities.GetDBStr(i9cb.i9BindCodeSetName) + " Order By CodeText ", "i9Code");
                i9ComboBox.PopulateCombobox(i9cb, dt, "i9Code");
            }
        }
Example #21
0
        public static void DisplayClients()
        {
            IClientDataAccess cliDa = new ClientDataAccess();
            IClientService    cliS  = new ClientService(cliDa);
            var clientList          = cliS.GetConnectedClients();

            Console.WriteLine("Hay " + clientList.Count + " usuarios conectados");
            foreach (var client in clientList)
            {
                Console.WriteLine(client);
            }
        }
        /// <summary>
        /// DataGridViewForm - display all client event for mailing
        /// </summary>
        /// <param name="mainForm"></param>
        /// <param name="clientEventsList"></param>
        public DataGridViewForm(MainForm mainForm, List <ClientEventModel> clientEventsList)
        {
            InitializeComponent();

            DataGridView dataGridView = dgvData;
            DataTable    dataTable    = ToDataTable(clientEventsList);

            foreach (DataRow row in dataTable.Rows)
            {
                if (row["ClientId"] != null)
                {
                    ClientModel clientModel = ClientDataAccess.LoadClient((int)row["ClientId"]);
                    row["ClientName"] = clientModel.Name;
                }
                if (row["TrackId"] != null)
                {
                    TrackModel trackModel = TrackDataAccess.LoadTrack((int)row["TrackId"]);
                    row["TrackName"] = trackModel.Name;
                }
            }
            dataTable.Columns.Add("Applied", typeof(bool)).SetOrdinal(0);
            dataTable.Columns["ClientEventID"].SetOrdinal(1);
            dataTable.Columns["ClientName"].SetOrdinal(2);
            dataTable.Columns["TrackName"].SetOrdinal(3);

            dataGridView.DataSource          = dataTable;
            dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;

            dataGridView.Columns["IsDeleted"].Visible = false;
            dataGridView.Columns["ClientId"].Visible  = false;
            dataGridView.Columns["TrackId"].Visible   = false;

            int dgv_width = dataGridView.Columns.GetColumnsWidth(DataGridViewElementStates.Visible);

            this.Width = 365 + dgv_width;

            foreach (DataGridViewColumn column in dgvData.Columns)
            {
                if (column.HeaderText == "Applied")
                {
                    column.ReadOnly = false;
                }
                else
                {
                    column.ReadOnly = true;
                }
            }
            dataGridView.ClearSelection();

            btnSelect.Click += btnAddClientEvent_Click;
            _mainForm        = mainForm;
        }
Example #23
0
        private void CodeSetNameComboBox_DropDownOpened(object sender, EventArgs e)
        {
            if (CodeSetNameComboBox.Items.Count <= 0)
            {
                CodeSetNameComboBox.DisplayMemberPath = "CodeSetName";
                CodeSetNameComboBox.SelectedValue     = "CodeSetName";
                CodeSetNameComboBox.SelectedValuePath = "CodeSetName";

                ClientDataAccess cda = new ClientDataAccess();
                DataTable        dt  = cda.GetDataTable("SELECT CodeSetName FROM i9Code Group By CodeSetName Order By CodeSetName ", "i9Code");
                i9ComboBox.PopulateCombobox(CodeSetNameComboBox, dt, "CodeSetName");
            }
        }
Example #24
0
 /// <summary>
 /// Safely reads value from config datatable and deserializes it
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="key"></param>
 /// <param name="default"></param>
 /// <returns></returns>
 public static T ReadSf <T>(string key, T @default)
 {
     try
     {
         ObjectSerializer serializer = new ObjectSerializer(true);
         var buffer = ClientDataAccess.SelectConfigValue(key);
         return(serializer.Deserialize <T>(buffer));
     }
     catch
     {
         return(@default);
     }
 }
Example #25
0
        /// <summary>
        /// Delete a specific resource access claim out of the database.
        /// </summary>
        /// <param name="id">Client Id</param>
        /// <returns></returns>
        public (bool IsSuccess, String Message) DeleteClaim(int id)
        {
            var dbView = ClientDataAccess.ClientResourceAccessClaim.GetById(id);

            if (dbView == null)
            {
                return(false, ResourceManagerMessages.Error.CLAIM_NOT_FOUND);
            }

            ClientDataAccess.ClientResourceAccessClaim.Delete(dbView);
            ClientDataAccess.Save();

            return(true, ResourceManagerMessages.Success.CLAIM_DELETED);
        }
Example #26
0
        /*TODO : MAKE SURE THAT ALL THE TRANSACTION ON SET ARE LOGGED IN A TABLE*/

        /// <summary>
        /// Create a new client record.
        /// </summary>
        /// <param name="ownerId">Owner Id</param>
        /// <param name="name">Client Name</param>
        /// <param name="status">Client Status</param>
        /// <returns><![CDATA[ (ClientVm Client, ClientKeyVm Key, bool IsSuccess, String Message) ]]></returns>
        public (ClientVm Client, ClientKeyVm Key, bool IsSuccess, String Message) CreateClient(int ownerId, string name, ClientKeyStatus status)
        {
            try
            {
                var dbCheck = ClientDataAccess.Client.Find(f => f.OwnerId == ownerId &&
                                                           f.Name.ToLower() == name.ToLower());
                if (dbCheck != null)
                {
                    return(null, null, false, ResourceManagerMessages.Error.CLIENT_ADD_ALREADY_EXISTS);
                }

                // Create the Client Resource
                var dbView = (new ClientVm()
                {
                    Name = name
                }).ToEntityCreate(ownerId);
                dbView = ClientDataAccess.Client.Create(dbView);

                // Generate a new Client Key
                var dbKey = (new ClientKeyVm()
                {
                    Status = status
                }).ToEntityCreate(dbView.Id);
                dbKey = ClientDataAccess.ClientKey.Create(dbKey);

                ClientDataAccess.Save();

                var client = new ClientVm(dbView);
                var key    = new ClientKeyVm(dbKey);

                return(client, key, true, ResourceManagerMessages.Success.CLAIM_CREATED);
            }
            catch (DbEntityValidationException ex)
            {
#if (DEBUG)
                // for debuging entity framework
                foreach (var error in ex.EntityValidationErrors.SelectMany(valError => valError.ValidationErrors))
                {
                    Console.WriteLine(error.ErrorMessage);
                }
#endif
                throw;
            }
            catch
            {
                throw;
            }
        }
Example #27
0
        private void button1_Click(object sender, EventArgs e)
        {
            var g      = Guid.NewGuid();
            var buffer = File.ReadAllBytes(@"C:\Users\Rosen.rusev\Desktop\Voucher1.png");

            ClientDataAccess.InsertBarcodeInfo(g, buffer);

            var p = Process.Start(@"C:\PROJECTS\VScan\BarReaderProc\bin\Debug\ReaderProc.exe", g.ToString());

            p.WaitForExit();
            var buffer2 = ClientDataAccess.SelectBarcodeInfoData(g);

            ClientDataAccess.DeleteBarcodeInfo(g);
            ObjectSerializer ser = new ObjectSerializer(true);
            var barArray         = ser.Deserialize <BarcodeInfoArray>(buffer2);
        }
Example #28
0
        public override void Uninstall(IDictionary savedState)
        {
            string path = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), DBINSTALLPATH);

            if (MessageBox.Show("Would you like to drop the database?\r\nKeep in mind if there are unsent data will be lost.", "Installer",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                string msg;
                if ((msg = ClientDataAccess.DropDatabaseSafe(path)) != null)
                {
                    MessageBox.Show(msg, "Installer", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            base.Uninstall(savedState);
        }
Example #29
0
        public static IMarketFileExporter GetPrismExporter(ExportFileContext context, ILogger logger)
        {
            var clientDataAccess = new ClientDataAccess(context.ClientConnectionString);

            var fileType = context.FileType;

            switch (fileType)
            {
            case "650":
            {
                var dataAccess = new Export650PrismDataAccess(context.MarketConnectionString);
                return(new Export650Prism(clientDataAccess, dataAccess, logger));
            }

            case "810":
            {
                var dataAccess = new Export810PrismDataAccess(context.MarketConnectionString);
                return(new Export810Prism(clientDataAccess, dataAccess, logger));
            }

            case "814":
            {
                var dataAccess = new Export814PrismDataAccess(context.MarketConnectionString);
                return(new Export814Prism(clientDataAccess, dataAccess, logger));
            }

            case "820":
            {
                var dataAccess = new Export820PrismDataAccess(context.MarketConnectionString);
                return(new Export820Prism(clientDataAccess, dataAccess, logger));
            }

            case "824":
            {
                var dataAccess = new Export824PrismDataAccess(context.MarketConnectionString);
                return(new Export824Prism(clientDataAccess, dataAccess, logger));
            }

            case "CBF":
            {
                var dataAccess = new ExportCustomerInfoDataAccess(context.ClientConnectionString);
                return(new ExportCustomerInfoPrism(dataAccess, logger));
            }
            }

            throw new ArgumentOutOfRangeException(fileType);
        }
Example #30
0
        private void SendFiles(DataServiceClient client, bool querySiteIds)
        {
            //******************************************************************
            //  SEND FILES TO THE SERVER
            //******************************************************************
            Trace.WriteLine("TransferringService: ClientDataAccess.SelectFilesForExport");
            int filesCount = (Settings != null && Settings.MaximumFilesForExport > 0) ?
                             Settings.MaximumFilesForExport :
                             Program.MAXIMUM_FILES_FOR_EXPORT;

            List <DbClientFileInfo> files = ClientDataAccess.SelectFilesForExport(filesCount);

            if (files != null && files.Count > 0)
            {
                foreach (var file in files)
                {
                    Stopwatch w = Stopwatch.StartNew();
                    Trace.WriteLine("TransferringService: client.SaveDataXmlText");
                    var voucher = new VoucherData()
                    {
                        CountryID    = file.CountryID,
                        RetailerID   = file.RetailerID,
                        VoucherID    = file.VoucherID,
                        SiteCode     = file.SiteCode,
                        BarCodeImage = file.BarCodeImage,
                        VoucherImage = file.VoucherImage,
                        DateCreated  = DateTime.Now,
                    };

                    client.SaveVoucher(voucher, Auth.ClientID);

                    Trace.WriteLine("TransferringService: ClientDataAccess.SetFileExportedAsync");
                    ClientDataAccess.SetFileExportedAsync(file.SiteCode, null, null);

                    if (querySiteIds)
                    {
                        QuerySiteCodes(client);
                    }

                    Thread.Sleep(0);
                }
            }
            else
            {
                Trace.WriteLine("TransferringService: FILES to Send (OK)");
            }
        }
 /// <summary>
 /// Requests the data and caches them. Uses the ClientDataAccess to request the data.
 /// </summary>
 /// <param name="dataAccess">Data access object that is used to request the data.</param>
 internal ClientDataCache(ClientDataAccess dataAccess)
 {
     this.dataAccess = dataAccess;
 }