コード例 #1
0
 public async Task <ActionResult> DeleteCompany(int id)
 {
     if (_companyService.Delete(id))
     {
         return(Ok("Kompanija je uspesno obrisana!"));
     }
     return(BadRequest("Kompaniju nije moguce obrisati!"));
 }
コード例 #2
0
 //============================== DELETE ==============================
 public IActionResult Delete(int id)
 {
     if (ModelState.IsValid)
     {
         // Delete Article Based On The ID
         company.Delete(id);
     }
     return(View());
 }
コード例 #3
0
        public IActionResult Delete(int pId)
        {
            var retval = _companyRepo.Delete(pId);

            if (!retval)
            {
                return(StatusCode(StatusCodes.Status400BadRequest, ErrorNoCompanyId.Replace("@Id", pId.ToString())));
            }

            return(StatusCode(StatusCodes.Status200OK));
        }
コード例 #4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (Company == null)
            {
                return(RedirectToPage("../Index"));
            }
            db.Delete(Company);
            await db.CommitAsync();

            TempData["CompanyDelete"] = "Your company has been removed!";
            return(RedirectToPage("../Index"));
        }
コード例 #5
0
 public override async Task <UpsertCompanyResponse> DeleteCompany(SearchCompanyRequest request, ServerCallContext context)
 {
     if (_companyService.Delete(request.CompanyId))
     {
         _logger.LogInformation("company deleted");
         return(new UpsertCompanyResponse
         {
             Status = StatusCode.Ok,
             Message = "kompanija je uspesno obrisana"
         });
     }
     _logger.LogError("company can't be deleted");
     return(new UpsertCompanyResponse
     {
         Status = StatusCode.Error,
         Message = "kompaniju nije moguce obrisati"
     });
 }
コード例 #6
0
        public static bool Delete(string recordId)
        {
            if (string.IsNullOrWhiteSpace(recordId))
            {
                throw new ArgumentNullException("recordId");
            }

            ICompany    factory = CompanyFactory.GetFactory();
            BaseCompany model   = factory.QueryCompanyByRecordId(recordId);

            if (model == null)
            {
                throw new MyException("待删除的单位不存在");
            }

            List <BaseCompany> models = factory.QueryCompanysByMasterID(model.CPID);

            if (models.Count > 0)
            {
                throw new MyException("请先删除该公司下的所有下级公司");
            }

            List <BaseVillage> villages = VillageServices.QueryVillageByCompanyId(recordId);

            if (villages.Count != 0)
            {
                throw new MyException("请先删除该单位下的所有的小区");
            }

            ISysUser factoryUser = SysUserFactory.GetFactory();

            using (DbOperator dbOperator = ConnectionManager.CreateConnection())
            {
                try
                {
                    dbOperator.BeginTransaction();
                    bool result = factory.Delete(recordId, dbOperator);
                    if (!result)
                    {
                        throw new MyException("移除单位信息失败");
                    }

                    result = factoryUser.DeleteByCompanyId(recordId, dbOperator);
                    if (!result)
                    {
                        throw new MyException("移除用户信息失败");
                    }

                    dbOperator.CommitTransaction();
                    if (result)
                    {
                        OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("recordId:{0}", recordId));
                    }
                    return(result);
                }
                catch
                {
                    dbOperator.RollbackTransaction();
                    throw;
                }
            }
        }
コード例 #7
0
 public void DeleteCompany(CompanyTBL companyTBL)
 {
     _compRespository.Delete(companyTBL);
 }
コード例 #8
0
 public static bool Delete(int companyId)
 {
     return(dal.Delete(companyId));
 }
コード例 #9
0
ファイル: BCompany.cs プロジェクト: zhr008/ERP-1
 /// <summary>
 /// 删除一条数据
 /// </summary>
 public bool Delete(string CODE)
 {
     return(dal.Delete(CODE));
 }
コード例 #10
0
ファイル: Company.cs プロジェクト: zzpgeorge/Wms
 public int Delete(Guid id)
 {
     return(dal.Delete(id));
 }
コード例 #11
0
ファイル: CompanyApp.cs プロジェクト: Berbecut/08_ManageStore
 public async Task Delete(Core.Models.Company entity)
 {
     await _company.Delete(entity);
 }
コード例 #12
0
 public ResultModel Delete(int ID)
 {
     return(_svr.Delete(ID));
 }
コード例 #13
0
 /// <summary>
 /// 删除对应数据
 /// </summary>
 /// <param name="Id"></param>
 /// <returns></returns>
 public int Delete(object Id)
 {
     return(dal.Delete(Id));
 }
コード例 #14
0
 public async Task Delete(int id)
 {
     await _service.Delete(id);
 }