public ProjectFinancialPropertiesResponse ProjectFinancialProperties([FromBody] BaseRequest request) { ProjectFinancialPropertiesResponse response = new ProjectFinancialPropertiesResponse(); List <MDeparment> deparments = new List <MDeparment>(); List <MFund> funds = new List <MFund>(); List <MImplementAgency> implementAgencies = new List <MImplementAgency>(); try { if (!BAplication.ValidateAplicationToken(request.ApplicationToken)) { response.Code = "2"; response.Message = Messages.ApplicationTokenNoAutorize; return(response); } deparments = BDeparment.List(); funds = BFund.List(); implementAgencies = BImplementAgency.List(); response.Code = "0"; response.Message = "Success"; response.Deparments = deparments.ToArray(); response.Funds = funds.ToArray(); response.ImplementAgencies = implementAgencies.ToArray(); } catch (Exception ex) { response.Code = "2"; response.Message = ex.Message; } return(response); }
public FundsResponse GetFunds([FromBody] BaseRequest request) { FundsResponse response = new FundsResponse(); try { if (!BAplication.ValidateAplicationToken(request.ApplicationToken)) { response.Code = "2"; response.Message = Messages.ApplicationTokenNoAutorize; return(response); } List <MFund> funds = BFund.List(); response.Funds = funds.ToArray(); response.Code = "0"; response.Message = "Success"; } catch (Exception ex) { response.Code = "2"; response.Message = ex.Message; } return(response); }
public BaseResponse InsertFund([FromBody] FundsRequest request) { BaseResponse response = new BaseResponse(); using (TransactionScope scope = new TransactionScope()) { try { if (!BAplication.ValidateAplicationToken(request.ApplicationToken)) { response.Code = "2"; response.Message = Messages.ApplicationTokenNoAutorize; return(response); } string webRoot = _env.ContentRootPath; string rootPath = _appSettings.Value.rootPath; string ProjectPath = _appSettings.Value.ProjectPath; BaseRequest baseRequest = new BaseRequest(); foreach (MFund model in request.Funds) { MFund fund = new MFund(); fund.FundCode = model.FundCode; fund.Description = model.Description; BFund.Insert(fund); } response.Code = "0"; response.Message = "Success"; scope.Complete(); } catch (Exception ex) { response.Code = "2"; response.Message = ex.Message; scope.Dispose(); } } return(response); }