Commit 6fc02edd authored by 黄奎's avatar 黄奎

页面修改

parent 63e04b17
using Edu.Common.Enum.Customer;
using Edu.Common.Enum;
using Edu.Common.Enum.Customer;
using System;
using VT.FW.DB;
......@@ -21,11 +22,6 @@ namespace Edu.Model.Entity.Customer
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 联系人
/// </summary>
public string ContactMan { get; set; }
/// <summary>
/// 联系电话
/// </summary>
......@@ -139,7 +135,7 @@ namespace Edu.Model.Entity.Customer
/// <summary>
/// 状态 0正常,1删除
/// </summary>
public int Status { get; set; }
public DateStateEnum Status { get; set; }
/// <summary>
/// 修改时间
......
using Edu.Repository.Customer;
using Edu.Common.Enum;
using Edu.Model.ViewModel.Customer;
using Edu.Repository.Customer;
using System;
using System.Collections.Generic;
using VT.FW.DB;
namespace Edu.Module.Customer
{
......@@ -12,5 +16,88 @@ namespace Edu.Module.Customer
/// 同业客户管理仓储层对象
/// </summary>
private readonly RB_CustomerRepository customerRepository = new RB_CustomerRepository();
/// <summary>
/// 获取客户分页列表..
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Customer_Extend> GetCustomerPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Customer_Extend query)
{
var list = customerRepository.GetCustomerPageRepository(pageIndex, pageSize, out rowsCount, query);
return list;
}
/// <summary>
/// 新增修改客户资料
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetCustomerModule(RB_Customer_Extend model)
{
bool flag;
if (model.CustomerId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Customer_Extend.CustomerName),model.CustomerName },
{nameof(RB_Customer_Extend.ContactNumber),model.ContactNumber },
{nameof(RB_Customer_Extend.Fax),model.Fax },
{nameof(RB_Customer_Extend.QQ),model.QQ },
{nameof(RB_Customer_Extend.Email),model.Email },
{nameof(RB_Customer_Extend.Address),model.Address },
{nameof(RB_Customer_Extend.Sex),model.Sex },
{nameof(RB_Customer_Extend.CustomerSourceType),model.CustomerSourceType },
{nameof(RB_Customer_Extend.CustomerSource),model.CustomerSource },
{nameof(RB_Customer_Extend.CountryId),model.CountryId },
{nameof(RB_Customer_Extend.ProvinceId),model.ProvinceId },
{nameof(RB_Customer_Extend.CityId),model.CityId },
{nameof(RB_Customer_Extend.DistrictId),model.DistrictId },
{nameof(RB_Customer_Extend.LngLat),model.LngLat },
{nameof(RB_Customer_Extend.Account),model.Account },
{nameof(RB_Customer_Extend.Remark),model.Remark },
{nameof(RB_Customer_Extend.UpdateTime),model.UpdateTime },
};
flag = customerRepository.Update(fileds, new WhereHelper(nameof(RB_Customer_Extend.CustomerId), model.CustomerId));
}
else
{
var newId = customerRepository.Insert(model);
model.CustomerId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号删除客户信息
/// </summary>
/// <param name="CustomerId"></param>
/// <returns></returns>
public bool RemoveCustomerModule(object CustomerId)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Customer_Extend.Status),(int)DateStateEnum.Delete},
};
var flag = customerRepository.Update(fileds, new WhereHelper(nameof(RB_Customer_Extend.CustomerId), CustomerId));
return flag;
}
/// <summary>
/// 根据客户编号获取客户实体类
/// </summary>
/// <param name="CustomerId"></param>
/// <returns></returns>
public RB_Customer_Extend GetCustomerModule(object CustomerId)
{
var extModel = customerRepository.GetEntity<RB_Customer_Extend>(CustomerId);
return extModel;
}
}
}
using Edu.Model.Entity.Customer;
using Edu.Common.Enum;
using Edu.Model.Entity.Customer;
using Edu.Model.ViewModel.Customer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Customer
{
......@@ -10,5 +14,33 @@ namespace Edu.Repository.Customer
/// </summary>
public class RB_CustomerRepository : BaseRepository<RB_Customer>
{
/// <summary>
/// 获取客户分页列表..
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Customer_Extend> GetCustomerPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Customer_Extend query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Customer AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (!string.IsNullOrEmpty(query.CustomerName))
{
builder.AppendFormat(" AND A.{0} LIKE @CustomerName ", nameof(RB_Customer_Extend.CustomerName));
parameters.Add("CustomerName", "%" + query.CustomerName.Trim() + "%");
}
}
return GetPage<RB_Customer_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment