コード例 #1
0
        private async void DeleteBtn_Click(object sender, RoutedEventArgs e)
        {
            var item = (Model)TestDataGrid.SelectedItem;

            var Query = $"Delete from Merc_xs where S.CodM={item.CodeFil} and S.CodM={item.CodePred}S";
            await ConnHolder.NonQueryAsyncConnect(Query);
        }
コード例 #2
0
 private async void SaveChanges_Click(object sender, RoutedEventArgs e)
 {
     foreach (var item in Info)
     {
         var Query = $"Update Merc_xs set Name=\'{item.NameOfPlace}\', Login = \'{item.APILogin}\', Passw = \'{item.APIPass}\', GUID = \'{item.CompanyGuid}\', GUIDP = \'{item.PlaceGuid}\', Initiator = \'{item.User}\', APIKey = \'{item.APIKey}\' where CodM= {item.CodeFil} and CodB= {item.CodePred}";
         await ConnHolder.NonQueryAsyncConnect(Query);
     }
 }
コード例 #3
0
        private async void TestDataGrid_RowEditEnding(object sender, Microsoft.Toolkit.Uwp.UI.Controls.DataGridRowEditEndingEventArgs e)
        {
            if (e.EditAction == DataGridEditAction.Commit)
            {
                Model item  = e.Row.DataContext as Model;
                var   Query = $"Update Merc_xs set Name=\'{item.NameOfPlace}\', Login = \'{item.APILogin}\', Passw = \'{item.APIPass}\', GUID = \'{item.CompanyGuid}\', GUIDP = \'{item.PlaceGuid}\', Initiator = \'{item.User}\', APIKey = \'{item.APIKey}\' where CodM= {item.CodeFil} and CodB= {item.CodePred}";
                await ConnHolder.NonQueryAsyncConnect(Query);

                //Debug.WriteLine(item.NameOfPlace);
            }
        }
コード例 #4
0
        public static async Task <class1.Envelope> GetXML(Model selectedOne, ObservableCollection <Model> Info)
        {
            var response = await HttpRest.InfoPostAsync(IenumerationPaths.PostFirstTime, selectedOne);

            var filledModel = XmlParser.Desirialize(response);
            var xml         = new class1.Envelope();

            //string text = "No Data";

            if (filledModel.Body.submitApplicationResponse != null)
            {
                if (filledModel.Body.submitApplicationResponse.application.status == "ACCEPTED")
                {
                    foreach (var elem in Info)
                    {
                        if (elem == selectedOne)
                        {
                            elem.AppId = filledModel.Body.submitApplicationResponse.application.applicationId;
                            var Query = $"Update Merc_xs set AppID=\'{elem.AppId}\' where CodM= {elem.CodeFil} and CodB= {elem.CodePred}";
                            await ConnHolder.NonQueryAsyncConnect(Query);

                            Debug.WriteLine("Updated");
                        }
                    }
                    // = filledModel.Body.submitApplicationResponse.application.applicationId;
                    xml = XmlParser.DesirializeBig(await HttpRest.InfoPostAsync(IenumerationPaths.PostToCheck, selectedOne));
                    Debug.WriteLine(xml.Body.ReceiveApplicationResultResponse.Application.Status);
                    while (xml.Body.ReceiveApplicationResultResponse.Application.Status == "IN_PROCESS")
                    {
                        xml = XmlParser.DesirializeBig(await HttpRest.InfoPostAsync(IenumerationPaths.PostToCheck, selectedOne));
                        System.Threading.Thread.Sleep(2000);
                        //Debug.WriteLine(xml.Body.ReceiveApplicationResultResponse.Application.Status);
                    }
                    //Debug.WriteLine(xml.Body.ReceiveApplicationResultResponse.Application.Status);
                    //XmlParser.Serialize(xml);
                    //xmlFinish();
                    //text = File.ReadAllText(Windows.Storage.ApplicationData.Current.LocalFolder.Path + "\\" + "Out.xml");
                }
            }
            else
            {
                ContentDialog dialog = new ContentDialog()
                {
                    Title             = "Error",
                    Content           = "Failed to parse answer. This may means, you send wrong data or XML file is damaged.",
                    PrimaryButtonText = "ОК",
                };
                await dialog.ShowAsync();
            }
            return(xml);
        }