예제 #1
0
 public static Customer_CE ToCE(CustomerEntity item)
 {
     Customer_CE target = new Customer_CE();
     target.ID=item.ID;
     target.CusNum=item.CusNum;
     target.CusName=item.CusName;
     target.Phone=item.Phone;
     target.Email=item.Email;
     target.Fax=item.Fax;
     target.Address=item.Address;
     target.CusType=item.CusType;
     target.IsDelete=item.IsDelete;
     target.CreateTime=item.CreateTime;
     target.CreateUser=item.CreateUser;
     target.Remark=item.Remark;
     return target;
 }
예제 #2
0
        /// <summary>
        /// 添加客户信息
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public int AddCustomer(CustomerEntity entity, List<CusAddressEntity> list)
        {
            entity.IncludeAll();
            int line = this.Customer.Add(entity);
            if (!list.IsNullOrEmpty())
            {
                list.ForEach(a =>
                {
                    a.CusNum = entity.CusNum;
                    a.IncludeAll();
                });
                line += this.CusAddress.Add(list);

            }
            if (line > 0)
            {
                CacheHelper.Remove(CacheKey.JOOSHOW_CUSADDRESS_CACHE);
            }
            return line;
        }
예제 #3
0
        public ActionResult CustomerDetailList()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
            string storageNum = this.DefaultStore;

            CustomerProvider provider = new CustomerProvider();
            CustomerEntity entity = new CustomerEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            List<CustomerEntity> listResult = provider.GetCustomerList(entity, ref pageInfo);
            listResult = listResult.IsNull() ? new List<CustomerEntity>() : listResult;
            OutStorageProvider outProvider = new OutStorageProvider();
            foreach (CustomerEntity item in listResult)
            {
                item.Num = outProvider.GetNumByCusNum(item.CusNum, queryTime, storageNum);
            }
            string json = ConvertJson.ListToJson<CustomerEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
예제 #4
0
        public ActionResult GetCustomerList()
        {
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 1);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 15);
            string CusNum = WebUtil.GetFormValue<string>("CusNum", string.Empty);
            int CusType = WebUtil.GetFormValue<int>("CusType", 0);

            CustomerProvider provider = new CustomerProvider();
            CustomerEntity entity = new CustomerEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            if (!CusNum.IsEmpty())
            {
                entity.Begin<CustomerEntity>()
                   .Where<CustomerEntity>("CusNum", ECondition.Like, "%" + CusNum + "%")
                   .Or<CustomerEntity>("CusName", ECondition.Like, "%" + CusNum + "%")
                   .End<CustomerEntity>();
            }
            if (CusType != 0)
            {
                entity.Where<CustomerEntity>(a => a.CusType == CusType);
            }

            List<CustomerEntity> listResult = provider.GetCustomerList(entity, ref pageInfo);
            string json = ConvertJson.ListToJson<CustomerEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
예제 #5
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="list"></param>
 /// <returns></returns>
 public int Update(CustomerEntity entity, List<CusAddressEntity> list)
 {
     entity.IncludeCusName(true)
         .IncludeEmail(true)
         .IncludeFax(true)
         .IncludePhone(true)
         .IncludeRemark(true)
         .IncludeCusType(true)
         ;
     entity.Where(a => a.CusNum == entity.CusNum);
     int line = this.Customer.Update(entity);
     if (!list.IsNullOrEmpty())
     {
         foreach (CusAddressEntity item in list)
         {
             item.CusNum = entity.CusNum;
             CusAddressEntity tempEntity = new CusAddressEntity();
             tempEntity.IncludeAll();
             tempEntity.Where(a => a.CusNum == item.CusNum).And(a => a.SnNum == item.SnNum);
             tempEntity = this.CusAddress.GetSingle(tempEntity);
             if (tempEntity.IsNotNull())
             {
                 item.IncludeAddress(true)
                 .IncludeContact(true)
                 .IncludePhone(true)
                 ;
                 item.Where(a => a.SnNum == item.SnNum).And(a => a.CusNum == item.CusNum);
                 line += this.CusAddress.Update(item);
             }
             else
             {
                 item.IncludeAll();
                 line = this.CusAddress.Add(item);
             }
         }
         if (line > 0)
         {
             CacheHelper.Remove(CacheKey.JOOSHOW_CUSADDRESS_CACHE);
         }
     }
     return line;
 }
예제 #6
0
 /// <summary>
 /// 根据客户编号获得客户信息
 /// </summary>
 /// <param name="cusNum"></param>
 /// <returns></returns>
 public CustomerEntity GetSingleCustomer(string cusNum)
 {
     CustomerEntity entity = new CustomerEntity();
     entity.IncludeAll();
     entity.Where(a => a.CusNum == cusNum);
     entity = this.Customer.GetSingle(entity);
     return entity;
 }
예제 #7
0
 /// <summary>
 /// 查询所有的客户数据信息
 /// </summary>
 /// <returns></returns>
 public List<CustomerEntity> GetList()
 {
     CustomerEntity entity = new CustomerEntity();
     entity.IncludeAll();
     entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
     List<CustomerEntity> listResult = this.Customer.GetList();
     return listResult;
 }
예제 #8
0
 /// <summary>
 /// 分页查询客户信息
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="pageInfo"></param>
 /// <returns></returns>
 public List<CustomerEntity> GetCustomerList(CustomerEntity entity, ref PageInfo pageInfo)
 {
     entity.IncludeAll();
     entity.OrderBy(a => a.ID, EOrderBy.DESC);
     entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
     int rowCount = 0;
     List<CustomerEntity> listResult = this.Customer.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
     pageInfo.RowCount = rowCount;
     return listResult;
 }
예제 #9
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="cusNum"></param>
 /// <returns></returns>
 public int Delete(string cusNum)
 {
     CustomerEntity entity = new CustomerEntity();
     entity.IsDelete = (int)EIsDelete.Deleted;
     entity.IncludeIsDelete(true);
     entity.Where(a => a.CusNum == cusNum);
     int line = this.Customer.Update(entity);
     if (line > 0)
     {
         CacheHelper.Remove(CacheKey.JOOSHOW_CUSADDRESS_CACHE);
     }
     return line;
 }