public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();


                var biz = new UpdateTonDauKhoChiTietByTonKhoChiTietIdBiz(context);
                biz.TON_KHO_ID          = TonKhoId;
                biz.TON_KHO_CHI_TIET_ID = TonKhoChiTietId;
                biz.TON_DAU             = Protector.Decimal(TonDau);
                biz.GIA_NHAP            = Protector.Decimal(GiaNhap);
                biz.LO_HANG             = LoHang;
                biz.LOGIN_ID            = LoginId;
                var result = await biz.Execute();

                dynamic _metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, _metaData));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Beispiel #2
0
 /// <summary>
 /// Ham khoi tao gia tri mac dinh cho cac bien
 /// </summary>
 private void init()
 {
     _NgayDi       = Protector.DateTime(NgayDi, "yyyy-MM-dd", true);
     _NgayVe       = Protector.DateTime(NgayVe, "yyyy-MM-dd", true);
     _NhanVienId   = Protector.Int(nhanVienId, 0);
     _NguoiDuyetId = Protector.Int(NguoiDuyetId, 0);
     _SoNgay       = Protector.Decimal(SoNgay, 0);
     _LoginId      = Protector.Int(LoginId, 0);
 }
Beispiel #3
0
 /// <summary>
 /// Ham khoi tao gia tri mac dinh cho cac bien
 /// </summary>
 private void init()
 {
     _NgayDi         = Protector.DateTime(NgayDi, "yyyy-MM-dd", true);
     _NgayVe         = Protector.DateTime(NgayVe, "yyyy-MM-dd", true);
     _PhieuCongTacId = Protector.Int(PhieuCongTacId, 0);
     _NhanVienId     = Protector.Int(nhanVienId, 0);
     _LoginId        = Protector.Int(LoginId, 0);
     _SoNgay         = Protector.Decimal(SoNgay, 0);
     _CtrVersion     = Protector.Int(CtrVersion, 0);
 }
Beispiel #4
0
 /// <summary>
 /// Ham khoi tao gia tri mac dinh cho cac bien
 /// </summary>
 private void init()
 {
     _PhieuBaoHanhChiTietId = Protector.Int(PhieuBaoHanhChiTietId, 0);
     _ThietBi        = Protector.Int(ThietBi, true);
     _ThietBiThayThe = Protector.Int(ThietBiThayThe, true);
     _ChiPhi         = Protector.Decimal(ChiPhi, 0);
     _ThueVAT        = Protector.Int(ThueVAT, 0);
     _TienThue       = Protector.Decimal(TienThue, 0);
     _KhuyenMai      = Protector.Int(KhuyenMai, 0);
     _LoginId        = Protector.Int(loginId, 0);
 }
 /// <summary>
 /// Ham khoi tao gia tri mac dinh cho cac bien
 /// </summary>
 private void init()
 {
     _NhanVienId     = Protector.Int(NhanVienId, 0);
     _LuongCoBan     = Protector.Int(LuongCoBan, 0);
     _LuongChinhThuc = Protector.Int(LuongChinhThuc, 0);
     _HuongLuong     = Protector.Decimal(HuongLuong, 0);
     _ComTrua        = Protector.Int(ComTrua);
     _DienThoai      = Protector.Int(DienThoai, 0);
     _TrachNhiem     = Protector.Int(TrachNhiem, 0);
     _DongPhuc       = Protector.Int(DongPhuc, 0);
     _Khac           = Protector.Int(Khac, 0);
 }
Beispiel #6
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var congviec = new Entity.MSSQL_QLDN_QLNS.Entity.CongViec();
                congviec.DuAnId = Protector.Int(DuAnId);
                congviec.TieuDe = TieuDe;
                congviec.MoTa   = MoTa;
                if (NgayBatDau != "" && NgayBatDau != null)
                {
                    congviec.NgayBatDau = DateTime.ParseExact(NgayBatDau, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                if (NgayThatSuBatDau != null && NgayThatSuBatDau != "")
                {
                    congviec.NgayThatSuBatDau = DateTime.ParseExact(NgayThatSuBatDau, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                if (NgayKetThuc != null && NgayKetThuc != "")
                {
                    congviec.NgayKetThuc = DateTime.ParseExact(NgayKetThuc, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                if (NgayThatSuKetThuc != null && NgayThatSuKetThuc != "")
                {
                    congviec.NgayThatSuKetThuc = DateTime.ParseExact(NgayThatSuKetThuc, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                congviec.SoNgay           = Protector.Decimal(SoNgay);
                congviec.TienDo           = Protector.Int(TienDo);
                congviec.NoiDungCongViec  = NoiDungCongViec;
                congviec.ThuanLoiKhoKhan  = ThuanLoiKhoKhan;
                congviec.GiaiPhapKienNghi = GiaiPhapKienNghi;
                congviec.MaTrangThai      = MaTrangThai;
                congviec.NguoiXuLy        = Protector.Int(NguoiXuLy);
                congviec.NguoiTao         = Protector.Int(NguoiTao);
                congviec.GhiChu           = GhiChu;
                congviec.XoaYN            = "N";
                congviec.CtrVersion       = 1;
                CongViecRepository repo = new CongViecRepository(context);
                await repo.Insert(congviec);

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "CongViec", congviec.CongViecId, "Insert", congviec.NguoiTao);

                return(returnActionResult(HttpStatusCode.OK, congviec, null));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Beispiel #7
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                int i          = 0;
                int count_list = _listDauKy.Count;

                var biz = new ImportDauKyBiz(context);
                foreach (var kychitietmodel in _listDauKy)
                {
                    i++;
                    biz              = new ImportDauKyBiz(context);
                    biz.MA_KHO       = Protector.String(kychitietmodel.MaKho);
                    biz.MA_HANG_HOA  = Protector.String(kychitietmodel.MaHangHoa);
                    biz.TEN_HANG_HOA = Protector.String(kychitietmodel.TenHangHoa);
                    biz.DON_VI_TINH  = Protector.String(kychitietmodel.DonViTinh);
                    biz.LO_HANG      = Protector.String(kychitietmodel.LoHang);
                    biz.THANG_NAM    = Protector.String(kychitietmodel.ThangNam);
                    biz.TON_DAU      = Protector.Decimal(kychitietmodel.TonDau);
                    biz.GIA_NHAP     = Protector.Decimal(kychitietmodel.GiaNhap);
                    biz.LOGIN_ID     = loginId;
                    if (i == count_list)
                    {
                        biz.IMPORT_YN = "Y";
                    }
                    else
                    {
                        biz.IMPORT_YN = "N";
                    }
                    var result = await biz.Execute();
                }

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, _listDauKy, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
        /// <summary>
        /// Ham khoi tao gia tri mac dinh cho cac bien
        /// </summary>
        private void init()
        {
            var _TuNgay = Protector.DateTime(strTuNgay, "yyyy-MM-dd", true);

            if (_TuNgay == null)
            {
                throw new BaseException("TuNgay không dúng.");
            }
            TuNgay = _TuNgay.Value;

            var _DenNgay = Protector.DateTime(strDenNgay, "yyyy-MM-dd", true);

            if (_DenNgay == null)
            {
                throw new BaseException("DenNgay không dúng.");
            }
            DenNgay = _DenNgay.Value;

            NgayKetThucSom = Protector.DateTime(strNgayKetThucSom, "yyyy-MM-dd", true);
            HopDong        = Protector.String(HopDong, "");
            HuongLuong     = Protector.Decimal(HuongLuong, 0);
            Luong          = Protector.Int(Luong, 0);
            Hinh           = Protector.String(Hinh, "");
        }
Beispiel #9
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                /* b repo */
                //var KyChiTiet = new Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKyChiTiet();
                //KhoBaoCaoTheoKyChiTietRepository repo = new KhoBaoCaoTheoKyChiTietRepository(context);
                //await repo.Delete(45);
                //if (_listDauKy.Count > 0)
                //{
                //    // delete old data
                //    //foreach (var kychitietmodel in _listDauKy)
                //    //{
                //    //    int kyId_del = Protector.Int(kychitietmodel.KyId);
                //    //    await repo.Delete(kyId_del);
                //    //    break;
                //    //}

                //    foreach (var kychitietmodel in _listDauKy)
                //    {
                //        KyChiTiet.KyId = Protector.Int(kychitietmodel.KyId);
                //        KyChiTiet.KhoHangId = Protector.Int(kychitietmodel.KhoHangId);
                //        KyChiTiet.HangHoaId = Protector.Int(kychitietmodel.HangHoaId);
                //        KyChiTiet.SoLuongTonDau = Protector.Decimal(kychitietmodel.SoLuongTonDau);
                //        KyChiTiet.GiaTriTonDau = Protector.Decimal(kychitietmodel.GiaTriTonDau);
                //        KyChiTiet.SoLuongNhapTrongKy = Protector.Decimal(kychitietmodel.SoLuongNhapTrongKy);
                //        KyChiTiet.GiaTriNhapTrongKy = Protector.Decimal(kychitietmodel.GiaTriNhapTrongKy);
                //        KyChiTiet.SoLuongXuatTrongKy = Protector.Decimal(kychitietmodel.SoLuongXuatTrongKy);
                //        KyChiTiet.DonGiaXuatBinhQuan = Protector.Decimal(kychitietmodel.DonGiaXuatBinhQuan);
                //        KyChiTiet.SoLuongTonCuoi = Protector.Decimal(kychitietmodel.SoLuongTonCuoi);
                //        KyChiTiet.GiaTriTonCuoi = Protector.Decimal(kychitietmodel.GiaTriTonCuoi);
                //        await repo.Insert(KyChiTiet);
                //    }
                //}
                /* e repo */
                var biz   = new ImportExcelDauKyBiz(context);
                int index = 1;
                foreach (var kychitietmodel in _listDauKy)
                {
                    biz                   = new ImportExcelDauKyBiz(context);
                    biz.KY_ID             = _kyId; //Protector.Int(kychitietmodel.KyId);
                    biz.KHO_HANG_ID       = 0;     //Protector.Int(kychitietmodel.KhoHangId);
                    biz.HANG_HOA_ID       = 0;     //Protector.Int(kychitietmodel.HangHoaId);
                    biz.MA_HANG_HOA       = Protector.String(kychitietmodel.MaHangHoa);
                    biz.SL_TON_DAU        = Protector.Decimal(kychitietmodel.SoLuongTonDau);
                    biz.GT_TON_DAU        = Protector.Decimal(kychitietmodel.GiaTriTonDau);
                    biz.SL_NHAP_TRONG_KY  = Protector.Decimal(kychitietmodel.SoLuongNhapTrongKy);
                    biz.GT_NHAP_TRONG_KY  = Protector.Decimal(kychitietmodel.GiaTriNhapTrongKy);
                    biz.SL_XUAT_TRONG_KY  = Protector.Decimal(kychitietmodel.SoLuongXuatTrongKy);
                    biz.DG_XUAT_BINH_QUAN = Protector.Decimal(kychitietmodel.DonGiaXuatBinhQuan);
                    biz.SL_TON_CUOI       = Protector.Decimal(kychitietmodel.SoLuongTonCuoi);
                    biz.GT_TON_CUOI       = Protector.Decimal(kychitietmodel.GiaTriTonCuoi);
                    biz.XOA               = index;
                    var result = await biz.Execute();

                    index = 2;
                }

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, _listDauKy, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }