Example #1
0
        private void mnuCurrentUser_Click(object sender, EventArgs e)
        {
            string originalStatus = Status;

            try
            {
                DialogResult result           = DialogResult.Cancel;
                User         currentUserClone = GlobalDataCache.Instance.CurrentUser.Clone();
                using (UserForm f = new UserForm(currentUserClone, EntityOperation.LimitedUpdate, null))
                {
                    result = f.ShowDialog();
                }
                if (result == DialogResult.OK)
                {
                    using (WaitCursor w = new WaitCursor())
                    {
                        Status = "Saving current user to server ...";
                        ServiceProcedureResult userResult = GlobalDataCache.Instance.Service.SaveUser(new User[] { currentUserClone }, GlobalDataCache.Instance.CurrentUser, false);
                        if (ServiceResultHandler.HandleServiceResult(userResult))
                        {
                            return;
                        }
                    }
                    currentUserClone.CopyTo(GlobalDataCache.Instance.CurrentUser);
                }
            }
            finally
            {
                if (Status != originalStatus)
                {
                    Status = originalStatus;
                }
            }
        }
Example #2
0
        private static void SaveDeviceConfig()
        {
            Console.Write("Saving device config ... ");

            string   companyName       = "Monagham Farm";
            string   deviceId          = "RV2WJB270311-RV1WJB270515";
            DateTime licenseExpiryDate = DateTime.Now.Add(new TimeSpan(30, 0, 0, 0));
            ServiceFunctionResultOfListOfCustomer resultCustomer = GlobalDataCache.Instance.Service.GetCustomerByField(
                EntityReader <Customer> .GetPropertyName(p => p.CompanyName, false),
                companyName,
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (resultCustomer.Code != ServiceResultCode.Success)
            {
                throw new Exception(resultCustomer.Message);
            }
            Customer customer = resultCustomer.Contents[0];

            ServiceFunctionResultOfListOfDeviceConfig resultDeviceConfigQuery = GlobalDataCache.Instance.Service.GetDeviceConfigByField(
                EntityReader <DeviceConfig> .GetPropertyName(p => p.DeviceId, false),
                deviceId,
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (resultDeviceConfigQuery.Code != ServiceResultCode.Success)
            {
                throw new Exception(resultDeviceConfigQuery.Message);
            }
            DeviceConfig deviceConfig = null;

            if (resultDeviceConfigQuery.Contents == null || resultDeviceConfigQuery.Contents.Length < 1)
            {
                deviceConfig = new DeviceConfig()
                {
                    DeviceConfigId = Guid.NewGuid(), DeviceId = deviceId, DateCreated = DateTime.Now
                };
            }
            else
            {
                deviceConfig = resultDeviceConfigQuery.Contents[0];
            }
            deviceConfig.ApplicationName                     = "CarTracker.Mobile.exe";
            deviceConfig.ApplicationWebServiceURL            = "http://169.254.2.2/CarTracker.Web.Service/Service.asmx";
            deviceConfig.ApplicationReplicationWebServiceURL = "http://169.254.2.2/CarTrackerMobileSync/sqlcesa35.dll";
            deviceConfig.ClientConfigWebServiceURL           = "http://169.254.2.2/Figlut.Web.Service/Service.asmx";
            deviceConfig.LicenseExpiryDate                   = licenseExpiryDate;
            deviceConfig.CustomerId = customer.CustomerId;

            ServiceProcedureResult resultDeviceConfig = GlobalDataCache.Instance.Service.SaveDeviceConfig(
                new DeviceConfig[] { deviceConfig },
                GlobalDataCache.Instance.CurrentUser,
                false);

            if (resultDeviceConfig.Code != ServiceResultCode.Success)
            {
                throw new Exception(resultDeviceConfig.Message);
            }
            Console.WriteLine("done.");
        }
Example #3
0
        private static void ApproveDevicePendingApprovalCabster(string deviceId, string applicationName, string companyName)
        {
            Console.Write("Approving device pending approval for Figlut Cabster... ");
            DateTime licenseExpiryDate   = DateTime.Now.Add(new TimeSpan(365, 0, 0, 0));
            string   FiglutWebServiceURL = "http://184.22.83.112/Figlut.Web.Service/Service.asmx";
            ServiceFunctionResultOfListOfCustomer resultCustomer = GlobalDataCache.Instance.Service.GetCustomerByField(
                EntityReader <Customer> .GetPropertyName(p => p.CompanyName, false),
                companyName,
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (resultCustomer.Code != ServiceResultCode.Success)
            {
                throw new Exception(resultCustomer.Message);
            }
            Customer customer = resultCustomer.Contents[0];
            ServiceProcedureResult approvalResult = GlobalDataCache.Instance.Service.ApproveDevicePendingApproval(
                deviceId,
                applicationName,
                null,
                null,
                FiglutWebServiceURL,
                365,
                customer,
                GlobalDataCache.Instance.CurrentUser);

            if (approvalResult.Code != ServiceResultCode.Success)
            {
                throw new Exception(approvalResult.Message);
            }
            Console.WriteLine("done");
        }
Example #4
0
        private static void ApproveDevicePendingApprovalTripInspection(string deviceId, string applicationName, string companyName)
        {
            Console.Write("Approving device pending approval for Trip Inspection... ");
            string applicationWebServiceURL            = "http://www.r2mslive.co.za/R2MSWebService/BulkUpload.asmx";
            string applicationReplicationWebServiceURL = "http://41.86.108.77/CarTrackerMobileSync/sqlcesa35.dll";
            string FiglutWebServiceURL = "http://184.22.83.112/Figlut.Web.Service/Service.asmx";
            ServiceFunctionResultOfListOfCustomer resultCustomer = GlobalDataCache.Instance.Service.GetCustomerByField(
                EntityReader <Customer> .GetPropertyName(p => p.CompanyName, false),
                companyName,
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (resultCustomer.Code != ServiceResultCode.Success)
            {
                throw new Exception(resultCustomer.Message);
            }
            Customer customer = resultCustomer.Contents[0];
            ServiceProcedureResult approvalResult = GlobalDataCache.Instance.Service.ApproveDevicePendingApproval(
                deviceId,
                applicationName,
                applicationWebServiceURL,
                applicationReplicationWebServiceURL,
                FiglutWebServiceURL,
                30,
                customer,
                GlobalDataCache.Instance.CurrentUser);

            if (approvalResult.Code != ServiceResultCode.Success)
            {
                throw new Exception(approvalResult.Message);
            }
            Console.WriteLine("done");
        }
        public bool SaveToServer()
        {
            ServiceProcedureResult result = GlobalDataCache.Instance.Service.SaveGlobalVariable(
                _globalVariables.Values.ToArray(),
                GlobalDataCache.Instance.CurrentUser,
                false);

            if (ServiceResultHandler.HandleServiceResult(result))
            {
                return(true);
            }
            return(false);
        }
Example #6
0
        private void mnuApprove_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtDeviceId.Text))
            {
                txtDeviceId.Focus();
                throw new UserThrownException("Device id may not be left empty.", false, true, false);
            }
            if (string.IsNullOrEmpty(txtApplicationName.Text))
            {
                txtApplicationName.Focus();
                throw new UserThrownException("Application Name may not be left empty.", false, true, false);
            }
            if (_selectedCustomer == null)
            {
                btnSelectCustomer.Focus();
                throw new UserThrownException("Customer not selected.", false, true, false);
            }
            string originalStatus = Status;

            try
            {
                using (WaitCursor w = new WaitCursor())
                {
                    Status = "Approving device ...";
                    ServiceProcedureResult result = GlobalDataCache.Instance.Service.ApproveDevicePendingApproval(
                        txtDeviceId.Text,
                        txtApplicationName.Text,
                        txtApplicationWebServiceURL.Text,
                        txtApplicationReplicationWebServiceURL.Text,
                        txtFiglutWebServiceURL.Text,
                        Convert.ToInt32(nudDaysToActivate.Value),
                        _selectedCustomer,
                        GlobalDataCache.Instance.CurrentUser);
                    if (ServiceResultHandler.HandleServiceResult(result))
                    {
                        return;
                    }
                }
                UIHelper.DisplayInformation(string.Format("Device {0} approved.", txtDeviceId.Text));
                this.DialogResult = DialogResult.OK;
                Close();
            }
            finally
            {
                if (Status != originalStatus)
                {
                    Status = originalStatus;
                }
            }
        }
Example #7
0
        private static void ApproveDevicePendingApprovalVisitUs(string deviceId, string applicationName, string companyName)
        {
            Console.Write("Approving device pending approval for Visit Us... ");
            //string applicationWebServiceURL = "http://41.86.108.77/PebbleRock.CarTracker.Web.Service/Service.asmx";
            //string applicationReplicationWebServiceURL = "http://41.86.108.77/PebbleRockMobileSync/sqlcesa35.dll";
            //string applicationWebServiceURL = "http://41.86.108.77/Caribbean.CarTracker.Web.Service/Service.asmx";
            //string applicationReplicationWebServiceURL = "http://41.86.108.77/CaribbeanRockMobileSync/sqlcesa35.dll";

            //string applicationWebServiceURL = "http://41.86.108.77/Monaghan.VisitUs.Web.Service/Service.asmx";
            //string applicationReplicationWebServiceURL = null;
            //string FiglutWebServiceURL = "http://41.76.214.230/Figlut.Web.Service/Service.asmx";

            //string applicationWebServiceURL = "http://41.86.108.77/EcoPark.CarTracker.Web.Service/Service.asmx";
            //string applicationReplicationWebServiceURL = "http://41.86.108.77/EcoPark.CarTracker.Web.Service/SyncService.svc";
            //string FiglutWebServiceURL = "http://184.22.83.112/Figlut.Web.Service/Service.asmx";

            string applicationWebServiceURL            = "http://41.86.108.77/Dainfern.CarTracker.Web.Service/Service.asmx";
            string applicationReplicationWebServiceURL = "http://41.86.108.77/Dainfern.CarTracker.Web.Service/SyncService.svc";
            string FiglutWebServiceURL = "http://41.76.214.230/Figlut.Web.Service/Service.asmx";

            ServiceFunctionResultOfListOfCustomer resultCustomer = GlobalDataCache.Instance.Service.GetCustomerByField(
                EntityReader <Customer> .GetPropertyName(p => p.CompanyName, false),
                companyName,
                false,
                GlobalDataCache.Instance.CurrentUser);

            if (resultCustomer.Code != ServiceResultCode.Success)
            {
                throw new Exception(resultCustomer.Message);
            }
            Customer customer = resultCustomer.Contents[0];
            ServiceProcedureResult approvalResult = GlobalDataCache.Instance.Service.ApproveDevicePendingApproval(
                deviceId,
                applicationName,
                applicationWebServiceURL,
                applicationReplicationWebServiceURL,
                FiglutWebServiceURL,
                730,
                customer,
                GlobalDataCache.Instance.CurrentUser);

            if (approvalResult.Code != ServiceResultCode.Success)
            {
                throw new Exception(approvalResult.Message);
            }
            Console.WriteLine("done");
        }
Example #8
0
        private static void CreateCustomer(string customerName)
        {
            Console.Write("Saving customer ... ");
            Customer customer = new Customer()
            {
                CustomerId  = Guid.NewGuid(),
                CompanyName = customerName,
                DateCreated = DateTime.Now
            };
            ServiceProcedureResult result = GlobalDataCache.Instance.Service.SaveCustomer(new Customer[] { customer }, GlobalDataCache.Instance.CurrentUser, false);

            if (result.Code != ServiceResultCode.Success)
            {
                throw new Exception(result.Message);
            }
            Console.WriteLine("done.");
        }
Example #9
0
        private static void SaveUser()
        {
            Console.Write("Saving user ... ");
            User user = new User()
            {
                UserId      = Guid.NewGuid(),
                UserName    = "******",
                Password    = "******",
                RoleId      = 7,
                Name        = "Paul",
                Surname     = "Kolozsvari",
                Email       = "*****@*****.**",
                DateCreated = DateTime.Now,
                Phone       = "0833958283"
            };
            ServiceProcedureResult result = GlobalDataCache.Instance.Service.SaveUser(new User[] { user }, GlobalDataCache.Instance.CurrentUser, false);

            if (result.Code != ServiceResultCode.Success)
            {
                throw new Exception(result.Message);
            }
            Console.WriteLine("done.");
        }