Exemplo n.º 1
0
        public ActionResult SaveForm(string keyValue, ChanceEntity entity, string chanceDescriptionJson)
        {
            var chanceDescriptionList = chanceDescriptionJson.ToList <Client_ChanceDescriptionEntity>();

            chancebll.SaveForm(keyValue, entity, chanceDescriptionList);
            return(Success("操作成功。"));
        }
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, TrailRecordEntity entity)
        {
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                switch (entity.ObjectSort)
                {
                case 1:             //商机
                    ChanceEntity chanceEntity = new ChanceEntity();
                    chanceEntity.Modify(entity.ObjectId);
                    db.Update <ChanceEntity>(chanceEntity);
                    break;

                case 2:             //客户
                    CustomerEntity customerEntity = new CustomerEntity();
                    customerEntity.Modify(entity.ObjectId);
                    db.Update <CustomerEntity>(customerEntity);
                    break;

                default:
                    break;
                }
                entity.Create();
                db.Insert(entity);

                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
                throw;
            }
        }
Exemplo n.º 3
0
        public ActionResult SaveForm(string keyValue, ChanceEntity entity)
        {
            var user = OperatorProvider.Provider.Current();

            chancebll.SaveForm(keyValue, entity);
            return(Success("操作成功。"));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, TrailRecordEntity entity)
        {
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                switch (entity.ObjectSort)
                {
                case 1:             //商机
                    ChanceEntity chanceEntity = new ChanceEntity();
                    chanceEntity.Modify(entity.ObjectId);
                    db.Update <ChanceEntity>(chanceEntity);
                    break;

                case 2:             //客户
                    CustomerEntity customerEntity = new CustomerEntity();
                    customerEntity.Modify(entity.ObjectId);
                    db.Update <CustomerEntity>(customerEntity);
                    break;

                case 3:             //手机号
                    TelphoneSourceEntity telEntity = new TelphoneSourceEntity();
                    telEntity.Modify(int.Parse(entity.ObjectId));
                    db.Update <TelphoneSourceEntity>(telEntity);
                    break;

                case 4:             //店铺
                    POS_ShopEntity shopEntity = new POS_ShopEntity();
                    shopEntity.Modify(entity.ObjectId);
                    db.Update <POS_ShopEntity>(shopEntity);
                    break;

                case 5:             //公司
                    POS_OfficeCompanyEntity officeCompanyEntity = new POS_OfficeCompanyEntity();
                    officeCompanyEntity.Modify(entity.ObjectId);
                    db.Update <POS_OfficeCompanyEntity>(officeCompanyEntity);
                    break;

                case 6:             //私池
                    Ku_CompanyEntity companyEntity = new Ku_CompanyEntity();
                    companyEntity.Modify(Convert.ToInt32(entity.ObjectId));
                    db.Update <Ku_CompanyEntity>(companyEntity);
                    break;

                default:
                    break;
                }
                entity.Create();
                db.Insert(entity);

                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
                throw;
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, ChanceEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 6
0
 public void SaveFormApi(string keyValue, ChanceEntity entity, string userid, string username)
 {
     try
     {
         service.SaveFormApi(keyValue, entity, userid, username);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, ChanceEntity entity, List <Client_ChanceDescriptionEntity> chanceDescriptionEntitys = null)
 {
     try
     {
         service.SaveForm(keyValue, entity, chanceDescriptionEntitys);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, TrailRecordEntity entity)
        {
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                switch (entity.ObjectSort)
                {
                case 1:             //商机
                    ChanceEntity chanceEntity = new ChanceEntity();
                    chanceEntity.Modify(entity.ObjectId);
                    db.Update <ChanceEntity>(chanceEntity);
                    break;

                case 2:             //客户
                    CustomerEntity customerEntity = new CustomerEntity();
                    customerEntity.Modify(entity.ObjectId);
                    db.Update <CustomerEntity>(customerEntity);
                    break;

                case 3:             //洗号池
                    TelphoneWashEntity washEntity = new TelphoneWashEntity();
                    //washEntity.CallResult = entity.TrackTypeId;
                    washEntity.CallDescription = entity.TrackContent;
                    washEntity.CallTime        = entity.CreateDate;
                    washEntity.Modify(int.Parse(entity.ObjectId));
                    db.Update <TelphoneWashEntity>(washEntity);
                    break;

                default:
                    break;
                }
                entity.Create();
                db.Insert(entity);

                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
                throw;
            }
        }
Exemplo n.º 9
0
 public ActionResult SaveForm(string keyValue, ChanceEntity entity)
 {
     chancebll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }
Exemplo n.º 10
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, TrailRecordEntity entity)
        {
            if (!string.IsNullOrWhiteSpace(keyValue))
            {
                entity.Modify(keyValue);
                this.BaseRepository().Update(entity);
                entity = this.GetEntity(entity.TrailId);
                #region 商机
                if (entity.ObjectSort == 1)
                {
                    IRepository db = new RepositoryFactory().BaseRepository();
                    db.BeginTrans();
                    try
                    {
                        ChanceEntity chanceEntity = new ChanceEntity();
                        chanceEntity.Modify(entity.ObjectId);
                        db.Update <ChanceEntity>(chanceEntity);
                        db.Commit();
                    }
                    catch (Exception)
                    {
                        db.Rollback();
                        throw;
                    }
                }

                #endregion

                #region 客户
                else if (entity.ObjectSort == 2)
                {
                    string userId = OperatorProvider.Provider.Current().LoginInfo.UserId;
                    //销售阶段
                    CustomerFollowEntity followEntity = new CustomerFollowEntity();
                    followEntity.Create();
                    followEntity.CustomerId       = entity.ObjectId;
                    followEntity.SaleStageId      = entity.SaleStageId;
                    followEntity.SaleStageName    = entity.SaleStageName;
                    followEntity.CustomerFollowId = entity.TrailId;


                    IRepository db = new RepositoryFactory().BaseRepository();
                    db.BeginTrans();
                    try
                    {
                        CustomerEntity customerEntity = new CustomerEntity();
                        customerEntity.Modify(entity.ObjectId);
                        db.Update <CustomerEntity>(customerEntity);


                        //更新日程
                        ScheduleEntity scheduleEntity = new ScheduleEntity();
                        scheduleEntity.ScheduleState = 1;
                        scheduleEntity.Modify(entity.TrailId);
                        db.Update(scheduleEntity);

                        //删除已有的客户销售阶段
                        db.Delete <CustomerFollowEntity>(t => t.CustomerId == entity.ObjectId && t.CreateUserId == userId);
                        //创建新销售阶段
                        db.Insert <CustomerFollowEntity>(followEntity);
                        db.Commit();
                    }
                    catch (Exception)
                    {
                        db.Rollback();
                        throw;
                    }
                }
                #endregion
            }
            else
            {
                entity.Create();

                #region 商机
                if (entity.ObjectSort == 1)
                {
                    IRepository db = new RepositoryFactory().BaseRepository();
                    db.BeginTrans();
                    try
                    {
                        ChanceEntity chanceEntity = new ChanceEntity();
                        chanceEntity.Modify(entity.ObjectId);
                        db.Update <ChanceEntity>(chanceEntity);
                        db.Insert(entity);
                        db.Commit();
                    }
                    catch (Exception)
                    {
                        db.Rollback();
                        throw;
                    }
                }

                #endregion

                #region 客户
                else if (entity.ObjectSort == 2)
                {
                    string userId = OperatorProvider.Provider.Current().LoginInfo.UserId;
                    //销售阶段
                    CustomerFollowEntity followEntity = new CustomerFollowEntity();
                    followEntity.Create();
                    followEntity.CustomerId    = entity.ObjectId;
                    followEntity.SaleStageId   = entity.SaleStageId;
                    followEntity.SaleStageName = entity.SaleStageName;

                    followEntity.CustomerFollowId = entity.TrailId;
                    IRepository db = new RepositoryFactory().BaseRepository();
                    db.BeginTrans();
                    try
                    {
                        CustomerEntity customerEntity = new CustomerEntity();
                        customerEntity.Modify(entity.ObjectId);
                        db.Update <CustomerEntity>(customerEntity);


                        db.Insert(entity);
                        #region 计划任务增加到日程
                        if (entity.TrailType == 1)
                        {
                            ScheduleEntity scheduleEntity = new ScheduleEntity();
                            scheduleEntity.ScheduleContent = entity.ObjectName + "-" + entity.SaleStageName + "-" + entity.TrackContent;
                            scheduleEntity.ScheduleState   = 0;
                            scheduleEntity.StartDate       = entity.StartTime.ToDate();
                            scheduleEntity.StartTime       = Convert.ToDateTime(entity.StartTime).ToString("HHmm");
                            scheduleEntity.EndDate         = entity.EndTime.ToDate();
                            scheduleEntity.EndTime         = Convert.ToDateTime(entity.EndTime).ToString("HHmm");
                            scheduleEntity.IsMailAlert     = 0;
                            scheduleEntity.IsMobileAlert   = 0;
                            scheduleEntity.IsWeChatAlert   = 0;
                            scheduleEntity.Create();
                            scheduleEntity.ScheduleId = entity.TrailId;
                            db.Insert(scheduleEntity);
                        }
                        else
                        {
                            //删除已有的客户销售阶段
                            db.Delete <CustomerFollowEntity>(t => t.CustomerId == entity.ObjectId && t.CreateUserId == userId);
                            //创建新销售阶段
                            db.Insert <CustomerFollowEntity>(followEntity);
                        }
                        #endregion
                        db.Commit();
                    }
                    catch (Exception)
                    {
                        db.Rollback();
                        throw;
                    }
                }
                #endregion
            }
        }