static void Main(string[] args) { // Create the MyApplicationContext, that derives from ApplicationContext, // that manages when the application should exit. MyApplicationContext context = new MyApplicationContext(); // Run the application with the specific context. It will exit when // all forms are closed. Application.Run(context); }
public static void XoaDiemSVVan(string idSinhVien) { var db = new MyApplicationContext(); var itemToRemove = db.KhoaVanDbSet.SingleOrDefault(x => x.IDSinhVien.Equals(idSinhVien)); if (itemToRemove != null) { db.KhoaVanDbSet.Remove(itemToRemove); db.SaveChanges(); } }
public static void CapNhatDiemSVVan(float DiemVHCD, float DiemVHHD, string IDSinhvien) { var db = new MyApplicationContext(); var result = db.KhoaVanDbSet.SingleOrDefault(a => a.IDSinhVien.Equals(IDSinhvien)); if (result != null) { result.DiemVHCD = DiemVHCD; result.DiemVHHD = DiemVHHD; db.SaveChanges(); } }
public static void CapNhatDiemSVCNTT(float DiemC, float DiemJava, string IDSinhvien) { var db = new MyApplicationContext(); var result = db.KhoaTinDbSet.SingleOrDefault(a => a.IDSinhVien.Equals(IDSinhvien)); if (result != null) { result.DiemC = DiemC; result.DiemJava = DiemJava; db.SaveChanges(); } }
public static void ThemDiemSVVan(float DiemVHCD, float DiemVHHD, string IDSinhvien) { var db = new MyApplicationContext(); var cre = db.KhoaVanDbSet.Create(); cre.IDDiem = Guid.NewGuid().ToString(); cre.DiemVHCD = DiemVHCD; cre.DiemVHHD = DiemVHHD; cre.IDSinhVien = IDSinhvien; db.KhoaVanDbSet.Add(cre); db.SaveChanges(); }
public static void ThemDiemSVLy(float DiemCoHoc, float DiemQuangHoc, string IDSinhvien) { var db = new MyApplicationContext(); var cre = db.KhoaLyDbSet.Create(); cre.IDDiem = Guid.NewGuid().ToString(); cre.DiemCoHoc = DiemCoHoc; cre.DiemQuangHoc = DiemQuangHoc; cre.IDSinhVien = IDSinhvien; db.KhoaLyDbSet.Add(cre); db.SaveChanges(); }
public static void ThemDiemSVCNTT(float DiemC, float DiemJava, string IDSinhvien) { var db = new MyApplicationContext(); var cre = db.KhoaTinDbSet.Create(); cre.IDDiem = Guid.NewGuid().ToString(); cre.DiemC = DiemC; cre.DiemJava = DiemJava; cre.IDSinhVien = IDSinhvien; db.KhoaTinDbSet.Add(cre); db.SaveChanges(); }
void start() { try { CurContext = new MyApplicationContext(); Application.Run(CurContext); } catch { CurContext.CurForm.Close(); } }
public static void CapNhatDiemSVLy(float DiemCo, float DiemQuang, string IDSinhvien) { var db = new MyApplicationContext(); var result = db.KhoaLyDbSet.SingleOrDefault(a => a.IDSinhVien.Equals(IDSinhvien)); if (result != null) { result.DiemCoHoc = DiemCo; result.DiemQuangHoc = DiemQuang; db.SaveChanges(); } }
public static void CapNhatThongTinSV(string IDSinhVien, string HoTen, int GioiTinh, DateTime NgaySinh) { var db = new MyApplicationContext(); var result = db.SinhViensDbSet.SingleOrDefault(a => a.IDSinhVien.Equals(IDSinhVien)); if (result != null) { result.HoTen = HoTen; result.GioiTinh = GioiTinh; result.NgaySinh = NgaySinh; db.SaveChanges(); } }
public static void ThemSinhVien(string IDSinhVien, string HoTen, int GioiTinh, DateTime NgaySinh, string IDKhoa) { var db = new MyApplicationContext(); var cre = db.SinhViensDbSet.Create(); cre.IDSinhVien = IDSinhVien; cre.HoTen = HoTen; cre.GioiTinh = GioiTinh; cre.NgaySinh = NgaySinh; cre.IDKhoa = IDKhoa; db.SinhViensDbSet.Add(cre); db.SaveChanges(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // string ss = SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "New"); if (SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "New") == null || SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "New") == "") { MyApplicationContext context = new MyApplicationContext(new Install()); SysRegedit.SaveReg(MyShopConfigration.ProjectName, "Settings", "New", "1"); Application.Run(context); return; } else if (SysRegedit.ReadReg(MyShopConfigration.ProjectName, "Settings", "New") == "1") { MyApplicationContext context = new MyApplicationContext(new LogIn()); Application.Run(context); } }
public static void Main() { if (!IsAdministrator()) { // Restart and run as admin ProcessStartInfo startInfo = new ProcessStartInfo(Application.ExecutablePath); startInfo.Verb = "runas"; Process.Start(startInfo); Application.Exit(); return; } Directory.SetCurrentDirectory(Application.StartupPath); settings.Load(Path.ChangeExtension(Application.ExecutablePath, ".config")); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MyApplicationContext app = new MyApplicationContext(settings); Application.Run(app); Environment.Exit(0); }
public AuthController(MyApplicationContext context, IOptions <AuthOptions> _authOptions) { db = context; authOptions = _authOptions; }
public ProductRepository(MyApplicationContext context, IWebHostEnvironment appEnvironment, IMapper _mapper) { db = context; _appEnvironment = appEnvironment; mapper = _mapper; }
public OrderRepository(MyApplicationContext context, IMapper _mapper) { db = context; mapper = _mapper; }
public Form2(MyApplicationContext context) : this() { _context = context; }
private static void Main(string[] args) { Version LocalVersion, RemoteVersion; string remoteUri = "http://patcher.gw2.mmominion.com/Updater/"; string fileName = "Updater.exe"; try { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainAssemblyResolve; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args.Length > 0) { var context = new MyApplicationContext(); Application.Run(context); } else { var myWebClient = new WebClient(); myWebClient.Proxy = null; myWebClient.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore); if (File.Exists(fileName)) { FileVersionInfo fv; fv = FileVersionInfo.GetVersionInfo(fileName); LocalVersion = new Version(fv.FileVersion.Replace(',', '.')); string updaterVersion = myWebClient.DownloadString(remoteUri + "UpdaterVer.txt"); RemoteVersion = new Version(updaterVersion); if (LocalVersion < RemoteVersion) { File.SetAttributes(fileName, FileAttributes.Normal); File.Delete(fileName); myWebClient.DownloadFile(remoteUri + fileName, fileName); } } else { //we dont have the damn file anyway so get it! myWebClient.DownloadFile(remoteUri + fileName, fileName); } Thread.Sleep(1000); //now run the damn file to update the noobs Process currentproc = Process.GetCurrentProcess(); var startInfo = new ProcessStartInfo(); startInfo.FileName = fileName; startInfo.Arguments = currentproc.Id.ToString(); Process startedProc = Process.Start(startInfo); startedProc.WaitForExit(); Thread.Sleep(1000); var context = new MyApplicationContext(); Application.Run(context); } } catch (Exception ex) { ex.ToString(); } }
public CategoryRepository(MyApplicationContext context) { db = context; }
static void Main() { MyApplicationContext ac = new MyApplicationContext(); Application.Run(ac); }
public MyApplicationContext(Form mainForm) : base(mainForm) { //...implement any hooks, additional context etc. CurrentContext = this; }