Exemple #1
0
        /// <summary>
        /// 提交,修改
        /// </summary>
        /// <param name="tandasEntity"></param>
        /// <param name="keyValue"></param>
        public void SubmitForm(ProfileSanitationGreeningEntity greenEntity, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                greenEntity.Modify(keyValue);

                service.Update(greenEntity);

                try
                {
                    //添加日志
                    LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "修改环卫沿途绿化信息【" + greenEntity.Address + "】成功!");
                }
                catch { }
            }
            else
            {
                greenEntity.Create();

                service.Insert(greenEntity);

                try
                {
                    //添加日志
                    LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建环卫沿途绿化信息【" + greenEntity.Address + "】成功!");
                }
                catch { }
            }
        }
Exemple #2
0
        /// <summary>
        /// 单条
        /// 批量导入
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="skipWhere"></param>
        /// <param name="coverWhere"></param>
        public void BatchSubmitFrom(ProfileSanitationGreeningEntity entity, Func <ProfileSanitationGreeningEntity, ProfileSanitationGreeningEntity, bool> skipWhere, Func <ProfileSanitationGreeningEntity, ProfileSanitationGreeningEntity, bool> coverWhere)
        {
            if (skipWhere != null)
            {
                Func <ProfileSanitationGreeningEntity, bool> dbSkipWhere = db => skipWhere(db, entity);

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

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

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

                var dbCoverQuery = this.service.dbcontext.Set <ProfileSanitationGreeningEntity>().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.F_EnCode    = entity.F_EnCode;
                    dbEntity.Origin      = entity.Origin;
                    dbEntity.Destination = entity.Destination;

                    dbEntity.Modify(dbEntity.F_Id);

                    this.service.Update(dbEntity);

                    return;
                }
            }

            entity.Create();

            this.service.Insert(entity);
        }
Exemple #3
0
 public ActionResult SubmitForm(ProfileSanitationGreeningEntity greenEntity, string keyValue)
 {
     App.SubmitForm(greenEntity, keyValue);
     return(Success("操作成功。"));
 }