protected override GetVipServicesLogDetailRD ProcessRequest(DTO.Base.APIRequest <SetVipServicesLogRP> pRequest)
        {
            var rd   = new GetVipServicesLogDetailRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo           = new SessionManager().CurrentUserLoginInfo;
            var vipServicesLogBLL            = new VipServicesLogBLL(loggingSessionInfo);
            VipServicesLogEntity servicesLog = vipServicesLogBLL.GetByID(para.ServicesLogID);

            if (servicesLog != null)
            {
                rd.ServicesLogID = servicesLog.ServicesLogID.ToString();
                rd.VipID         = servicesLog.VipID;
                rd.ServicesTime  = servicesLog.ServicesTime == DateTime.MinValue?"":servicesLog.ServicesTime.Value.ToString("yyyy-MM-dd hh:mm");

                rd.ServicesMode = servicesLog.ServicesMode;
                rd.UnitID       = servicesLog.UnitID;
                rd.UnitName     = servicesLog.UnitName;
                rd.UserID       = servicesLog.UserID;
                rd.UserName     = servicesLog.UserName;
                rd.Content      = servicesLog.Content;
                rd.ServicesType = servicesLog.ServicesType.Value;
                rd.Duration     = servicesLog.Duration;
            }
            return(rd);
        }
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetVipServicesLogRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo           = new SessionManager().CurrentUserLoginInfo;
            var vipServicesLogBLL            = new VipServicesLogBLL(loggingSessionInfo);
            VipServicesLogEntity servicesLog = vipServicesLogBLL.GetByID(para.ServicesLogID);

            if (servicesLog != null)
            {
                vipServicesLogBLL.Delete(servicesLog);
            }
            return(rd);
        }
        protected override GetVipServicesLogListRD ProcessRequest(DTO.Base.APIRequest <GetVipServicesLogListRP> pRequest)
        {
            var rd   = new GetVipServicesLogListRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var vipServicesLogBLL  = new VipServicesLogBLL(loggingSessionInfo);

            //查询参数
            List <IWhereCondition> complexCondition = new List <IWhereCondition> {
            };

            complexCondition.Add(new EqualsCondition()
            {
                FieldName = "VipID", Value = para.VipID
            });
            //排序参数
            List <OrderBy> lstOrder = new List <OrderBy> {
            };

            lstOrder.Add(new OrderBy()
            {
                FieldName = "ServicesTime", Direction = OrderByDirections.Desc
            });

            var tempList = vipServicesLogBLL.PagedQuery(complexCondition.ToArray(), lstOrder.ToArray(), para.PageSize, para.PageIndex);

            rd.TotalPageCount     = tempList.PageCount;
            rd.TotalCount         = tempList.RowCount;
            rd.VipServicesLogList = tempList.Entities.Select(t => new VipServicesLogInfo()
            {
                ServicesLogID = t.ServicesLogID.ToString(),
                ServicesTime  = t.ServicesTime == null ? "" : t.ServicesTime.Value.ToString("yyyy-MM-dd HH:mm"),
                ServicesMode  = t.ServicesMode,
                UnitName      = t.UnitName,
                UserName      = t.UserName,
                Content       = t.Content
            }).ToArray();
            return(rd);
        }
