Exemple #1
0
        public void Savephoto(string keyValue, Cadre_BaseEntity entity)
        {
            IRepository db = this.BaseRepository().BeginTrans();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    //主表
                    entity.Modify(keyValue);
                    db.Update(entity);
                }
                else
                {
                    //主表
                    entity.Create();
                    db.Insert(entity);
                }
                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
                throw;
            }
        }
Exemple #2
0
        /// <summary>
        /// 干部任免
        /// </summary>
        /// <param name="keyValue">主键</param>
        public void ToCustomer(string keyValue)
        {
            Cadre_PlanAdjustEntity chanceEntity = this.GetEntity(keyValue);
            // IEnumerable<TrailRecordEntity> trailRecordList = trailRecordService.GetList(keyValue);
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                chanceEntity.Modify(keyValue);
                chanceEntity.appointresultstatus = "1";
                db.Update <Cadre_PlanAdjustEntity>(chanceEntity);

                Cadre_BaseEntity Cadre_BaseEntity = new Cadre_BaseEntity();
                Cadre_BaseEntity.Modify(keyValue);
                Cadre_BaseEntity.id          = chanceEntity.cadreid;
                Cadre_BaseEntity.currentduty = chanceEntity.aspiringduty;
                db.Update <Cadre_BaseEntity>(Cadre_BaseEntity);

                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
                throw;
            }
        }
Exemple #3
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, Cadre_BaseEntity entity, List <Cadre_FamilyEntity> entryList)
        {
            IRepository db = this.BaseRepository().BeginTrans();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    //主表
                    entity.Modify(keyValue);
                    db.Update(entity);
                    //明细
                    db.Delete <Cadre_FamilyEntity>(t => t.PID.Equals(keyValue));
                    foreach (Cadre_FamilyEntity item in entryList)
                    {
                        item.Create();
                        item.PID = entity.id;
                        db.Insert(item);
                    }
                }
                else
                {
                    //主表
                    entity.Create();
                    db.Insert(entity);
                    //明细
                    foreach (Cadre_FamilyEntity item in entryList)
                    {
                        item.Create();
                        item.PID = entity.id;
                        db.Insert(item);
                    }
                }
                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
                throw;
            }
        }