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