Example #1
0
 public ActionResult EditProfile(dispatch obj)
 {
     if (ModelState.IsValid)
     {
         db.Entry(obj).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("UserProfile"));
     }
     return(View(obj));
 }
        public ActionResult CreateDispatch(dispatch obj)
        {
            if (ModelState.IsValid)
            {
                db.dispatches.Add(obj);
                db.SaveChanges();
                return(RedirectToAction("IndexDispatch"));
            }

            return(View(obj));
        }
 public ActionResult DeleteDispatch(int id)
 {
     try
     {
         dispatch obj = db.dispatches.Find(id);
         db.dispatches.Remove(obj);
         db.SaveChanges();
         return(RedirectToAction("IndexDispatch"));
     }
     catch (DataException)
     {
         return(RedirectToAction("DeleteDispatch", new { id = id, saveChangesError = true }));
     }
     return(RedirectToAction("IndexDispatch"));
 }
        //View Dispatch Details
        public ActionResult DispatchDetails(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            dispatch obj = db.dispatches.Find(id);

            if (obj == null)
            {
                return(HttpNotFound());
            }
            return(View(obj));
        }
Example #5
0
        private async void submit(object sender, RoutedEventArgs e)
        {
            if (fDate.Text.Length > 0 && fTime.Text.Length > 0 && fDriverContact.Text.Length > 0 && fDriverName.Text.Length > 0 && fEQuantity.Text.Length > 0 && fPQuantity.Text.Length > 0 && fSales.Text.Length > 0 && fProduct.Text.Length > 0 && fStatus.Text.Length > 0 && fVehicle.Text.Length > 0)
            {
                try
                {
                    client = new FireSharp.FirebaseClient(config);
                    dispatch dispatch1 = new dispatch();
                    dispatch1.date             = fDate.Text;
                    dispatch1.time             = fTime.Text;
                    dispatch1.drivercontactno  = fDriverContact.Text;
                    dispatch1.drivername       = fDriverName.Text;
                    dispatch1.equantity        = Int32.Parse(fEQuantity.Text);
                    dispatch1.pquantity        = Int32.Parse(fPQuantity.Text);
                    dispatch1.salesordernumber = fSales.Text;
                    dispatch1.productname      = fProduct.Text;
                    dispatch1.vehicleno        = fVehicle.Text;
                    dispatch1.status           = fStatus.Text;
                    FirebaseResponse firebase = await client.GetAsync("Dispatch/" + dispatch1.salesordernumber + "/count/");

                    int c;
                    try
                    {
                        c = firebase.ResultAs <int>();
                    }
                    catch (Exception)
                    {
                        c = 0;
                    }
                    c++;
                    FirebaseResponse firebaseResponse = await client.SetAsync("Dispatch/" + dispatch1.salesordernumber + "/count/", c);

                    FirebaseResponse response = await client.SetAsync("Dispatch/" + dispatch1.salesordernumber + "/" + c + "/", dispatch1);
                }
                catch (Exception)
                {
                    MessageDialog error = new MessageDialog("Failed to connect to database!");
                    this.Frame.Navigate(typeof(BlankPage6));
                }
            }
            else
            {
                MessageDialog md = new MessageDialog("Check the inputs!");
                await md.ShowAsync();
            }
        }
        public ActionResult DeleteDispatch(int?id, bool?saveChangesError = false)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //
            if (saveChangesError.GetValueOrDefault())
            {
                ViewBag.ErrorMessage = "Delete failed.Try again.";
            }
            //

            dispatch obj = db.dispatches.Find(id);

            if (obj == null)
            {
                return(HttpNotFound());
            }
            return(View(obj));
        }
Example #7
0
        private async void Page_Loader(object sender, RoutedEventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(config);
                FirebaseResponse response = await client.GetAsync("Dispatch/Spinner/count/");

                int c;
                try
                {
                    c = response.ResultAs <int>();
                }
                catch (Exception)
                {
                    c = 0;
                }
                for (int i = 1; i <= c; i++)
                {
                    FirebaseResponse response1 = await client.GetAsync("Dispatch/Spinner/" + i + "/");

                    string           a         = response1.ResultAs <string>();
                    FirebaseResponse response3 = await client.GetAsync("Dispatch/" + a + "/count/");

                    int v;
                    try
                    {
                        v = response3.ResultAs <int>();
                    }
                    catch (Exception)
                    {
                        v = 0;
                    }
                    for (int j = 1; j <= v; j++)
                    {
                        FirebaseResponse response2 = await client.GetAsync("Dispatch/" + a + "/" + j + "/");

                        dispatch dispatch2 = new dispatch();
                        dispatch2 = response2.ResultAs <dispatch>();
                        productOut productOut = new productOut();
                        productOut.sno     = MyList.Items.Count + 1;
                        productOut.salesid = dispatch2.salesordernumber;
                        FirebaseResponse response4 = await client.GetAsync("Sales/SalesOrder/" + productOut.salesid + "/ClientName/");

                        productOut.clientname  = response4.ResultAs <string>();
                        productOut.productname = dispatch2.productname;
                        productOut.quantity    = dispatch2.pquantity;
                        productOut.vehicleno   = dispatch2.vehicleno;
                        productOut.date        = dispatch2.date;
                        productOut.time        = dispatch2.time;
                        MyList.Items.Add(productOut);
                    }
                    if (MyList.Items.Count > 0)
                    {
                        progress1.Visibility = Visibility.Collapsed;
                        pout.Visibility      = Visibility.Visible;
                    }
                }
            }
            catch (Exception)
            {
                MessageDialog error = new MessageDialog("Failed to connect to database!");
                this.Frame.Navigate(typeof(BlankPage6));
            }
        }
Example #8
0
        //--------------------------------pay

        public ActionResult EditProfile(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            dispatch obj = db.dispatches.Find(id);
            //

            List <SelectListItem> provinceList = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = "Alberta - AB", Value = "AB"
                },
                new SelectListItem()
                {
                    Text = "British Columbia - BC", Value = "BC"
                },
                new SelectListItem()
                {
                    Text = "Manitoba - MB", Value = "MB"
                },
                new SelectListItem()
                {
                    Text = "New Brunswick - NB", Value = "NB"
                },
                new SelectListItem()
                {
                    Text = "Newfoundland and Labrador - NL", Value = "NL"
                },
                new SelectListItem()
                {
                    Text = "Northwest Territories - NT", Value = "NT"
                },
                new SelectListItem()
                {
                    Text = "Nova Scotia - NS", Value = "NS"
                },
                new SelectListItem()
                {
                    Text = "Nunavut - NU", Value = "NU"
                },
                new SelectListItem()
                {
                    Text = "Ontario - ON", Value = "ON"
                },
                new SelectListItem()
                {
                    Text = "Prince Edward Island - PE", Value = "PE"
                },
                new SelectListItem()
                {
                    Text = "Quebec - QC", Value = "QC"
                },
                new SelectListItem()
                {
                    Text = "Saskatchewan - SK", Value = "SK"
                },
                new SelectListItem()
                {
                    Text = "Yukon - YT", Value = "YT"
                }
            };

            obj.provinceList = provinceList;

            List <SelectListItem> genderList = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = "Male - M", Value = "M"
                },
                new SelectListItem()
                {
                    Text = "Female - F", Value = "F"
                }
            };

            obj.genderList = genderList;

            //
            if (obj == null)
            {
                return(HttpNotFound());
            }
            return(View(obj));
        }
        //Add Dispatch
        public ActionResult CreateDispatch()
        {
            dispatch obj = new dispatch();
            List <SelectListItem> provinceList = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = "Alberta - AB", Value = "AB"
                },
                new SelectListItem()
                {
                    Text = "British Columbia - BC", Value = "BC"
                },
                new SelectListItem()
                {
                    Text = "Manitoba - MB", Value = "MB"
                },
                new SelectListItem()
                {
                    Text = "New Brunswick - NB", Value = "NB"
                },
                new SelectListItem()
                {
                    Text = "Newfoundland and Labrador - NL", Value = "NL"
                },
                new SelectListItem()
                {
                    Text = "Northwest Territories - NT", Value = "NT"
                },
                new SelectListItem()
                {
                    Text = "Nova Scotia - NS", Value = "NS"
                },
                new SelectListItem()
                {
                    Text = "Nunavut - NU", Value = "NU"
                },
                new SelectListItem()
                {
                    Text = "Ontario - ON", Value = "ON"
                },
                new SelectListItem()
                {
                    Text = "Prince Edward Island - PE", Value = "PE"
                },
                new SelectListItem()
                {
                    Text = "Quebec - QC", Value = "QC"
                },
                new SelectListItem()
                {
                    Text = "Saskatchewan - SK", Value = "SK"
                },
                new SelectListItem()
                {
                    Text = "Yukon - YT", Value = "YT"
                }
            };

            obj.provinceList = provinceList;

            List <SelectListItem> genderList = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = "Male - M", Value = "M"
                },
                new SelectListItem()
                {
                    Text = "Female - F", Value = "F"
                }
            };

            obj.genderList = genderList;

            return(View(obj));
            //return View();
        }