Exemplo n.º 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!"));
 }
Exemplo n.º 2
0
 //============================== DELETE ==============================
 public IActionResult Delete(int id)
 {
     if (ModelState.IsValid)
     {
         // Delete Article Based On The ID
         company.Delete(id);
     }
     return(View());
 }
Exemplo n.º 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));
        }
Exemplo n.º 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"));
        }
Exemplo n.º 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"
     });
 }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 7
0
 public void DeleteCompany(CompanyTBL companyTBL)
 {
     _compRespository.Delete(companyTBL);
 }
Exemplo n.º 8
0
 public static bool Delete(int companyId)
 {
     return(dal.Delete(companyId));
 }
Exemplo n.º 9
0
 /// <summary>
 /// 删除一条数据
 /// </summary>
 public bool Delete(string CODE)
 {
     return(dal.Delete(CODE));
 }
Exemplo n.º 10
0
 public int Delete(Guid id)
 {
     return(dal.Delete(id));
 }
Exemplo n.º 11
0
 public async Task Delete(Core.Models.Company entity)
 {
     await _company.Delete(entity);
 }
Exemplo n.º 12
0
 public ResultModel Delete(int ID)
 {
     return(_svr.Delete(ID));
 }
Exemplo n.º 13
0
 /// <summary>
 /// 删除对应数据
 /// </summary>
 /// <param name="Id"></param>
 /// <returns></returns>
 public int Delete(object Id)
 {
     return(dal.Delete(Id));
 }
Exemplo n.º 14
0
 public async Task Delete(int id)
 {
     await _service.Delete(id);
 }