コード例 #1
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(int keyValue, dm_apply_partners_recordEntity entity)
 {
     try
     {
         if (keyValue > 0)
         {
             entity.Modify(keyValue);
             this.BaseRepository("dm_data").Update(entity);
         }
         else
         {
             entity.Create();
             this.BaseRepository("dm_data").Insert(entity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(int keyValue, dm_apply_partners_recordEntity entity)
 {
     try
     {
         dM_APP_Partners_RecordService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
コード例 #3
0
 public void CheckAppPartnersRecord(dm_apply_partners_recordEntity entity)
 {
     try
     {
         dM_APP_Partners_RecordService.CheckAppPartnersRecord(entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
コード例 #4
0
        public void CheckAppPartnersRecord(dm_apply_partners_recordEntity entity)
        {
            IRepository db = null;

            try
            {
                if (entity.status == 1)
                {
                    dm_apply_partners_recordEntity dm_Apply_Partners_RecordEntity = GetEntity(entity.id);

                    dm_userEntity dm_UserEntity = new dm_userEntity();
                    dm_UserEntity.partnersstatus = 2;
                    dm_UserEntity.partners       = 20000 + dm_Apply_Partners_RecordEntity.user_id;
                    dm_UserEntity.id             = dm_Apply_Partners_RecordEntity.user_id;

                    dm_Apply_Partners_RecordEntity.status = entity.status;

                    db = this.BaseRepository("dm_data").BeginTrans();
                    db.Update(dm_UserEntity);
                    entity.Modify(entity.id);
                    db.Update(entity);

                    db.Commit();
                }
            }
            catch (Exception ex)
            {
                if (db != null)
                {
                    db.Rollback();
                }

                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// 申请成为合伙人
        /// </summary>
        /// <param name="user_id"></param>
        public void ApplyPartners(int user_id, string appid)
        {
            IEnumerable <dm_task_person_settingEntity> person_SettingEntities = GetListByCache(appid, 1);

            foreach (var item in person_SettingEntities)
            {
                if (item.s_type == 3)
                {//邀请粉丝任务
                    item.finishcount = dm_UserRelationService.GetMyChildCount(user_id);
                    if (item.finishcount < item.needcount)
                    {
                        throw new Exception("当前条件不满足!");
                    }
                }
                else if (item.s_type == 5)
                {//购物任务
                    item.finishcount = dm_OrderService.GetMyOrderCount(user_id);
                    if (item.finishcount < item.needcount)
                    {
                        throw new Exception("当前条件不满足!");
                    }
                }
            }

            dm_apply_partners_recordEntity dm_Apply_Partners_RecordEntity = dm_APP_Partners_RecordService.GetEntityByUserID(user_id);

            if (dm_Apply_Partners_RecordEntity.IsEmpty())
            {
                dm_Apply_Partners_RecordEntity            = new dm_apply_partners_recordEntity();
                dm_Apply_Partners_RecordEntity.user_id    = user_id;
                dm_Apply_Partners_RecordEntity.appid      = appid;
                dm_Apply_Partners_RecordEntity.createtime = DateTime.Now;

                dm_APP_Partners_RecordService.SaveEntity(0, dm_Apply_Partners_RecordEntity);
            }
            else
            {
                throw new Exception("当前申请记录正在审核中,请勿重复提交!");
            }
        }