Beispiel #1
0
 private async void cbShowImages_CheckedChanged(object sender, EventArgs e)
 {
     if (cbShowImages.Checked)
     {
         if (SummaryItems != null)
         {
             if (SummaryItems.Count() > 0)
             {
                 await Spinner.ShowSpinnerAsync(this, ShowImage());
             }
             else
             {
                 return;
             }
         }
         else
         {
             return;
         }
     }
     else
     {
         dgDetailedTransaction.Columns[dtlEntranceImage.Index].Visible = false;
         dgDetailedTransaction.Columns[dtlExitImage.Index].Visible     = false;
         HideImage();
     }
 }
        public int GetMarketVolume()
        {
            var models = SummaryItems.Where(s => !s.ModelId.HasValue && !s.FdpModelId.HasValue);
            var rawTakeRateSummaryItems = models as IList <RawTakeRateSummaryItem> ?? models.ToList();

            return(rawTakeRateSummaryItems.Any() ? rawTakeRateSummaryItems.Sum(s => s.Volume) : 0);
        }
Beispiel #3
0
        public async Task getProviderList()
        {
            var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getProviderListURL(), this);

            clsResponse provider_response = JsonConvert.DeserializeObject <clsResponse>(content);

            if (provider_response.IsGood)
            {
                var providers = JObject.Parse(content)["Result"].ToObject <List <clsProvider> >();

                App.Database.deleteRecords("ProviderList");
                App.Database.deleteRecordSummary("ProviderList");

                foreach (clsProvider provider in providers)
                {
                    ListItems menu = new ListItems();
                    menu.Id       = provider.Code;
                    menu.Name     = provider.Name;
                    menu.Category = "ProviderList";
                    App.Database.SaveMenuAsync(menu);

                    SummaryItems summaryItem = new SummaryItems();
                    summaryItem.Id      = provider.Code;
                    summaryItem.Name    = provider.Name;
                    summaryItem.Type    = "ProviderList";
                    summaryItem.Caption = "";
                    summaryItem.Value   = provider.Name;
                    summaryItem.Display = true;

                    App.Database.SaveSummarysAsync(summaryItem);
                }
                LoadProviderList();
            }
        }
Beispiel #4
0
        private async Task ShowImage()
        {
            dgDetailedTransaction.Columns[dtlEntranceImage.Index].Visible = true;
            dgDetailedTransaction.Columns[dtlExitImage.Index].Visible     = true;
            if (dgDetailedTransaction.Rows.Count > 0)
            {
                for (int i = 0; i <= dgDetailedTransaction.Rows.Count - 1; i++)
                {
                    await Task.Run(() =>
                    {
                        var item = SummaryItems.FirstOrDefault(a => a.TransitId.ToString() == dgDetailedTransaction[dtlTransitId.Index, i].Value.ToString());
                        dgDetailedTransaction.Columns[dtlEntranceImage.Index].Width = 250;
                        dgDetailedTransaction.Columns[dtlExitImage.Index].Width     = 250;

                        if (item.EntranceImage != null)
                        {
                            var entranceImage = ImageHelper.ConvertByteToImageWithResizing(item.EntranceImage);
                            var col           = new DataGridViewImageCell();
                            col.Value         = entranceImage;
                            col.ImageLayout   = DataGridViewImageCellLayout.Stretch;
                            dgDetailedTransaction[dtlEntranceImage.Index, i]          = col;
                            dgDetailedTransaction.Rows[i].Height                      = 250;
                            dgDetailedTransaction[dtlEntranceImage.Index, i].ReadOnly = true;
                        }
                        else
                        {
                            var col   = new DataGridViewTextBoxCell();
                            col.Value = string.Empty;

                            dgDetailedTransaction[dtlEntranceImage.Index, i]          = col;
                            dgDetailedTransaction.Rows[i].Height                      = 24;
                            dgDetailedTransaction[dtlEntranceImage.Index, i].ReadOnly = true;
                        }

                        if (item.ExitImage != null)
                        {
                            var image       = ImageHelper.ConvertByteToImageWithResizing(item.ExitImage);
                            var col         = new DataGridViewImageCell();
                            col.Value       = image;
                            col.ImageLayout = DataGridViewImageCellLayout.Stretch;
                            dgDetailedTransaction[dtlExitImage.Index, i]          = col;
                            dgDetailedTransaction.Rows[i].Height                  = 250;
                            dgDetailedTransaction[dtlExitImage.Index, i].ReadOnly = true;
                        }
                        else
                        {
                            var col   = new DataGridViewTextBoxCell();
                            col.Value = string.Empty;

                            dgDetailedTransaction[dtlExitImage.Index, i]          = col;
                            dgDetailedTransaction.Rows[i].Height                  = 24;
                            dgDetailedTransaction[dtlExitImage.Index, i].ReadOnly = true;
                        }
                    });
                }
            }
        }
        public async void getCategory()
        {
            var content = await CommonFunction.CallWebService(0,null,Ultis.Settings.SessionBaseURI, ControllerUtil.getCategoryListURL(providerCode),this);
            clsResponse provider_response = JsonConvert.DeserializeObject<clsResponse>(content);

            if (provider_response.IsGood)
            {
                categories = JObject.Parse(content)["Result"].ToObject<List<clsCaptionValue>>();

                App.Database.deleteRecords("Category");
                App.Database.deleteRecordSummary("Category");

                foreach (clsCaptionValue category in categories)
                {
                    ListItems menu = new ListItems();
                    menu.Id = category.Caption;
                    menu.Name = category.Value;
                    menu.Category = "Category";
                    App.Database.SaveMenuAsync(menu);

                    SummaryItems summaryItem = new SummaryItems();
                    summaryItem.Id = category.Caption;
                    summaryItem.Caption = "";
                    summaryItem.Value = category.Value;
                    summaryItem.Display = category.Display;
                    summaryItem.Type = "Category";
                    summaryItem.BackColor = "";
                    App.Database.SaveSummarysAsync(summaryItem);

                   /* string quantity = new String(category.Value.Where(Char.IsDigit).ToArray());
                    string[] name = category.Value.Split('(');

                    TrackingCategory trackingCategory = new TrackingCategory();
                    trackingCategory.CategoryCode = category.Caption;
                    trackingCategory.Name = name[0];
                    trackingCategory.Amount = Convert.ToInt32(quantity);

                    pieData.Add(trackingCategory);*/
                }

               /* bar.ItemsSource = pieData;
                bar.XBindingPath = "Name";
                bar.YBindingPath = "Amount";


                activityIndicator.IsEnabled = false;
                activityIndicator.IsVisible = false;
                activityIndicator.IsRunning = false;*/

                 loadCateogoryList();
            }
            else
            {
                await DisplayAlert("JsonError", provider_response.Message, "OK");
            }
        }
