Beispiel #1
0
        //DAL.onLocal();
        //        MySqlParameter[] param = new MySqlParameter[1];

        //param[0] = new MySqlParameter("@idCar", int.Parse(idCar));

        //DataTable data = DAL.SelectData("Call CarDetailsByIdCar(@idCar);", param);
        public DataTable user_profileInsertUpdate(UserProfile_Model userProfile)
        {
            DataTable dt = new DataTable();

            DAL2.onOnLine();
            MySqlParameter[] param = new MySqlParameter[7];
            param[0] = new MySqlParameter("@id", userProfile.id);
            param[1] = new MySqlParameter("@username", userProfile.username);
            param[2] = new MySqlParameter("@password", userProfile.password);
            param[3] = new MySqlParameter("@roleUser", userProfile.roleUser);
            param[4] = new MySqlParameter("@stateUser", userProfile.stateUser);
            param[5] = new MySqlParameter("@dateValidate", userProfile.dateValidate);
            param[6] = new MySqlParameter("@uuid", userProfile.uuid);
            dt       = DAL2.SelectData("CALL user_profileInsertUpdate( @id, @username,@password,@roleUser, @stateUser, @dateValidate, @uuid);", param);
            return(dt);
        }
Beispiel #2
0
        public DataTable CheckUserNameAndPassword(UserProfile_Model userProfile)
        {
            DAL.onLocal();
            DAL.Open();

            SqlParameter[] param = new SqlParameter[2];

            param[0]       = new SqlParameter("@Username", SqlDbType.NVarChar);
            param[0].Value = userProfile.username;

            param[1]       = new SqlParameter("@Password", SqlDbType.NVarChar);
            param[1].Value = userProfile.password;

            DataTable dt = DAL.SelectData("CheckUserNameAndPassword", param);

            DAL.Close();
            return(dt);
        }
Beispiel #3
0
 public ActionResult UserProfileAdd(UserProfile_Model userProfile_)
 {
     if (string.IsNullOrEmpty(userProfile_.ProfileName) || string.IsNullOrEmpty(userProfile_.Description) || userProfile_.UserProfileStatus == null)
     {
         ViewBag.AddUserProfileError = "Error";
         return(View("UserProfile"));
     }
     else
     {
         if (UserProfile_Interface_.SaveUserProfile(userProfile_))
         {
             Session["Success"] = userProfile_.ProfileName + " added successfully!!";
         }
         else
         {
             Session["Error"] = userProfile_.ProfileName + " couldn't be added please retry!!";
         }
         return(RedirectToAction("UserProfile"));
     }
 }
Beispiel #4
0
        public ActionResult UserProfileDelete(UserProfile_Model userProfile_)
        {
            var Module_Name = userProfile_.ProfileName;

            try
            {
                if (UserProfile_Interface_.DeleteUserProfile(userProfile_.UserProfileID))
                {
                    return(Json(Module_Name + " profile has been deleted successfully"));
                }
                else
                {
                    return(Json("Error"));
                }
            }
            catch (Exception e)
            {
                return(Json("Error" + e.ToString()));
            }
        }
 public bool UpdateUserProfile(UserProfile_Model userProfile)
 {
     using (var _context = new SalesTrackingSystemEntities())
     {
         try
         {
             var data = _context.UserProfiles.Where(userProfiles => userProfiles.UserProfileID == userProfile.UserProfileID).FirstOrDefault();
             data.ProfileName       = userProfile.ProfileName;
             data.UserProfileStatus = userProfile.UserProfileStatus;
             data.Description       = userProfile.Description;
             //data.CreatedBy = userProfile.CreatedBy;
             _context.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Beispiel #6
0
        public DataTable InsertUser(UserProfile_Model userProfile)
        {
            DAL.onLocal();
            DAL.Open();

            SqlParameter[] param = new SqlParameter[9];

            param[0]       = new SqlParameter("@id", SqlDbType.Int);
            param[0].Value = userProfile.id;

            param[1]       = new SqlParameter("@name", SqlDbType.NVarChar);
            param[1].Value = userProfile.username;

            param[2]       = new SqlParameter("@password", SqlDbType.NVarChar);
            param[2].Value = userProfile.password;

            param[3]       = new SqlParameter("@roleuser", SqlDbType.Int);
            param[3].Value = userProfile.roleUser;

            param[4]       = new SqlParameter("@stateUser", SqlDbType.Int);
            param[4].Value = userProfile.stateUser;

            param[5]       = new SqlParameter("@dateValidate", SqlDbType.DateTime);
            param[5].Value = userProfile.dateValidate;

            param[6]       = new SqlParameter("@user", SqlDbType.Int);
            param[6].Value = userProfile.user;

            param[7]       = new SqlParameter("@date", SqlDbType.DateTime);
            param[7].Value = userProfile.date;

            param[8]       = new SqlParameter("@state", SqlDbType.Int);
            param[8].Value = userProfile.state;
            DataTable dt = DAL.SelectData("InsertUser", param);

            DAL.Close();
            return(dt);
        }
 public bool SaveUserProfile(UserProfile_Model userProfile)
 {
     using (var _dbContext = new SalesTrackingSystemEntities())
     {
         try
         {
             var data = new UserProfile()
             {
                 ProfileName       = userProfile.ProfileName,
                 UserProfileStatus = userProfile.UserProfileStatus,
                 Description       = userProfile.Description,
                 DateCreated       = DateTime.Now
                                     //CreatedBy = userProfile.CreatedBy
             };
             _dbContext.UserProfiles.Add(data);
             _dbContext.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }