public bool UpdateAgreement(AgreementModel agreement) { _context.Entry(GetAgreement(agreement.CNPCUI)).State = EntityState.Detached; _context.Entry(agreement).State = EntityState.Modified; _context.Update(agreement); return(Save()); }
public static List <AgreementModel> GetAgreement(Action <CommandFilter> match) { var command = _dbBaseProvider.CreateCommandStruct("AgreementClass", CommandMode.Inquiry); command.Columns = string.Format("AgreementID,GameID,Title,Describe,CreateDate,(SELECT SLNNAME FROM SOLUTIONS WHERE SLNID={0}.GAMEID) SlnName", command.TableName); command.OrderBy = "AgreementID ASC"; command.Filter = _dbBaseProvider.CreateCommandFilter(); if (match != null) { match(command.Filter); } command.Parser(); var list = new List <AgreementModel>(); using (var reader = _dbBaseProvider.ExecuteReader(CommandType.Text, command.Sql, command.Parameters)) { while (reader.Read()) { AgreementModel model = new AgreementModel(); model.AgreementID = reader["AgreementID"].ToInt(); model.GameID = reader["GameID"].ToInt(); model.Title = reader["Title"].ToNotNullString(); model.Describe = reader["Describe"].ToNotNullString(); model.CreateDate = reader["CreateDate"].ToDateTime(); model.SlnName = reader["SlnName"].ToNotNullString(); list.Add(model); } } return(list); }
public async Task <ResultModel> GetCustomerDataAsync(AgreementModel agreementModel) { _log.LogInformation("Starting interest rate data gathering and calculations"); var customer = await _personService.GetCustomersByIdAsync(agreementModel.CustomerId); if (customer == null) { _log.LogError($"No Customer found with id: {agreementModel.CustomerId}"); return(null); } ResultModel result = new ResultModel(); result.Customer = customer; result.InterestRates.NewInterestRate = await CalculateNewInterestRate(agreementModel.BaseRateCode, agreementModel.Margin); var latestAgreement = customer.Agreements?.OrderByDescending(x => x.Timestamp).FirstOrDefault(); if (latestAgreement != null) { result.InterestRates.CurrentInterestRate = await GetCurrentInterestRate(latestAgreement); result.InterestRates.InterestRateDifference = CalculateRateDifference(result.InterestRates.CurrentInterestRate, result.InterestRates.NewInterestRate); } result.Agreement = await SaveNewAgreementAsync(agreementModel); return(result); }
public string UpdateAgreementStatus([FromBody] AgreementModel agreement) { string str = "Thanks!"; try { DBManager.VerifyAgreement(agreement.Agreement_Id, callback => { if (callback != null) { DBManager.UpdateAgreement(agreement); proxy = new HttpProxyServer(); if (callback.enableCallback.Equals("true")) { proxy.PostAgreement(callback, agreement); } } else { str = "Invalid agreement !"; } }); } catch (Exception eexx) { str = "Exception in UpdateAgreement " + eexx; } return(str); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); string Title = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Title")).Text; string Describe = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Describe")).Text; AgreementModel mode = new AgreementModel(); mode.AgreementID = id; mode.Title = Title; mode.Describe = Describe; if (DbDataLoader.Update(mode)) { GridView1.EditIndex = -1; BindData(); } } catch (Exception erro) { Response.Write("错误信息:" + erro.Message); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(AgreementModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into AgreementClass("); strSql.Append("GameID,Title,Describe)"); strSql.Append(" values ("); strSql.Append("@GameID,@Title,@Describe)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@GameID", SqlDbType.Int, 4), new SqlParameter("@Title", SqlDbType.VarChar, 0), new SqlParameter("@Describe", SqlDbType.VarChar, 0) }; parameters[0].Value = model.GameID; parameters[1].Value = model.Title; parameters[2].Value = model.Describe; object obj = SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
public string CreateAgreement([FromBody] AgreementModel agreement) { int id = 0; string str = "Thanks!"; string query = "select ID from MobilePayOnBoarding where BCTenantId='" + agreement.BcTenantId + "'"; try { DBManager.VerifyTenantID(query, status => { if (status.Equals("S")) { id = DBManager.InsertAgreement(agreement); } if (id == 0) { str = "ERROR on creating agreement!"; } if (id == -1) { str = "Agreement Id already Exist !"; } }); } catch (Exception eexx) { str = "Exception in Create Agreement " + eexx; } return(str); }
public void PostAgreement(BCClientModel clientModel, AgreementModel agreement) { string Cred = clientModel.userName + ":" + clientModel.password; HttpWebRequest request = Common.CreateWebRequest(clientModel.BCTenantId, Cred, null); XmlDocument soapEnvelopeXml = new XmlDocument(); soapEnvelopeXml.LoadXml(@"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:mer='urn:microsoft-dynamics-schemas/codeunit/MerchantTokens'> <soapenv:Body> <mer:AgreementStatus> <mer:agreementId>" + agreement.Agreement_Id + "</mer:agreementId> <mer:status>" + agreement.Status + "</mer:status> <mer:statusText>" + agreement.Status_Text + "</mer:statusText> <mer:statusCode>" + agreement.Status_Code + "</mer:statusCode> <mer:callBackTime>" + agreement.Timestamp + "</mer:callBackTime> </mer:AgreementStatus> </soapenv:Body> </soapenv:Envelope>"); using (Stream stream = request.GetRequestStream()) { soapEnvelopeXml.Save(stream); } try { using (WebResponse response = request.GetResponse()) { using (StreamReader rd = new StreamReader(response.GetResponseStream())) { string soapResult = rd.ReadToEnd(); Console.WriteLine(soapResult); } } } catch (Exception) { throw; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(AgreementModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update AgreementClass set "); strSql.Append("Title=@Title,Describe=@Describe"); strSql.Append(" where AgreementID=@AgreementID"); SqlParameter[] parameters = { new SqlParameter("@Title", SqlDbType.VarChar, 0), new SqlParameter("@Describe", SqlDbType.VarChar, 0),new SqlParameter("@AgreementID", SqlDbType.VarChar, 0) }; parameters[0].Value = model.Title; parameters[1].Value = model.Describe; parameters[2].Value = model.AgreementID; int rows = SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public static void UpdateAgreement(AgreementModel agreement) { WithConnection(conn => { UpdateAgreement(agreement, conn); }); }
public AgreementModel GetManagementModel(AgreementInfo.AgreementTypes type) { AgreementModel agreementModel = new AgreementModel(); AgreementInfo agreement = this._iSystemAgreementService.GetAgreement(type); agreementModel.AgreementType = agreement.AgreementType; agreementModel.AgreementContent = agreement.AgreementContent; return(agreementModel); }
public byte[] Generate(string fullName, DateTime date) { var template = GetTemplate(); var model = new AgreementModel { FullName = fullName, CurrentDate = date }; return(_agreementRenderer.RenderAgreementToPdf(template, model)); }
public AgreementModel GetManagementModel(Himall.Model.AgreementInfo.AgreementTypes type) { AgreementModel model = new AgreementModel(); var iAgreement = _iSystemAgreementService.GetAgreement(type); model.AgreementType = iAgreement.AgreementType; model.AgreementContent = iAgreement.AgreementContent; return(model); }
public AgreementModel GetManagementModel(AgreementInfo.AgreementTypes type) { AgreementModel agreementModel = new AgreementModel(); AgreementInfo agreement = ServiceHelper.Create <ISystemAgreementService>().GetAgreement(type); agreementModel.AgreementType = agreement.AgreementType; agreementModel.AgreementContent = agreement.AgreementContent; return(agreementModel); }
private static void UpdateAgreement(AgreementModel agreement, SqlConnection conn) { SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); var query = "Update UserAgreement Set status='" + agreement.Status + "', StatusText= '" + agreement.Status_Text + "', StatusCode= '" + agreement.Status_Code + "', ExternalId= '" + agreement.External_Id + "' ,TimesStamp='" + agreement.Timestamp + "' where AgreementId='" + agreement.Agreement_Id + "'"; SqlCommand sqlCommand = new SqlCommand(query, conn); sqlDataAdapter.InsertCommand = new SqlCommand(query, conn); sqlDataAdapter.InsertCommand.ExecuteNonQuery(); sqlCommand.Dispose(); }
public static bool Delete(AgreementModel model) { var command = _dbBaseProvider.CreateCommandStruct("AgreementClass", CommandMode.Delete); command.Filter = _dbBaseProvider.CreateCommandFilter(); command.Filter.Condition = _dbBaseProvider.FormatFilterParam("AgreementID"); command.Filter.AddParam("AgreementID", model.AgreementID); command.Parser(); return(_dbBaseProvider.ExecuteQuery(CommandType.Text, command.Sql, command.Parameters) > 0); }
public static int InsertAgreement(AgreementModel agreement) { int x = 0; WithConnection(conn => { x = InsertAgreement(agreement, conn); }); return(x); }
private async Task <decimal?> GetCurrentInterestRate(AgreementModel latestAgreement) { var baseRate = await _baseRateService.GetBaseRateByCodeAsync(latestAgreement.BaseRateCode); if (baseRate.HasValue) { return(baseRate.Value + latestAgreement.Margin); } return(null); }
public string RenderAgreement(Customer customer) { var agreement = _repository.GetByCustomerId(customer.Id); var template = agreement == null?GetTemplate() : agreement.Template; var model = new AgreementModel { FullName = customer.PersonalInfo.Fullname, CurrentDate = customer.GreetingMailSentDate ?? DateTime.UtcNow }; return(_agreementRenderer.RenderAgreement(template, model)); }
public AgreementModel GetManagementModel(Entities.AgreementInfo.AgreementTypes type) { AgreementModel model = new AgreementModel(); var iAgreement = SystemAgreementApplication.GetAgreement(type); if (iAgreement != null) { model.AgreementType = iAgreement.AgreementType; model.AgreementContent = iAgreement.AgreementContent; } return(model); }
private static int InsertAgreement(AgreementModel agreement, SqlConnection conn) { SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); var query = "if exists(select 1 from UserAgreement where [AgreementId] = '" + agreement.Agreement_Id + "' ) Begin Select -1 End Else Begin insert into UserAgreement (AgreementId,BCTenantId) OUTPUT INSERTED.ID values('" + agreement.Agreement_Id + "','" + agreement.BcTenantId + "') End;"; SqlCommand sqlCommand = new SqlCommand(query, conn); sqlDataAdapter.InsertCommand = new SqlCommand(query, conn); var val = sqlDataAdapter.InsertCommand.ExecuteScalar(); sqlCommand.Dispose(); return((Int32)val); }
public Result <AgreementModel> PutAgreementModel(AgreementModel agreementModel) { var validateResult = _validatorService.ValidateAgreement(agreementModel); if (validateResult.ResultType != ResultType.Ok) { Result <AgreementModel> result = new BadRequestResult <AgreementModel>(validateResult.Errors); if (_errorService.AddError( (agreementModel.CNPCUI != null ? agreementModel.CNPCUI : "invalid"), result.ResultType, result.Errors, "Put") == false) { Console.WriteLine("Error service failed"); } return(result); } try { if (!_agreementRepository.AgreementExists(agreementModel.CNPCUI)) { Result <AgreementModel> result = new NotFoundResult <AgreementModel>("Agreement not found!"); if (_errorService.AddError(agreementModel.CNPCUI, result.ResultType, result.Errors, "Put") == false) { Console.WriteLine("Error service failed"); } return(result); } bool success = _agreementRepository.UpdateAgreement(agreementModel); if (!success) { Result <AgreementModel> result = new BadRequestResult <AgreementModel>("Bad request: Agreement update failed!"); if (_errorService.AddError(agreementModel.CNPCUI, result.ResultType, result.Errors, "Put") == false) { Console.WriteLine("Error service failed"); } return(result); } } catch { Result <AgreementModel> result = new UnexpectedResult <AgreementModel>(); if (_errorService.AddError(agreementModel.CNPCUI, result.ResultType, result.Errors, "Put") == false) { Console.WriteLine("Error service failed"); } return(result); } return(new SuccessResult <AgreementModel>(agreementModel)); }
public AgreementModel GetManagementModel(Himall.Model.AgreementInfo.AgreementTypes type) { AgreementModel model = new AgreementModel(); model.AgreementType = (int)type; var agreement = SystemAgreementApplication.GetAgreement(type); if (agreement != null) { model.AgreementContent = agreement.AgreementContent; } return(model); }
public ActionResult Download() { AgreementRenderer agreementRenderer = new AgreementRenderer(); string template = (string)Session["Template"]; JavaScriptSerializer jss = new JavaScriptSerializer(); AgreementModel model = jss.Deserialize <AgreementModel>(GetDummyAgreementModel()); var pdf = agreementRenderer.RenderAgreementToPdf(template, model); return(File(pdf, "application/pdf", "test" + " Summary_" + DateTime.Now + ".pdf")); } // Download
public async Task <AgreementModel> SaveNewAgreementAsync(AgreementModel agreement) { var mappedNewAgreement = _mapper.Map <Agreement>(agreement); if (mappedNewAgreement != null) { var savedAgreement = await _agreementRepository.SaveNewAgreementAsync(mappedNewAgreement); return(_mapper.Map <AgreementModel>(savedAgreement)); } return(null); }
} // CreateSchedule public void CalculateTotal(decimal fee, List<LoanScheduleItem> schedule, AgreementModel model) { model.TotalAmount = FormattingUtils.NumericFormats(schedule.Sum(a => a.AmountDue)); model.TotalPrincipal = FormattingUtils.NumericFormats(schedule.Sum(a => a.LoanRepayment)); model.TotalInterest = FormattingUtils.NumericFormats(schedule.Sum(a => a.Interest)); model.TotalAmoutOfCredit = FormattingUtils.NumericFormats(schedule.Sum(a => a.LoanRepayment)); model.TotalFees = FormattingUtils.NumericFormats(fee); //var currencyRateRepository = ObjectFactory.GetInstance<CurrencyRateRepository>(); //decimal currencyRate = (decimal)currencyRateRepository.GetCurrencyHistoricalRate(DateTime.UtcNow, "USD"); decimal currencyRate = GetUSDCurrencyRate(); model.TotalPrincipalUsd = "$ " + (CurrentValues.Instance.AlibabaCurrencyConversionCoefficient * currencyRate * schedule.Sum(a => a.LoanRepayment)).ToString("N", CultureInfo.CreateSpecificCulture("en-gb")); } // CalculateTotal
public ActionResult CreateAgreement(AgreementModel model) { ServiceModelsAgreementDTO agreement = new ServiceModelsAgreementDTO { PersonaId = model.PersonalId, Amount = model.Amount, Margin = model.Margin, Duration = model.Duration, Code = model.BaseRateCode.ToString() }; if (service.CreateAgreement(agreement) == 0) { return(View("Error")); } return(View("SuccessfulSubmit")); }
public ActionResult <AgreementModel> Post(AgreementModel agreementModel) { Result <AgreementModel> result = _businessService.PostAgreementModel(agreementModel); switch (result.ResultType) { case ResultType.Unexpected: return(StatusCode(500, result.Errors)); case ResultType.BadRequest: return(BadRequest(result.Errors)); default: break; } return(result.Data); }
public static int Add(AgreementModel model) { var command = _dbBaseProvider.CreateCommandStruct("AgreementClass", CommandMode.Insert); command.AddParameter("GameID", model.GameID); command.AddParameter("Title", model.Title); command.AddParameter("Describe", model.Describe); command.ReturnIdentity = true; command.Parser(); using (var reader = _dbBaseProvider.ExecuteReader(CommandType.Text, command.Sql, command.Parameters)) { if (reader.Read()) { model.AgreementID = reader[0].ToInt(); } } return(model.AgreementID); }
public SaveAgreement( int customerId, AgreementModel model, string refNumber, string name, TemplateModel template, string path1, string path2 ) { _name = name; _template = template; _path1 = path1; _path2 = path2; _customerId = customerId; _model = model; _refNumber = refNumber; } // constructor