Exemple #1
0
        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);
        }
Exemple #3
0
 public ActionResult Edit(int id)
 {
     using (DBmain db = new DBmain())
     {
         var prd = db.Products.Find(id);
         return(View(prd));
     }
 }
Exemple #4
0
 // 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));
     }
 }
Exemple #5
0
        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));
            }
        }
Exemple #6
0
        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));
            }
        }
Exemple #7
0
        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));
            }
        }
Exemple #8
0
 public BSKho()
 {
     db = new DBmain();
 }
 public BLmuonsach()
 {
     db = new DBmain();
 }
Exemple #10
0
 public BLquanlydocgia()
 {
     db = new DBmain();
 }
Exemple #11
0
 public BLtacgia()
 {
     db = new DBmain();
 }
Exemple #12
0
 public BLquanlysach()
 {
     db = new DBmain();
 }
 public BLkiemtratk()
 {
     db = new DBmain();
 }
Exemple #14
0
 public BLGiaoVien()
 {
     db = new DBmain();
 }
Exemple #15
0
 public BLHocSinh()
 {
     db = new DBmain();
 }
Exemple #16
0
 public BLLop()
 {
     db = new DBmain();
 }
 public BSBanHang()
 {
     db = new DBmain();
 }
Exemple #18
0
 public BLhotro()
 {
     db = new DBmain();
 }
Exemple #19
0
 public BLBangDiem()
 {
     db = new DBmain();
 }
Exemple #20
0
 public BLnxb()
 {
     db = new DBmain();
 }
 public BLtaotaikhoanuser()
 {
     db = new DBmain();
 }
Exemple #22
0
 public BLdocgia()
 {
     db = new DBmain();
 }
Exemple #23
0
 public BS_Connect()
 {
     db = new DBmain();
 }
Exemple #24
0
 public BLMonHoc()
 {
     db = new DBmain();
 }