using Edu.AOP.CustomerAttribute;
using Edu.Common.Enum;
using Edu.Common.Enum.Sale;
using Edu.Model.CacheModel;
using Edu.Model.ViewModel.Sell;
using Edu.Model.ViewModel.StudyAbroad;
using Edu.Model.ViewModel.System;
using Edu.Repository.Course;
using Edu.Repository.Sell;
using Edu.Repository.StudyAbroad;
using Edu.Repository.System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB;

namespace Edu.Module.StudyAbroad
{
    /// <summary>
    /// 留学就业处理类
    /// </summary>
    public class StudyAbroadModule
    {
        /// <summary>
        /// 留学就业仓储层对象
        /// </summary>
        private readonly RB_StudyAbroadRepository studyAbroadRepository = new RB_StudyAbroadRepository();

        /// <summary>
        /// 留学就业优惠信息仓储层对象
        /// </summary>
        private readonly RB_StudyaBroad_PreferentialRepository studyaBroad_PreferentialRepository = new RB_StudyaBroad_PreferentialRepository();

        /// <summary>
        /// 订单仓储层对象
        /// </summary>
        private readonly RB_OrderRepository orderRepository = new RB_OrderRepository();

        /// <summary>
        /// 地区仓储层对象
        /// </summary>
        private readonly RB_DestinationRepository destinationRepository = new RB_DestinationRepository();

        /// <summary>
        /// 留学就业类型仓储层对象
        /// </summary>
        private readonly RB_Studyabroad_TypeRepository studyabroad_TypeRepository = new RB_Studyabroad_TypeRepository();

        /// <summary>
        /// 获取留学就业分页列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="rowsCount"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_StudyAbroad_ViewModel> GetStudyAbroadPageModule(int pageIndex, int pageSize, out long rowsCount, RB_StudyAbroad_ViewModel query)
        {
            var list = studyAbroadRepository.GetStudyAbroadPageRepository(pageIndex, pageSize, out rowsCount, query);
            if (list != null && list.Count > 0)
            {
                string ids = string.Join(",", list.Select(qitem => qitem.Id));
                string countryIds = string.Join(",", list.Where(qitem=>!string.IsNullOrEmpty(qitem.TypeCountryId)).Select(qitem => qitem.TypeCountryId));
                List<RB_StudyaBroad_Preferential_ViewModel> preferentialList = new List<RB_StudyaBroad_Preferential_ViewModel>();
                if (query.IsQPrice == 1)
                {
                    preferentialList = GetStudyaBroadPreferentialListModule(new RB_StudyaBroad_Preferential_ViewModel()
                    {
                        QStudyabroadIds = ids
                    });
                }
                List<RB_Destination_ViewModel> areaList = new List<RB_Destination_ViewModel>();
                if (!string.IsNullOrEmpty(countryIds))
                {
                    areaList = destinationRepository.GetDestinationListRepository(new RB_Destination_ViewModel()
                    {
                        Ids = countryIds
                    });
                }

                foreach (var item in list)
                {
                    string tempCountryName = "";
                    if (!string.IsNullOrEmpty(item.TypeCountryId))
                    {
                        var countryList = Common.ConvertHelper.StringToList(item.TypeCountryId);
                        if (countryList != null && countryList.Count > 0)
                        {
                            foreach (var subItem in countryList)
                            {
                                tempCountryName += (areaList?.Where(qitem => qitem.ID == subItem)?.FirstOrDefault()?.Name ?? "") + ",";
                            }
                        }
                    }
                    item.StudyCountryName = tempCountryName.TrimEnd(',');
                    item.PreferentialList = preferentialList?.Where(qitem => qitem.StudyabroadId == item.Id)?.ToList() ?? new List<RB_StudyaBroad_Preferential_ViewModel>();
                }
            }
            return list;
        }

        /// <summary>
        /// 获取留学就业审核分页列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="rowsCount"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_StudyAbroad_ViewModel> GetStudyAbroadAuditPageModule(int pageIndex, int pageSize, out long rowsCount, RB_StudyAbroad_ViewModel query)
        {
            var list = studyAbroadRepository.GetStudyAbroadAuditPageRepository(pageIndex, pageSize, out rowsCount, query);
            if (list != null && list.Count > 0)
            {
                string ids = string.Join(",", list.Select(qitem => qitem.Id));
                List<RB_StudyaBroad_Preferential_ViewModel> preferentialList = new List<RB_StudyaBroad_Preferential_ViewModel>();
                if (query.IsQPrice == 1)
                {
                    preferentialList = GetStudyaBroadPreferentialListModule(new RB_StudyaBroad_Preferential_ViewModel()
                    {
                        QStudyabroadIds = ids
                    });
                }
                foreach (var item in list)
                {
                    item.PreferentialList = preferentialList?.Where(qitem => qitem.StudyabroadId == item.Id)?.ToList() ?? new List<RB_StudyaBroad_Preferential_ViewModel>();
                }
            }
            return list;
        }


        /// <summary>
        /// 获取留学就业列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_StudyAbroad_ViewModel> GetStudyAbroadListModule(RB_StudyAbroad_ViewModel query)
        {
            var list = studyAbroadRepository.GetStudyAbroadListRepository(query);
            if (list != null && list.Count > 0)
            {
                string ids = string.Join(",", list.Select(qitem => qitem.Id));
                List<RB_StudyaBroad_Preferential_ViewModel> preferentialList = new List<RB_StudyaBroad_Preferential_ViewModel>();
                if (query.IsQPrice == 1)
                {
                    preferentialList = GetStudyaBroadPreferentialListModule(new RB_StudyaBroad_Preferential_ViewModel()
                    {
                        QStudyabroadIds = ids
                    });
                }
                foreach (var item in list)
                {
                    item.PreferentialList = preferentialList?.Where(qitem => qitem.StudyabroadId == item.Id)?.ToList() ?? new List<RB_StudyaBroad_Preferential_ViewModel>();
                }
            }
            return list;
        }

        /// <summary>
        /// 获取留学就业优惠列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_StudyaBroad_Preferential_ViewModel> GetStudyaBroadPreferentialListModule(RB_StudyaBroad_Preferential_ViewModel query)
        {
            return studyaBroad_PreferentialRepository.GetStudyaBroadPreferentialListRepostory(query);
        }


        /// <summary>
        /// 新增修改留学就业产品
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool SetStudyAbroadModule(RB_StudyAbroad_ViewModel model)
        {
            bool flag = false;
            if (model.Id > 0)
            {
                Dictionary<string, object> fileds = new Dictionary<string, object>()
                {
                    { nameof(RB_StudyAbroad_ViewModel.Type),model.Type},
                    { nameof(RB_StudyAbroad_ViewModel.Name),model.Name.Trim()},
                    { nameof(RB_StudyAbroad_ViewModel.SupplierId),model.SupplierId},
                    { nameof(RB_StudyAbroad_ViewModel.SupplierContract),model.SupplierContract},
                    { nameof(RB_StudyAbroad_ViewModel.Remark),model.Remark},
                    { nameof(RB_StudyAbroad_ViewModel.School_Id),model.School_Id},
                    { nameof(RB_StudyAbroad_ViewModel.ImgCover),model.ImgCover},
                    { nameof(RB_StudyAbroad_ViewModel.ProductType),model.ProductType},
                    { nameof(RB_StudyAbroad_ViewModel.StudyFeature),model.StudyFeature},
                    { nameof(RB_StudyAbroad_ViewModel.StudyCountryId),model.StudyCountryId},
                };
                flag = studyAbroadRepository.Update(fileds, new WhereHelper(nameof(RB_StudyAbroad_ViewModel.Id), model.Id));
            }
            else
            {
                var newId = studyAbroadRepository.Insert(model);
                model.Id = newId;
                flag = newId > 0;
            }
            return flag;
        }


        /// <summary>
        /// 批量新增修改留学就业优惠信息
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        [TransactionCallHandler]
        public virtual bool SetStudyAbroadPreferentialListModule(RB_StudyAbroad_ViewModel model, List<RB_StudyaBroad_Preferential_ViewModel> list)
        {
            bool flag = false;
            if (model.Id > 0)
            {
                Dictionary<string, object> fileds = new Dictionary<string, object>()
                {
                    {nameof(RB_StudyAbroad_ViewModel.SuggestPrice),model.SuggestPrice },
                    {nameof(RB_StudyAbroad_ViewModel.SellPrice),model.SellPrice },
                };
                flag = studyAbroadRepository.Update(fileds, new WhereHelper(nameof(RB_StudyAbroad_ViewModel.Id), model.Id));
            }
            var oldList = GetStudyaBroadPreferentialListModule(new RB_StudyaBroad_Preferential_ViewModel() { StudyabroadId = model.Id });
            //原来没有优惠数据
            if (oldList == null || (oldList != null && oldList.Count == 0))
            {
                foreach (var item in list)
                {
                    flag = studyaBroad_PreferentialRepository.Insert(item) > 0;
                }
            }
            //原来有优惠数据
            else
            {
                if (list == null || (list != null && list.Count == 0))
                {
                    flag = studyaBroad_PreferentialRepository.DeleteStudyaBroadPreferentialRepostory(model.Id);
                }
                else
                {
                    //找出差异的数据
                    var deleteList = oldList.Where(qitem => !list.Any(oldItem => qitem.Id == oldItem.Id)).ToList();
                    foreach (var dItem in deleteList)
                    {
                        if (dItem.Id > 0)
                        {
                            flag = studyaBroad_PreferentialRepository.Delete(dItem.Id) > 0;
                        }
                    }
                    foreach (var priceItem in list)
                    {
                        if (priceItem.Id == 0)
                        {
                            flag = studyaBroad_PreferentialRepository.Insert(priceItem) > 0;
                        }
                        else
                        {
                            flag = studyaBroad_PreferentialRepository.Update(priceItem);
                        }
                    }
                }
            }
            return flag;
        }

        /// <summary>
        /// 根据编号获取留学就业产品信息
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public RB_StudyAbroad_ViewModel GetStudyAbroadModule(int Id, int IsGetPrice = 0)
        {
            var model = studyAbroadRepository.GetStudyAbroadListExtRepository(new RB_StudyAbroad_ViewModel()
            {
                Id = Id,
                School_Id = -1
            })?.FirstOrDefault();
            if (model != null && IsGetPrice == 1)
            {
                model.PreferentialList = GetStudyaBroadPreferentialListModule(new RB_StudyaBroad_Preferential_ViewModel()
                {
                    StudyabroadId = model.Id
                });
            }
            return model;
        }

        /// <summary>
        /// 更新留学就业产品状态
        /// </summary>
        /// <param name="Id">供应商编号</param>
        /// <param name="Status">状态(0-正常，1-删除)</param>
        /// <returns></returns>
        public bool RemoveStudyAbroadModule(int Id, int Status, out string message)
        {
            message = "";
            var orderList = orderRepository.GetStudyOrderPageListRepository(1, 1, out _, new RB_Order_ViewModel()
            {
                SourceId = Id,
                Q_OrderState = 1
            });
            if (orderList != null && orderList.Count > 0)
            {
                message = "此产品下存在正常订单!不能删除!";
                return false;
            }
            Dictionary<string, object> fileds = new Dictionary<string, object>()
            {
                { nameof(RB_StudyAbroad_ViewModel.Status),Status},
            };
            bool flag = studyAbroadRepository.Update(fileds, new WhereHelper(nameof(RB_StudyAbroad_ViewModel.Id), Id));
            return flag;
        }