Beispiel #6
0
 public void FullLoad(string filename)
 {
     OpenDatbase(filename);
     LoadChapters();
     LoadIntros();
     LoadSummary();
     FilteredIntros    = IntroItems.ToList();
     FilteredSummaries = SummaryItems.ToList();
     FilteredChapters  = ChapterItems.ToList();
 }
Beispiel #7
0
        /// end intros
        /////load summary
        public void LoadSummary()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            bool shouldClose = false;

            // Is the database already open?
            if (conn.State != ConnectionState.Open)
            {
                shouldClose = true;
                conn.Open();
            }

            // Execute query
            using (var command = conn.CreateCommand())
            {
                // Create new command
                command.CommandText = "SELECT Id,Chapters,Summary FROM [tblSummaries]";
                try
                {
                    //await DataStore.GetItemsAsync(true);
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            SummaryRead item = new SummaryRead();
                            // Pull values back into class
                            item.Id       = Convert.ToString(reader[0]);
                            item.Chapters = Convert.ToString(reader[1]);
                            item.Summary  = Convert.ToString(reader[2]);
                            SummaryItems.Add(item);
                        }
                    }
                }

                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
                finally
                {
                    IsBusy = false;
                }
            }
            // Should we close the connection to the database
            if (shouldClose)
            {
                conn.Close();
            }
        }
Beispiel #8
0
 public int SaveSummarysAsync(SummaryItems item)
 {
     if (item.tableID != 0)
     {
         return(database.Update(item));
     }
     else
     {
         return(database.Insert(item));
     }
 }
        private void InitializeSupportedPriorityColumns()
        {
            SupportedPriorityColumns = new SortedSet <int>();

            SummaryItems.ForEach(item =>
                                 item.TestsByPriority.ForEach(testsByPriorityVm =>
            {
                if (testsByPriorityVm.Priority <= EmailReportConstants.MaxSupportedPriority)
                {
                    SupportedPriorityColumns.Add(testsByPriorityVm.Priority);
                }
            })
                                 );
        }
        public string Build(string sessionId)
        {
            XNamespace ns    = "services.nhsd.messages";
            XNamespace empty = "";

            var body = new XElement(ns + "SubmitHaSCToService",
                                    new XElement(empty + "Authentication",
                                                 new XElement("Username", Username),
                                                 new XElement("Password", Password)
                                                 ),
                                    new XElement(empty + "SubmitEncounterToServiceRequest",
                                                 new XElement("CaseDetails",
                                                              new XElement("ExternalReference", ExternalReference),
                                                              new XElement("DispositionCode", DispositionCode),
                                                              new XElement("DispositionName", DispositionName),
                                                              new XElement("CaseSummary",
                                                                           SummaryItems.Select(summaryItem => summaryItem.AsXElement())
                                                                           ),
                                                              new XElement("Provider", Provider)
                                                              ),
                                                 new XElement("PatientDetails",
                                                              new XElement("Forename", Forename),
                                                              new XElement("Surname", Surname),
                                                              new XElement("DateOfBirth",
                                                                           new XElement("dateOfBirth", DateOfBirth)
                                                                           ),
                                                              new XElement("Gender", Gender),
                                                              new XElement("InformantType", InformantType),
                                                              new XElement("CurrentAddress",
                                                                           CurrentAddress.AsXElements()
                                                                           ),
                                                              new XElement("HomeAddress",
                                                                           HomeAddress.AsXElements()
                                                                           ),
                                                              new XElement("TelephoneNumber", TelephoneNumber)
                                                              ),
                                                 ServiceDetails.AsXElement(),
                                                 new XElement("SendToRepeatCaller", SendToRepeatCaller.ToString())
                                                 )
                                    );

            var soapMsg = string.Format(@"<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><soap:Body>{0}</soap:Body></soap:Envelope>", body);

            _cacheManager.Set(sessionId, soapMsg);
            return(soapMsg);
        }
        private IEnumerable <RawTakeRateDataItem> ListFeaturesWithVolumeGreaterThanModel()
        {
            var features = new List <RawTakeRateDataItem>();

            foreach (var dataItem in DataItems)
            {
                var modelVolume = dataItem.ModelId.HasValue
                    ? SummaryItems.First(m => m.ModelId == dataItem.ModelId).Volume
                    : SummaryItems.First(m => m.FdpModelId == dataItem.FdpModelId).Volume;

                if (dataItem.Volume > modelVolume)
                {
                    features.Add(dataItem);
                }
            }
            return(features);
        }
        public async void refreshMainPage()
        {
            var context_content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getDownloadMenuURL(), this);

            clsResponse context_return = JsonConvert.DeserializeObject <clsResponse>(context_content);

            var contextMenuItems = JObject.Parse(context_content)["Result"].ToObject <clsLogin>();

            foreach (clsDataRow contextMenu in contextMenuItems.ContextMenu)
            {
                List <SummaryItems> existingSummaryItems = App.Database.GetSummarysAsync(contextMenu.Id, "ContextMenu");

                int index = 0;
                foreach (clsCaptionValue summaryList in contextMenu.Summary)
                {
                    SummaryItems summaryItem = null;
                    if (index < existingSummaryItems.Capacity)
                    {
                        summaryItem = existingSummaryItems.ElementAt(index);
                    }

                    if (summaryItem == null)
                    {
                        summaryItem = new SummaryItems();
                    }

                    summaryItem.Id      = contextMenu.Id;
                    summaryItem.Caption = summaryList.Caption;
                    summaryItem.Value   = summaryList.Value;
                    summaryItem.Display = summaryList.Display;
                    summaryItem.Type    = "ContextMenu";
                    App.Database.SaveSummarysAsync(summaryItem);
                    index++;
                }

                if (existingSummaryItems != null)
                {
                    for (; index < existingSummaryItems.Count; index++)
                    {
                        App.Database.DeleteSummaryItem(existingSummaryItems.ElementAt(index));
                    }
                }
            }

            Application.Current.MainPage = new MainPage();
        }
        public CategorySummary(CategoryTreeNode root, List<Expenses> expenses)
        {
            Category = root.Value;
            ExpensesCost = expenses.Sum(x => x.TotalPrice);

            decimal catCostSum = expenses.Where(x => x.CategoryId == root.Value.Id).Sum(x => x.TotalPrice);
            TryAddSummaryItem(catCostSum, root.Value.Name);

            if (root.Childs != null)
            {
                foreach (var child in root.Childs)
                {
                    List<int> childAndSubchildsCatIds = child.ToList().Select(x => x.Id).ToList();
                    catCostSum = expenses.Where(x => childAndSubchildsCatIds.Contains(x.CategoryId)).Sum(x => x.TotalPrice);

                    TryAddSummaryItem(catCostSum, child.Value.Name);
                }
            }

            SummaryItems = SummaryItems.OrderByDescending(x => x.Value).ToList();
            CalculatePercentages();
        }
        public static void StoreData(string content, string action)
        {
            List <clsBusTicket> stops = JObject.Parse(content)["Result"].ToObject <List <clsBusTicket> >();

            App.Database.deleteRecords(action);
            App.Database.deleteRecordSummary(action);

            foreach (clsBusTicket stop in stops)
            {
                ListItems items = new ListItems
                {
                    StopId   = stop.StopId,
                    StopName = stop.StopName,
                    Rate     = stop.Rate,
                    Category = action
                };

                App.Database.SaveMenuAsync(items);

                foreach (ListItems station in stop.Stops)
                {
                    SummaryItems summaryItem = new SummaryItems
                    {
                        Id        = stop.StopId,
                        StopId    = station.StopId,
                        StopName  = station.StopName,
                        Rate      = station.Rate,
                        BackColor = "#ffffff"
                    };
                    summaryItem.Type = action;


                    App.Database.SaveSummarysAsync(summaryItem);
                }
            }
        }
Beispiel #15
0
        public async void downloadRunSheet(string date)
        {
            try
            {
                activityIndicator.IsRunning = true;
                firstLoad   = false;
                CurrentPage = Children[1];

                string url = (runSheetItem.Id == "RunSheet") ? ControllerUtil.getDownloadHaulageHistoryURL(date) : ControllerUtil.getBusTripHistory(date);

                var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, url, this);

                clsResponse json_response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (json_response.IsGood == true)
                {
                    switch (option)
                    {
                    case "previous":
                        datePicker.Date = datePicker.Date.AddDays(-1);
                        break;

                    case "next":
                        datePicker.Date = datePicker.Date.AddDays(1);
                        break;

                    case "none":
                        break;
                    }

                    history = JObject.Parse(content)["Result"].ToObject <List <clsHaulageModel> >();

                    App.Database.deleteRecords(runSheetItem.Id);
                    App.Database.deleteRecordSummary(runSheetItem.Id);
                    //App.Database.deleteHaulage("HaulageHistory");
                    if (history != null)
                    {
                        foreach (clsHaulageModel data in history)
                        {
                            ListItems record = new ListItems
                            {
                                Id             = data.Id,
                                Background     = data.BackColor,
                                Category       = runSheetItem.Id,
                                Name           = runSheetItem.Name,
                                TruckId        = data.TruckId,
                                ReqSign        = data.ReqSign,
                                Latitude       = data.Latitude,
                                Longitude      = data.Longitude,
                                TelNo          = data.TelNo,
                                EventRecordId  = data.EventRecordId,
                                TrailerId      = data.TrailerId,
                                ContainerNo    = data.ContainerNo,
                                MaxGrossWeight = data.MaxGrossWeight,
                                TareWeight     = data.TareWeight,
                                CollectSeal    = data.CollectSeal,
                                SealNo         = data.SealNo,
                                ActionId       = data.ActionId.ToString(),
                                ActionMessage  = data.ActionMessage,
                                Title          = data.Title,
                                SealMode       = data.SealMode
                            };

                            App.Database.SaveMenuAsync(record);

                            foreach (clsCaptionValue summaryList in data.Summary)
                            {
                                SummaryItems summaryItem = new SummaryItems();

                                summaryItem.Id        = data.Id;
                                summaryItem.Caption   = summaryList.Caption;
                                summaryItem.Value     = summaryList.Value;
                                summaryItem.Display   = summaryList.Display;
                                summaryItem.Type      = runSheetItem.Id;
                                summaryItem.BackColor = data.BackColor;
                                App.Database.SaveSummarysAsync(summaryItem);
                            }
                        }

                        option = "none";
                    }

                    refreshRunSheetHistory();
                }
            }
            catch (Exception exception)
            {
                await DisplayAlert("Error", exception.Message, "OK");
            }
        }
        public override IMovilwayApiResponse PerformKinacuOperation(IMovilwayApiRequest requestObject, SaleInterface kinacuWS, string sessionID)
        {
            if (sessionID.Equals("0"))
            {
                return new GetSalesSummaryResponseBody()
                       {
                           ResponseCode    = 90,
                           ResponseMessage = "error session",
                           TransactionID   = 0,
                           FinalAmount     = 0m,
                           InitialAmount   = 0m,
                           Summaries       = new SummaryItems(),
                           SummaryDate     = DateTime.Now
                       }
            }
            ;

            GetSalesSummaryReportRequestBody request = requestObject as GetSalesSummaryReportRequestBody;

            if (request.InitialDate > request.EndDate)
            {
                // logger.InfoLow(() => TagValue.New().Message("RANGO DE FECHAS INVALIDO"));
                return(new GetSalesSummaryResponseBody()
                {
                    ResponseCode = 90,
                    ResponseMessage = "RANGO DE FECHAS INVALIDO",
                    TransactionID = 0,
                    FinalAmount = 0m,
                    InitialAmount = 0m,
                    Summaries = new SummaryItems(),
                    SummaryDate = DateTime.Now
                });
            }

            logger.InfoLow(() => TagValue.New().Message("[API] " + base.LOG_PREFIX + "[GetSalesSummaryReport]").Tag("[RCV-DATA] GetSalesSummaryReport ").Value(request));

            GetSalesSummaryResponseBody response = null;

            ManagementInterface managementWS = new ManagementInterface();
            LogisticsInterface  logisticsWS  = new LogisticsInterface();

            string message;

            #region comentario
            //int voucherQtyDownload, retailerId;
            //string retailerName, retailerAddress, retailerLegalId, ticketHeader, currentTime;

            //if (!managementWS.GetRetailerInfo(int.Parse(sessionID), out retailerId, out retailerName, out retailerAddress, out retailerLegalId, out voucherQtyDownload, out ticketHeader, out currentTime, out message))
            //{
            //    return new GetSalesSummaryResponseBody()
            //    {
            //        ResponseCode = 97,
            //        ResponseMessage = message,
            //        Summaries = null,
            //        SummaryDate = request.Date,
            //        TransactionID = new Random().Next(100000, 999999)
            //    };
            //}

            //int userId;
            //long timeOut;
            //string userName, userLastName, userAddress;

            //if (!managementWS.GetUserInfo(int.Parse(sessionID), out userId, out userName, out userLastName, out userAddress, out timeOut, out message))
            //{
            //    return new GetSalesSummaryResponseBody()
            //    {
            //        ResponseCode = 98,
            //        ResponseMessage = message,
            //        Summaries = null,
            //        SummaryDate = request.Date,
            //        TransactionID = new Random().Next(100000, 999999)
            //    };
            //}
            #endregion

            int amount, count;

            if (!kinacuWS.SaleCountBySeller(int.Parse(sessionID), out amount, out count, out message))
            {
                return(new GetSalesSummaryResponseBody()
                {
                    ResponseCode = 99,
                    ResponseMessage = message,
                    Summaries = null,
                    SummaryDate = request.InitialDate,
                    TransactionID = new Random().Next(100000, 999999)
                });
            }

            //long balance = kinacuWS.GetAccountBalance(int.Parse(sessionID), out message);

            SummaryItems summary = new SummaryItems();
            decimal      initialAmount, finalAmount;

            if (request.SummaryType == null || request.SummaryType.Equals(SummaryType.NotSpecified) || request.SummaryType.Equals(SummaryType.ByUser))
            {
                summary  = Utils.SalesSummary(request.AuthenticationData.Username, request.InitialDate, request.EndDate);
                response = new GetSalesSummaryResponseBody()
                {
                    ResponseCode    = 0,
                    ResponseMessage = "OK",
                    Summaries       = summary,

                    //     SummaryDate = DateTime.eM,
                    TransactionID = new Random().Next(100000, 999999)
                };
            }
            else
            {
                summary  = Utils.SalesSummaryByAgent(request.Agent, request.InitialDate, request.EndDate, out initialAmount, out finalAmount);
                response = new GetSalesSummaryResponseBody()
                {
                    ResponseCode    = 0,
                    ResponseMessage = "OK",
                    Summaries       = summary,
                    // SummaryDate = request.InitialDate,
                    TransactionID = new Random().Next(100000, 999999),
                    InitialAmount = initialAmount,
                    FinalAmount   = finalAmount
                };
            }

            //response.Summaries = new SummaryItems();

            //if (request.WalletType == WalletType.Stock)
            //    response.Summaries.Add(new SummaryItem() { TotalAmount = amount / 100m, TransactionCount = count, TransactionType = "Recargas y pines" });
            //else
            //    response.Summaries.Add(new SummaryItem() { TotalAmount = 0, TransactionCount = 0, TransactionType = "Recargas y pines" });
            //  logger.InfoLow(() => TagValue.New().Message("[API] " + base.LOG_PREFIX).Tag("[GetSalesSummaryReport]").Value(response));


            logger.InfoLow(() => TagValue.New().Message("[API] " + base.LOG_PREFIX + "[GetSalesSummaryReportResult]").Tag(" GetSalesSummaries ").Value(response.Summaries.Count));
            return(response);
        }
    }
