Example #1
0
        public IEnumerable <qtUnit> DanhSachUnit()
        {
            qtUnitService        _unit  = new qtUnitService();
            IEnumerable <qtUnit> dsUnit = _unit.FindList();

            return(dsUnit);
        }
Example #2
0
        public qtUnit ThemMoi_HieuChinhUnit(int UnitId, string UnitName, string UnitCode, int?ParentId, string LevelCode, int?SortOrder,
                                            string Email, string PhoneNumber, bool?Status, DateTime?CreatedDate)
        {
            qtUnitService _unit = new qtUnitService();
            qtUnit        unit  = new qtUnit();

            if (UnitId > 0)
            {
                unit = _unit.FindByKey(UnitId);
            }

            unit.UnitName    = UnitName;
            unit.UnitCode    = UnitCode;
            unit.ParentId    = ParentId;
            unit.LevelCode   = LevelCode;
            unit.SortOrder   = SortOrder;
            unit.Email       = Email;
            unit.PhoneNumber = PhoneNumber;
            unit.Status      = Status;
            unit.CreatedDate = CreatedDate;

            if (UnitId > 0)
            {
                _unit.Update(unit);
            }
            else
            {
                _unit.Insert(unit);
            }

            return(unit);
        }
        public IPagedList <qtUnitManager> DanhSachNguoiDung(int page, int pageSize)
        {
            qtUserService        _user     = new qtUserService();
            qtUnitService        _unit     = new qtUnitService();
            qtUnitManagerService _mangager = new qtUnitManagerService();
            var danhsach = (from mangager in _mangager.FindList()
                            join user in _user.FindList() on mangager.UserId equals user.UserId
                            select mangager).AsQueryable().GroupBy(m => m.UserId).Select(m => m.FirstOrDefault());

            return(danhsach.ToPagedList(page, pageSize));
        }
        public int SoluongNguoiDung(int?unitId)
        {
            qtUserService        _user     = new qtUserService();
            qtUnitService        _unit     = new qtUnitService();
            qtUnitManagerService _mangager = new qtUnitManagerService();
            var danhsach = (from mangager in _mangager.FindList()
                            join user in _user.FindList() on mangager.UserId equals user.UserId
                            where user.UnitId == unitId
                            select mangager).AsQueryable().GroupBy(m => m.UserId).Select(m => m.FirstOrDefault());

            return(danhsach.Count());
        }
        public List <qtUnit> ListUnit_By_UserId(int?userid)
        {
            if (!userid.HasValue)
            {
                return(new List <qtUnit>());
            }
            qtUnitService        _unit     = new qtUnitService();
            qtUnitManagerService _mangager = new qtUnitManagerService();
            List <qtUnit>        danhsach  = _mangager.FindList().Where(m => m.UserId == userid.Value)
                                             .Join(_unit.FindList().Where(m => m.Status == true), m => m.UnitId, u => u.UnitId, (m, u) => u)
                                             .Distinct().ToList();

            return(danhsach);
        }
Example #6
0
        public string UnitName(int?UnitId)
        {
            string UnitName = string.Empty;

            if (UnitId.HasValue)
            {
                qtUnitService _unit = new qtUnitService();
                qtUnit        unit  = _unit.FindByKey(UnitId);
                if (unit != null)
                {
                    return(unit.UnitName);
                }
                return(UnitName);
            }
            return(UnitName);
        }
Example #7
0
        public IEnumerable <qtUnit> GetUnitsByParentId(int?ParentId)
        {
            qtUnitService _unit = new qtUnitService();

            return(_unit.FindList().Where(x => x.ParentId == ParentId));
        }
Example #8
0
        public shGoodReceiptIsuue Insert_Update(
            string ReceiptIsuueGuid,
            int?ReceiptIssueId,
            int?Phieu,
            string ReceiptIsuueName,
            string SKU,
            int?MaKho,
            string TenKho,
            int?LoaiPhieu,
            string MaDonHang,
            string GhiChu,
            int?UserId,
            int?TrangThai,
            bool?Status,
            DateTime?CreateDate
            )
        {
            shGoodReceiptIsuueService _receipt = new shGoodReceiptIsuueService();
            shGoodReceiptIsuue        receipt  = new shGoodReceiptIsuue();

            if (!string.IsNullOrEmpty(ReceiptIsuueGuid) || !string.IsNullOrWhiteSpace(ReceiptIsuueGuid))
            {
                receipt = _receipt.FindByKey(ReceiptIsuueGuid);
            }
            else
            {
                receipt.ReceiptIsuueGuid = GuidUnique.getInstance().GenerateUnique();


                qtUnitService _unit   = new qtUnitService();
                string        _TenKho = _unit.UnitName(MaKho);
                if (string.IsNullOrEmpty(receipt.ReceiptIsuueName) && string.IsNullOrWhiteSpace(receipt.ReceiptIsuueName))
                {
                    receipt.ReceiptIsuueName = StringHelper.ToUnsignString(_TenKho) + "-" + receipt.CreateDate.GetValueOrDefault(DateTime.Now).ToString("dd-MM-yyyy");
                }
                receipt.TenKho = _TenKho;
            }


            receipt.Phieu = Phieu;

            receipt.SKU   = SKU;
            receipt.MaKho = MaKho;

            receipt.LoaiPhieu  = LoaiPhieu;
            receipt.MaDonHang  = MaDonHang;
            receipt.GhiChu     = GhiChu;
            receipt.UserId     = UserId;
            receipt.TrangThai  = TrangThai;
            receipt.Status     = Status;
            receipt.CreateDate = CreateDate;

            if (receipt.ReceiptIssueId > 0)
            {
                _receipt.Update(receipt);
            }
            else
            {
                _receipt.Insert(receipt);
            }

            return(receipt);
        }