Exemplo n.º 1
0
        public ActionResult CodeRetrival()
        {
            try
            {
                if (Session["UserID"] == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }

                Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
                DailyOrder DO           = new DailyOrder();
                var        dbcode       = Entity.DailyStatusChange().LastOrDefault();
                var        orderdetails = Entity.DailyOrders.Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month).ToList();

                var code = orderdetails.Where(q => Convert.ToDecimal(q.Code) == Convert.ToDecimal(dbcode.rcode) && q.OrderId == dbcode.OrderId).ToList();
                if (code.Count == 0)
                {
                    var Orders = Entity.DailyOrderData().Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month).OrderBy(q => q.Status).ToList();
                    return(View(Orders));
                }
                else
                {
                    code[0].Status = "Delivered";
                    Entity.Entry(code[0]).State = System.Data.Entity.EntityState.Modified;
                    Entity.SaveChanges();
                    var Orders = Entity.DailyOrderData().Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month).OrderBy(q => q.Status).ToList();
                    return(View(Orders));
                }
            }

            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 2
0
        public ActionResult ViewDailyOrder()
        {
            try
            {
                if (Session["UserID"] == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                var id = Convert.ToInt32(Session["UserID"]);

                var currentdate = Convert.ToDateTime(DateTime.Now.ToShortDateString());

                Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();

                var dailyordercount = Entity.DailyOrders.Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month).Count();

                if (dailyordercount == 0)
                {
                    return(RedirectToAction("DOEntry"));
                }

                // var dailyOrder  = Entity.DailyOrder().Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month).ToList();
                var dailyOrder = Entity.DailyOrderData().Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month).ToList();

                return(View(dailyOrder));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 3
0
        //
        // GET: /Admin/

        public ActionResult Admin()
        {
            try
            {
                if (Session["UserID"] == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                var id = Convert.ToInt32(Session["UserID"]);
                Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
                DailyOrder DO     = new DailyOrder();
                var        Orders = Entity.DailyOrderData().Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month).OrderBy(q => q.Status).ToList();
                if (Orders.Count != 0)
                {
                    return(View(Orders));
                }
                else
                {
                    return(RedirectToAction("ViewDailyOrder"));
                }
            }

            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 4
0
        public ActionResult ViewDailyOrder()
        {
            try
            {
                if (Session["UserID"] == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }


                var id = Convert.ToInt32(Session["UserID"]);
                Chatpata_dabbaEntities1 en = new Chatpata_dabbaEntities1();
                OrderMaster             om = new OrderMaster();
                var currentdate            = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                var dailyOrder             = en.DailyOrderData().Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month && q.CustId == id).OrderBy(q => q.Status).ToList();

                // var orderdetails = en.DailyOrder().Where(q => q currentdate
                //   && q.CustomerId == id).ToList();  //&&q.Status.Equals("Accept")


                return(View(dailyOrder));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Login", "Home"));
            }
        }
        // [HttpPost]
        // public ActionResult CodeRetrival(FormCollection frm)
        //{
        //    var code = Convert.ToString(frm["code"]);
        //    var mailid = Convert.ToString(frm["mailid"]);
        //    var pw1 = Convert.ToString(frm["pw"]);
        //    var password = MD5Crypt.Encrypt(pw1, "Dabba");

        //    Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();

        //    var chk = Entity.CustomerMasters.Where(q => q.EmailID == mailid && q.Password == password).FirstOrDefault();

        //    if (chk != null)
        //    {

        //        var dbcode = Entity.DailyOrders.Where(q => q.CustId == chk.CustId && q.Code == code).Count();

        //        if (dbcode != 0)
        //        {
        //            var dbcode1 = Entity.DailyOrders.Where(q => q.CustId == chk.CustId && q.Code == code).ToList();

        //            dbcode1[0].Status = "Delivered";

        //            Entity.Entry(dbcode1[0]).State = System.Data.Entity.EntityState.Modified;
        //            Entity.SaveChanges();


        //            return RedirectToAction("ViewDailyOrder");
        //        }
        //        else
        //        {
        //            return RedirectToAction("CodeRetrival");
        //        }
        //    }
        //    else
        //    {
        //        return RedirectToAction("CodeRetrival");
        //    }
        //}


        public ActionResult DailyOrders()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var id = Convert.ToInt32(Session["UserID"]);
            Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
            var Orders = Entity.DailyOrderData().Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month).OrderBy(q => q.Status).ToList();

            return(View(Orders));
        }