123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- using CZFW.Framework.Interface;
- using CZFW.Framework.Logic;
- using CZFW.Framework.Model.ViewModel;
- using CZKJ.GBRS2.Entity;
- using CZKJ.GBRS2.Interface;
- using System.Linq;
- using CZKJ.GBRS2.Model;
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace CZKJ.GBRS2.Logic
- {
- public class UserInfoCustomerLogic : LogicBase<CustomerInfoEntity>, IUserInfoCustomer
- {
- public ResultModel AddModel(Model.UserInfoModel model)
- {
- var entity = new CustomerInfoEntity();
- entity.User_id = model.User_id;
- entity.Type = model.Type;
- entity.Channel = model.Channel;
- entity.Job_number = model.Job_number;
- entity.Lock_flag = model.Lock_flag;
- entity.Email = model.Email;
- entity.Mobile = model.Mobile;
- entity.Nickname = model.Nickname;
- entity.Head_url = model.Head_url;
- entity.Wx_open_id = model.Wx_open_id;
- entity.Wx_union_id = model.Wx_union_id;
- entity.Core_customer_code = model.Core_customer_code;
- entity.Department = model.Props.Department;
- entity.On_job = model.Props.On_job;
- entity.Out_user_id = model.Props.Out_user_id;
- entity.Gender = model.Customer_info.Gender;
- entity.Id_type = model.Customer_info.Id_type;
- entity.Id_no = model.Customer_info.Id_no;
- entity.Name = model.Customer_info.Name;
- entity.Birthday = model.Customer_info.Birthday;
- entity.LastLoginTime = DateTime.Now;
- var result = AddEntity(entity);
- return result;
- }
- public CustomerInfoEntity GetCuser(string userId)
- {
- return Queryable.Where(x => x.User_id == userId).SingleOrDefault();
- }
- public TableModel<SlimCutomerInfo> GetCustomerList(int pageindex = 1, int pageSize = 20)
- {
- var res = new TableModel<SlimCutomerInfo>();
- var queryable = Queryable;
- var data = (from x in queryable
- select new SlimCutomerInfo
- {
- Id=x.Id,
- User_id = x.User_id,
- Mobile = x.Mobile,
- Nickname = x.Nickname,
- Name=x.Name,
- Gender=x.Gender,
- Birthday=x.Birthday,
- }).Skip(pageindex-1).Take(pageSize).ToList();
- res.SetData(data);
- res.TableHeads = PropertyHelper.Get(typeof(SlimCutomerInfo));
- return res;
- }
- /// <summary>
- /// 查看
- /// </summary>
- /// <param name="Id"></param>
- /// <returns></returns>
- public FormModel<CustomerInfoEntity> GetModel(int Id)
- {
- var queryable = Queryable;
- var data = queryable.Where(x => x.Id == Id).FirstOrDefault();
- var res = new FormModel<CustomerInfoEntity>(data);
- return res;
- }
- public TableModel<CustomerInfoEntity> GetUserInFo(string userId)
- {
- var res = new TableModel<CustomerInfoEntity>();
- var queryable = Queryable;
- if (!string.IsNullOrWhiteSpace(userId))
- {
- queryable = queryable.Where(x => x.User_id == userId);
- }
- var data = (from x in queryable
- select new CustomerInfoEntity
- {
- User_id = x.User_id,
- Type = x.Type,
- Channel = x.Channel,
- Job_number = x.Job_number,
- Lock_flag = x.Lock_flag,
- Email = x.Email,
- Mobile = x.Mobile,
- Nickname = x.Nickname,
- Head_url = x.Head_url,
- Wx_open_id = x.Wx_open_id,
- Wx_union_id = x.Wx_union_id,
- Core_customer_code = x.Core_customer_code,
- }).ToList();
- res.SetData(data);
- res.TableHeads = PropertyHelper.Get(typeof(CustomerInfoEntity));
- return res;
- }
- /// <summary>
- /// 明细
- /// </summary>
- /// <returns></returns>
- public TableModel<CustomerInfoEntity> GetUserInFoCustomer()
- {
- var res = new TableModel<CustomerInfoEntity>();
- var queryable = DbContext.Set<CustomerInfoEntity>();
- var data = queryable.OrderByDescending(x => x.SortOrder).ToList();
- res.SetData(data);
- res.TableHeads = PropertyHelper.Get(typeof(CustomerInfoEntity));
- return res;
- }
- }
- }
|