private void btnLogin_Click(object sender, EventArgs e) { IDname = txtID.Text.Trim().ToString(); Passworld = txtPass.Text.Trim().ToString(); DBmain.Connect(); if (DBmain.success) { string cnstr = "Server = " + Admin_Login.ServerIP + "; Database = " + Admin_Login.DataOfServer + "; User Id = " + Admin_Login.IDname + "; Password = "******";"; Settings.Default.ConnectionString = cnstr; Properties.Settings.Default.Save(); MessageBox.Show("Succesfull!"); if (!checkexitform("GiaodienAdmin")) { GiaoDienAdmin frm = new GiaoDienAdmin(); frm.ShowDialog(); } else { activechirldform("GiaodienAdmin"); } this.Close(); } else { MessageBox.Show("Connected Faile!"); } }
private void cmdRun_SQL(object sender, RoutedEventArgs e) { string s = txtViewSQL.SelectedText; s = Regex.Replace(s, @"\/*(.+)\*\/|--(.+)\n", ""); DBmain.RunSQLs(s, txtSchema.Text, GridView); }
public ActionResult Edit(int id) { using (DBmain db = new DBmain()) { var prd = db.Products.Find(id); return(View(prd)); } }
// GET: Home public ActionResult Index() { using (DBmain db = new DBmain()) { var result = db.Database.SqlQuery <Product>("select * from product where Name=@name", new SqlParameter[] { new SqlParameter("@name", "123") }); var m = db.Products.ToList(); return(View(m)); } }
public ActionResult SaveEdit(Product pd) { using (DBmain db = new DBmain()) { db.Entry(pd).State = EntityState.Modified; db.SaveChanges(); var m = db.Products.ToList(); return(View("Index", m)); } }
public ActionResult Create(Product pd) { using (DBmain db = new DBmain()) { db.Products.Add(pd); db.SaveChanges(); var m = db.Products.ToList(); return(View("Index", m)); } }
public ActionResult Delete(int id) { using (DBmain db = new DBmain()) { var prd = db.Products.Find(id); db.Products.Remove(prd); db.SaveChanges(); var m = db.Products.ToList(); return(View("Index", m)); } }
public BSKho() { db = new DBmain(); }
public BLmuonsach() { db = new DBmain(); }
public BLquanlydocgia() { db = new DBmain(); }
public BLtacgia() { db = new DBmain(); }
public BLquanlysach() { db = new DBmain(); }
public BLkiemtratk() { db = new DBmain(); }
public BLGiaoVien() { db = new DBmain(); }
public BLHocSinh() { db = new DBmain(); }
public BLLop() { db = new DBmain(); }
public BSBanHang() { db = new DBmain(); }
public BLhotro() { db = new DBmain(); }
public BLBangDiem() { db = new DBmain(); }
public BLnxb() { db = new DBmain(); }
public BLtaotaikhoanuser() { db = new DBmain(); }
public BLdocgia() { db = new DBmain(); }
public BS_Connect() { db = new DBmain(); }
public BLMonHoc() { db = new DBmain(); }