public void Them(QuanLy themql) { XmlNode QuanLy = doc.CreateElement("QuanLy"); XmlElement MaQL = doc.CreateElement("MaQL"); MaQL.InnerText = themql.MaQL1.ToString(); QuanLy.AppendChild(MaQL); XmlElement HoTen = doc.CreateElement("HoTen"); HoTen.InnerText = themql.HoTen1.ToString(); QuanLy.AppendChild(HoTen); XmlElement NgaySinh = doc.CreateElement("NgaySinh"); NgaySinh.InnerText = themql.NgaySinh1.ToShortDateString(); QuanLy.AppendChild(NgaySinh); XmlElement DiaChi = doc.CreateElement("DiaChi"); DiaChi.InnerText = themql.DiaChi1.ToString(); QuanLy.AppendChild(DiaChi); XmlElement SDT = doc.CreateElement("SDT"); SDT.InnerText = themql.SDT1.ToString(); QuanLy.AppendChild(SDT); root.AppendChild(QuanLy); doc.Save(fileName); }
public void timkiem(QuanLy timql, DataGridView dgv) { XmlNode quanlycantim = root.SelectSingleNode("QuanLy[MaQL='" + timql.MaQL1 + "']"); if (quanlycantim != null) { dgv.Rows.Clear(); dgv.ColumnCount = 5; dgv.Rows.Add(); XmlNode MaQL = quanlycantim.SelectSingleNode("MaQL"); dgv.Rows[0].Cells[0].Value = MaQL.InnerText; XmlNode HoTen = quanlycantim.SelectSingleNode("HoTen"); dgv.Rows[0].Cells[1].Value = HoTen.InnerText; XmlNode NgaySinh = quanlycantim.SelectSingleNode("NgaySinh"); dgv.Rows[0].Cells[2].Value = NgaySinh.InnerText; XmlNode DiaChi = quanlycantim.SelectSingleNode("DiaChi"); dgv.Rows[0].Cells[3].Value = DiaChi.InnerText; XmlNode SDT = quanlycantim.SelectSingleNode("SDT"); dgv.Rows[0].Cells[4].Value = SDT.InnerText; } }
public ActionResult DangNhap(FormCollection collection) { var tk = collection["taikhoan"]; var mk = collection["password"]; if (String.IsNullOrEmpty(tk)) { ViewData["Loi1"] = "Chưa nhập tài khoản"; } else { if (String.IsNullOrEmpty(mk)) { ViewData["Loi2"] = "Chưa nhập mật khẩu"; } else { QuanLy ad = db.QuanLies.SingleOrDefault(m => m.TenTK == tk && m.Pass == mk); if (ad != null) { Session["Admin"] = ad; return(RedirectToAction("Index", "TrangAdmin")); } else { ViewData["Loi2"] = "Tài khoản hoặc mật khẩu sai"; } } } return(View()); }
/// <summary>Function for LoginCommand.</summary> /// <Modified> /// Name Date Comments /// quangnt2 16/03/2020 created /// </Modified> private async Task Login() { if (string.IsNullOrEmpty(QuanLy.UserName) || string.IsNullOrEmpty(QuanLy.Password)) { await _pageService.DisplayAlert("Cảnh báo", "Yêu cầu nhập đầy đủ thông tin.", "OK"); return; } else { var result = _quanlyService.FindQuanLy(QuanLy.UserName, QuanLy.Password); if (result.Result != null) { var quanly = new QuanLy() { ID = result.Result.ID, UserName = result.Result.UserName, Password = result.Result.Password }; SaveCredentials(quanly.UserName, quanly.Password); await _pageService.PushAsync(new _layout()); } else { await _pageService.DisplayAlert("Cảnh báo", "Sai thông tin đăng nhập.", "OK"); return; } } }
public void sua(QuanLy suaql) { XmlNode suaquanly = root.SelectSingleNode("QuanLy[MaQL='" + suaql.MaQL1 + "']"); if (suaql != null) { XmlNode suaquanlymoi = doc.CreateElement("QuanLy"); XmlElement MaQL = doc.CreateElement("MaQL"); MaQL.InnerText = suaql.MaQL1.ToString(); suaquanlymoi.AppendChild(MaQL); XmlElement HoTen = doc.CreateElement("HoTen"); HoTen.InnerText = suaql.HoTen1.ToString(); suaquanlymoi.AppendChild(HoTen); XmlElement NgaySinh = doc.CreateElement("NgaySinh"); NgaySinh.InnerText = suaql.NgaySinh1.ToString(); suaquanlymoi.AppendChild(NgaySinh); XmlElement DiaChi = doc.CreateElement("DiaChi"); DiaChi.InnerText = suaql.DiaChi1.ToString(); suaquanlymoi.AppendChild(DiaChi); XmlElement SDT = doc.CreateElement("SDT"); SDT.InnerText = suaql.SDT1.ToString(); suaquanlymoi.AppendChild(SDT); // thay thế sinh vien củ bằng sinh viene mới root.ReplaceChild(suaquanlymoi, suaquanly); doc.Save(fileName); } }
public IHttpActionResult PutQuanLy(string id, QuanLy quanLy) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != quanLy.ID_QL) { return(BadRequest()); } db.Entry(quanLy).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!QuanLyExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutQuanLy(int id, QuanLy quanLy) { if (id != quanLy.Tba) { return(BadRequest()); } _context.Entry(quanLy).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!QuanLyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult XoaInfo(int id) { QuanLy ql = new QuanLy(); ql.DeleteType(id); return(RedirectToAction("Type")); }
public ActionResult XoaOrder(int id) { QuanLy ql = new QuanLy(); ql.DeleteOrder(id); return(RedirectToAction("Order")); }
public ActionResult XoaPromotion(int id) { QuanLy ql = new QuanLy(); ql.DeletePromotion(id); return(RedirectToAction("Promotion")); }
public ActionResult XoaCustomer(int id) { QuanLy ql = new QuanLy(); ql.DeleteCustomer(id); return(RedirectToAction("Customer")); }
public ActionResult XoaSanPham(int id) { QuanLy ql = new QuanLy(); ql.DeleteProduct(id); return(RedirectToAction("Product")); }
public ActionResult DoiMatKhau(QuanLy ql, string id, FormCollection collection) { var mkcu = collection["matkhaucu"]; var mkmoi = collection["matkhaumoi"]; var mknhaplai = collection["matkhaunhaplai"]; if (String.IsNullOrEmpty(mkcu)) { ViewData["Loi1"] = "Phải nhập mật khẩu cũ"; } else if (String.IsNullOrEmpty(mkmoi)) { ViewData["Loi2"] = "Phải nhập mật khẩu mới"; } else if (mknhaplai != mkmoi) { ViewData["Loi3"] = "Mật khẩu nhập lại không khớp"; } else { QuanLy tk = data.QuanLies.ToList().Find(n => n.Username == id); if (MaHoaMD5.Md5(mkcu) == tk.Password) { tk.Password = MaHoaMD5.Md5(mkmoi); data.SubmitChanges(); ViewBag.ThongBao = "Đổi mật khẩu thành công"; } else { ViewBag.ThongBao = "Mật khẩu cũ không đúng"; } } return(View()); }
public bool InsertQuanLy(QuanLy data) { SqlParameter[] sqlParameters = new SqlParameter[] { new SqlParameter("@QLID", data.QLID), new SqlParameter("@QLMa", data.QLMa), new SqlParameter("@QLTen", data.QLTen), new SqlParameter("@QLNamQT", data.QLNamQT), new SqlParameter("@QLNgayHopDong", data.QLNgayHopDong), new SqlParameter("@QLSoHopDong", data.QLSoHopDong), new SqlParameter("@QLSoLuongHD", data.QLSoLuongHD), new SqlParameter("@QLDoanhThu", data.QLDoanhThu), new SqlParameter("@QLVAT", data.QLVAT), new SqlParameter("@QLNgayKhoiCong", data.QLNgayKhoiCong), new SqlParameter("@QLNgayKetThuc", data.QLNgayKetThuc), new SqlParameter("@QLHopDong", data.QLHopDong), new SqlParameter("@QLDuToan", data.QLDuToan), new SqlParameter("@QLQuyetToan", data.QLQuyetToan), new SqlParameter("@QLKLHoanThanh", data.QLKLHoanThanh), new SqlParameter("@QLBBNghiemThu", data.QLBBNghiemThu), new SqlParameter("@QLBBThanhLy", data.QLBBThanhLy), new SqlParameter("@QLHSChuan", data.QLHSChuan), new SqlParameter("@QLNhatKy", data.QLNhatKy), new SqlParameter("@QLYCBoSung", data.QLYCBoSung), new SqlParameter("@UserCreate", UserInfo.UserID), new SqlParameter("@CompanyID", CommonInfo.CompanyInfo.CompanyID) }; this.Context.ExecuteDataFromProcedure("QuanLyInsert", sqlParameters); return(true); }
public ActionResult DangNhap(FormCollection collection) { var sdt = collection["SDT"]; if (String.IsNullOrEmpty(sdt)) { ViewData["Loi1"] = "* Bắt buộc"; } else { QuanLy NV = data.QuanLies.SingleOrDefault(n => n.SDT == sdt); if (NV != null) { Session["SDT"] = NV.SDT; Session["MaNV"] = NV.MaNV; Session["TenNhanVien"] = NV.TenNhanVien; Session["MaChiNhanh"] = NV.MaChiNhanh; var machinhanh = NV.MaChiNhanh; ChiNhanh CN = data.ChiNhanhs.SingleOrDefault(n => n.MaChiNhanh == machinhanh); Session["TenChiNhanh"] = CN.TenChiNhanh; Session["NamSinh"] = NV.NamSinh; return(RedirectToAction("Index", "ChiNhanh_Z9TheCoffee")); } else { ViewBag.ThongBao = "Số Điện Thoại không tồn tại"; } } return(View()); }
public ActionResult XoaBrand(int id) { QuanLy ql = new QuanLy(); ql.DeleteBrand(id); return(RedirectToAction("Brand")); }
public ActionResult Login(FormCollection collection) { var tendn = collection["username"]; var mk = MaHoaMD5.Md5(collection["password"].Trim()); if (String.IsNullOrEmpty(tendn)) { ViewData["Loi1"] = "Phải nhập username"; } else if (String.IsNullOrEmpty(mk)) { ViewData["Loi2]"] = "Phải nhập password"; } else { QuanLy ad = data.QuanLies.SingleOrDefault(n => n.Username == tendn && n.Password == mk); if (ad != null) { Session["Taikhoanadmin"] = ad; return(RedirectToAction("Index", "Admin")); } else { ViewBag.Thongbao = "Tên đăng nhập hoặc mật khẩu không đúng"; } } return(View()); }
public ActionResult LoginForm(QuanLy acc) { string a = acc.TenDangNhap; string b = acc.MatKhau; if (ModelState.IsValid) { if (Login(acc.TenDangNhap, acc.MatKhau) == 2) //admin { //kiem tra vai tro var ban = context.Bans.ToList(); return(RedirectToAction("Index", "AdminHome", new { Area = "Admin" })); } else if (Login(acc.TenDangNhap, acc.MatKhau) == 3) { // DangNhapSession[DangNhapSession] = return(Redirect(@"~\Home\Index")); } else { return(View()); } } else { return(View()); } }
public ActionResult ThemTaiKhoan(QuanLy ql, FormCollection collection) { var mk = collection["Matkhau"]; var mknhaplai = collection["Matkhaunhaplai"]; var loai = collection["Loai"]; if (String.IsNullOrEmpty(mk)) { ViewData["Loi"] = "Phải nhập mật khẩu"; } else if (mknhaplai != mk) { ViewData["Loi1"] = "Mật khẩu nhập lại không đúng"; } else if (ModelState.IsValid) { ql.Password = MaHoaMD5.Md5(mk); ql.Allower = Convert.ToInt32(loai); data.QuanLies.InsertOnSubmit(ql); data.SubmitChanges(); return(RedirectToAction("QuanLy")); } else { ModelState.AddModelError(" ", "Thêm thất bại"); } return(View()); }
public IHttpActionResult PostQuanLy(QuanLy quanLy) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.QuanLies.Add(quanLy); try { db.SaveChanges(); } catch (DbUpdateException) { if (QuanLyExists(quanLy.ID_QL)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = quanLy.ID_QL }, quanLy)); }
private void menuQuanly_Click(object sender, EventArgs e) { Form frm = this.MdiChildren.OfType <QuanLy>().FirstOrDefault(); Form frmm = this.MdiChildren.OfType <QlTaiKhoan>().FirstOrDefault(); if (frmm != null) { frmm.Close(); } if (frm != null) { } else { if (loainv == 1) { QuanLy ql = new QuanLy(tk, ten); ql.MdiParent = this; ql.StartPosition = FormStartPosition.CenterScreen; ql.Show(); } else { QuanLy2 ql = new QuanLy2(tk, ten); ql.MdiParent = this; ql.StartPosition = FormStartPosition.CenterScreen; ql.Show(); } } }
public void TestWithDeposit() { QuanLy acc = new QuanLy(200000); Assert.IsNotNull(acc); Assert.IsInstanceOfType(acc, typeof(QuanLy)); Assert.AreEqual(100000, acc.Deposit(100000)); }
public void TestWithdraw() { QuanLy acc = new QuanLy(200000); Assert.IsNotNull(acc); Assert.IsInstanceOfType(acc, typeof(QuanLy)); Assert.AreEqual(400000, acc.WithDraw(200000)); }
public LoginViewModel(IQuanLyService quanlyService, IPageService pageService) { _quanlyService = quanlyService; _pageService = pageService; LoginCommand = new Command(async() => await Login()); QuanLy = new QuanLy(); }
public void TestMethod1() { QuanLy acc = new QuanLy(200000); Assert.IsNotNull(acc); Assert.IsInstanceOfType(acc, typeof(QuanLy)); Assert.AreEqual(200000, acc.Balance()); }
public void xoa(QuanLy xoaql) { XmlNode quanlycanxoa = root.SelectSingleNode("QuanLy[MaQL='" + xoaql.MaQL1 + "']"); if (quanlycanxoa != null) { root.RemoveChild(quanlycanxoa); doc.Save(fileName); } }
public void testchuyenban() { int ban1 = int.Parse(TestContext.DataRow[0].ToString()); int ban2 = int.Parse(TestContext.DataRow[1].ToString()); bool expected = bool.Parse(TestContext.DataRow[2].ToString()); QuanLy ql = new QuanLy(); bool actual = ql.thuchuyen(ban1, ban2); Assert.AreEqual(expected, actual); }
// GET: Home public ActionResult Index() { var quanly = new QuanLy(); ViewBag.DonHangMoi = quanly.DonHangMoi(); ViewBag.KhachHangMoi = quanly.KhachHangMoi(); ViewBag.NguoiDiChoMoi = quanly.NguoiDiChoMoi(); ViewBag.PhanHoiMoi = quanly.PhanHoiMoi(); return(View()); }
public IHttpActionResult GetQuanLy(string id) { QuanLy quanLy = db.QuanLies.Find(id); if (quanLy == null) { return(NotFound()); } return(Ok(quanLy)); }
public ActionResult XoaTaiKhoan(string id) { QuanLy ql = data.QuanLies.SingleOrDefault(n => n.Username == id); if (ql == null) { Response.StatusCode = 404; return(null); } return(View(ql)); }
private void logInBut_Click(object sender, EventArgs e) { SqlCommand command = new SqlCommand(); command.Connection = con; command.CommandType = CommandType.Text; command.CommandText = "Select username,passworduser from NGUOIDUNG where (username=@user) and (passworduser=@pass)"; command.Parameters.Add("@user", SqlDbType.NVarChar, 50).Value = uNameBox.Text; command.Parameters.Add("@pass", SqlDbType.NVarChar, 50).Value = pWordBox.Text; da.SelectCommand = command; da.Fill(dt); if (dt.Rows.Count > 0) { QuanLy ql = new QuanLy(); delPassData del = new delPassData(ql.funData); del(this.txtTaikhoan); ql.Show(); Hide(); } else { MessageBox.Show("Đăng nhập thất bại. Sai mật khẩu hoặc tên tài khoản"); } }