public static string Update(int UID, string Fullname, int Gender, DateTime BirthDay,
                             string Email, string Phone, string Address, DateTime ModifiedDate, string ModifiedBy, string Note)
 {
     using (var dbe = new inventorymanagementEntities())
     {
         dbe.Configuration.ValidateOnSaveEnabled = false;
         tbl_AccountInfo ui = dbe.tbl_AccountInfo.Where(a => a.UID == UID).SingleOrDefault();
         if (ui != null)
         {
             ui.Fullname     = Fullname;
             ui.Gender       = Gender;
             ui.Birthday     = BirthDay;
             ui.Email        = Email;
             ui.Phone        = Phone;
             ui.Address      = Address;
             ui.ModifiedBy   = ModifiedBy;
             ui.ModifiedDate = ModifiedDate;
             ui.Note         = Note;
             int kq = dbe.SaveChanges();
             return(kq.ToString());
         }
         else
         {
             return(null);
         }
     }
 }
 public static tbl_AccountInfo GetByUserID(int UID)
 {
     using (var dbe = new inventorymanagementEntities())
     {
         tbl_AccountInfo ai = dbe.tbl_AccountInfo.Where(a => a.UID == UID).SingleOrDefault();
         if (ai != null)
         {
             return(ai);
         }
         else
         {
             return(null);
         }
     }
 }
 public static tbl_AccountInfo GetByPhone(string phone)
 {
     using (var dbe = new inventorymanagementEntities())
     {
         tbl_AccountInfo acc = dbe.tbl_AccountInfo.Where(a => a.Phone == phone).SingleOrDefault();
         if (acc != null)
         {
             return(acc);
         }
         else
         {
             return(null);
         }
     }
 }
 public static string updateNote(int UID, string Note)
 {
     using (var dbe = new inventorymanagementEntities())
     {
         dbe.Configuration.ValidateOnSaveEnabled = false;
         tbl_AccountInfo ui = dbe.tbl_AccountInfo.Where(a => a.UID == UID).SingleOrDefault();
         if (ui != null)
         {
             ui.Note = Note;
             int kq = dbe.SaveChanges();
             return(kq.ToString());
         }
         else
         {
             return(null);
         }
     }
 }
 public static string Insert(int UID, string Fullname, int Gender, DateTime BirthDay,
                             string Email, string Phone, string Address,
                             DateTime CreatedDate, string CreatedBy)
 {
     using (var dbe = new inventorymanagementEntities())
     {
         dbe.Configuration.ValidateOnSaveEnabled = false;
         tbl_AccountInfo ui = new tbl_AccountInfo();
         ui.UID         = UID;
         ui.Fullname    = Fullname;
         ui.Gender      = Gender;
         ui.Birthday    = BirthDay;
         ui.Email       = Email;
         ui.Phone       = Phone;
         ui.Address     = Address;
         ui.CreatedDate = CreatedDate;
         ui.CreatedBy   = CreatedBy;
         dbe.tbl_AccountInfo.Add(ui);
         int kq = dbe.SaveChanges();
         return(kq.ToString());
     }
 }