/// <summary>
        /// 提交,修改
        /// </summary>
        /// <param name="tandasEntity"></param>
        /// <param name="keyValue"></param>
        public void SubmitForm(ProfileSanitationCompressionStationEntity compressStatEntity, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                compressStatEntity.Modify(keyValue);

                service.Update(compressStatEntity);

                try
                {
                    //添加日志
                    LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "修改环卫压缩站信息【" + compressStatEntity.StationName + "】成功!");
                }
                catch { }
            }
            else
            {
                compressStatEntity.Create();

                service.Insert(compressStatEntity);

                try
                {
                    //添加日志
                    LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建环卫压缩站信息【" + compressStatEntity.StationName + "】成功!");
                }
                catch { }
            }
        }
示例#2
0
        /// <summary>
        /// 单条
        /// 批量导入
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="skipWhere"></param>
        /// <param name="coverWhere"></param>
        public void BatchSubmitFrom(ProfileSanitationCompressionStationEntity entity, Func <ProfileSanitationCompressionStationEntity, ProfileSanitationCompressionStationEntity, bool> skipWhere, Func <ProfileSanitationCompressionStationEntity, ProfileSanitationCompressionStationEntity, bool> coverWhere)
        {
            if (skipWhere != null)
            {
                Func <ProfileSanitationCompressionStationEntity, bool> dbSkipWhere = db => skipWhere(db, entity);

                var dbSkipQuery = this.service.dbcontext.Set <ProfileSanitationCompressionStationEntity>().Where(dbSkipWhere);

                if (dbSkipQuery.Count() > 0)
                {
                    return;
                }
            }

            if (coverWhere != null)
            {
                Func <ProfileSanitationCompressionStationEntity, bool> dbCoverWhere = db => coverWhere(db, entity);

                var dbCoverQuery = this.service.dbcontext.Set <ProfileSanitationCompressionStationEntity>().Where(dbCoverWhere);

                if (dbCoverQuery.Count() > 0)
                {
                    var dbEntity = dbCoverQuery.FirstOrDefault();

                    dbEntity.CityId       = entity.CityId;
                    dbEntity.CountyId     = entity.CountyId;
                    dbEntity.ProjectId    = entity.ProjectId;
                    dbEntity.StreetId     = entity.StreetId;
                    dbEntity.Address      = entity.Address;
                    dbEntity.CompanyId    = entity.CompanyId;
                    dbEntity.CompType     = entity.CompType;
                    dbEntity.F_EnCode     = entity.F_EnCode;
                    dbEntity.OpeningHours = entity.OpeningHours;

                    dbEntity.Modify(dbEntity.F_Id);
                    this.service.Update(dbEntity);

                    return;
                }
            }

            entity.Create();

            this.service.Insert(entity);
        }
 public ActionResult SubmitForm(ProfileSanitationCompressionStationEntity CStationEntity, string keyValue)
 {
     CStationApp.SubmitForm(CStationEntity, keyValue);
     return(Success("操作成功。"));
 }