public IList<Accept> GetListAccepts(FilterDataModel inputObject) { // Local variable declaration var acceptDateStart = inputObject.AcceptDateStart; var acceptDateEnd = inputObject.AcceptDateEnd; var deliveryDateStart = inputObject.DeliveryDateStart; var deliveryDateEnd = inputObject.DeliveryDateEnd; // Check end date if(acceptDateEnd.HasValue) acceptDateEnd = acceptDateEnd.Value.AddDays(1); if(deliveryDateEnd.HasValue) deliveryDateEnd = deliveryDateEnd.Value.AddDays(1); // Get value var listResult = from tbl in EntityManager.Accepts where (tbl.SlipStatus == inputObject.SlipStatus || DataCheckHelper.IsNull(inputObject.SlipStatus)) && (tbl.AcceptSlipNo.CompareTo(inputObject.SlipNoStart) >= 0 || DataCheckHelper.IsNull(inputObject.SlipNoStart)) && (tbl.AcceptSlipNo.CompareTo(inputObject.SlipNoEnd) < 0 || DataCheckHelper.IsNull(inputObject.SlipNoEnd)) && (tbl.AcceptDate >= acceptDateStart || DataCheckHelper.IsNull(acceptDateStart)) && (tbl.AcceptDate < acceptDateEnd || DataCheckHelper.IsNull(acceptDateEnd)) && (tbl.DeliveryDate >= deliveryDateStart || DataCheckHelper.IsNull(deliveryDateStart)) && (tbl.DeliveryDate < deliveryDateEnd || DataCheckHelper.IsNull(deliveryDateEnd)) && (tbl.ClientCd.Contains(inputObject.ClientCd) || DataCheckHelper.IsNull(inputObject.ClientCd)) && (tbl.ClientName.Contains(inputObject.ClientName) || DataCheckHelper.IsNull(inputObject.ClientName)) && (tbl.AcceptDetails.Any(sub => sub.ItemCd.Contains(inputObject.ItemCd)) || DataCheckHelper.IsNull(inputObject.ItemCd)) && (tbl.AcceptDetails.Any(sub => sub.ItemName.Contains(inputObject.ItemName)) || DataCheckHelper.IsNull(inputObject.ItemName)) && tbl.DeleteFlag == false orderby tbl.UpdateDate ascending select tbl; // Return value return listResult.ToList(); }
/// <summary> /// Execute convert ouput. /// </summary> /// <param name="resultObject">DataModel</param> /// <returns>ResponseModel</returns> private FilterResponseModel Convert(FilterDataModel resultObject) { // Local variable declaration FilterResponseModel responseModel = null; IList<OutputAcceptModel> listAccepts = null; MCodeCom mCodeCom = null; OutputAcceptModel accept = null; // Variable initialize responseModel = new FilterResponseModel(); listAccepts = new List<OutputAcceptModel>(); mCodeCom = new MCodeCom(); // Get value var slipStatusName = string.Empty; var paymentMethodsName = string.Empty; var deleteFlagName = string.Empty; var cbSlipStatus = new ComboModel(); foreach (var obj in resultObject.ListAccepts) { accept = new OutputAcceptModel(); accept.AcceptSlipNo = DataHelper.ToString(obj.AcceptSlipNo); accept.SlipStatus = DataHelper.ToString(obj.SlipStatus); slipStatusName = mCodeCom.GetCodeName(Logics.GROUP_SLIP_STATUS, accept.SlipStatus); accept.SlipStatusName = DataHelper.ToString(slipStatusName); accept.AcceptDate = DataHelper.ToString(Formats.DATE, obj.AcceptDate); accept.DeliveryDate = DataHelper.ToString(Formats.DATE, obj.DeliveryDate); accept.ClientCd = DataHelper.ToString(obj.ClientCd); accept.ClientName = DataHelper.ToString(obj.ClientName); accept.ClientAddress = DataHelper.ToString(obj.ClientAddress); accept.ClientTel = DataHelper.ToString(obj.ClientTel); accept.DeliveryCd = DataHelper.ToString(obj.DeliveryCd); accept.DeliveryName = DataHelper.ToString(obj.DeliveryName); accept.DeliveryAddress = DataHelper.ToString(obj.DeliveryAddress); accept.DeliveryTel = DataHelper.ToString(obj.DeliveryTel); accept.PaymentMethods = DataHelper.ToString(obj.PaymentMethods); paymentMethodsName = mCodeCom.GetCodeName(Logics.GROUP_PAYMENT_METHODS, accept.PaymentMethods); accept.PaymentMethodsName = DataHelper.ToString(paymentMethodsName); accept.GiftCd = DataHelper.ToString(obj.GiftCd); accept.ViewId = DataHelper.ToString(obj.ViewId); accept.Notes = DataHelper.ToString(obj.Notes); accept.UpdateUser = DataHelper.ToString(obj.UpdateUser); accept.UpdateDate = DataHelper.ToString(Formats.UPDATE_DATE, obj.UpdateDate); accept.DeleteFlag = DataHelper.ToString(obj.DeleteFlag); deleteFlagName = mCodeCom.GetCodeName(Logics.GROUP_DELETE_FLAG, accept.DeleteFlag); accept.DeleteFlagName = DataHelper.ToString(deleteFlagName); cbSlipStatus = MCodeCom.ToComboItems(resultObject.ListSlipStatus, accept.SlipStatus); accept.ListSlipStatus = cbSlipStatus.ListItems; accept.SlipStatus = cbSlipStatus.SeletedValue; listAccepts.Add(accept); } // Set value responseModel.ListAccepts = listAccepts; // Return value return responseModel; }
/// <summary> /// Execute convert input. /// </summary> /// <param name="request">RequestModel</param> /// <returns>DataModel</returns> private FilterDataModel Convert(FilterRequestModel request) { // Local variable declaration FilterDataModel inputObject = null; // Variable initialize inputObject = new FilterDataModel(); // Convert data input DataHelper.ConvertInput(request, inputObject); // Return value return inputObject; }
/// <summary> /// Check processing. /// </summary> /// <param name="inputObject">DataModel</param> private void Check(FilterDataModel inputObject) { // Check role if (!PageHelper.AuthRole(Logics.RL_ACCEPTS)) throw new ExecuteException("E_MSG_00013"); }
/// <summary> /// Get infomation /// </summary> /// <param name="inputObject">DataModel</param> /// <returns>DataModel</returns> private FilterDataModel GetInfo(FilterDataModel inputObject) { // Local variable declaration FilterDataModel getResult = null; MCodeCom mCodeCom = null; AdminAcceptListDao adminAcceptListDao = null; // Variable initialize getResult = new FilterDataModel(); mCodeCom = new MCodeCom(); adminAcceptListDao = new AdminAcceptListDao(); // Get data var listSlipStatus = mCodeCom.GetListCode(Logics.GROUP_SLIP_STATUS, null, true, false); var listAccepts = adminAcceptListDao.GetListAccepts(inputObject); // Set value getResult.ListSlipStatus = listSlipStatus; getResult.ListAccepts = listAccepts; // Return value return getResult; }