Beispiel #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CustomList<UserProfile> lstUserProfile = UserProfileList;
                if (lstUserProfile.Count == 0)
                {
                    UserProfile uP = new UserProfile();
                    lstUserProfile.Add(uP);
                }
                UserProfile uPObj=lstUserProfile[0];
                uPObj.UserCode = CurrentUserSession.UserCode;
                uPObj.ThemeName = ddlTheme.SelectedValue;
                uPObj.DefaultAppID = ddlDefalultApplication.SelectedValue.ToInt();
                //UserProfileList.Add(uPObj);
                manager.SaveUserProfile(ref lstUserProfile);
                this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg);

                CurrentUserSession.DefaultApplicationID = ddlDefalultApplication.SelectedValue.ToInt();
                CurrentUserSession.DefaultTheme = ddlTheme.SelectedValue;
                Session["Static_Theme"] = ddlTheme.SelectedValue;
                Response.Redirect(Request.RawUrl);
            }
            catch (SqlException ex)
            {
                this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
            }
            catch (Exception ex)
            {
                this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }
Beispiel #2
0
 public static CustomList<UserProfile> GetAllUserProfile(String userCode)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
     CustomList<UserProfile> UserProfileCollection = new CustomList<UserProfile>();
     IDataReader reader = null;
     String sql = "select  *from UserProfile Where UserCode='" + userCode + "'";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             UserProfile newUserProfile = new UserProfile();
             newUserProfile.SetData(reader);
             UserProfileCollection.Add(newUserProfile);
         }
         return UserProfileCollection;
     }
     catch(Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }