Esempio n. 1
0
        public void UpdateProfile(ProfileView PV)
        {
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                User user = new User();
                user.UserID          = PV.UserID;
                user.Username        = PV.Username;
                user.Password        = PV.Password;
                db.Entry(user).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                UserProfile UP = new UserProfile();
                UP.UserProfileID   = PV.UserProfileID;
                UP.UserID          = PV.UserID;
                UP.RoleID          = PV.RoleID;
                UP.FirstName       = PV.FirstName;
                UP.LastName        = PV.LastName;
                UP.Gender          = PV.Gender;
                UP.BirthDate       = Convert.ToDateTime(PV.BirthDate);
                UP.Email           = PV.Email;
                UP.Mobile          = PV.Mobile;
                db.Entry(UP).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                FormsAuthentication.SetAuthCookie(PV.Username, false);
            }
        }
Esempio n. 2
0
        public void AddEmployeeAccount(UserProfileView user)
        {
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                //User Table
                User U = new User();
                U.Username = user.Username;
                U.Password = user.Password;
                db.Users.Add(U);
                db.SaveChanges();

                //UserProfile Table
                UserProfile UP = new UserProfile();
                UP.UserID    = U.UserID;
                UP.FirstName = user.FirstName;
                UP.LastName  = user.LastName;
                UP.Gender    = user.Gender;
                UP.BirthDate = Convert.ToDateTime(user.BirthDate);
                UP.Mobile    = user.Mobile;
                UP.Email     = user.Email;
                UP.RoleID    = 2;
                db.UserProfiles.Add(UP);
                db.SaveChanges();
            }
        }
Esempio n. 3
0
        public void AddUserAccount(UserSignUpView user)
        {
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                //User Table
                User U = new User();
                U.Username = user.Username;
                U.Password = user.Password;
                db.Users.Add(U);
                db.SaveChanges();

                //UserProfile Table
                UserProfile UP = new UserProfile();
                UP.UserID    = U.UserID;
                UP.FirstName = user.FirstName;
                UP.LastName  = user.LastName;
                UP.Gender    = user.Gender;
                UP.BirthDate = user.BirthDate;
                UP.Mobile    = user.Mobile;
                UP.Email     = user.Email;
                UP.RoleID    = 3;
                db.UserProfiles.Add(UP);
                db.SaveChanges();

                CustomerUser CU = new CustomerUser();
                CU.UserID = U.UserID;
                CU.Active = true;
                db.CustomerUsers.Add(CU);
                db.SaveChanges();
            }
        }
Esempio n. 4
0
        public void UpdateUserAccount(UserProfileView user)
        {
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                //User Table
                User U = new User();
                U.UserID          = user.UserID;
                U.Username        = user.Username;
                U.Password        = user.Password;
                db.Entry(U).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                //UserProfile Table
                UserProfile UP = new UserProfile();
                UP.UserProfileID   = user.UserProfileID;
                UP.UserID          = U.UserID;
                UP.FirstName       = user.FirstName;
                UP.LastName        = user.LastName;
                UP.Gender          = user.Gender;
                UP.BirthDate       = Convert.ToDateTime(user.BirthDate);
                UP.Mobile          = user.Mobile;
                UP.Email           = user.Email;
                UP.RoleID          = user.RoleID;
                db.Entry(UP).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
Esempio n. 5
0
        public ActionResult Delete(int id)
        {
            UserManager     UM  = new UserManager();
            UserProfileView UPV = new UserProfileView();

            UPV = UM.GetAllUserProfiles().Where(o => o.UserProfileID.Equals(id)).FirstOrDefault();
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                UserProfile userProfile = new UserProfile();
                userProfile.UserProfileID   = UPV.UserProfileID;
                userProfile.UserID          = UPV.UserID;
                userProfile.FirstName       = UPV.FirstName;
                userProfile.LastName        = UPV.LastName;
                userProfile.Gender          = UPV.Gender;
                userProfile.BirthDate       = Convert.ToDateTime(UPV.BirthDate);
                userProfile.Email           = UPV.Email;
                userProfile.Mobile          = UPV.Mobile;
                userProfile.RoleID          = UPV.RoleID;
                db.Entry(userProfile).State = EntityState.Deleted;
                db.SaveChanges();
                CMSProject.Models.DB.User user = new User();
                user.UserID          = userProfile.UserID;
                user.Username        = UPV.Username;
                user.Password        = UPV.Password;
                db.Entry(user).State = EntityState.Deleted;
                db.SaveChanges();
                return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 6
0
        public void UpdateOrder(OrderUpdateView OUV)
        {
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                CustomerOrder CO = new CustomerOrder();
                CO.OrderID    = OUV.OrderID;
                CO.CustomerID = OUV.CustomerID;
                CO.OrderDate  = OUV.OrderDate;
                if (OUV.ShippedDate.HasValue)
                {
                    CO.ShippedDate = OUV.ShippedDate;
                }
                else
                {
                    CO.ShippedDate = null;
                }
                CO.PickupAddressID   = OUV.PickupAddressID;
                CO.ShippingAddressID = OUV.ShippingAddressID;
                CO.Weight            = OUV.Weight;
                CO.OrderValue        = OUV.OrderValue;
                db.Entry(CO).State   = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                PaymentTBL pay = new PaymentTBL();
                pay.PaymentID = OUV.PaymentID;
                pay.Value     = CO.OrderValue;
                if (OUV.PaymentDate.HasValue)
                {
                    pay.PaymentDate = OUV.PaymentDate;
                }
                else
                {
                    pay.PaymentDate = null;
                }
                pay.PaymentStatusID = OUV.PaymentStatusID;
                pay.OrderID         = CO.OrderID;
                db.Entry(pay).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                TrackingTBL tracking = new TrackingTBL();
                tracking.TrackingID       = OUV.TrackingID;
                tracking.PickupBranchID   = OUV.PickupBranchID;
                tracking.ShippingBranchID = OUV.ShippingBranchID;
                tracking.OrderStatusID    = OUV.OrderStatusID;
                tracking.OrderID          = CO.OrderID;
                db.Entry(tracking).State  = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
Esempio n. 7
0
        public void PlaceOrder(PlaceOrderView POV)
        {
            Address paddr = new Address();
            Address saddr = new Address();

            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                paddr.StreetAddress = POV.PickupAddressSA;
                paddr.City          = POV.PickupAddressCity;
                paddr.State         = POV.PickupAddressState;
                paddr.Pincode       = POV.PickupAddressPincode;
                saddr.StreetAddress = POV.ShippingAddressSA;
                saddr.City          = POV.ShippingAddressCity;
                saddr.State         = POV.ShippingAddressState;
                saddr.Pincode       = POV.ShippingAddressPincode;
                db.Addresses.Add(paddr);
                db.SaveChanges();
                db.Addresses.Add(saddr);
                db.SaveChanges();
                User          user = db.Users.Where(o => o.Username.Equals(HttpContext.Current.User.Identity.Name)).FirstOrDefault();
                CustomerUser  CU   = db.CustomerUsers.Where(o => o.UserID.Equals(user.UserID)).FirstOrDefault();
                CustomerOrder CO   = new CustomerOrder();
                CO.CustomerID        = CU.CustomerID;
                CO.OrderDate         = DateTime.Now;
                CO.ShippedDate       = null;
                CO.PickupAddressID   = db.Addresses.Where(o => o.StreetAddress.Equals(paddr.StreetAddress)).FirstOrDefault().AddressID;
                CO.ShippingAddressID = db.Addresses.Where(o => o.StreetAddress.Equals(saddr.StreetAddress)).FirstOrDefault().AddressID;
                CO.Weight            = POV.Weight;
                CO.OrderValue        = POV.OrderValue;
                db.CustomerOrders.Add(CO);
                db.SaveChanges();

                TrackingTBL tracking = new TrackingTBL();
                tracking.OrderStatusID = 0;
                tracking.OrderID       = CO.OrderID;
                db.TrackingTBLs.Add(tracking);
                db.SaveChanges();

                PaymentTBL pay = new PaymentTBL();
                pay.Value           = CO.OrderValue;
                pay.PaymentDate     = null;
                pay.PaymentStatusID = 1;
                pay.OrderID         = CO.OrderID;
                db.PaymentTBLs.Add(pay);
                db.SaveChanges();
            }
        }
Esempio n. 8
0
        public ActionResult MakeComplaint(ComplaintView CV)
        {
            DataManager DM = new DataManager();
            Complaint   C  = new Complaint();

            C = DM.AddOrUpdateComplaint(CV, 1);
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                db.Complaints.Add(C);
                db.SaveChanges();
            }
            return(Json(new { success = true, message = "Added Successfully!" }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 9
0
 public void AddBranch(BranchesView BV)
 {
     using (CMSProjectEntities db = new CMSProjectEntities())
     {
         BranchList branch = new BranchList();
         branch.StreetAddress = BV.StreetAddress;
         branch.City          = BV.City;
         branch.State         = BV.State;
         branch.Pincode       = BV.Pincode;
         branch.Active        = true;
         db.BranchLists.Add(branch);
         db.SaveChanges();
     }
 }
Esempio n. 10
0
 public ActionResult Feedback(FeedbackView FV)
 {
     using (CMSProjectEntities db = new CMSProjectEntities())
     {
         CMSProject.Models.DB.Feedback FB = new Feedback();
         FB.Description = FV.Description;
         UserManager UM                 = new UserManager();
         var         username           = System.Web.HttpContext.Current.User.Identity.Name;
         CMSProject.Models.DB.User user = db.Users.Where(o => o.Username.Equals(username)).FirstOrDefault();
         FB.CustomerID = db.CustomerUsers.Where(o => o.UserID.Equals(user.UserID)).FirstOrDefault().CustomerID;
         db.Feedbacks.Add(FB);
         db.SaveChanges();
     }
     return(RedirectToAction("Index", "Home"));
 }
Esempio n. 11
0
 public void UpdateComplaint(ComplaintView CV)
 {
     using (CMSProjectEntities db = new CMSProjectEntities())
     {
         var       emp           = db.Users.Where(o => o.Username.Equals(HttpContext.Current.User.Identity.Name)).FirstOrDefault();
         Complaint currComplaint = new Complaint();
         currComplaint.ComplaintID       = CV.ComplaintID;
         currComplaint.CustomerID        = CV.CustomerID;
         currComplaint.Description       = CV.Description;
         currComplaint.ComplaintStatusID = CV.ComplaintStatusID;
         currComplaint.EmployeeID        = emp.UserID;
         db.Entry(currComplaint).State   = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 12
0
 public void UpdateBranch(BranchesView BV)
 {
     using (CMSProjectEntities db = new CMSProjectEntities())
     {
         BranchList branch = new BranchList();
         branch.BranchID        = BV.BranchID;
         branch.StreetAddress   = BV.StreetAddress;
         branch.City            = BV.City;
         branch.State           = BV.State;
         branch.Pincode         = BV.Pincode;
         branch.Active          = (bool)BV.Active;
         db.Entry(branch).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 13
0
        public ActionResult DeleteB(int id)
        {
            DataManager  DM = new DataManager();
            BranchesView BV = new BranchesView();

            BV = DM.GetBranchView(id);
            using (CMSProjectEntities db = new CMSProjectEntities())
            {
                BranchList branch = new BranchList();
                branch.BranchID        = BV.BranchID;
                branch.StreetAddress   = BV.StreetAddress;
                branch.City            = BV.City;
                branch.State           = BV.State;
                branch.Pincode         = BV.Pincode;
                branch.Active          = (bool)BV.Active;
                db.Entry(branch).State = System.Data.Entity.EntityState.Deleted;
                db.SaveChanges();
                return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
            }
        }