Beispiel #17
0
 public int DeleteSummaryItem(SummaryItems item)
 {
     return(database.Delete(item));
 }
        public override IMovilwayApiResponse PerformKinacuOperation(IMovilwayApiRequest requestObject, SaleInterface kinacuWS, String sessionID)
        {
            if (sessionID.Equals("0"))
            {
                return new GetSalesSummaryResponseBody()
                       {
                           ResponseCode    = 90,
                           ResponseMessage = "error session",
                           TransactionID   = 0,
                           FinalAmount     = 0m,
                           InitialAmount   = 0m,
                           Summaries       = new SummaryItems(),
                           SummaryDate     = DateTime.Now
                       }
            }
            ;

            GetSalesSummaryRequestBody  request  = requestObject as GetSalesSummaryRequestBody;
            GetSalesSummaryResponseBody response = null;

            ManagementInterface managementWS = new ManagementInterface();
            LogisticsInterface  logisticsWS  = new LogisticsInterface();

            string message;

            #region comentario
            //int voucherQtyDownload, retailerId;
            //string retailerName, retailerAddress, retailerLegalId, ticketHeader, currentTime;

            //if (!managementWS.GetRetailerInfo(int.Parse(sessionID), out retailerId, out retailerName, out retailerAddress, out retailerLegalId, out voucherQtyDownload, out ticketHeader, out currentTime, out message))
            //{
            //    return new GetSalesSummaryResponseBody()
            //    {
            //        ResponseCode = 97,
            //        ResponseMessage = message,
            //        Summaries = null,
            //        SummaryDate = request.Date,
            //        TransactionID = new Random().Next(100000, 999999)
            //    };
            //}

            //int userId;
            //long timeOut;
            //string userName, userLastName, userAddress;

            //if (!managementWS.GetUserInfo(int.Parse(sessionID), out userId, out userName, out userLastName, out userAddress, out timeOut, out message))
            //{
            //    return new GetSalesSummaryResponseBody()
            //    {
            //        ResponseCode = 98,
            //        ResponseMessage = message,
            //        Summaries = null,
            //        SummaryDate = request.Date,
            //        TransactionID = new Random().Next(100000, 999999)
            //    };
            //}
            #endregion

            /* Se comenta porque no hace nada (sólo reventar en caso de overflow
             * int amount, count;
             *
             * if (!kinacuWS.SaleCountBySeller(int.Parse(sessionID), out amount, out count, out message))
             * {
             *   return new GetSalesSummaryResponseBody()
             *   {
             *       ResponseCode = 99,
             *       ResponseMessage = message,
             *       Summaries = null,
             *       SummaryDate = request.Date,
             *       TransactionID = new Random().Next(100000, 999999)
             *   };
             * }*/

            //long balance = kinacuWS.GetAccountBalance(int.Parse(sessionID), out message);

            SummaryItems summary = new SummaryItems();
            decimal      initialAmount, finalAmount;

            if (request.SummaryType == null || request.SummaryType.Equals(SummaryType.NotSpecified) || request.SummaryType.Equals(SummaryType.ByUser))
            {
                summary = Utils.SalesSummary(request.AuthenticationData.Username, request.Date);

                response = new GetSalesSummaryResponseBody()
                {
                    ResponseCode    = 0,
                    ResponseMessage = "OK",
                    Summaries       = summary,
                    SummaryDate     = request.Date,
                    TransactionID   = new Random().Next(100000, 999999)
                };
            }
            else
            {
                summary  = Utils.SalesSummaryByAgent(request.AuthenticationData.Username, request.Date, out initialAmount, out finalAmount);
                response = new GetSalesSummaryResponseBody()
                {
                    ResponseCode    = 0,
                    ResponseMessage = "OK",
                    Summaries       = summary,
                    SummaryDate     = request.Date,
                    TransactionID   = new Random().Next(100000, 999999),
                    InitialAmount   = initialAmount,
                    FinalAmount     = finalAmount
                };
            }


            // Asignar Nombre de agencia y fecha de impresion
            if (response != null)
            {
                response.BranchName  = Utils.GetAgentName(request.AuthenticationData.Username);
                response.DatePrinter = Utils.GetLocalTimeZone().ToString("yyyy-MM-dd HH:mm:ss");
            }


            //response.Summaries = new SummaryItems();

            //if (request.WalletType == WalletType.Stock)
            //    response.Summaries.Add(new SummaryItem() { TotalAmount = amount / 100m, TransactionCount = count, TransactionType = "Recargas y pines" });
            //else
            //    response.Summaries.Add(new SummaryItem() { TotalAmount = 0, TransactionCount = 0, TransactionType = "Recargas y pines" });
            logger.InfoLow(() => TagValue.New().Message("[API] " + base.LOG_PREFIX + "[GetSalessSummaryResult]").Tag(" GetSalesSummaries ").Value(response.Summaries.Count));
            return(response);
        }
    }
        public int GetFdpModelVolume(int?fdpModelId)
        {
            var model = SummaryItems.FirstOrDefault(s => s.FdpModelId == fdpModelId);

            return(model != null ? model.Volume : 0);
        }
        async void GetListData()
        {
            loading.IsVisible = true;
            try
            {
                overloadRecord.Clear();
                var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, uri, this);

                clsResponse response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (response.IsGood == true)
                {
                    App.Database.deleteRecords(menuItems.Id);
                    App.Database.deleteRecordSummary(menuItems.Id);
                    App.Database.deleteRecordDetails();

                    //clsHaulageModel inherit clsDataRow
                    records = JObject.Parse(content)["Result"].ToObject <List <clsHaulageModel> >();

                    foreach (clsHaulageModel data in records)
                    {
                        Guid      objectID = Guid.NewGuid();
                        ListItems record   = new ListItems
                        {
                            Id         = (menuItems.Id == "PendingCollection") ? objectID.ToString() : data.Id,
                            Background = (!(String.IsNullOrEmpty(data.BackColor))) ? data.BackColor : "#ffffff",
                            Category   = menuItems.Id,
                            Name       = menuItems.Name,
                            Action     = data.Action
                        };

                        if (menuItems.Id == "JobList")
                        {
                            record.TruckId        = data.TruckId;
                            record.ReqSign        = data.ReqSign;
                            record.Latitude       = data.Latitude;
                            record.Longitude      = data.Longitude;
                            record.TelNo          = data.TelNo;
                            record.EventRecordId  = data.EventRecordId;
                            record.TrailerId      = data.TrailerId;
                            record.ContainerNo    = data.ContainerNo;
                            record.MaxGrossWeight = data.MaxGrossWeight;
                            record.TareWeight     = data.TareWeight;
                            record.CollectSeal    = data.CollectSeal;
                            record.SealNo         = data.SealNo;
                            record.ActionId       = data.ActionId.ToString();
                            record.ActionMessage  = data.ActionMessage;
                            record.Title          = data.Title;
                            record.SealMode       = data.SealMode;
                        }

                        //store summary of the record for search
                        string summary = "", closingTime = "";
                        int    count = 0;
                        foreach (clsCaptionValue summaryItem in data.Summary)
                        {
                            count++;

                            if (summaryItem.Caption == "Closing Date")
                            {
                                closingTime = summaryItem.Value.Replace('-', '/');
                            }
                            else if (!(String.IsNullOrEmpty(summaryItem.Caption)))
                            {
                                if (count == data.Summary.Count)
                                {
                                    summary += summaryItem.Caption + " :  " + summaryItem.Value;
                                }
                                else
                                {
                                    summary += summaryItem.Caption + " :  " + summaryItem.Value + "\r\n" + "\r\n";
                                }
                            }
                            else if (summaryItem.Caption == "")
                            {
                                if (!(String.IsNullOrEmpty(summaryItem.Value)))
                                {
                                    summary += summaryItem.Value + "\r\n" + "\r\n";
                                }
                            }
                        }

                        record.Summary     = summary;
                        record.ClosingDate = (String.IsNullOrEmpty(closingTime)) ? DateTime.Now : DateTime.Parse(closingTime);

                        if (records.Count < 50)
                        {
                            App.Database.SaveMenuAsync(record);

                            foreach (clsCaptionValue summaryList in data.Summary)
                            {
                                SummaryItems summaryItem = new SummaryItems();

                                summaryItem.Id        = (menuItems.Id == "PendingCollection") ? objectID.ToString() : data.Id;
                                summaryItem.Caption   = summaryList.Caption;
                                summaryItem.Value     = summaryList.Value;
                                summaryItem.Display   = summaryList.Display;
                                summaryItem.Type      = menuItems.Id;
                                summaryItem.BackColor = data.BackColor;
                                App.Database.SaveSummarysAsync(summaryItem);
                            }

                            foreach (clsCaptionValue detailList in data.Details)
                            {
                                DetailItems detailItem = new DetailItems();
                                detailItem.Id      = data.Id;
                                detailItem.Caption = detailList.Caption;
                                detailItem.Value   = detailList.Value;
                                detailItem.Display = detailList.Display;
                                App.Database.SaveDetailsAsync(detailItem);
                            }
                        }
                        else
                        {
                            overloadRecord.Add(record);
                        }
                    }

                    if (records.Count < 50)
                    {
                        LoadListData();
                    }
                    else
                    {
                        listView.ItemsSource = overloadRecord;
                    }

                    listView.IsRefreshing = false;
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }

            loading.IsVisible = false;
        }
        public async void DownloadLogo()
        {
            try
            {
                encryptedUserId   = System.Net.WebUtility.UrlEncode(clsCommonFunc.AES_Encrypt(userIDEntry.Text));
                encryptedPassword = System.Net.WebUtility.UrlEncode(clsCommonFunc.AES_Encrypt(passwordEntry.Text));

                var client = new HttpClient();
                client.BaseAddress = new Uri(Ultis.Settings.SessionBaseURI);
                var uri      = ControllerUtil.getLoginURL(encryptedUserId, encryptedPassword);
                var response = await client.GetAsync(uri);

                var content = await response.Content.ReadAsStringAsync();

                Debug.WriteLine(content);
                clsResponse login_response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (login_response.IsGood == true)
                {
                    activityIndicator.IsRunning = false;
                    //save user equipment into db and which use to display it on list for user to choose (similar to auto complete)

                    var login_user = JObject.Parse(content)["Result"].ToObject <clsLogin>();

                    foreach (clsDataRow contextMenu in login_user.ContextMenu)
                    {
                        List <SummaryItems> existingSummaryItems = App.Database.GetSummarysAsync(contextMenu.Id, "ContextMenu");

                        int index = 0;
                        foreach (clsCaptionValue summaryList in contextMenu.Summary)
                        {
                            SummaryItems summaryItem = null;
                            if (index < existingSummaryItems.Capacity)
                            {
                                summaryItem = existingSummaryItems.ElementAt(index);
                            }

                            if (summaryItem == null)
                            {
                                summaryItem = new SummaryItems();
                            }

                            summaryItem.Id      = contextMenu.Id;
                            summaryItem.Caption = summaryList.Caption;
                            summaryItem.Value   = summaryList.Value;
                            summaryItem.Display = summaryList.Display;
                            summaryItem.Type    = "ContextMenu";
                            App.Database.SaveSummarysAsync(summaryItem);
                            index++;
                        }

                        if (existingSummaryItems != null)
                        {
                            for (; index < existingSummaryItems.Count; index++)
                            {
                                App.Database.DeleteSummaryItem(existingSummaryItems.ElementAt(index));
                            }
                        }
                    }

                    var userObject = JObject.Parse(content)["Result"].ToObject <UserItem>();
                    //Save user info to constant
                    Ultis.Settings.SessionUserItem   = userObject;
                    Ultis.Settings.SessionUserId     = userIDEntry.Text;
                    Ultis.Settings.SessionSettingKey = System.Net.WebUtility.UrlEncode(login_user.SessionId);


                    if (login_user.Language == 0)
                    {
                        Ultis.Settings.Language = "English";
                    }
                    else
                    {
                        Ultis.Settings.Language = "Malay";
                    }

                    if (login_user.GetLogo || !File.Exists(Ultis.Settings.GetAppLogoFileLocation(userIDEntry.Text)))
                    {
                        var downloadLogoURI = ControllerUtil.getDownloadLogoURL();
                        var logo            = await client.GetAsync(downloadLogoURI);

                        var logo_byte = await logo.Content.ReadAsStringAsync();

                        clsResponse logo_response = JsonConvert.DeserializeObject <clsResponse>(logo_byte);

                        if (logo_response.IsGood)
                        {
                            if (logo_response.Result != null)
                            {
                                byte[] bytes = Convert.FromBase64String(logo_response.Result);
                                File.WriteAllBytes(Ultis.Settings.GetAppLogoFileLocation(), bytes);
                                File.WriteAllBytes(Ultis.Settings.GetAppLogoFileLocation(userIDEntry.Text), bytes);

                                try
                                {
                                    var downloadLogoAckURI = ControllerUtil.getDownloadLogoAcknowledgementURL();
                                    var logoAckResp        = await client.GetAsync(downloadLogoAckURI);
                                }
                                catch (Exception exception)
                                {
                                    await DisplayAlert("Error", exception.Message, "OK");
                                }
                            }
                            else
                            {
                                await DisplayAlert("Download Logo Error", "No image.", "OK");
                            }
                        }
                        else
                        {
                            await DisplayAlert("Download Logo Error", "No image.", "OK");
                        }
                    }
                    else
                    {
                        if (File.Exists(Ultis.Settings.GetAppLogoFileLocation(userIDEntry.Text)))
                        {
                            if (File.Exists(Ultis.Settings.GetAppLogoFileLocation()))
                            {
                                File.Delete(Ultis.Settings.GetAppLogoFileLocation());
                            }
                            File.Copy(Ultis.Settings.GetAppLogoFileLocation(userIDEntry.Text), Ultis.Settings.GetAppLogoFileLocation());
                        }
                    }

                    if (userIDEntry.Text == passwordEntry.Text)
                    {
                        Application.Current.MainPage = new ChangePasswordPage();
                    }
                    else
                    {
                        Application.Current.MainPage = new MainPage();
                    }
                }
                else
                {
                    await DisplayAlert("Error", login_response.Message, "OK");

                    this.activityIndicator.IsRunning = false;
                }
            }
            catch
            {
                //await DisplayAlert("Error", "Please try again", "OK");
            }

            activityIndicator.IsRunning = false;
        }
        async void Login()
        {
            this.activityIndicator.IsRunning = true;

            if (!string.IsNullOrEmpty(usernameEntry.Text) &&
                !string.IsNullOrEmpty(passwordEntry.Text))
            {
                string encryptedUserId   = System.Net.WebUtility.UrlEncode(clsCommonFunc.AES_Encrypt(usernameEntry.Text));
                string encryptedPassword = System.Net.WebUtility.UrlEncode(clsCommonFunc.AES_Encrypt(passwordEntry.Text));
                try
                {
                    var content = (Ultis.Settings.App == "asolute.Mobile.ASOLUTEFLEET") ?
                                  await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getLoginURL(encryptedUserId, encryptedPassword, equipmentEntry.Text), this)
                                    : await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getLoginURL(encryptedUserId, encryptedPassword), this);

                    clsResponse login_response = JsonConvert.DeserializeObject <clsResponse>(content);

                    if (login_response.IsGood)
                    {
                        //save user equipment into db and which use to display it on list for user to choose (similar to auto complete)
                        Ultis.Settings.RefreshListView = "Yes";

                        Ultis.Settings.SessionUserId = usernameEntry.Text;

                        var login_user = JObject.Parse(content)["Result"].ToObject <clsLogin>();

                        foreach (clsDataRow contextMenu in login_user.ContextMenu)
                        {
                            List <SummaryItems> existingSummaryItems = App.Database.GetSummarysAsync(contextMenu.Id, "ContextMenu");

                            int index = 0;
                            foreach (clsCaptionValue summaryList in contextMenu.Summary)
                            {
                                SummaryItems summaryItem = null;
                                if (index < existingSummaryItems.Capacity)
                                {
                                    summaryItem = existingSummaryItems.ElementAt(index);
                                }

                                if (summaryItem == null)
                                {
                                    summaryItem = new SummaryItems();
                                }

                                summaryItem.Id      = contextMenu.Id;
                                summaryItem.Caption = summaryList.Caption;
                                summaryItem.Value   = summaryList.Value;
                                summaryItem.Display = summaryList.Display;
                                summaryItem.Type    = "ContextMenu";
                                App.Database.SaveSummarysAsync(summaryItem);
                                index++;
                            }

                            if (existingSummaryItems != null)
                            {
                                for (; index < existingSummaryItems.Count; index++)
                                {
                                    App.Database.DeleteSummaryItem(existingSummaryItems.ElementAt(index));
                                }
                            }
                        }

                        var userObject = JObject.Parse(content)["Result"].ToObject <UserItem>();
                        //Save user info to constant
                        Ultis.Settings.SessionUserItem   = userObject;
                        Ultis.Settings.SessionSettingKey = System.Net.WebUtility.UrlEncode(login_user.SessionId);

                        if (login_user.Language == 0)
                        {
                            Ultis.Settings.Language = "English";
                        }
                        else
                        {
                            Ultis.Settings.Language = "Malay";
                        }

                        if (login_user.GetLogo || !File.Exists(Ultis.Settings.GetAppLogoFileLocation(usernameEntry.Text)))
                        {
                            var client = new HttpClient();
                            client.BaseAddress = new Uri(Ultis.Settings.SessionBaseURI);
                            var downloadLogoURI = ControllerUtil.getDownloadLogoURL();
                            var logo            = await client.GetAsync(downloadLogoURI);

                            var logo_byte = await logo.Content.ReadAsStringAsync();

                            clsResponse logo_response = JsonConvert.DeserializeObject <clsResponse>(logo_byte);

                            if (logo_response.IsGood)
                            {
                                if (logo_response.Result != null)
                                {
                                    byte[] bytes = Convert.FromBase64String(logo_response.Result);
                                    File.WriteAllBytes(Ultis.Settings.GetAppLogoFileLocation(), bytes);
                                    File.WriteAllBytes(Ultis.Settings.GetAppLogoFileLocation(usernameEntry.Text), bytes);

                                    try
                                    {
                                        var downloadLogoAckURI = ControllerUtil.getDownloadLogoAcknowledgementURL();
                                        var logoAckResp        = await client.GetAsync(downloadLogoAckURI);
                                    }
                                    catch (Exception exception)
                                    {
                                        await DisplayAlert("Error", exception.Message, "OK");
                                    }
                                }
                                else
                                {
                                    await DisplayAlert("Download Logo Error", "No image.", "Ok");
                                }
                            }
                            else
                            {
                                await DisplayAlert("Download Logo Error", "No image.", "Ok");
                            }
                        }
                        else
                        {
                            if (File.Exists(Ultis.Settings.GetAppLogoFileLocation(usernameEntry.Text)))
                            {
                                if (File.Exists(Ultis.Settings.GetAppLogoFileLocation()))
                                {
                                    File.Delete(Ultis.Settings.GetAppLogoFileLocation());
                                }
                                File.Copy(Ultis.Settings.GetAppLogoFileLocation(usernameEntry.Text), Ultis.Settings.GetAppLogoFileLocation());
                            }
                        }


                        // Task.Run(async () => { await BackgroundTask.UploadPendingRecord(); }).Wait();

                        Application.Current.MainPage = new MainPage();
                    }
                }
                catch (HttpRequestException exception)
                {
                    await DisplayAlert("Unable to connect", exception.Message, "Ok");

                    Application.Current.MainPage = new LoginPage();
                }
                catch
                {
                }

                this.activityIndicator.IsRunning = false;
            }
            else
            {
                await DisplayAlert("Login Fail", "Please make sure all fields are complete", "Ok");
            }
            this.activityIndicator.IsRunning = false;
        }
