Ejemplo n.º 1
0
        public void SubmitForm(CustomerEntity customerEntity, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                //更新业务员跟单记录信息
                var lst = tranService.IQueryable().Where(t => t.CustomerId.Equals(keyValue));
                foreach (var item in lst)
                {
                    item.SalesmanCode = customerEntity.SalesmanCode;
                    item.Salesman     = customerEntity.Salesman;
                    item.Modify(item.Id);
                    tranService.SubmitForm(item, item.Id);
                }

                customerEntity.Modify(keyValue);
            }
            else
            {
                //先根据客户名称
                var expression = ExtLinq.True <CustomerEntity>();
                expression = expression.And(t => t.Company.Contains(customerEntity.Company.Trim()));
                expression = expression.And(t => t.Telphone.Contains(customerEntity.Telphone));
                var lst = service.IQueryable(expression);
                if (lst != null & lst.Count() > 0)
                {
                    throw new Exception("存在相同的客户信息!!!");
                }
                customerEntity.Create();
            }
            service.SubmitForm(customerEntity, keyValue);
        }
Ejemplo n.º 2
0
 private void Save()
 {
     if (Helpers.CheckEmpty(errorProvider1, txtCustomerName, txtGender, txtAddress, lblOtherContact))
     {
         return;
     }
     else
     {
         SaveCompleted = true;
         errorProvider1.Clear();
         //string text = StringCipher.Encrypt
         CustomerEntity customerEntity = new CustomerEntity();
         customerEntity.CustomerName = txtCustomerName.Text;
         customerEntity.Gender       = txtGender.Text;
         customerEntity.Address      = txtAddress.Text;
         customerEntity.Photo        = picCustomer.GetByteArrayFromBrowse();
         customerEntity.Active       = chkActive.Checked;
         customerEntity.MemberShipID = (Guid)cboMemberShip.SelectedValue;
         customerEntity.OtherContact = txtOtherContact.Text;
         if (CustomerID != Guid.Empty)
         {
             customerEntity.ID = CustomerID;
             customerEntity.Update(USER.UserName);
             CustomerDao.Update(customerEntity);
         }
         else
         {
             customerEntity.ID = Guid.NewGuid();
             customerEntity.Create(USER.UserName);
             CustomerDao.Insert(customerEntity);
         }
     }
 }
Ejemplo n.º 3
0
 public void SubmitFormAPI(CustomerEntity userEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         userEntity.ModifySimple(keyValue);
     }
     else
     {
         userEntity.Create();
     }
     service.SubmitForm(userEntity, keyValue);
 }
Ejemplo n.º 4
0
 public void SubmitForm(CustomerEntity customerEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         customerEntity.Modify(keyValue);
     }
     else
     {
         customerEntity.Create();
     }
     service.SubmitForm(customerEntity, keyValue);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 商机转换客户
        /// </summary>
        /// <param name="keyValue">主键</param>
        public void ToCustomer(string keyValue)
        {
            ChanceEntity chanceEntity = this.GetEntity(keyValue);
            IEnumerable <TrailRecordEntity> trailRecordList = trailRecordService.GetList(keyValue);
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                chanceEntity.Modify(keyValue);
                chanceEntity.IsToCustom = 1;
                db.Update <ChanceEntity>(chanceEntity);

                CustomerEntity customerEntity = new CustomerEntity();
                customerEntity.Create();
                customerEntity.EnCode         = coderuleService.SetBillCode(customerEntity.CreateUserId, "", "10003", db);
                customerEntity.FullName       = chanceEntity.CompanyName;
                customerEntity.TraceUserId    = chanceEntity.TraceUserId;
                customerEntity.TraceUserName  = chanceEntity.TraceUserName;
                customerEntity.CustIndustryId = chanceEntity.CompanyNatureId;
                customerEntity.CompanySite    = chanceEntity.CompanySite;
                customerEntity.CompanyDesc    = chanceEntity.CompanyDesc;
                customerEntity.CompanyAddress = chanceEntity.CompanyAddress;
                customerEntity.Province       = chanceEntity.Province;
                customerEntity.City           = chanceEntity.City;
                customerEntity.Contact        = chanceEntity.Contacts;
                customerEntity.Mobile         = chanceEntity.Mobile;
                customerEntity.Tel            = chanceEntity.Tel;
                customerEntity.Fax            = chanceEntity.Fax;
                customerEntity.QQ             = chanceEntity.QQ;
                customerEntity.Email          = chanceEntity.Email;
                customerEntity.Wechat         = chanceEntity.Wechat;
                customerEntity.Hobby          = chanceEntity.Hobby;
                customerEntity.Description    = chanceEntity.Description;
                customerEntity.CustLevelId    = "C";
                customerEntity.CustDegreeId   = "往来客户";
                db.Insert <CustomerEntity>(customerEntity);

                foreach (TrailRecordEntity item in trailRecordList)
                {
                    item.TrailId    = Guid.NewGuid().ToString();
                    item.ObjectId   = customerEntity.CustomerId;
                    item.ObjectSort = 2;
                    db.Insert <TrailRecordEntity>(item);
                }
                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
                throw;
            }
        }
Ejemplo n.º 6
0
 public void SubmitForm(CustomerEntity itemsEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         itemsEntity.Modify(keyValue);
         service.Update(itemsEntity);
     }
     else
     {
         itemsEntity.Create();
         service.Insert(itemsEntity);
     }
 }
Ejemplo n.º 7
0
 public void SubmitCustomerForm(CustomerEntity customerEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         customerEntity.Modify(keyValue);
         customerRepository.Update(customerEntity);
     }
     else
     {
         customerEntity.Create();
         customerRepository.Insert(customerEntity);
     }
 }
Ejemplo n.º 8
0
        public async Task SaveForm(CustomerEntity entity)
        {
            if (entity.Id.IsNullOrZero())
            {
                await entity.Create();

                await this.BaseRepository().Insert(entity);
            }
            else
            {
                await entity.Modify();

                await this.BaseRepository().Update(entity);
            }
        }