Beispiel #1
0
        public bool Update_User_Password(string strUserName, string strPassword)
        {
            try
            {
                var gettui = from tui in db.t_user_info
                             where tui.F_USER_NAME == strUserName
                             select tui;

                List <T_USER_INFO> ui = gettui.ToList();
                if (ui.Count > 0)
                {
                    T_USER_INFO updatingUi = ui[0];
                    updatingUi.F_USER_PASSWORD   = strPassword;
                    updatingUi.F_USER_UPDATEDATE = DateTime.Now;
                }

                // Submit the changes to the database.
                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
                // Provide for exceptions.
            }
        }
Beispiel #2
0
 public bool Add_User_Info(T_USER_INFO tui)
 {
     db.t_user_info.Add(tui);
     // Submit the change to the database.
     try
     {
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(false);
         // Make some adjustments.
         // ...
         // Try again.
         //db.SaveChanges();
     }
     return(false);
 }