/// <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); }
/// <summary> /// Execute get email model. /// </summary> /// <param name="param">String</param> /// <returns>EmailModel</returns> private OutputEmailModel GetEmailModel(string param) { // Local variable declaration OutputEmailModel emailModel = null; ClientCheckoutDao clientCheckoutDao = null; MParameterCom mParameterCom = null; MCodeCom mCodeCom = null; IList <OutputAcceptDetailsModel> listAcceptDetails = null; // Variable initialize emailModel = new OutputEmailModel(); clientCheckoutDao = new ClientCheckoutDao(); mParameterCom = new MParameterCom(); mCodeCom = new MCodeCom(); listAcceptDetails = new List <OutputAcceptDetailsModel>(); // Get data var accept = clientCheckoutDao.GetAccept(param); var strHotline = mParameterCom.GetString(Logics.PR_HOTLINE, false); var strEmail = mParameterCom.GetString(Logics.PR_EMAIL_SUPPORT, false); var paymentMethodsContent = mCodeCom.GetCodeContent(Logics.GROUP_PAYMENT_METHODS, accept.PaymentMethods); OutputAcceptDetailsModel acceptDetails = null; foreach (var obj in accept.AcceptDetails) { acceptDetails = new OutputAcceptDetailsModel(); acceptDetails.ItemName = DataHelper.ToString(obj.ItemName); acceptDetails.DetailPrice = DataHelper.ToString(Formats.CURRENCY, obj.DetailPrice); acceptDetails.DetailQtty = DataHelper.ToString(Formats.NUMBER, obj.DetailQtty); acceptDetails.DetailAmt = DataHelper.ToString(Formats.CURRENCY, obj.DetailAmt); listAcceptDetails.Add(acceptDetails); } // Set data emailModel.AcceptSlipNo = DataHelper.ToString(accept.AcceptSlipNo); emailModel.ViewId = DataHelper.ToString(accept.ViewId); emailModel.AcceptDate = DataHelper.ToString(Formats.RFC_DATE, accept.AcceptDate); emailModel.ClientName = DataHelper.ToString(accept.ClientName); emailModel.ClientAddress = DataHelper.ToString(accept.ClientAddress); emailModel.ClientTel = DataHelper.ToString(accept.ClientTel); emailModel.DeliveryName = DataHelper.ToString(accept.DeliveryName); emailModel.DeliveryAddress = DataHelper.ToString(accept.DeliveryAddress); emailModel.DeliveryTel = DataHelper.ToString(accept.DeliveryTel); emailModel.PaymentMethodsContent = DataHelper.ToString(paymentMethodsContent); emailModel.Notes = DataHelper.ToString(accept.Notes); emailModel.Hotline = DataHelper.ToString(strHotline); emailModel.EmailSupport = DataHelper.ToString(strEmail); emailModel.AcceptDetails = listAcceptDetails; emailModel.TotalAmount = DataHelper.ToString(Formats.CURRENCY, accept.TotalAmount); // Return value; return(emailModel); }