Exemplo n.º 1
0
        internal IEnumerable <Nganhnhom> getCategory(string Manhanvien)
        {
            try
            {
                //  DT_GIAODICH = (from GD in DT_GIAODICH.AsEnumerable()
                //                            join KH in SessionStart.DmKhachhangALL.AsEnumerable() on GD["customerCode"] equals KH[KhachhangFields.MakhachhangColumn.ColumnName]
                //                            into KHGD
                //                            from KH in KHGD.DefaultIfEmpty()
                //                            join NV in SessionStart.DmNhanvien.AsEnumerable() on GD["userCode"] equals NV[nhanvienFields.ManhanvienColumn.ColumnName]
                //                            into NVGD
                //                            from NV in NVGD.DefaultIfEmpty()
                //                            select addkhachhang(GD, KH, NV)).CopyToDataTable();
                DataTable nganhnhoms         = DB.WEB_GETNGANHNHOM(this.Madonvi);
                DataTable phanquyennganhnhom = DB.GetData_VTHH_DSphanquyennvhh();
                nganhnhoms = (from nganhnhom in nganhnhoms.AsEnumerable()
                              join phanquyen in phanquyennganhnhom.AsEnumerable() on nganhnhom["Ma"] equals phanquyen["Manganh"]
                              where phanquyen["Manhanvien"].ToString() == Manhanvien
                              select(nganhnhom)
                              ).Concat(from nganhnhom in nganhnhoms.AsEnumerable()
                                       join phanquyen in phanquyennganhnhom.AsEnumerable() on nganhnhom["Macha"] equals phanquyen["Manganh"]
                                       where phanquyen["Manhanvien"].ToString() == Manhanvien
                                       select(nganhnhom)).CopyToDataTable();
                List <Nganhnhom> c = LIB.ConvertDataTable <Nganhnhom>(nganhnhoms).ToList();

                return(c);
            }
            catch
            {
                return(new List <Nganhnhom>());
            }
        }
Exemplo n.º 2
0
        internal List <BaoCaoXBBModel> getBaoCaoXBBTH(BaocaoRequest request)
        {
            DateTime              tuNgay         = DateTime.Parse(request.tuNgay);
            DateTime              denNgay        = DateTime.Parse(request.denNgay);
            DataTable             DT_BaoCaoXBBTH = DB.BC_XUATBANBUONTH(tuNgay, denNgay, this.Madonvi, "", "", "", "", "", "", "", "", request.trangthai, "", "", "", 1);
            List <BaoCaoXBBModel> baoCaos        = new List <BaoCaoXBBModel>();

            baoCaos = LIB.ConvertDataTableToList <BaoCaoXBBModel>(DT_BaoCaoXBBTH);
            return(baoCaos);
        }
Exemplo n.º 3
0
        internal IEnumerable <Mathanggia> getProducts(System.Security.Claims.ClaimsPrincipal user)
        {
            string Manhanvien = user.FindFirst("Manhanvien").Value;
            IEnumerable <Nganhnhom> nganhnhoms = categorysManage.getCategory(Manhanvien);
            DataTable dataMathang = DB.Getdata_VTHH_MATHANG(DB.XNT_TABLENAME(PublicValue.ngayPhatSinh), this.Madonvi, this.DataBaseXnt, 1);

            dataMathang = (from mh in dataMathang.AsEnumerable()
                           join pq in nganhnhoms on mh["Manhomhang"] equals pq.Ma
                           select(mh)
                           ).CopyToDataTable();


            List <Mathanggia> listMathhang = LIB.ConvertDataTable <Mathanggia>(dataMathang).ToList();

            return(listMathhang.AsEnumerable <Mathanggia>());
        }
Exemplo n.º 4
0
        public AuthenticateResponse Authenticate(AuthenticateRequest model, string ipAddress)
        {
            var Password = LIB.EncryptSvc(string.Empty, model.Password);
            var user     = _context.Nguoidungs.SingleOrDefault(x => x.Tendangnhap == model.Username && x.Matkhau == Password && x.Madonvi == this._appSettings.Madonvi);

            // return null if user not found
            if (user == null)
            {
                return(null);
            }

            // authentication successful so generate jwt and refresh tokens
            var jwtToken     = generateJwtToken(user, model.Remember);
            var refreshToken = generateRefreshToken(ipAddress);

            // save refresh token
            // user.RefreshTokens.Add(refreshToken);
            // _context.Update(user);
            // _context.SaveChanges();

            return(new AuthenticateResponse(user, jwtToken, refreshToken.Token));
        }