Exemple #4
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetVipServicesLogRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo           = new SessionManager().CurrentUserLoginInfo;
            var vipServicesLogBLL            = new VipServicesLogBLL(loggingSessionInfo);
            VipServicesLogEntity servicesLog = null;

            if (string.IsNullOrEmpty(para.ServicesLogID))//创建
            {
                servicesLog = new VipServicesLogEntity();
                if (!string.IsNullOrEmpty(para.ServicesTime))
                {
                    servicesLog.ServicesTime = DateTime.Parse(para.ServicesTime);
                }
                servicesLog.VipID        = para.VipID;
                servicesLog.ServicesMode = para.ServicesMode;
                servicesLog.UnitID       = loggingSessionInfo.CurrentUserRole.UnitId;
                servicesLog.UserID       = loggingSessionInfo.UserID;
                //servicesLog.UserID = para.UserID;
                servicesLog.ServicesType = para.ServicesType;
                servicesLog.Duration     = para.Duration;
                servicesLog.Content      = para.Content;
                servicesLog.CustomerID   = loggingSessionInfo.ClientID;
                vipServicesLogBLL.Create(servicesLog);
            }
            else//编辑
            {
                servicesLog = vipServicesLogBLL.GetByID(new Guid(para.ServicesLogID));
                if (servicesLog != null)
                {
                    if (!string.IsNullOrEmpty(para.ServicesTime))
                    {
                        servicesLog.ServicesTime = DateTime.Parse(para.ServicesTime);
                    }
                    if (!string.IsNullOrEmpty(para.VipID))
                    {
                        servicesLog.VipID = para.VipID;
                    }
                    if (!string.IsNullOrEmpty(para.ServicesMode))
                    {
                        servicesLog.ServicesMode = para.ServicesMode;
                    }
                    //if (!string.IsNullOrEmpty(para.UnitID))
                    //    servicesLog.UnitID = para.UnitID;
                    //servicesLog.UserID = loggingSessionInfo.UserID;
                    //servicesLog.UserID = para.UserID;
                    if (para.ServicesType > 0)
                    {
                        servicesLog.ServicesType = para.ServicesType;
                    }
                    if (!string.IsNullOrEmpty(para.Duration))
                    {
                        servicesLog.Duration = para.Duration;
                    }
                    if (!string.IsNullOrEmpty(para.Content))
                    {
                        servicesLog.Content = para.Content;
                    }
                    vipServicesLogBLL.Update(servicesLog);
                }
            }
            return(rd);
        }
        protected override GetVipServicesLogListRD ProcessRequest(DTO.Base.APIRequest <GetVipServicesLogListRP> pRequest)
        {
            var rd   = new GetVipServicesLogListRD();
            var para = pRequest.Parameters;
            var vipServicesLogBLL = new VipServicesLogBLL(CurrentUserInfo);
            var VipBLL            = new VipBLL(CurrentUserInfo);
            //查询参数
            List <IWhereCondition> complexCondition = new List <IWhereCondition> {
            };

            #region 门店条件处理
            string UnitId = "";
            if (CurrentUserInfo.CurrentUserRole != null)
            {
                if (!string.IsNullOrWhiteSpace(CurrentUserInfo.CurrentUserRole.UnitId))
                {
                    UnitId = CurrentUserInfo.CurrentUserRole.UnitId;
                }
            }

            if (!string.IsNullOrWhiteSpace(para.VipID))
            {
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "VipID", Value = para.VipID
                });
            }
            //if (!string.IsNullOrWhiteSpace(UnitId))   //过滤门店的要去掉
            //    complexCondition.Add(new EqualsCondition() { FieldName = "UnitID", Value = CurrentUserInfo.CurrentUserRole.UnitId });
            //else
            //    return rd;
            #endregion
            //排序参数
            List <OrderBy> lstOrder = new List <OrderBy> {
            };
            lstOrder.Add(new OrderBy()
            {
                FieldName = "ServicesTime", Direction = OrderByDirections.Desc
            });
            if (para.PageIndex <= 0)
            {
                para.PageIndex = 1;
            }
            var tempList = vipServicesLogBLL.PagedQuery(complexCondition.ToArray(), lstOrder.ToArray(), para.PageSize, para.PageIndex);
            rd.TotalPageCount     = tempList.PageCount;
            rd.TotalCount         = tempList.RowCount;
            rd.VipServicesLogList = tempList.Entities.Select(t => new VipServicesLogInfo()
            {
                ServicesLogID = t.ServicesLogID.ToString(),
                ServicesTime  = t.ServicesTime == null ? "" : t.ServicesTime.Value.ToString("yyyy-MM-dd HH:mm"),
                ServicesMode  = t.ServicesMode,
                UnitName      = t.UnitName,
                UserName      = t.UserName,
                Content       = t.Content,
                VipID         = t.VipID
            }).ToArray();

            foreach (var item in rd.VipServicesLogList)
            {
                //会员名称
                var VipData = VipBLL.GetByID(item.VipID);
                if (VipData != null)
                {
                    item.VipName    = VipData.VipName ?? "";
                    item.HeadImgUrl = VipData.HeadImgUrl ?? "";
                }
            }

            return(rd);
        }