Exemplo n.º 1
0
        /// <summary>
        /// Execute convert ouput.
        /// </summary>
        /// <param name="resultObject">DataModel</param>
        /// <returns>ResponseModel</returns>
        private InitResponseModel Convert(InitDataModel resultObject)
        {
            // Local variable declaration
            InitResponseModel responseModel = null;
            OutputDetailsModel details = null;
            IList<OutputAcceptDetailsModel> listAcceptDetails = null;
            OutputAcceptDetailsModel acceptDetails = null;
            MCodeCom mCodeCom = null;

            // Variable initialize
            responseModel = new InitResponseModel();
            details = new OutputDetailsModel();
            listAcceptDetails = new List<OutputAcceptDetailsModel>();
            mCodeCom = new MCodeCom();

            // Get value
            var accept = resultObject.Accept;
            details.AcceptSlipNo = DataHelper.ToString(accept.AcceptSlipNo);
            var slipStatusName = mCodeCom.GetCodeName(Logics.GROUP_SLIP_STATUS, accept.SlipStatus);
            details.SlipStatus = DataHelper.ToString(accept.SlipStatus);
            details.SlipStatusName = DataHelper.ToString(slipStatusName);
            details.AcceptDate = DataHelper.ToString(Formats.FULL_DATE, accept.AcceptDate);
            details.DeliveryName = DataHelper.ToString(accept.DeliveryName);
            details.DeliveryAddress = DataHelper.ToString(accept.DeliveryAddress);
            details.ClientName = DataHelper.ToString(accept.ClientName);
            details.ClientAddress = DataHelper.ToString(accept.ClientAddress);
            var paymentMethodsName = mCodeCom.GetCodeContent(Logics.GROUP_PAYMENT_METHODS, accept.PaymentMethods);
            details.PaymentMethods = DataHelper.ToString(accept.PaymentMethods);
            details.PaymentMethodsName = DataHelper.ToString(paymentMethodsName);
            var totalItem = accept.AcceptDetails.Sum(o => o.DetailAmt);
            var totalAmount = accept.TotalAmt;
            details.TotalAmount = DataHelper.ToString(Formats.CURRENCY, totalAmount);
            details.ShipAmount = DataHelper.ToString(Formats.CURRENCY, totalAmount - totalItem);
            foreach (var obj in accept.AcceptDetails)
            {
                acceptDetails = new OutputAcceptDetailsModel();
                acceptDetails.ItemCd = DataHelper.ToString(obj.ItemCd);
                acceptDetails.ItemName = DataHelper.ToString(obj.ItemName);
                acceptDetails.Price = DataHelper.ToString(Formats.CURRENCY, obj.DetailPrice);
                acceptDetails.Quantty = DataHelper.ToString(Formats.NUMBER, obj.DetailQtty);
                acceptDetails.Amount = DataHelper.ToString(Formats.CURRENCY, obj.DetailAmt);

                listAcceptDetails.Add(acceptDetails);
            }
            details.ListAcceptDetails = listAcceptDetails;

            // Set value
            responseModel.Details = new List<OutputDetailsModel>() { details };

            // Return value
            return responseModel;
        }
Exemplo n.º 2
0
        public bool IsExistAccept(InitDataModel inputObject)
        {
            var result = from tbl in EntityManager.Accepts
                         where ((tbl.AcceptSlipNo == inputObject.AcceptSlipNo
                         && tbl.ClientCd == PageHelper.UserName)
                         || tbl.ViewId == inputObject.ViewId)
                         && tbl.DeleteFlag == false
                         select tbl;

            var count = result.LongCount();

            return count >= decimal.One;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Execute convert input.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel Convert(InitRequestModel request)
        {
            // Local variable declaration
            InitDataModel inputObject = null;

            // Variable initialize
            inputObject = new InitDataModel();

            // Convert data input
            DataHelper.ConvertInput(request, inputObject);

            // Return value
            return inputObject;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Check processing.
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        private void Check(InitDataModel inputObject)
        {
            // Local variable declaration
            ClientAcceptDetailsDao clientAcceptDetailsDao = null;

            // Variable initialize
            clientAcceptDetailsDao = new ClientAcceptDetailsDao();

            // Check valid
            if (DataCheckHelper.IsNull(inputObject.AcceptSlipNo) && DataCheckHelper.IsNull(inputObject.ViewId))
                throw new ExecuteException("E_MSG_00004", "Mã hóa đơn");

            if (!clientAcceptDetailsDao.IsExistAccept(inputObject))
                throw new DataNotExistException(string.Format("Hóa đơn ({0})", inputObject.AcceptSlipNo + inputObject.ViewId));
        }
Exemplo n.º 5
0
        public AcceptModel GetAccept(InitDataModel inputObject)
        {
            var result = from tbl in EntityManager.Accepts
                         where ((tbl.AcceptSlipNo == inputObject.AcceptSlipNo
                         && tbl.ClientCd == PageHelper.UserName)
                         || tbl.ViewId == inputObject.ViewId)
                         && tbl.DeleteFlag == false
                         select tbl;

            var acceptModel = new AcceptModel();

            DataHelper.CopyObject(result.SingleOrDefault(), acceptModel);
            acceptModel.TotalAmount = acceptModel.AcceptDetails.Where(o => o.DeleteFlag == false).Sum(o => o.DetailAmt);

            return acceptModel;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel getResult = null;
            ClientAcceptDetailsDao clientAcceptDetailsDao = null;

            // Variable initialize
            getResult = new InitDataModel();
            clientAcceptDetailsDao = new ClientAcceptDetailsDao();

            // Get data
            var accept = clientAcceptDetailsDao.GetAccept(inputObject);

            // Set value
            getResult.Accept = accept;

            // Return value
            return getResult;
        }