Пример #1
0
        public async void proxy(String subName, int slot)
        {
            List <Timings> subNames = await App.MobileService.GetTable <Timings>().Where(timings => ((timings.Slot == slot && timings.SubjectName == subName))).ToListAsync();

            String subId = subNames[0].SubjectId;

            GlobalRollNumber.slot      = slot;
            GlobalRollNumber.subName   = subName;
            GlobalRollNumber.subjectID = subId;

            List <Absentee> check1 = await App.MobileService.GetTable <Absentee>().Where(check => (check.RollNumber == GlobalRollNumber.RollNumber && check.Slot == slot)).ToListAsync();

            if (check1.Count == 0)
            {
                Absentee absentObj = new Absentee
                {
                    SubjectId  = subId,
                    BidPrice   = 0,
                    RollNumber = GlobalRollNumber.RollNumber,
                    Slot       = slot,
                    Completed  = true
                };
                await App.MobileService.GetTable <Absentee>().InsertAsync(absentObj);
            }



            this.Frame.Navigate(typeof(Absent), null);
        }
Пример #2
0
        private async void submit_Click(object sender, RoutedEventArgs e)
        {
            List <Absentee> check1 = await App.MobileService.GetTable <Absentee>().Where(check => check.RollNumber == GlobalRollNumber.RollNumber && check.Slot == GlobalRollNumber.slot).ToListAsync();

            int init = check1.Count;

            Absentee goingObj = new Absentee
            {
                RollNumber = GlobalRollNumber.RollNumber,
                BidPrice   = Int32.Parse(bidPrice.Text),
                SubjectId  = GlobalRollNumber.subjectID,
                Slot       = GlobalRollNumber.slot,
                Completed  = true
            };

            if (init == 0)
            {
                await App.MobileService.GetTable <Absentee>().InsertAsync(goingObj);
            }
            else
            {
                check1[0].RollNumber = GlobalRollNumber.RollNumber;
                check1[0].BidPrice   = Int32.Parse(bidPrice.Text);
                check1[0].SubjectId  = GlobalRollNumber.subjectID;
                check1[0].Slot       = GlobalRollNumber.slot;
                check1[0].Completed  = true;
                await App.MobileService.GetTable <Absentee>().UpdateAsync(check1[0]);
            }
            // Absentee goingObj = new Absentee

            /*  {
             *    RollNumber = GlobalRollNumber.RollNumber,
             *    BidPrice = Int32.Parse(bidPrice.Text),
             *    SubjectId = GlobalRollNumber.subjectID,
             *    Slot = GlobalRollNumber.slot,
             *    Completed = true
             * };*/

            this.Frame.Navigate(typeof(Tomorrow), null);
        }