Beispiel #1
0
 public ActionResult EditMenu(MenuMaster menuinfo, HttpPostedFileBase file)
 {
     try
     {
         Chatpata_dabbaEntities1 EntityFile = new Chatpata_dabbaEntities1();
         var newFileName = "";
         if (file != null)
         {
             string   pic           = System.IO.Path.GetFileName(file.FileName);
             FileInfo fi            = new FileInfo(pic);
             string   fileextension = fi.Extension.Substring(1).ToUpper();
             newFileName = Convert.ToString(Guid.NewGuid()) + "." + fileextension;
             var FolderPath = "~/Images/";
             var Imgpath    = Path.Combine(Server.MapPath(FolderPath), newFileName);
             file.SaveAs(Imgpath);
             newFileName = FolderPath + newFileName;
         }
         menuinfo.Image = newFileName;
         EntityFile.Entry(menuinfo).State = System.Data.Entity.EntityState.Modified;
         EntityFile.SaveChanges();
         return(RedirectToAction("ViewMenu"));
     }
     catch (Exception e)
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Beispiel #2
0
 public ActionResult Payment()
 {
     try
     {
         if (Session["UserID"] == null)
         {
             return(RedirectToAction("Index", "Home"));
         }
         if (Session["OrderID"] == null)
         {
             return(RedirectToAction("PlaceOrder", "Customer"));
         }
         var Id          = Convert.ToInt32(Session["UserId"]);
         var MenuId      = Convert.ToInt32(Session["MenuID"]);
         var oid         = Convert.ToInt32(Session["OrderID"]);
         var currentdate = Convert.ToDateTime(DateTime.Now.ToShortDateString());
         Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
         var orderdetails = Entity.OrderMasters.Where(q => q.OrderId == oid).FirstOrDefault();
         return(View(orderdetails));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #3
0
        public JsonResult UpdateOrderStatus(int id)
        {
            try
            {
                Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
                OrderMaster             OM     = new OrderMaster();
                var details = Entity.OrderMasters.Where(q => q.OrderId == id).FirstOrDefault();
                details.Status = "Accept";
                Entity.Entry(details).State = System.Data.Entity.EntityState.Modified;
                Entity.SaveChanges();


                if (details.StartDate.Day <= DateTime.Now.Day && details.EndDate.Day >= DateTime.Now.Day)
                {
                    DailyOrder dor = new DailyOrder();
                    dor.CustId  = details.CustomerId;
                    dor.OrderId = id;
                    dor.Date    = DateTime.Now;
                    dor.Status  = "Pending";
                    dor.Code    = 0;

                    Entity.DailyOrders.Add(dor);
                    Entity.SaveChanges();
                }

                return(Json("Accept", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json("Error", JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #4
0
        public ActionResult AddMenu(FormCollection frm, HttpPostedFileBase file)
        {
            try
            {
                Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
                MenuMaster menu        = new MenuMaster();
                var        newFileName = "";
                if (file != null)
                {
                    string   pic           = System.IO.Path.GetFileName(file.FileName);
                    FileInfo fi            = new FileInfo(pic);
                    string   fileextension = fi.Extension.Substring(1).ToUpper();
                    newFileName = Convert.ToString(Guid.NewGuid()) + "." + fileextension;
                    var FolderPath = "~/Images/";
                    var Imgpath    = Path.Combine(Server.MapPath(FolderPath), newFileName);
                    file.SaveAs(Imgpath);
                    newFileName = FolderPath + newFileName;
                }

                menu.Name        = Convert.ToString(frm["Name"]);
                menu.Description = Convert.ToString(frm["Description"]);
                menu.Image       = Convert.ToString(frm["Image"]);
                menu.Price       = Convert.ToDecimal(frm["Price"]);
                menu.Image       = newFileName;
                Entity.MenuMasters.Add(menu);
                Entity.SaveChanges();


                return(RedirectToAction("Admin", "Admin"));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #5
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;
            }
        }
Beispiel #6
0
        public ActionResult Verifychpass(FormCollection frm)
        {
            try
            {
                if (Session["UserID"] == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }


                Chatpata_dabbaEntities1 en = new Chatpata_dabbaEntities1();
                CustomerMaster          cm = new CustomerMaster();

                var pass = Convert.ToString(frm["new_pass"]);
                var id   = Convert.ToInt32(Session["UserID"]);
                var user = en.CustomerMasters.Where(q => q.CustId == id).FirstOrDefault();
                user.Password        = MD5Crypt.Encrypt(pass, "Dabba");
                en.Entry(user).State = System.Data.Entity.EntityState.Modified;

                en.SaveChanges();
                return(RedirectToAction("Admin", "Admin"));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Admin"));
            }
        }
Beispiel #7
0
        public ActionResult DOEntry()
        {
            Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
            OrderMaster             OM     = new OrderMaster();
            DailyOrder DO          = new DailyOrder();
            var        currentdate = Convert.ToDateTime(DateTime.Now.ToShortDateString());

            var orderdetails = Entity.OrderMasters.Where(q => q.StartDate <= currentdate && q.EndDate >= currentdate && (q.Status.Equals("Accept") || q.Status.Equals("Delivered"))).OrderBy(q => q.CustomerMaster.FirstName).ToList();

            //   var cname = orderdetails.OrderBy(q => q.MenuId).ToList();


            if (orderdetails != null)
            {
                foreach (var order in orderdetails.ToList())
                {
                    DO.CustId  = Convert.ToInt32(order.CustomerId);
                    DO.OrderId = Convert.ToInt32(order.OrderId);
                    DO.Date    = DateTime.Now;
                    DO.Status  = "Pending";
                    DO.Code    = 0;

                    Entity.DailyOrders.Add(DO);
                    Entity.SaveChanges();
                }
            }

            return(RedirectToAction("ViewDailyOrder"));
        }
Beispiel #8
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;
            }
        }
Beispiel #9
0
        public ActionResult Complain(FormCollection frm)
        {
            Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
            Complain com = new Complain();


            var d = 0;

            if (frm["Dname"] != null)
            {
                var dname = frm["Dname"].ToString();
                var did   = Entity.CustomerMasters.Where(q => q.FirstName.Equals(dname)).FirstOrDefault();
                if (did != null)
                {
                    d = did.CustId;
                }
            }
            com.CustId      = Convert.ToInt32(Session["UserId"]);
            com.Date        = DateTime.Now;
            com.Status      = "complain";
            com.Description = Convert.ToString(frm["Complain"]);
            com.DriverId    = d;

            Entity.Complains.Add(com);
            Entity.SaveChanges();

            return(RedirectToAction("Customer"));
        }
Beispiel #10
0
 public ActionResult UpdateProfile(CustomerMaster ProfileInfo, FormCollection frm, HttpPostedFileBase file)
 {
     try
     {
         ProfileInfo.CustId = Convert.ToInt32(frm["CustId"]);
         Chatpata_dabbaEntities1 cd = new Chatpata_dabbaEntities1();
         var user        = cd.CustomerMasters.Where(q => q.CustId == ProfileInfo.CustId).FirstOrDefault();
         var newFileName = "";
         if (file != null)
         {
             string   pic           = System.IO.Path.GetFileName(file.FileName);
             FileInfo fi            = new FileInfo(pic);
             string   fileextension = fi.Extension.Substring(1).ToUpper();
             newFileName = Convert.ToString(Guid.NewGuid()) + "." + fileextension;
             var FolderPath = "~/Images/";
             var Imgpath    = Path.Combine(Server.MapPath(FolderPath), newFileName);
             file.SaveAs(Imgpath);
             newFileName = FolderPath + newFileName;
         }
         ProfileInfo.Image     = newFileName;
         ProfileInfo.Birthdate = user.Birthdate;
         cd.Entry(user).State  = System.Data.Entity.EntityState.Modified;
         cd.SaveChanges();
         return(RedirectToAction("Customer"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #11
0
        public ActionResult CodeRetrival(FormCollection frm)
        {
            var code = Convert.ToString(frm["code"]);

            Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
            DailyOrder DO = new DailyOrder();

            var cid = Convert.ToInt32(Session["UserID"]);

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

            if (dbcode != null)
            {
                //  var dbcode1 = Entity.DailyOrders.Where(q => q.CustId == cid && q.Code == code).ToList();
                //   var orderstatus=Entity.
                // dbcode1[0].Status = "Delivered";
                var orderdetails = Entity.DailyOrders.Where(q => q.Date.Day == DateTime.Now.Day && q.Date.Month == DateTime.Now.Month).ToList();

                var data = orderdetails.Where(q => Convert.ToDecimal(q.Code) == Convert.ToDecimal(dbcode.rcode) && q.OrderId == dbcode.OrderId).ToList();

                // var orderdetails = Entity.DailyOrderData().Where(q => q.CustId == dbcode.CustId).FirstOrDefault();
                //var orderchange = Entity.DailyOrders.Where(q => q.CustId == orderdetails.CustId).ToList();
                data[0].Status = "Delivered";
                Entity.Entry(data[0]).State = System.Data.Entity.EntityState.Modified;
                Entity.SaveChanges();
                return(RedirectToAction("ThankYouPage"));
            }
            else
            {
                return(RedirectToAction("CodeRetrival"));
            }
        }
Beispiel #12
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;
            }
        }
Beispiel #13
0
        public ActionResult UpdateProfile(CustomerMaster ProfileInfo, FormCollection frm)
        {
            try
            {
                if (Session["UserID"] == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                var id = Convert.ToInt32(Session["UserID"]);
                ProfileInfo.CustId = Convert.ToInt32(frm["CustId"]);
                Chatpata_dabbaEntities1 cd = new Chatpata_dabbaEntities1();
                var user = cd.CustomerMasters.Where(q => q.CustId == ProfileInfo.CustId).FirstOrDefault();
                ProfileInfo.Birthdate = user.Birthdate;
                ProfileInfo.FirstName = user.FirstName;
                user.LastName         = Convert.ToString(frm["LastName"]);
                user.Address1         = Convert.ToString(frm["Address1"]);
                user.Address2         = Convert.ToString(frm["Address2"]);
                user.Address3         = Convert.ToString(frm["Address3"]);
                user.Pincode          = Convert.ToString(frm["Pincode"]);
                user.PhoneNo          = Convert.ToString(frm["PhoneNo"]);

                cd.Entry(user).State = System.Data.Entity.EntityState.Modified;
                cd.SaveChanges();
                return(RedirectToAction("Customer"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #14
0
        public JsonResult UpdateStatus(int id, string st)
        {
            try
            {
                Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
                RequestMaster           rm     = new RequestMaster();
                var details = Entity.RequestMasters.Where(q => q.Id == id).FirstOrDefault();

                if (st == "Accept")
                {
                    details.Status = "Accept";
                    Entity.Entry(details).State = System.Data.Entity.EntityState.Modified;
                    Entity.SaveChanges();
                    return(Json("Accept", JsonRequestBehavior.AllowGet));
                }
                else if (st == "Reject")
                {
                    details.Status = "Reject";
                    Entity.Entry(details).State = System.Data.Entity.EntityState.Modified;
                    Entity.SaveChanges();
                    return(Json("Reject", JsonRequestBehavior.AllowGet));
                }

                else
                {
                    return(Json("Error", JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                return(Json("Error", JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult Forgotque(FormCollection frm)
        {
            try
            {
                Chatpata_dabbaEntities1 EntityFile = new Chatpata_dabbaEntities1();


                var email = Convert.ToString(frm["Email"]);

                var user = EntityFile.CustomerMasters.Where(q => q.EmailID == email).FirstOrDefault();
                //Session["UserID"]=details.CustId;

                string pass    = GenerateRandomPassword(6);
                int    chkmail = Mail.SendMail("Your New Password", pass, email);
                user.Password = MD5Crypt.Encrypt(pass, "Dabba");
                EntityFile.Entry(user).State = System.Data.Entity.EntityState.Modified;
                EntityFile.SaveChanges();
                return(RedirectToAction("Index"));
            }

            catch (Exception ex)
            {
                return(RedirectToAction("Forgotpass_new", "Home"));
            }
        }
Beispiel #16
0
        public JsonResult AddMenuItem(int Id, int menuid)
        {
            try
            {
                Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
                MenuItem menuitem = new MenuItem();

                var chk = Entity.MenuItems.Where(q => q.ItemId == Id && q.MenuId == menuid).FirstOrDefault();
                if (chk != null)
                {
                    return(Json("item", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    menuitem.ItemId = Id;
                    menuitem.MenuId = menuid;
                    Entity.MenuItems.Add(menuitem);
                    Entity.SaveChanges();
                    return(Json("Success", JsonRequestBehavior.AllowGet));
                }
            }
            catch
            {
                return(Json("Error", JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #17
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"));
            }
        }
Beispiel #18
0
 public ActionResult Payment(FormCollection frm, OrderMaster OM)
 {
     try
     {
         if (Session["UserID"] == null)
         {
             return(RedirectToAction("Index", "Home"));
         }
         var Id = Convert.ToInt32(Session["UserId"]);
         Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
         OM.OrderId = Convert.ToInt32(frm["OrderID"]);
         var orderdetails = Entity.OrderMasters.Where(q => q.OrderId == OM.OrderId).FirstOrDefault();
         if (Convert.ToString(frm["Method"]) == "online")
         {
             orderdetails.PaymentMode = "Online";
         }
         if (Convert.ToString(frm["Method"]) == "cash")
         {
             orderdetails.PaymentMode = "COD";
         }
         Entity.Entry(orderdetails).State = System.Data.Entity.EntityState.Modified;
         Entity.SaveChanges();
         return(RedirectToAction("OrderReview"));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public ActionResult Registration1()
        {
            Chatpata_dabbaEntities1 en = new Chatpata_dabbaEntities1();
            var que = en.Questions.ToList();

            ViewBag.data = que;
            return(View());
        }
        public ActionResult Forgotpass()
        {
            Chatpata_dabbaEntities1 en = new Chatpata_dabbaEntities1();

            //   var que = en.Questions.ToList();
            // ViewBag.data = que;
            return(View());
        }
Beispiel #21
0
        public ActionResult Area()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            Chatpata_dabbaEntities1 EntityFile = new Chatpata_dabbaEntities1();
            var AllUsers = EntityFile.AreaMasters.ToList();

            return(View(AllUsers));
        }
Beispiel #22
0
        public ActionResult ViewComplain()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            Chatpata_dabbaEntities1 EntityFile = new Chatpata_dabbaEntities1();
            var Feedback = EntityFile.Complains.ToList();

            return(View(Feedback));
        }
        // [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));
        }
Beispiel #24
0
        public ActionResult Changepa()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var id = Convert.ToInt32(Session["UserID"]);
            Chatpata_dabbaEntities1 en = new Chatpata_dabbaEntities1();
            var user = en.CustomerMasters.Where(q => q.CustId == id).FirstOrDefault();

            return(View(user));
        }
Beispiel #25
0
        public ActionResult EditMenu(int Id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var id = Convert.ToInt32(Session["UserID"]);
            Chatpata_dabbaEntities1 model = new Chatpata_dabbaEntities1();
            var UserDetails = model.MenuMasters.Where(q => q.Id == Id).FirstOrDefault();

            return(View(UserDetails));
        }
Beispiel #26
0
        public ActionResult AddMenuItems(int id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();

            ViewBag.MenuId = id;
            var Items = Entity.ItemMasters.ToList();

            return(View(Items));
        }
Beispiel #27
0
        public ActionResult Profile()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Customer"));
            }

            var id = Convert.ToInt32(Session["UserID"]);
            Chatpata_dabbaEntities1 model = new Chatpata_dabbaEntities1();
            var UserDetails = model.CustomerMasters.Where(q => q.CustId == id).FirstOrDefault();

            return(View(UserDetails));
        }
        public ActionResult CheckLogin(FormCollection frm)
        {
            try
            {
                var Emailid  = Convert.ToString(frm["EmailID"]);
                var password = Convert.ToString(frm["Password"]);


                Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
                CustomerMaster          reg    = new CustomerMaster();
                password = MD5Crypt.Encrypt(password, "Dabba");


                var chkEntry = Entity.CustomerMasters.Where(q => q.EmailID == Emailid && q.Password == password).FirstOrDefault();
                if (chkEntry != null)
                {
                    int?[] rid = (Entity.CustomerMasters.Where(p => p.EmailID == Emailid).Select(q => q.Roleid)).ToArray();

                    int r = Convert.ToInt16(rid[0]);

                    if (r == 1)
                    {
                        Session["UserID"] = chkEntry.CustId;

                        Session["cname"] = chkEntry.FirstName;
                        return(RedirectToAction("Admin", "Admin"));
                    }
                    else if (r == 2)
                    {
                        Session["UserID"] = chkEntry.CustId;
                        Session["cname"]  = chkEntry.FirstName;
                        return(RedirectToAction("Driver", "Driver"));
                    }
                    else
                    {
                        Session["UserID"] = chkEntry.CustId;
                        Session["cname"]  = chkEntry.FirstName;
                        return(RedirectToAction("Customer", "Customer"));
                    }
                }
                else
                {
                    TempData["ErrMsg"] = "Invalid user name or password";
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index"));
            }
        }
Beispiel #29
0
        public JsonResult CheckMenuName(string Name)
        {
            Chatpata_dabbaEntities1 Entity = new Chatpata_dabbaEntities1();
            var checkName = Entity.MenuMasters.Where(q => q.Name == Name).FirstOrDefault();

            if (checkName != null)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #30
0
 public ActionResult DriverTable()
 {
     try
     {
         Chatpata_dabbaEntities1 en = new Chatpata_dabbaEntities1();
         var records = en.CustomerMasters.Where(Q => Q.Roleid == 2).ToList();
         ViewBag.data = records;
         return(View());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }