Example #1
0
 public ActionResult SaveCustomers(CustomerProfileAndRegistration CustomerProfileAndRegistration)
 {
     try
     {
         int                 status    = 0;
         SuperAdminDAL       DAL       = new SuperAdminDAL();
         SuperAdminViewModel viewModel = new SuperAdminViewModel();
         status = DAL.SaveCustomers(CustomerProfileAndRegistration);
         viewModel.GetUserProfileAndUserRegistrationRecord = DAL.GetUserProfileAndVendorRegistrationRecord(null, Convert.ToString(Session["UserType"]));
         return(PartialView("_ManageCustomer", viewModel));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #2
0
        public int DeleteUser(CustomerProfileAndRegistration CustomerProfileAndRegistration)
        {
            try
            {
                UserProfile UserProfile = new UserProfile();
                UserProfile = _db.UserProfiles.Where(x => x.Id == CustomerProfileAndRegistration.UserProfile.Id).FirstOrDefault();
                _db.UserProfiles.Remove(UserProfile);
                _db.SaveChanges();

                UserRegistration UserRegistration = new UserRegistration();
                UserRegistration = _db.UserRegistrations.Where(x => x.Id == CustomerProfileAndRegistration.UserRegistration.Id).FirstOrDefault();
                _db.UserRegistrations.Remove(UserRegistration);
                _db.SaveChanges();
                return(1);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #3
0
 public ActionResult DeleteUser(int UserProfileId, int UserRegistrationId)
 {
     try
     {
         SuperAdminViewModel            viewmodel = new SuperAdminViewModel();
         SuperAdminDAL                  DAL       = new SuperAdminDAL();
         CustomerProfileAndRegistration CustomerProfileAndRegistration = new CustomerProfileAndRegistration();
         CustomerProfileAndRegistration.UserRegistration    = new UserRegistration();
         CustomerProfileAndRegistration.UserProfile         = new UserProfile();
         CustomerProfileAndRegistration.UserRegistration.Id = Convert.ToInt32(UserRegistrationId);
         CustomerProfileAndRegistration.UserProfile.Id      = Convert.ToInt32(UserProfileId);
         int status = DAL.DeleteUser(CustomerProfileAndRegistration);
         viewmodel.GetUserProfileAndUserRegistrationRecord = DAL.GetUserProfileAndVendorRegistrationRecord(null, Convert.ToString(Session["UserType"]));
         return(PartialView("_ManageCustomer", viewmodel));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #4
0
        public int SaveCustomers(CustomerProfileAndRegistration CustomerProfileAndRegistration)
        {
            try
            {
                if (CustomerProfileAndRegistration.UserProfile.Id == 0)
                {
                    //CustomerProfileAndRegistration.VendorRegistration.Type = "Customer";
                    if (CustomerProfileAndRegistration.UserRegistration.Type != null)
                    {
                        CustomerProfileAndRegistration.UserRegistration.Type = CustomerProfileAndRegistration.UserRegistration.Type;
                    }
                    else
                    {
                        CustomerProfileAndRegistration.UserRegistration.Type = "Customer";
                    }
                    _db.UserRegistrations.Add(CustomerProfileAndRegistration.UserRegistration);
                    _db.SaveChanges();

                    CustomerProfileAndRegistration.UserProfile.UserRegistrationId = CustomerProfileAndRegistration.UserRegistration.Id;
                    CustomerProfileAndRegistration.UserProfile.Email    = CustomerProfileAndRegistration.UserRegistration.Email;
                    CustomerProfileAndRegistration.UserProfile.IsActive = true;

                    _db.UserProfiles.Add(CustomerProfileAndRegistration.UserProfile);
                    _db.SaveChanges();
                }
                else
                {
                    UserRegistration UserRegistrations = new UserRegistration();
                    UserRegistrations                 = _db.UserRegistrations.Where(x => x.Id == CustomerProfileAndRegistration.UserRegistration.Id).FirstOrDefault();
                    UserRegistrations.UserName        = CustomerProfileAndRegistration.UserRegistration.UserName;
                    UserRegistrations.ConfirmPassword = CustomerProfileAndRegistration.UserRegistration.ConfirmPassword;
                    UserRegistrations.Password        = CustomerProfileAndRegistration.UserRegistration.Password;
                    UserRegistrations.Email           = CustomerProfileAndRegistration.UserRegistration.Email;
                    if (CustomerProfileAndRegistration.UserRegistration.Type != null)
                    {
                        UserRegistrations.Type = CustomerProfileAndRegistration.UserRegistration.Type;
                    }
                    else
                    {
                        UserRegistrations.Type = "Customer";
                    }

                    _db.SaveChanges();

                    UserProfile UserProfile = new UserProfile();
                    UserProfile                = _db.UserProfiles.Where(x => x.Id == CustomerProfileAndRegistration.UserProfile.Id).FirstOrDefault();
                    UserProfile.FirstName      = CustomerProfileAndRegistration.UserProfile.FirstName;
                    UserProfile.MiddleName     = CustomerProfileAndRegistration.UserProfile.MiddleName;
                    UserProfile.LastName       = CustomerProfileAndRegistration.UserProfile.LastName;
                    UserProfile.Email          = CustomerProfileAndRegistration.UserRegistration.Email;
                    UserProfile.PhoneNo        = CustomerProfileAndRegistration.UserProfile.PhoneNo;
                    UserProfile.MobileNo       = CustomerProfileAndRegistration.UserProfile.MobileNo;
                    UserProfile.PrimaryAddress = CustomerProfileAndRegistration.UserProfile.PrimaryAddress;
                    UserProfile.DOB            = CustomerProfileAndRegistration.UserProfile.DOB;
                    UserProfile.CNIC           = CustomerProfileAndRegistration.UserProfile.CNIC;
                    _db.SaveChanges();
                }


                return(CustomerProfileAndRegistration.UserProfile.Id);
            }
            catch (Exception ex)
            {
                throw;
            }
        }