        /// <summary>
        /// 更新留学就业产品提交审核
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public bool SetSaleStateModule(int Id, int SaleState)
        {
            Dictionary<string, object> fileds = new Dictionary<string, object>()
            {
                { nameof(RB_StudyAbroad_ViewModel.SaleState),SaleState},
            };
            if (SaleState == 2)
            {
                fileds.Add(nameof(RB_StudyAbroad_ViewModel.DirectorAuditTime), null);
                fileds.Add(nameof(RB_StudyAbroad_ViewModel.DirectorId), Common.Config.StudyAbroadDirectorId);
                fileds.Add(nameof(RB_StudyAbroad_ViewModel.DirectorOpinion), "");
                fileds.Add(nameof(RB_StudyAbroad_ViewModel.DirectorStatus), 0);
            }
            bool flag = studyAbroadRepository.Update(fileds, new WhereHelper(nameof(RB_StudyAbroad_ViewModel.Id), Id));
            return flag;
        }

        /// <summary>
        /// 部门主管审核
        /// </summary>
        /// <param name="model"></param>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        [TransactionCallHandler]
        public virtual bool SetDirectorAuditModule(RB_StudyAbroad_ViewModel model, UserInfo userInfo)
        {
            Dictionary<string, object> fileds = new Dictionary<string, object>()
            {
                { nameof(RB_StudyAbroad_ViewModel.DirectorId),userInfo.Id},
                { nameof(RB_StudyAbroad_ViewModel.DirectorOpinion),model.DirectorOpinion},
                { nameof(RB_StudyAbroad_ViewModel.DirectorStatus),model.DirectorStatus},
                { nameof(RB_StudyAbroad_ViewModel.DirectorAuditTime),model.DirectorAuditTime},
            };
            //拒绝
            if (model.DirectorStatus == 2)
            {
                fileds.Add(nameof(RB_StudyAbroad_ViewModel.SaleState), (int)SaleStateEnum.Fail);
            }
            else if (model.DirectorStatus == 1)
            {
                //2022-1-4  ld  修改审核只用主管审核  =》 徐总审核
                fileds.Add(nameof(RB_StudyAbroad_ViewModel.SaleState), (int)SaleStateEnum.Sell);
                //fileds.Add(nameof(RB_StudyAbroad_ViewModel.ManagerId), Common.Config.StudyAbroadManagerId);
                //fileds.Add(nameof(RB_StudyAbroad_ViewModel.ManagerOpinion), "");
                //fileds.Add(nameof(RB_StudyAbroad_ViewModel.ManagerStatus),0 );
                //fileds.Add(nameof(RB_StudyAbroad_ViewModel.ManagerAuditTime), null);
            }
            bool flag = studyAbroadRepository.Update(fileds, new WhereHelper(nameof(RB_StudyAbroad_ViewModel.Id), model.Id));
            return flag;
        }

        /// <summary>
        /// 部门负责人审核
        /// </summary>
        /// <param name="model"></param>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        [TransactionCallHandler]
        public virtual bool SetManagerAuditModule(RB_StudyAbroad_ViewModel model, UserInfo userInfo)
        {
            Dictionary<string, object> fileds = new Dictionary<string, object>()
            {
                { nameof(RB_StudyAbroad_ViewModel.ManagerId),userInfo.Id},
                { nameof(RB_StudyAbroad_ViewModel.ManagerOpinion),model.ManagerOpinion},
                { nameof(RB_StudyAbroad_ViewModel.ManagerStatus),model.ManagerStatus},
                { nameof(RB_StudyAbroad_ViewModel.ManagerAuditTime),model.ManagerAuditTime},
            };
            //拒绝
            if (model.DirectorStatus == 2)
            {
                fileds.Add(nameof(RB_StudyAbroad_ViewModel.SaleState), (int)SaleStateEnum.Fail);
            }
            //通过
            else
            {
                fileds.Add(nameof(RB_StudyAbroad_ViewModel.SaleState), (int)SaleStateEnum.Sell);
            }
            bool flag = studyAbroadRepository.Update(fileds, new WhereHelper(nameof(RB_StudyAbroad_ViewModel.Id), model.Id));
            return flag;
        }

        /// <summary>
        /// 设置留学就业产品价格及返佣
        /// </summary>
        /// <param name="demodel"></param>
        /// <returns></returns>
        public string SetStudyAbroadPrice(RB_StudyAbroad_ViewModel demodel)
        {
            Dictionary<string, object> keyValues = new Dictionary<string, object>() {
                { nameof(RB_StudyAbroad_ViewModel.SuggestPrice), demodel.SuggestPrice},
                { nameof(RB_StudyAbroad_ViewModel.SellPrice), demodel.SellPrice},
                { nameof(RB_StudyAbroad_ViewModel.B2CRatio), demodel.B2CRatio},
                { nameof(RB_StudyAbroad_ViewModel.B2CReNewRatio), demodel.B2CReNewRatio},
                { nameof(RB_StudyAbroad_ViewModel.B2BRebateRatio), demodel.B2BRebateRatio},
                { nameof(RB_StudyAbroad_ViewModel.B2BRebateRatioType), demodel.B2BRebateRatioType},
                { nameof(RB_StudyAbroad_ViewModel.B2BRebateRatioValue), demodel.B2BRebateRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.B2BReNewRatio), demodel.B2BReNewRatio},
                { nameof(RB_StudyAbroad_ViewModel.B2BReNewRatioType), demodel.B2BReNewRatioType},
                { nameof(RB_StudyAbroad_ViewModel.B2BReNewRatioValue), demodel.B2BReNewRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.SchoolRebateRatio), demodel.SchoolRebateRatio},
                { nameof(RB_StudyAbroad_ViewModel.SchoolRebateRatioType), demodel.SchoolRebateRatioType},
                { nameof(RB_StudyAbroad_ViewModel.SchoolRebateRatioValue), demodel.SchoolRebateRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.SchoolReNewRatio), demodel.SchoolReNewRatio},
                { nameof(RB_StudyAbroad_ViewModel.SchoolReNewRatioType), demodel.SchoolReNewRatioType},
                { nameof(RB_StudyAbroad_ViewModel.SchoolReNewRatioValue), demodel.SchoolReNewRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.TransIntroductceRatio), demodel.TransIntroductceRatio},
                { nameof(RB_StudyAbroad_ViewModel.TransIntroductceRatioType), demodel.TransIntroductceRatioType},
                { nameof(RB_StudyAbroad_ViewModel.TransIntroductceRatioValue), demodel.TransIntroductceRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.TransIntroductceReNewRatio), demodel.TransIntroductceReNewRatio},
                { nameof(RB_StudyAbroad_ViewModel.TransIntroductceReNewRatioType), demodel.TransIntroductceReNewRatioType},
                { nameof(RB_StudyAbroad_ViewModel.TransIntroductceReNewRatioValue), demodel.TransIntroductceReNewRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.InnerRecommendRatio), demodel.InnerRecommendRatio},
                { nameof(RB_StudyAbroad_ViewModel.InnerRecommendRatioType), demodel.InnerRecommendRatioType},
                { nameof(RB_StudyAbroad_ViewModel.InnerRecommendRatioValue), demodel.InnerRecommendRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.InnerRecommendReNewRatio), demodel.InnerRecommendReNewRatio},
                { nameof(RB_StudyAbroad_ViewModel.InnerRecommendReNewRatioType), demodel.InnerRecommendReNewRatioType},
                { nameof(RB_StudyAbroad_ViewModel.InnerRecommendReNewRatioValue), demodel.InnerRecommendReNewRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.CommissionReType), demodel.CommissionReType},
                { nameof(RB_StudyAbroad_ViewModel.B2CRbRatio), demodel.B2CRbRatio},
                { nameof(RB_StudyAbroad_ViewModel.B2CRbRatioType), demodel.B2CRbRatioType},
                { nameof(RB_StudyAbroad_ViewModel.B2CRbRatioValue), demodel.B2CRbRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.B2CRNRatio), demodel.B2CRNRatio},
                { nameof(RB_StudyAbroad_ViewModel.B2CRNRatioType), demodel.B2CRNRatioType},
                { nameof(RB_StudyAbroad_ViewModel.B2CRNRatioValue), demodel.B2CRNRatioValue},
                { nameof(RB_StudyAbroad_ViewModel.UpdateBy), demodel.UpdateBy},
                { nameof(RB_StudyAbroad_ViewModel.UpdateTime), demodel.UpdateTime}
            };
            List<WhereHelper> wheres = new List<WhereHelper>() {
                 new WhereHelper(){
                     FiledName = nameof(RB_StudyAbroad_ViewModel.Id),
                      FiledValue = demodel.Id,
                       OperatorEnum =OperatorEnum.Equal
                 }
            };
            bool flag = studyAbroadRepository.Update(keyValues, wheres);
            return flag ? "" : "出错了，请联系管理员";
        }

        #region 留学就业类型

        /// <summary>
        /// 获取留学就业类型分页列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="rowsCount"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_Studyabroad_Type_Extend> GetStudyabroadTypePageModule(int pageIndex, int pageSize, out long rowsCount, RB_Studyabroad_Type_Extend query)
        {
            var list = studyabroad_TypeRepository.GetStudyabroadTypePageRepository(pageIndex, pageSize, out rowsCount, query);
            if (list != null && list.Count > 0)
            {
                string countryIds = string.Join(",", list.Select(qitem => qitem.CountryId));
                List<RB_Destination_ViewModel> countryList = new List<RB_Destination_ViewModel>();
                if (!string.IsNullOrEmpty(countryIds))
                {
                    countryList= destinationRepository.GetDestinationListRepository(new RB_Destination_ViewModel()
                    {
                        Ids=countryIds
                    });
                }
                foreach (var item in list)
                {
                    string tempStr = "";
                    if (item.CountryIdList != null && item.CountryIdList.Count > 0)
                    {
                        foreach (var subItem in item.CountryIdList)
                        {
                            tempStr+= (countryList?.FirstOrDefault(qitem => qitem.ID == subItem)?.Name ?? "")+",";
                        }
                    }
                    item.CountryName = tempStr.TrimEnd(',');
                }
            }
            return list;
        }


        /// <summary>
        /// 获取留学就业类型列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<RB_Studyabroad_Type_Extend> GetStudyabroadTypeListModule(RB_Studyabroad_Type_Extend query)
        {
            var list = studyabroad_TypeRepository.GetStudyabroadTypeListRepository(query);
           
            return list;
        }

        /// <summary>
        /// 新增修改留学就业类型
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool SetStudyabroadTypeModule(RB_Studyabroad_Type_Extend model)
        {
            bool flag = false;
            if (model.Id > 0)
            {
                Dictionary<string, object> fileds = new Dictionary<string, object>()
                {
                    {nameof(RB_Studyabroad_Type_Extend.Name),model.Name },
                    {nameof(RB_Studyabroad_Type_Extend.Num),model.Num },
                    {nameof(RB_Studyabroad_Type_Extend.Type),model.Type },
                    {nameof(RB_Studyabroad_Type_Extend.UpdateBy),model.UpdateBy },
                    {nameof(RB_Studyabroad_Type_Extend.UpdateTime),model.UpdateTime },
                    {nameof(RB_Studyabroad_Type_Extend.CountryId),model.CountryId },
                };
                flag = studyabroad_TypeRepository.Update(fileds, new WhereHelper(nameof(RB_Studyabroad_Type_Extend.Id), model.Id));
            }
            else
            {
                var newId = studyabroad_TypeRepository.Insert(model);
                model.Id = newId;
                flag = newId > 0;
            }
            return flag;
        }

        /// <summary>
        /// 根据编号获取类型实体
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public RB_Studyabroad_Type_Extend GetStudyabroadTypeModule(object Id)
        {
            var extModel = studyabroad_TypeRepository.GetEntity<RB_Studyabroad_Type_Extend>(Id);
            return extModel;
        }

        /// <summary>
        /// 根据编号删除留学就业类型
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public bool RemoveStudyabroadTypeModule(object Id)
        {
            Dictionary<string, object> fileds = new Dictionary<string, object>()
            {
                {nameof(RB_Studyabroad_Type_Extend.Status),(int)DateStateEnum.Delete },
            };
            bool flag = studyabroad_TypeRepository.Update(fileds, new WhereHelper(nameof(RB_Studyabroad_Type_Extend.Id), Id));
            return flag;
        }
        #endregion
    }
}