Beispiel #23
0
        async void GetMainMenu()
        {
            try
            {
                var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getDownloadMenuURL(), this);

                clsResponse response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (response.IsGood == true)
                {
                    var menu = JObject.Parse(content)["Result"].ToObject <clsLogin>();
                    Ultis.Settings.SubTitle = menu.SubTitle;
                    title2.Text             = Ultis.Settings.SubTitle;

                    //clear and load value from the menu in json response "CheckList"
                    checkItems.Clear();
                    for (int check = 0; check < response.Result["Checklist"].Count; check++)
                    {
                        string itemKey   = response.Result["Checklist"][check]["Key"];
                        string itemValue = response.Result["Checklist"][check]["Value"];
                        checkItems.Add(new clsKeyValue(itemKey, itemValue));
                    }

                    // clear the db before insert to it to prevent duplicate
                    App.Database.deleteRecords("MainMenu");
                    App.Database.deleteRecordSummary("MainMenu");
                    App.Database.deleteRecordSummary("UserInfo");
                    App.Database.deleteRecordSummary("ContextMenu");
                    foreach (clsDataRow mainMenu in menu.MainMenu)
                    {
                        switch (mainMenu.Id)
                        {
                        //display expiry date info
                        case "Expiry":
                            expiryStack.IsVisible = true;
                            if (expiryGrid.IsVisible == true)
                            {
                                expiryGrid.ColumnDefinitions.Clear();
                            }
                            mainGrid.Children.Add(expiryStack, 0, 2);
                            expiryLabel.Text = mainMenu.Caption;
                            expiryGrid.Children.Clear();

                            int rowIndex = 0, columnIndex = 0;
                            foreach (clsCaptionValue expiryInfo in mainMenu.Summary)
                            {
                                if (expiryInfo.Caption != "")
                                {
                                    expiryGrid.ColumnDefinitions.Add(new ColumnDefinition());
                                    StackLayout expiryInfoStack = new StackLayout
                                    {
                                        BackgroundColor = Color.FromHex(mainMenu.BackColor),
                                        Padding         = new Thickness(0, 10, 0, 10)
                                    };

                                    Label date = new Label
                                    {
                                        Style     = (Xamarin.Forms.Style)Application.Current.Resources["StatsNumberLabel"],
                                        Text      = expiryInfo.Value,
                                        TextColor = Color.FromHex("#696969")
                                    };

                                    Label caption = new Label
                                    {
                                        Style     = (Xamarin.Forms.Style)Application.Current.Resources["StatsCaptionLabel"],
                                        Text      = expiryInfo.Caption,
                                        TextColor = Color.FromHex("#696969")
                                    };

                                    expiryInfoStack.Children.Add(date);
                                    expiryInfoStack.Children.Add(caption);

                                    expiryGrid.Children.Add(expiryInfoStack, columnIndex, rowIndex);
                                    columnIndex++;
                                }
                            }
                            break;

                        default:
                            ListItems mainMenuItems = new ListItems();
                            mainMenuItems.Id       = mainMenu.Id;
                            mainMenuItems.Name     = mainMenu.Caption;
                            mainMenuItems.Action   = mainMenu.Action;
                            mainMenuItems.Category = (mainMenu.Id == "Info") ? "UserInfo" : "MainMenu";

                            List <SummaryItems> existingSummaryItems = App.Database.GetSummarysAsync(mainMenu.Id, mainMenuItems.Category);
                            int index = 0;
                            foreach (clsCaptionValue summaryList in mainMenu.Summary)
                            {
                                SummaryItems summaryItem = null;
                                if (index < existingSummaryItems.Capacity)
                                {
                                    summaryItem = existingSummaryItems.ElementAt(index);
                                }

                                if (summaryItem == null)
                                {
                                    summaryItem = new SummaryItems();
                                }

                                if (String.IsNullOrEmpty(summaryList.Caption))
                                {
                                    mainMenuItems.Name = summaryList.Value;
                                }

                                summaryItem.Id        = mainMenu.Id;
                                summaryItem.Caption   = summaryList.Caption;
                                summaryItem.Value     = summaryList.Value;
                                summaryItem.Display   = summaryList.Display;
                                summaryItem.Type      = mainMenuItems.Category;
                                summaryItem.BackColor = mainMenu.BackColor;
                                App.Database.SaveSummarysAsync(summaryItem);
                                index++;
                            }
                            App.Database.SaveMenuAsync(mainMenuItems);
                            break;
                        }
                    }

                    foreach (clsDataRow contextMenu in menu.ContextMenu)
                    {
                        List <SummaryItems> existingSummaryItems = App.Database.GetSummarysAsync(contextMenu.Id, "ContextMenu");
                        int index = 0;
                        foreach (clsCaptionValue summaryList in contextMenu.Summary)
                        {
                            SummaryItems summaryItem = new SummaryItems();
                            summaryItem.Id      = contextMenu.Id;
                            summaryItem.Caption = summaryList.Caption;
                            summaryItem.Value   = summaryList.Value;
                            summaryItem.Display = summaryList.Display;
                            summaryItem.Type    = "ContextMenu";
                            App.Database.SaveSummarysAsync(summaryItem);
                            index++;
                        }
                    }

                    LoadMainMenu();

                    if (checkItems.Count != 0)
                    {
                        CheckList chkList = new CheckList(checkItems, menu.CheckListLinkId);
                        NavigationPage.SetHasBackButton(chkList, false);
                        await Navigation.PushAsync(chkList);
                    }
                }
                loading.IsVisible          = false;
                pullToRefresh.IsRefreshing = false;
            }
            catch (Exception ex)
            {
                await DisplayAlert("Exception", ex.Message, "OK");
            }
        }
Beispiel #24
0
        public async void GetStopList()
        {
            try
            {
                string listtype = (action == "Inbound Trip") ? "InboundList" : "OutboundList";

                var content = await CommonFunction.CallWebService(0, null, "https://api.asolute.com/host/api/", ControllerUtil.getBusStops(listtype), this);

                clsResponse response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (response.IsGood)
                {
                    stops = JObject.Parse(content)["Result"].ToObject <List <clsBusTicket> >();


                    App.Database.deleteRecords(action);
                    App.Database.deleteRecordSummary(action);


                    foreach (clsBusTicket stop in stops)
                    {
                        ListItems items = new ListItems
                        {
                            StopId   = stop.StopId,
                            StopName = stop.StopName,
                            Rate     = stop.Rate,
                            Category = action
                        };

                        App.Database.SaveMenuAsync(items);

                        foreach (ListItems station in stop.Stops)
                        {
                            SummaryItems summaryItem = new SummaryItems
                            {
                                Id        = stop.StopId,
                                StopId    = station.StopId,
                                StopName  = station.StopName,
                                Rate      = station.Rate,
                                BackColor = "#ffffff"
                            };
                            summaryItem.Type = action;


                            App.Database.SaveSummarysAsync(summaryItem);
                        }
                    }

                    var test = App.Database.GetMainMenu(action);

                    LoadStoplist();
                }
                else
                {
                    await DisplayAlert("Error", response.Message, "OK");
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }
        }
        async void RefreshJobContent()
        {
            App.Database.deleteRecords("JobList");
            App.Database.deleteRecordSummary("JobList");
            App.Database.deleteRecordDetails();

            var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getHaulageJobListURL(), this);

            clsResponse response = JsonConvert.DeserializeObject <clsResponse>(content);

            if (response.IsGood)
            {
                var HaulageJobList = JObject.Parse(content)["Result"].ToObject <List <clsHaulageModel> >();

                foreach (clsHaulageModel job in HaulageJobList)
                {
                    ListItems record = new ListItems
                    {
                        Id             = job.Id,
                        Background     = job.BackColor,
                        Category       = "JobList",
                        TruckId        = job.TruckId,
                        ReqSign        = job.ReqSign,
                        Latitude       = job.Latitude,
                        Longitude      = job.Longitude,
                        TelNo          = job.TelNo,
                        EventRecordId  = job.EventRecordId,
                        TrailerId      = job.TrailerId,
                        ContainerNo    = job.ContainerNo,
                        MaxGrossWeight = job.MaxGrossWeight,
                        TareWeight     = job.TareWeight,
                        CollectSeal    = job.CollectSeal,
                        SealNo         = job.SealNo,
                        ActionId       = job.ActionId.ToString(),
                        ActionMessage  = job.ActionMessage,
                        Title          = job.Title,
                        SealMode       = job.SealMode
                    };
                    App.Database.SaveMenuAsync(record);

                    foreach (clsCaptionValue summaryList in job.Summary)
                    {
                        SummaryItems summaryItem = new SummaryItems();

                        summaryItem.Id        = job.Id;
                        summaryItem.Caption   = summaryList.Caption;
                        summaryItem.Value     = summaryList.Value;
                        summaryItem.Display   = summaryList.Display;
                        summaryItem.Type      = "JobList";
                        summaryItem.BackColor = job.BackColor;
                        App.Database.SaveSummarysAsync(summaryItem);
                    }

                    foreach (clsCaptionValue detailList in job.Details)
                    {
                        DetailItems detailItem = new DetailItems();

                        detailItem.Id      = job.Id;
                        detailItem.Caption = detailList.Caption;
                        detailItem.Value   = detailList.Value;
                        detailItem.Display = detailList.Display;
                        App.Database.SaveDetailsAsync(detailItem);
                    }

                    if (job.Id.Equals(Ultis.Settings.SessionCurrentJobId))
                    {
                        Ultis.Settings.Action = job.ActionId.ToString();
                        Ultis.Settings.SessionCurrentJobId = job.Id;
                        jobItem = null;
                        JobContent();
                    }
                }
            }
        }