示例#1
0
        public async Task <System.Collections.ObjectModel.ObservableCollection <BusinessLogic.Portable.SSModels.Supplier> > GetSuppliersByClassAsync(string classId, BusinessLogic.Portable.SSModels.UserInfo userInfo)
        {
            try
            {
                var postData = new { target = "ServiceScheduling", parameters = new[] { "GetSuppliersByClass", classId, Newtonsoft.Json.JsonConvert.SerializeObject(userInfo) } };
                var response = await _httpFactory.PostAsync(new HttpStringContent(JsonConvert.SerializeObject(postData), Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"));

                response.EnsureSuccessStatusCode();
                if (response.IsSuccessStatusCode)
                {
                    return(JsonConvert.DeserializeObject <ObservableCollection <Supplier> >(await response.Content.ReadAsStringAsync()));
                }
            }
            catch (Exception ex)
            {
                new MessageDialog(ex.Message).ShowAsync();
            }
            return(null);
        }
示例#2
0
        public async Task <BusinessLogic.Portable.SSModels.ServiceSchedulingDetail> GetServiceDetailAsync(string caseNumber, long caseServiceRecId, long serviceRecId, BusinessLogic.Portable.SSModels.UserInfo userInfo)
        {
            try
            {
                var postData = new { target = "ServiceScheduling", method = "single", parameters = new[] { "GetServiceDetails", caseNumber, caseServiceRecId.ToString(), serviceRecId.ToString(), JsonConvert.SerializeObject(userInfo) } };
                var response = await _httpFactory.PostAsync(new HttpStringContent(JsonConvert.SerializeObject(postData), Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"));

                response.EnsureSuccessStatusCode();
                if (response.IsSuccessStatusCode)
                {
                    return(JsonConvert.DeserializeObject <ServiceSchedulingDetail>(await response.Content.ReadAsStringAsync()));
                }
            }
            catch (Exception ex)
            {
                new MessageDialog(ex.Message).ShowAsync();
            }
            return(null);
        }
示例#3
0
        async private Task GetTasksforLiveTile()
        {
            try
            {
                if (ApplicationData.Current.RoamingSettings.Values.ContainsKey(Constants.USERINFO))
                {
                    this.UserInfo = JsonConvert.DeserializeObject <Eqstra.BusinessLogic.Portable.SSModels.UserInfo>(ApplicationData.Current.RoamingSettings.Values[Constants.USERINFO].ToString());
                }

                var allTasks = await this._taskService.GetTasksAsync(this.UserInfo);

                if (allTasks != null)
                {
                    var updaterWide  = TileUpdateManager.CreateTileUpdaterForApplication();
                    var updaterSqure = TileUpdateManager.CreateTileUpdaterForApplication();
                    var updaterBadge = BadgeUpdateManager.CreateBadgeUpdaterForApplication();
                    updaterWide.EnableNotificationQueue(true);
                    updaterSqure.EnableNotificationQueue(true);
                    updaterWide.Clear();
                    updaterSqure.Clear();
                    updaterBadge.Clear();
                    int counter = 0;

                    foreach (var item in allTasks)
                    {
                        int index = 0;

                        XmlDocument tileXmlSquare = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150IconWithBadgeAndText);

                        var bindingElementSquare = (XmlElement)tileXmlSquare.GetElementsByTagName("binding").Item(0);
                        bindingElementSquare.SetAttribute("branding", "name");

                        XmlNodeList tileTextAttributes = tileXmlSquare.GetElementsByTagName("text");

                        XmlDocument tileXmlWide = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Text01);

                        var bindingElemtWide = (XmlElement)tileXmlWide.GetElementsByTagName("binding").Item(0);
                        bindingElemtWide.SetAttribute("branding", "name");

                        tileTextAttributes[index].InnerText   = item.CustomerName.ToString();
                        tileTextAttributes[++index].InnerText = item.ContactName.ToString();
                        tileTextAttributes[++index].InnerText = DateTime.Parse(item.StatusDueDate).Day.ToString() + " " + DateTime.Parse(item.StatusDueDate).ToString("MMMM");


                        char[]   whitespace = new char[] { ' ', '\t' };
                        string[] cutName    = item.CustomerName.Split(whitespace);

                        if (cutName != null && cutName.Any())
                        {
                            tileXmlWide.GetElementsByTagName(textElementName)[0].InnerText = cutName[0];
                        }
                        tileXmlWide.GetElementsByTagName(textElementName)[1].InnerText = Environment.NewLine;
                        tileXmlWide.GetElementsByTagName(textElementName)[2].InnerText = item.ContactName;
                        tileXmlWide.GetElementsByTagName(textElementName)[3].InnerText = DateTime.Parse(item.StatusDueDate).Day.ToString() + " " + DateTime.Parse(item.StatusDueDate).ToString("MMMM");

                        updaterWide.Update(new TileNotification(tileXmlWide));

                        if (counter++ > 6)
                        {
                            break;
                        }
                        updaterSqure.Update(new TileNotification(tileXmlSquare));
                    }

                    XmlDocument BadgeXml        = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);
                    var         badgeAttributes = BadgeXml.GetElementsByTagName("badge");
                    ((XmlElement)badgeAttributes[0]).SetAttribute("value", allTasks.Count.ToString());

                    updaterBadge.Update(new BadgeNotification(BadgeXml));
                }
            }
            catch (Exception)
            {
            }
        }
示例#4
0
        public async Task <bool> InsertServiceDetailsAsync(BusinessLogic.Portable.SSModels.ServiceSchedulingDetail serviceSchedulingDetail, BusinessLogic.Portable.SSModels.Address address, BusinessLogic.Portable.SSModels.UserInfo userInfo)
        {
            try
            {
                var postData = new { target = "ServiceScheduling", method = "save", parameters = new[] { "InsertServiceDetails", JsonConvert.SerializeObject(serviceSchedulingDetail), JsonConvert.SerializeObject(address), JsonConvert.SerializeObject(userInfo) } };
                var response = await _httpFactory.PostAsync(new HttpStringContent(JsonConvert.SerializeObject(postData), Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"));

                response.EnsureSuccessStatusCode();
                if (response.IsSuccessStatusCode)
                {
                    return(JsonConvert.DeserializeObject <bool>(await response.Content.ReadAsStringAsync()));
                }
            }
            catch (Exception ex)
            {
                new MessageDialog(ex.Message).ShowAsync();
            }
            return(false);
        }