public AccountModel() { context = new Data_MassageEntities1(); }
// // GET: /Admin/AdminAccountant/ public ActionResult CashBook() { using (var db = new Data_MassageEntities1()) { var chi = db.tbl_Phieu_Chi.ToList(); List <Accountant> kho = new List <Accountant> { }; foreach (var item in chi) { if (kho == null) { var item1 = new Accountant(); var list1 = new List <Accountant>(); item1.chuky_nguoinhan = item.chuky_nguoinhan; item1.diachi = item.diachi; item1.Id = item.Id; item1.ngaylap = item.ngaylap; item1.nguoilap = item.nguoilap; item1.nguoinhan = item.nguoinhan; item1.nguoinop = item.nguoinhan; item1.nguoinoptien = item.nguoinhan; item1.noidungchi = item.noidungchi; item1.noidungthu = item.noidungchi; item1.Note_chi = item.Note_chi; item1.Note_thu = item.Note_chi; item1.sodienthoai = item.sodienthoai; item1.sotien_chi = (float)item.sotien_chi; item1.sotien_thu = 0; item1.sochungtu_thu = item.sochungtu_chi; var y = item1.sotien_chi; var x = item1.sotien_thu; item1.sotienton = x - y; kho.Add(item1); } else { var item1 = new Accountant(); var list1 = new List <Accountant>(); item1.chuky_nguoinhan = item.chuky_nguoinhan; item1.diachi = item.diachi; item1.Id = item.Id; item1.ngaylap = item.ngaylap; item1.nguoilap = item.nguoilap; item1.nguoinhan = item.nguoinhan; item1.nguoinop = item.nguoinhan; item1.nguoinoptien = item.nguoinhan; item1.noidungchi = item.noidungchi; item1.noidungthu = item.noidungchi; item1.Note_chi = item.Note_chi; item1.Note_thu = item.Note_chi; item1.sodienthoai = item.sodienthoai; item1.sotien_thu = 0; item1.sochungtu_thu = item.sochungtu_chi; if (item.sotien_chi == null) { item.sotien_chi = 0; } item1.sotien_chi = (float)item.sotien_chi; var y = item1.sotien_chi; var x = item1.sotien_thu; item1.sotienton = x - y; kho.Add(item1); } } var thu = db.phieu_thu.ToList(); foreach (var item in thu) { if (kho == null) { var item1 = new Accountant(); var list1 = new List <Accountant>(); item1.chuky_nguoinhan = item.nguoinop; item1.diachi = item.diachi; item1.Id = item.Id; item1.ngaylap = item.ngaylap; item1.nguoilap = item.nguoilap; item1.nguoinhan = item.nguoinop; item1.nguoinop = item.nguoinoptien; item1.nguoinoptien = item.nguoinoptien; item1.noidungchi = item.noidungthu; item1.noidungthu = item.noidungthu; item1.Note_chi = item.Note_thu; item1.sodienthoai = item.sodienthoai; item1.sochungtu_thu = item.sochungtu_thu; item1.sotien_chi = 0; item1.sotien_thu = (float)item.sotien_thu; item1.sotienton = item1.sotien_thu - item1.sotien_chi; kho.Add(item1); } else { var item1 = new Accountant(); var list1 = new List <Accountant>(); item1.chuky_nguoinhan = item.nguoinop; item1.diachi = item.diachi; item1.Id = item.Id; item1.ngaylap = item.ngaylap; item1.nguoilap = item.nguoilap; item1.nguoinhan = item.nguoinop; item1.nguoinop = item.nguoinoptien; item1.nguoinoptien = item.nguoinoptien; item1.noidungchi = item.noidungthu; item1.noidungthu = item.noidungthu; item1.Note_chi = item.Note_thu; item1.sodienthoai = item.sodienthoai; item1.sochungtu_thu = item.sochungtu_thu; item1.sotien_chi = 0; if (item.sotien_thu == null) { item.sotien_thu = 0; } item1.sotien_thu = (float)item.sotien_thu; item1.sotienton = item1.sotien_thu - item1.sotien_chi; kho.Add(item1); } } ViewData["list_quy_tien"] = kho.OrderBy(x => x.sotien_thu).OrderByDescending(x => x.ngaylap).ToList(); return(View()); } }
public ActionResult Index(Loginmodel model) { using (var db = new Data_MassageEntities1()) { var dao = new UserDao(); //var result = new AccountModel().Login(model.UserName, model.Password);new EmployeeDAO().MD5Hash(model.Password) var result = dao.login(model.UserName, model.Password); switch (result) { case 1: var user = dao.GetById(model.UserName); var userSesstion = new UserLogin(); Session["userName"] = model.UserName; Session["userId"] = user.Id_User; Session["status_color"] = user.Dark_Light_theme; var mau = ""; var list_color = db.SettingAdmins.Where(x => x.ID_User == user.Id_User).ToArray(); var dangky = db.BDang_Ky.Where(x => x.ID_dang_Ky == 1).ToArray(); var yt = 0; if (dangky[0].Thoi_Gian_Check_Int > 0) { yt = (int)dangky[0].Thoi_Gian_Check_Int; } if (list_color.Any()) { mau = list_color[0].colorbar + "|" + list_color[0].cochu + "|" + list_color[0].fontchu + "|" + list_color[0].mauchu + "|" + list_color[0].maucokhach + "|" + list_color[0].mauonline + "|" + list_color[0].maucho + "|" + yt + "|" + list_color[0].heightContent + "|" + list_color[0].heightRight + "|" + list_color[0].widthContent + "|" + list_color[0].widthRight + "|" + list_color[0].thongbao + "|" + list_color[0].chuy + "|" + list_color[0].maunhanvienonline + "|" + list_color[0].maunhanviencokhach; } Session["chang_color"] = mau; if (db.tbl_CaLamViec.Any()) { var moca = db.tbl_CaLamViec.Where(x => x.Status == 1).ToArray(); if (moca.Any()) { moca = db.tbl_CaLamViec.Where(x => x.Status == 1 && x.Id_nhan == user.Id_User).ToArray(); if (moca.Any()) { Session["status_KA"] = 1; Session["Id_giao_KA"] = moca[0].Id; } else { Session["status_KA"] = 3; Session["Id_giao_KA"] = -1; } } else { var moca1 = db.tbl_CaLamViec.OrderByDescending(x => x.Id).Take(1).ToList(); moca1 = moca1.Where(x => x.Id_nhan == user.Id_User).ToList(); if (moca1.Any()) { Session["status_KA"] = 2; Session["Id_giao_KA"] = 0; } else { Session["status_KA"] = 3; Session["Id_giao_KA"] = -1; } } } else { Session["status_KA"] = 2; Session["Id_giao_KA"] = 0; } Session["setting"] = 0; userSesstion.UserName = user.Name_User; userSesstion.UserID = user.Id_User; Session.Add(CommonConstants.USER_SESSTION, userSesstion); var id_dangnhap = userSesstion.UserID; var id_setting = db.SettingAdmins.Where(x => x.ID_User == id_dangnhap).ToArray(); if (id_setting.Any()) //Any khong hoat hoat dong khi .Tolist(); { var set = id_setting[0].ID_User; if (id_dangnhap == set) { return(RedirectToAction("Home", "AdminHome")); } else { return(RedirectToAction("Setting", "AdminSettingAdmin")); } } else { Session["setting"] = 1; return(RedirectToAction("Setting", "AdminSettingAdmin")); } case 0: ModelState.AddModelError("", "Tai khoan khong ton tai !"); break; case -1: ModelState.AddModelError("", "Tai khoan dang bi khoa !"); break; case -2: ModelState.AddModelError("", "Mat khau sai !"); break; default: ModelState.AddModelError("", "Tên đăng nhập or mật khẩu không đúng !"); break; } return(View(model)); } }
public EmployeeDAO() { db = new Data_MassageEntities1(); }
public UserDao() { db = new Data_MassageEntities1(); }