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

                service.Update(tandasEntity);

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

                service.Insert(tandasEntity);

                try
                {
                    //添加日志
                    LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建环卫公厕信息【" + tandasEntity.Address + "】成功!");
                }
                catch { }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 单条
        /// 批量导入使用
        /// </summary>
        /// <param name="tandasEntity"></param>
        /// <param name="skipWhere"></param>
        /// <param name="coverWhere"></param>
        public void BatchSubmitFrom(ProfileSanitationTandasEntity tandasEntity, Func <ProfileSanitationTandasEntity, ProfileSanitationTandasEntity, bool> skipWhere, Func <ProfileSanitationTandasEntity, ProfileSanitationTandasEntity, bool> coverWhere)
        {
            if (skipWhere != null)
            {
                Func <ProfileSanitationTandasEntity, bool> dbSkipWhere = db => skipWhere(db, tandasEntity);

                var skipQuery = service.dbcontext.Set <ProfileSanitationTandasEntity>().Where(dbSkipWhere);

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

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

                var coverQuery = service.dbcontext.Set <ProfileSanitationTandasEntity>().Where(dbCoverWhere);

                if (coverQuery.Count() > 0)
                {
                    var dbEnity = coverQuery.FirstOrDefault();

                    dbEnity.CityId         = tandasEntity.CityId;
                    dbEnity.CountyId       = tandasEntity.CountyId;
                    dbEnity.ProjectId      = tandasEntity.ProjectId;
                    dbEnity.StreetId       = tandasEntity.StreetId;
                    dbEnity.Address        = tandasEntity.Address;
                    dbEnity.Grade          = tandasEntity.Grade;
                    dbEnity.F_EnCode       = tandasEntity.F_EnCode;
                    dbEnity.ManagementForm = tandasEntity.ManagementForm;
                    dbEnity.CleaningUnit   = tandasEntity.CleaningUnit;

                    dbEnity.Modify(dbEnity.F_Id);

                    service.Update(dbEnity);

                    return;
                }
            }

            //添加
            tandasEntity.Create();

            service.Insert(tandasEntity);
        }
Esempio n. 3
0
 public ActionResult SubmitForm(ProfileSanitationTandasEntity TandasEntity, string keyValue)
 {
     tandasApp.SubmitForm(TandasEntity, keyValue);
     return(Success("操作成功。"));
 }