⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customer.cs

📁 某个公司需要维持良好的客户关系
💻 CS
字号:
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using CRM.IDAL;
using CRM.Model;

namespace CRM.SQLServerDAL
{
	/// <summary>
	/// Customer 的摘要说明。
	/// </summary>
	public class Customer : ICustomer
	{
		#region ICustomer 成员

		public DataTable GetAllCustomer()
		{
			return DAI.RunProcTable("CRM_Customer_GetAllCustomer");
		}

		public void Insert(SysUserInfo user,CustomerInfo customer)
		{
			customer.CustomerId = Common.GetNextIdByTable("CustomerInfo","CustomerId","SingleLayer",null,10);
			object[] parms = {
								customer.CustomerId,
								 customer.CustomerName,
								
								 customer.TypeId,
								 customer.Leader,
								 customer.DeputyId,
								 customer.LevelId,
								 customer.Credit,
								 customer.Phone,
								 customer.Address,
								 customer.PostCode,
								 customer.Fax,
								 customer.Email,
								 customer.HomePage,
								
								
								 customer.BZ
							 };
			DAI.RunProcNonQuery("CRM_Customer_Insert",parms);
			DAI.RunProcNonQuery("CRM_SysUser_UserCustomerInsert",user.UserId,customer.CustomerId);
		}

		public CustomerInfo GetCustomerById(string customerId)
		{
			CustomerInfo customer = null;
			using (SqlDataReader rdr = DAI.RunProcReader("CRM_Customer_GetCustomerById",customerId))
			{
				if (rdr.Read())
				{
					customer = new CustomerInfo();

					customer.CustomerId = rdr["CustomerId"].ToString();
					customer.CustomerName = rdr["CustomerName"].ToString();
					customer.Leader = rdr["Leader"].ToString();
					customer.TypeId = rdr["TypeId"].ToString();
					customer.DeputyId = rdr["DeputyId"].ToString();
					customer.Phone = rdr["Phone"].ToString();
					customer.Address = rdr["Address"].ToString();
					customer.PostCode = rdr["PostCode"].ToString();
					customer.Fax = rdr["Fax"].ToString();
					customer.Email = rdr["Email"].ToString();
					customer.HomePage = rdr["HomePage"].ToString();
					customer.LevelId = rdr["LevelId"].ToString();
					customer.Credit = rdr["Credit"].ToString();
					customer.BZ = rdr["BZ"].ToString();
				}
			}
			return customer;
		}

		public void Delete(string customerId)
		{
			DAI.RunProcNonQuery("CRM_Customer_Delete",customerId);
		}

		public void Update(CustomerInfo customer)
		{
			object[] parms = {
								 customer.CustomerId,
								 customer.CustomerName,
								
								 customer.TypeId,
								  customer.Leader,
								 customer.DeputyId,
								  customer.LevelId,
								  customer.Credit,
								 customer.Phone,
								 customer.Address,
								 customer.PostCode,
								 customer.Fax,
								 customer.Email,
								 customer.HomePage,
								
								
								 customer.BZ
							 };
			DAI.RunProcNonQuery("CRM_Customer_Update",parms);
		}

		public DataTable GetCustomerByTypeId(string typeId)
		{
			return DAI.RunProcTable("CRM_Customer_GetCustomerByTypeId",typeId);
		}
		
		public SysUserInfo GetSysUserByCustomerId(string customerId)
		{
			SysUserInfo user = null;
			using (SqlDataReader rdr = DAI.RunProcReader("CRM_Customer_GetSysUserByCustomerId",customerId))
			{
				if (rdr.Read())
				{
					user = new SysUserInfo();
					user.UserId = rdr["UserId"].ToString();
					user.LoginName = rdr["LoginName"].ToString();
					user.LoginPwd = Common.Encrypt(rdr["LoginPwd"].ToString());
					user.TrueName = rdr["TrueName"].ToString();
					user.Sex = rdr["Sex"].ToString();
					user.Birthday = rdr["Birthday"].ToString();
					user.Address = rdr["Address"].ToString();
					user.Phone = rdr["Address"].ToString();
					user.MobilePhone = rdr["MobilePhone"].ToString();
					user.PostCode = rdr["PostCode"].ToString();
					user.Email = rdr["Email"].ToString();
					user.BZ = rdr["BZ"].ToString();
				}
			}
			return user;
		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -