public static int Insert(object ID_nhan_vien, string Tai_khoan, string Mat_khau, string Ten_day_du, int ID_trang_thai, string Thoi_gian_cho, Entities db = null) { if (db == null) { db = new Entities(); } var entity = db.SYS_NguoiDung.FirstOrDefault(t => t.Tai_khoan == Tai_khoan); if (entity == null) { entity = new SYS_NguoiDung(); } else { return(-1); } entity.Tai_khoan = Tai_khoan; entity.Ten_day_du = Ten_day_du; entity.ID_trang_thai = ID_trang_thai; entity.Thoi_gian_cho = TimeSpan.Parse(Thoi_gian_cho); entity.Mat_khau = SecurityHelper.CreateSHAHash(Mat_khau); if (ID_nhan_vien != null) { entity.ID_nhan_vien = (int?)ID_nhan_vien; } db.SYS_NguoiDung.Add(entity); return(db.SaveChanges()); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DevExpress.Skins.SkinManager.EnableFormSkins(); UserLookAndFeel.Default.SetSkinStyle("Office 2013"); CurrentUser = new SYS_NguoiDung(); Application.Run(new frmMain()); }