private async void ButtonCancel_Click(object sender, RoutedEventArgs e)
        {
            var SelectedSender = (FrameworkElement)sender;
            var SelectedItem   = (Leavetransaction)SelectedSender.DataContext;

            //Update the data working code
            string condition = SelectedItem._id.Oid.ToString();
            string empid     = SelectedItem.EmpId.ToString();
            string setValue  = String.Format("{{\"$set\":{{\"LeaveStatus\":\"{0}\"}}}}", "-1");
            await LeaveTransactionGetPostPut.LeaveTransactionPutAsync(condition, setValue);

            await LeaveTransactionGetPostPut.GetLeaveTransactionAsnc(LeaveTransactions, empid, "1");
        }
示例#2
0
        private async void AcceptButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var          parent             = (sender as Button).Parent;
                ProgressRing AcceptProgressRing = parent.GetChildrenOfType <ProgressRing>().First(x => x.Name == "AcceptProgressRing");
                AcceptProgressRing.IsActive   = true;
                AcceptProgressRing.Visibility = Visibility.Visible;
                (sender as Button).IsEnabled  = false;

                var SelectedSender = (FrameworkElement)sender;
                var SelectedItem   = (Leavetransaction)SelectedSender.DataContext;


                //Update the data working code
                string condition = SelectedItem._id.Oid.ToString();
                string empid     = SelectedItem.EmpId.ToString();
                string setValue  = String.Format("{{\"$set\":{{\"LeaveStatus\":\"{0}\",\"ApprovedBy\":\"{1}\",\"ApprovedDate\":\"{2}\",\"ApprovedTime\":\"{3}\"}}}}", "2", empid, DateTimeToDateIndian.GetDateFromDateTime(DateTime.Now.ToString("G")), DateTime.Now.ToString("hh:mm tt"));


                await LeaveTransactionGetPostPut.LeaveTransactionPutAsync(condition, setValue);


                var messageDialog = new MessageDialog("Accepted");
                await messageDialog.ShowAsync();

                AcceptProgressRing.IsActive   = false;
                AcceptProgressRing.Visibility = Visibility.Collapsed;
                (sender as Button).IsEnabled  = true;

                await LeaveTransactionGetPostPut.GetLeaveTransactionAsnc(LeaveTransactions, empid, "1");
            }
            catch
            {
                var messageDialog = new MessageDialog("not accepted !Error ");
                await messageDialog.ShowAsync();


                var          parent             = (sender as Button).Parent;
                ProgressRing AcceptProgressRing = parent.GetChildrenOfType <ProgressRing>().First(x => x.Name == "AcceptProgressRing");
                AcceptProgressRing.IsActive   = false;
                AcceptProgressRing.Visibility = Visibility.Collapsed;
                (sender as Button).IsEnabled  = true;
            }
        }
示例#3
0
        private async void ButtonCancel_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var          parent             = (sender as Button).Parent;
                ProgressRing CancelProgressRing = parent.GetChildrenOfType <ProgressRing>().First(x => x.Name == "CancelProgressRing");
                CancelProgressRing.IsActive   = true;
                CancelProgressRing.Visibility = Visibility.Visible;
                (sender as Button).IsEnabled  = false;

                var SelectedSender = (FrameworkElement)sender;
                var SelectedItem   = (Leavetransaction)SelectedSender.DataContext;

                //Update the data working code
                string condition = SelectedItem._id.Oid.ToString();
                string empid     = SelectedItem.EmpId.ToString();
                string setValue  = String.Format("{{\"$set\":{{\"LeaveStatus\":\"{0}\"}}}}", "-1");
                await LeaveTransactionGetPostPut.LeaveTransactionPutAsync(condition, setValue);

                var messageDialog = new MessageDialog("Canceled");
                await messageDialog.ShowAsync();

                CancelProgressRing.IsActive   = false;
                CancelProgressRing.Visibility = Visibility.Collapsed;
                (sender as Button).IsEnabled  = true;

                await LeaveTransactionGetPostPut.GetLeaveTransactionAsnc(LeaveTransactions, empid, "1");
            }
            catch
            {
                var messageDialog = new MessageDialog("Not canceled !Error ");
                await messageDialog.ShowAsync();

                var          parent             = (sender as Button).Parent;
                ProgressRing CancelProgressRing = parent.GetChildrenOfType <ProgressRing>().First(x => x.Name == "CancelProgressRing");
                CancelProgressRing.IsActive   = false;
                CancelProgressRing.Visibility = Visibility.Collapsed;
                (sender as Button).IsEnabled  = true;
            }
        }