Exemplo n.º 1
0
 public ActionResult CreateQuestion(Questionbase obj)
 {
     try
     {
         if (Session["user"] != null)
         {
             Logindetail LogInfo = Session["user"] as Logindetail;
             obj.LoginID     = LogInfo.Loginid;
             obj.CreatedDate = DateTime.Now;
             DB.Questionbases.Add(obj);
             DB.SaveChanges();
             ViewBag.sucMsg = "Question sends success.";
             return(View());
         }
         else
         {
             ViewBag.ErrorEx = "Session is expired.";
             return(View("Error"));
         }
     }
     catch (Exception ex)
     {
         ViewBag.ErrorEx = ex.Message;
         return(View("Error"));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create FeedBack
 /// </summary>
 public ActionResult Create(FeedbackDesc obj)
 {
     try
     {
         if (Session["user"] != null)
         {
             Logindetail user = Session["user"] as Logindetail;
             obj.LoginID     = user.Loginid;
             obj.CreatedBy   = user.Loginid.ToString();
             obj.CreatedDate = DateTime.Now;
             obj.IsDeleted   = false;
             obj.IsActive    = true;
             DB.FeedbackDescs.Add(obj);
             DB.SaveChanges();
             LoadDDL();
             ViewBag.sucMsg = "Feedback sends success.";
             return(View("Index"));
         }
         else
         {
             ViewBag.ErrorEx = "Session is expired.";
             return(View("Error"));
         }
     }
     catch (Exception ex)
     {
         ViewBag.ErrorEx = ex.Message;
         return(View("Index"));
     }
 }
Exemplo n.º 3
0
 public ActionResult CreateQuery(Query obj)
 {
     try
     {
         if (Session["user"] != null)
         {
             Logindetail LogInfo = Session["user"] as Logindetail;
             obj.LogiID    = LogInfo.Loginid;
             obj.QueryDate = DateTime.Now;
             obj.IsActive  = true;
             obj.IsDeleted = false;
             DB.Queries.Add(obj);
             DB.SaveChanges();
             ViewBag.sucMsg = "Query sends success.";
             return(View());
         }
         else
         {
             ViewBag.ErrorEx = "Session is expired.";
             return(View("Error"));
         }
     }
     catch (Exception ex)
     {
         ViewBag.ErrorEx = ex.Message;
         return(View("Error"));
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Add Cart to store selected product
        /// </summary>
        public ActionResult AddCart(int Id, int price)
        {
            try
            {
                if (Session["user"] != null)
                {
                    Logindetail LogInfo = Session["user"] as Logindetail;

                    DB.sp_SaveCart(Id, 0, price, LogInfo.Loginid);
                    ViewBag.sucMsg = "Item added in cart success.";
                    IList <cGet_Items> _getallitem = GetItems();
                    return(View("Index", _getallitem));
                }
                else
                {
                    ViewBag.ErrorEx = "Session is expired.";
                    return(View("Error"));
                }
            }
            catch (Exception ex)
            {
                ViewBag.ErrorEx = ex.Message;
                return(View("Index"));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Add Cart to store selected product
        /// </summary>
        public ActionResult AddCart(int Id)
        {
            try
            {
                if (Session["user"] != null)
                {
                    Logindetail LogInfo = Session["user"] as Logindetail;

                    DB.sp_SaveCart(Id, 0, 0, LogInfo.Loginid);

                    ViewBag.sucMsg = "Added new cart success.";
                    return(View("Index"));
                }
                else
                {
                    ViewBag.ErrorEx = "Session is expired.";
                    return(View("Error"));
                }
            }
            catch (Exception ex)
            {
                ViewBag.ErrorEx = ex.Message;
                return(View("Index"));
            }
        }
Exemplo n.º 6
0
        public ActionResult Create(CraditDetails obj)
        {
            try                                                           //try catch block to check the valid details
            {
                if (Session["user"] != null)                              // Checking session is valid or not
                {
                    Logindetail LogInfo = Session["user"] as Logindetail; // getting stored session values in Logindetails object
                    obj.LoginId = LogInfo.Loginid;                        // Assigning LoginId to Creaditapp

                    // Quantity validation

                    Inventory dbobj = DB.Inventories.Where(x => x.ItemID == obj.OrderItemId).FirstOrDefault();

                    if (dbobj != null)
                    {
                        dbobj.Quantity = dbobj.Quantity - obj.OrderQuantity;
                        DB.SaveChanges();
                    }

                    //Saving Ordered details and cradit details
                    DB.sp_Save_Orders(obj.OrderItemId, obj.OrderQuantity, obj.LoginId, obj.Type, obj.CcNumber, obj.CName, obj.Cvv, obj.Exp, obj.Street, obj.CityID, obj.StateID, obj.CountryID, obj.Zipcode);

                    //Adding message for added new order...
                    ViewBag.sucMsg = "Added new order success.";

                    //Redirecting to all order details
                    return(RedirectToAction("Index", "Order"));
                }
                else
                {
                    ViewBag.ErrorEx = "Session is expired.";
                    return(View("Error"));
                }
            }
            catch (Exception ex)
            {
                ViewBag.ErrorEx = ex.Message;
                return(View("Error"));
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Get all orders to check ordered list
 /// </summary>
 public ActionResult Index()
 {
     try
     {
         if (Session["user"] != null)
         {
             Logindetail            LogInfo    = Session["user"] as Logindetail;
             IList <cGet_AllOrders> _AllOrders = DB.sp_Get_AllOrders(0).ToList();
             return(View(_AllOrders));
         }
         else
         {
             ViewBag.ErrorEx = "Session is expired.";
             return(View("Error"));
         }
     }
     catch (Exception ex)
     {
         ViewBag.ErrorEx = ex.Message;
         return(View("Index"));
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Add FeedBack to products
 /// </summary>
 public ActionResult Index()
 {
     try
     {
         if (Session["user"] != null)
         {
             Logindetail user = Session["user"] as Logindetail;
             LoadDDL();
             return(View());
         }
         else
         {
             ViewBag.ErrorEx = "Session is expired.";
             return(View("Error"));
         }
     }
     catch (Exception ex)
     {
         ViewBag.ErrorEx = ex.Message;
         return(View("Index"));
     }
 }
 /// <summary>
 /// Get total orders and ordered dates
 /// </summary>
 public ActionResult Index()
 {
     try
     {
         if (Session["user"] != null)
         {
             Logindetail        user       = Session["user"] as Logindetail;
             IList <TotalOrder> totalOrdes = DB.TotalOrders.Where(x => x.IsDeleted == false && x.IsActive == true && x.LoginID != 0).ToList();
             return(View(totalOrdes));
         }
         else
         {
             ViewBag.ErrorEx = "Session is expired.";
             return(View("Error"));
         }
     }
     catch (Exception ex)
     {
         ViewBag.ErrorEx = ex.Message;
         return(View("Index"));
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Get all customers feedback
 /// </summary>
 public ActionResult Index()
 {
     try
     {
         if (Session["user"] != null)
         {
             Logindetail user = Session["user"] as Logindetail;
             IList <cGet_AllFeedback> Feedback = DB.sp_Get_AllFeedback(user.Loginid).ToList();
             return(View(Feedback));
         }
         else
         {
             ViewBag.ErrorEx = "Session is expired.";
             return(View("Error"));
         }
     }
     catch (Exception ex)
     {
         ViewBag.ErrorEx = ex.Message;
         return(View("Index"));
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// Get valid login details
        /// </summary>
        public ActionResult CheckLoginAccess(Logindetail Lobj, string ReturnUrl)
        {
            try
            {
                // Checking user exist or given user name and password
                Logindetail _User = DB.Logindetails.Where(x => x.Loginname == Lobj.Loginname && x.Password == Lobj.Password && x.IsDeleted == false).FirstOrDefault();
                // Validating user
                if (_User != null)
                {
                    //Seting form authentication
                    FormsAuthentication.SetAuthCookie(_User.Logintype, false);

                    //Store the user information in session
                    Session["user"] = _User as Logindetail;

                    //Checking user role accessing the controller's
                    if (_User.Logintype == "Admin")
                    {
                        return(RedirectToAction("Index", "cmsAdmin"));
                    }
                    else if (_User.Logintype == "Customer")
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                //In valid user
                else
                {
                    ViewBag.sucMsg = "user name and password incorrect.";
                }
                return(View("Index"));
            }
            catch (Exception ex)
            {
                // system handle exception return error view page.
                ViewBag.exError = ex.Message;
                return(View("Error"));
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Add new password required old password and login name
        /// </summary>
        public ActionResult addnewpassword(ChangePasword obj)
        {
            try
            {
                if (Session["user"] != null)
                {
                    Logindetail user = DB.Logindetails.Where(x => x.Loginname == obj.username && x.Password == obj.oldpassword && x.IsActive == true && x.IsDeleted == false).FirstOrDefault();
                    if (user != null)
                    {
                        user.Password         = obj.newpassword;
                        user.Passmodifieddate = DateTime.Now;
                        user.UpdatedBy        = user.Loginid.ToString();
                        user.UpdatedDate      = DateTime.Now;

                        DB.SaveChanges();
                        ViewBag.sucMsg = "Password is changed successfully.";
                        return(View("Index"));
                    }
                    else
                    {
                        ViewBag.sucMsg = "Login name and password is not matched please try agin.";
                        return(View("Index"));
                    }
                }
                else
                {
                    ViewBag.ErrorEx = "Session is expired.";
                    return(View("Error"));
                }
            }
            catch (Exception ex)
            {
                ViewBag.ErrorEx = ex.Message;
                return(View("Index"));
            }
        }