/// <summary> /// Получить сохраненный ПДН по номеру договору 1С асинхронно. /// </summary> /// <param name="account1CCode">Номер договора из 1С</param> /// <param name="cancellationToken">Токен отмены</param> /// <returns>ПДН и дата анкеты, на основании которой был рассчитан ПДН</returns> public async Task <PDNInfoList> GetSavedPDNAsync(string account1CCode, CancellationToken cancellationToken) { GetSavedPDNCheckParams(account1CCode); using (IDBSource dbSource = new MKKContext()) { Account1C account1C = await FindAccountAsync(account1CCode, cancellationToken, i => i.PDNData); if ((account1C?.PDNCreditHistoryAnket ?? default) != default) { PDNData[] pdnData = await dbSource.PDNDatas. Include(i => i.Account1C). Where(i => i.Account1C.Account1CCode.Equals(account1CCode)). ToArrayAndLogErrorAsync <PDNData, EFServicePDN>(cancellationToken); CreditHistory creditHistory = await dbSource.CreditHistories.Where(i => i.ID == account1C.PDNCreditHistoryAnket). FirstOrDefaultAndLogErrorAsync <CreditHistory, EFServicePDN>(cancellationToken); return(new PDNInfoList { PDNCards = pdnData.Where(i => i.PDNCalculateType == PDNCalculateType.Card) .Select(i => (PDNCard)i).ToArray(), PDNNonCards = pdnData.Where(i => i.PDNCalculateType == PDNCalculateType.NonCard).Select(i => { PDNNonCard result = i; return result; }).ToArray(), CreditHistoryID = creditHistory.ID, ReportDate = creditHistory.Date, Account1CID = account1CCode }); } } return(default);
/// <summary> /// Рассчитать ПДН по коду клиента 1С асинхронно. /// </summary> /// <param name="accountDate">Дата заведения счета</param> /// <param name="client1CCode">Код клиента 1С</param> /// <param name="account1CCode">Код договора 1С, для которого требуется рассчитать ПДН</param> /// <param name="cancellationToken">Токен отмены</param> /// <returns>ПДН и дата анкеты, на основании которой был рассчитан ПДН</returns> public async Task <PDNInfoList> CalculatePDNAsync(string account1CCode, DateTime accountDate, string client1CCode, CancellationToken cancellationToken) { CalculatePDNCheckParams(account1CCode, accountDate, client1CCode); PDN[] pdnInfos; DateTime reportDate; int creditHistoryID; CreditHistory creditHistory = await EFServiceNBCH.GetCreditHistoryByAccount1CCodeAsync <EFServicePDN>(client1CCode, accountDate, cancellationToken); if (creditHistory != default) { ProductResponse productResponse = EFServiceNBCH.GetNBCHXml(creditHistory); pdnInfos = PDN.CreatePDNObgect(productResponse?.Preply?.Report?.AccountReply, Helper.EndOfDay(creditHistory.Date)); reportDate = creditHistory.Date; creditHistoryID = creditHistory.ID; } else { throw new PDNAnketaNotFoundException("Нет подходящей для расчета анкеты НБКИ.\n"); } return(new PDNInfoList(pdnInfos) { ReportDate = reportDate, CreditHistoryID = creditHistoryID, Account1CID = account1CCode, Account1CDate = accountDate }); }
/// <summary> /// Получить КИ по ID асинхронно. /// </summary> /// <param name="creditHistoryID">ID кредитной истории в базе</param> /// <param name="cancellationToken">Токен отмены</param> /// <returns>Кредитная история</returns> public async Task <Report> GetSavedReportAsync(int creditHistoryID, CancellationToken cancellationToken) { GetSavedReportCheckParams(creditHistoryID); Report report; CreditHistory creditHistory = await GetCreditHistoryByIDAsync(creditHistoryID, cancellationToken); if (creditHistory != default) { ProductResponse productResponse = GetNBCHXml(creditHistory); report = productResponse.Preply.Report ?? new Report(); report.ErrorMessage = productResponse.Preply?.Error?.CtErr?.Text ?? ""; report.Client1CCode = creditHistory.Client.Code1C; report.calc.ReportDate = creditHistory.Date; } else { report = new Report { ErrorMessage = "Анкета не найдена" }; } return(report); }
public IActionResult CreditWallet([FromBody] CreditModel credit) { if (!ModelState.IsValid) { return(BadRequest()); } var Ispermitted = isPermitted("ALL", User.FindFirstValue("RoleId")); if (!Ispermitted) { return(Unauthorized()); } var Token = _context.Tokens.Where(x => x.Token == credit.VerificationToken).FirstOrDefault(); if (Token == null) { return(BadRequest("Invalid Token")); } if (Token.isUsed || Token.ExpiryDate <= DateTime.Now) { return(BadRequest("Invalid Token")); } if (Token.Amount != credit.Amount) { return(BadRequest("Token Invalid for Specified Amount")); } if (Token.ResellerId != credit.ResellerId) { return(BadRequest("Token is for different reseller")); } var Reseller = _context.Users.Where(x => x.UserModelId == credit.ResellerId).FirstOrDefault(); if (Reseller == null) { return(BadRequest("Reseller not recognised")); } Reseller.Balance += credit.Amount; _context.Entry(Reseller).State = EntityState.Modified; Token.isUsed = true; _context.Entry(Token).State = EntityState.Modified; var Histo = new CreditHistory { Amount = credit.Amount, Id = Guid.NewGuid().ToString(), IssuedDate = DateTime.Now, IssuerId = User.FindFirstValue("Id"), ResellerId = credit.ResellerId, }; _context.Histories.Add(Histo); _context.SaveChanges(); return(Ok("Wallet Creditied Successfully")); }
public bool AddCredit(long accountId, int credit, string type, string reason) { CY.UME.Core.Business.Account account; if (TryGetAccount(accountId, out account)) { int orgCredit = account.Credit; int modifiedCredit = orgCredit + credit; account.Credit = modifiedCredit; account.Save(); CreditHistory ch = new CreditHistory(); ch.AccountId = account.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = account.Id.ToString(); ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = credit; ch.Type = type; ch.Description = reason; ch.Save(); } return false; }
public void CreateOrUpdate(CreditHistory credit) { lock (Look) { _db.CreditHistory.AddOrUpdate(credit); _db.SaveChanges(); } }
public static string GetInsertCreditHistory(int customerRemainingCredit, int customers_id, int?abo_type, int quantity) { int?credit_free; int?quantity_free = 0; int?credit_paid = 0; int?quantity_paid = 0; DVdPostMobileApIWS contextBeProd = null; string connstr_prod = ConfigurationManager.ConnectionStrings["prod-WRITE"].ConnectionString; InsertMobileApplicationLog(customers_id, "GetInsertCreditHistory customerRemainingCredit, quantity 1: " + connstr_prod, customerRemainingCredit.ToString() + quantity.ToString(), "", -1); contextBeProd = new DVdPostMobileApIWS(new MySqlConnection(connstr_prod)); string sqlmax = QueriesDB.getSelectMaxIDCreditHistory(customers_id); IEnumerable <numberresult> res = contextBeProd.ExecuteQuery <numberresult>(sqlmax); numberresult max = res.FirstOrDefault <numberresult>(); int maxID = max.r; var x = from creditHistory in contextBeProd.CreditHistory where creditHistory.ID == maxID select creditHistory; CreditHistory ch = x.SingleOrDefault(); if (ch == null) { credit_free = 0; credit_paid = 0; } else { credit_free = ch.CreditFree + ch.QuantityFree; credit_paid = ch.CreditPaid + ch.QuantityPaid; } InsertMobileApplicationLog(customers_id, "GetInsertCreditHistory credit_free, credit_paid, ch.ID, ch.CreditPaid, ch.QuantityPaid, ch.CreditFree, ch.QuantityFree, 2: ", credit_free.ToString() + ", " + credit_paid.ToString() + ", " + ch.ID.ToString() + ", " + ch.CreditPaid.ToString() + ", " + ch.QuantityPaid.ToString() + ", " + ch.CreditFree.ToString() + ", " + ch.QuantityFree.ToString(), "", -1); if (credit_free >= quantity) { quantity_free = quantity; quantity_paid = 0; } else if (credit_free + customerRemainingCredit >= quantity) { quantity_paid = quantity - credit_free; quantity_free = credit_free; } else if (customerRemainingCredit >= quantity) { quantity_free = 0; quantity_paid = quantity; } string sql = string.Format("insert into credit_history (customers_id , credit_action_id , user_modified,credit_paid , quantity_paid , quantity_free , credit_free , orders_id,abo_type )" + " values ({0}, 12, 77, {1}, {2}, {3}, {4}, null, {5} )", customers_id, credit_paid, (-1) * quantity_paid, (-1) * quantity_free, credit_free, abo_type); return(sql); }
public AClient(Bank Bank, SqlMoney Amount, CreditHistory creditHistory = CreditHistory.Normal) { this.Bank = Bank; this.Amount = Amount; Credits = new List <Credit>(); Deposits = new List <Deposit>(); CreditHistory = creditHistory; FillCredits(); FillDeposits(); }
public static CreditHistory[] GetByCreditID(int credit_id) { DataTable tbl = GetDataTable_ByCreditID(credit_id); CreditHistory[] list = new CreditHistory[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { list[i] = CreditHistoryDB.LoadAll(tbl.Rows[i]); } return(list); }
public async Task <string> Credit(int id, decimal CreditAmount, string date, int rateOfIntrest, string creditPaymantTime, decimal remainingCredit) { bool canTakingCredit = true; foreach (var history in _context.CreditHistories) { if (id == history.IDPersonTakinCredit) { canTakingCredit = false; } else { canTakingCredit = true; } } if (canTakingCredit) { var createCreditHistory = new CreditHistory { IDPersonTakinCredit = id, CreditAmmount = CreditAmount, Date = date, RateOfIntrest = rateOfIntrest, CreditPaymentTime = creditPaymantTime, RemainingCredit = (CreditAmount * rateOfIntrest / 100) + CreditAmount }; foreach (var user in _context.Accounts) { if (user.IdUser == id) { user.Cash = user.Cash + CreditAmount; } } await _context.AddAsync(createCreditHistory); await _context.SaveChangesAsync(); return("Succesfully"); } return("You can't take credit"); }
public IHttpActionResult Get(string id) { CreditHistory credit = db.CreditHistories.Where(c => c.SSN == id).FirstOrDefault(); if (credit == null) { Random number = new Random(); credit = new CreditHistory { SSN = id, RiskScore = number.Next(1, 101) }; db.CreditHistories.Add(credit); db.SaveChanges(); } return(Ok(credit.RiskScore)); }
static private void ShowClientInf() // Method out all history of client(sold and bought things) { Console.Clear(); Console.WriteLine("Enter the name of the client: "); List <Client> list = pawnshop.GetListOfClients(); while (true) { string name = Console.ReadLine(); if (name == "exit") { break; } CreditHistory history = pawnshop.GetHistoryOfClient(name); List <KeyValuePair <Thing, SoldOrBought> > dict = history?.GetRecords(); if (dict != null) { if (dict.Count > 0) { Console.WriteLine($"{name} history: "); Parallel.ForEach <KeyValuePair <Thing, SoldOrBought> >(dict, // using parallel programming for faster execution keyValue => // using lambda expression { Console.WriteLine($"Name of thing:{keyValue.Key.Name}" + $", Price: {keyValue.Key.Price}, {keyValue.Value}"); }); } else { Console.WriteLine("History is empty"); } } else { Console.WriteLine("Not such a client!"); } Console.WriteLine("Enter new client name or \"exit\""); } }
public static CreditHistory LoadAll(DataRow row) { CreditHistory creditHistory = Load(row, "credit_history_"); creditHistory.CreditType = new IDandDescr(Convert.ToInt32(row["credittype_credit_type_id"]), Convert.ToString(row["credittype_descr"])); if (row["vouchercredit_credit_id"] != DBNull.Value) { creditHistory.VoucherCredit = CreditDB.Load(row, "vouchercredit_"); creditHistory.VoucherCredit.CreditType = new IDandDescr(Convert.ToInt32(row["vouchercredittype_credit_type_id"]), Convert.ToString(row["vouchercredittype_descr"])); } if (row["added_by_staff_id"] != DBNull.Value) { creditHistory.AddedBy = StaffDB.Load(row, "added_by_"); } if (row["person_added_by_person_id"] != DBNull.Value) { creditHistory.AddedBy.Person = PersonDB.Load(row, "person_added_by_"); creditHistory.AddedBy.Person.Title = IDandDescrDB.Load(row, "title_added_by_title_id", "title_added_by_descr"); } if (row["deleted_by_staff_id"] != DBNull.Value) { creditHistory.DeletedBy = StaffDB.Load(row, "deleted_by_"); } if (row["person_deleted_by_person_id"] != DBNull.Value) { creditHistory.DeletedBy.Person.Title = IDandDescrDB.Load(row, "title_deleted_by_title_id", "title_deleted_by_descr"); creditHistory.DeletedBy.Person = PersonDB.Load(row, "person_deleted_by_"); } if (row["modified_by_staff_id"] != DBNull.Value) { creditHistory.ModifiedBy = StaffDB.Load(row, "modified_by_"); } if (row["person_modified_by_person_id"] != DBNull.Value) { creditHistory.ModifiedBy.Person.Title = IDandDescrDB.Load(row, "title_modified_by_title_id", "title_modified_by_descr"); creditHistory.ModifiedBy.Person = PersonDB.Load(row, "person_modified_by_"); } return(creditHistory); }
public async Task <IActionResult> Agregar(PeopleAddModel p) { try { if (ModelState.IsValid) { if (p.Files.Count() <= 0) { ModelState.AddModelError("", "Favor seleccionar uno o mas archivos de evidencia"); return(View(p)); } var user = _userManager.GetUserName(User); var persona = new Person { Identification = p.Identification.Replace("-", ""), LastName = p.LastName, FirstName = p.FirstName, Created = DateTime.Now, CreateBy = user, }; var credit = new CreditHistory { CreateDate = DateTime.Now, Note = p.Description, Person = persona, CreateBy = user }; var credits = new List <CreditHistory> { credit }; //save images var FullfilePath = System.IO.Directory.GetCurrentDirectory(); var relativePath = @"\images\Upload\Evidencia_"; foreach (var formFile in p.Files) { if (formFile.Length > 0) { string strFileExtension = System.IO.Path.GetExtension(formFile.FileName); var relativePath1 = relativePath + $"{Guid.NewGuid()}{strFileExtension}"; var FullfilePath1 = $"{FullfilePath}{relativePath1}"; using (var stream = new FileStream(FullfilePath1, FileMode.Create)) { await formFile.CopyToAsync(stream); } var picture = new Picture { PicturePath = relativePath1, CreditHistory = credit }; _context.Add(picture); } } persona.AddCreditHistory(credits); _context.Add(persona); await _context.SaveChangesAsync(); ModelState.Clear(); var newP = new PeopleAddModel { Results = "La Persona ha Sido Creada." }; return(View(newP)); // This will clear whatever form items have been populated // ModelState.Clear(); } } catch (DbUpdateException ex) { //Log the error (uncomment ex variable name and write a log. ModelState.AddModelError("", ex.Message + " Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } return(View(p)); }
/// <summary> /// 注册 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LB_Next_Click(object sender, EventArgs e) { if (TxtEmail.Text.Length == 0) { return; } CY.UME.Core.Business.SystemLog.SaveLog("Info", "注册开始"); if (Session["CaptchaImageText"] == null)// 验证码 { ShowAlert("注册失败", "服务器忙,请稍后再试!"); return; } string validateCode = Session["CaptchaImageText"].ToString(); if (TxtValidCode.Text != validateCode) { ShowAlert("注册失败", "验证码错误!"); return; } if (string.IsNullOrEmpty(TxtSudentCode.Text)) { ShowAlert("注册失败", "学号不能为空"); return; } if (string.IsNullOrEmpty(TxtUserName.Text)) { ShowAlert("注册失败", "姓名不能为空"); return; } if (TxtUserPassword.Text.Length < 6 || TxtUserPassword.Text.Length > 20) { ShowAlert("注册失败", "密码长度必须在6至20之间"); return; } String ZipRegex = @"/^\w{0,19}$/"; if (System.Text.RegularExpressions.Regex.IsMatch(TxtUserPassword.Text, ZipRegex)) { ShowAlert("注册失败", "密码含有非法字符,只能输入数字、字母和\"_\"的组合。"); return; } if (String.Compare(TxtUserPassword.Text.Trim(), TxtUserPasswordAgain.Text.Trim()) != 0) { ShowAlert("注册失败", "两次密码输入不一致,请重新输入。"); return; } if (!RBGenderFemale.Checked && !RBGenderMale.Checked) { ShowAlert("注册失败", "性别不能为空"); return; } if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0") { ; } else if (YearHF.Value == "0" || MonthHF.Value == "0" || DayHF.Value == "0") { ShowAlert("提示", "请完善您的生日信息!"); return; } CY.UME.Core.Business.AccountExtend aeTemp = CY.UME.Core.Business.AccountExtend.Load(TxtEmail.Text.Trim()); if (aeTemp != null) { ShowAlert("提示", "该邮箱已被使用!"); return; } CY.Security.SecurityHelper sh = new CY.Security.SecurityHelper(); CY.UME.Core.Business.Account account = new CY.UME.Core.Business.Account(); account.Code = TxtSudentCode.Text; account.DateCreated = DateTime.Now; account.HasAvatar = false; account.IsTeacher = false; account.Name = TxtUserName.Text; account.NickName = string.Empty; account.ViewNumber = 0; account.Save(); // extend info CY.UME.Core.Business.AccountExtend ae = CY.UME.Core.Business.AccountExtend.Load(account.Id); if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0") { ae.Birthday = UME.Core.Global.MinDateTime; } else { int day = 0, month = 0, year = 0; if (int.TryParse(DayHF.Value, out day)) ae.BirthDate = day; if (int.TryParse(MonthHF.Value, out month)) ae.BirthMonth = month; if (int.TryParse(YearHF.Value, out year)) ae.BirthYear = year; ae.Birthday = new DateTime(year, month, day);//生日 } ae.Email = TxtEmail.Text.Trim(); ae.Gender = RBGenderMale.Checked ? 1 : 0; ae.IsEmailChecked = true; //ae.LibUserId = 0; ae.Password = sh.ComputeMD5Hash(TxtUserPassword.Text); ae.UniversityId = CY.Utility.Common.ConvertUtility.ConvertToInt(HFUniversity.Value, -1);// 学校 ae.CollegeId = CY.Utility.Common.ConvertUtility.ConvertToInt(HFCollege.Value, -1);// 学院 ae.GradeId = int.Parse(DDLGrades.SelectedValue); ae.IsShow = 0; ae.Save(); try { /**************************************************废除的代码/*************************************************/ /************************MySQL数据库同步开始************************* CY.UME.Core.Business.Ask_members members = new CY.UME.Core.Business.Ask_members(); members.Id = account.Id; members.Username = ae.Email; members.Password = ae.Password; //members.Secques = ""; members.Save(); CY.UME.Core.Business.Ask_memberfields memberfields = new CY.UME.Core.Business.Ask_memberfields(); memberfields.Id = account.Id; memberfields.Username = ae.Email; memberfields.Email = ae.Email; memberfields.Nickname = account.NickName; memberfields.Realname = account.Name;//HFURLEncodeName.Value; memberfields.Gender = ae.Gender; memberfields.Birthday = 0; memberfields.Score = 200;//后面去改 memberfields.Save(); /************************MySQL数据库同步结束*************************/ } catch (Exception ex) { CY.UME.Core.Business.SystemLog.SaveLog("Error", "用户同步失败:" + ex.Message); } CY.UME.Core.Business.SystemLog.SaveLog("Info", account.Name + "注册成功"); if (Session["user"] != null) { Session["user"] = account.Id.ToString(); } else { Session.Add("user", account.Id.ToString()); } try { if (!string.IsNullOrEmpty(Request.QueryString["inviterId"])) { long inviterId = CY.Utility.Common.ConvertUtility.ConvertToLong(Request.QueryString["inviterId"], -1); if (inviterId != -1) { Core.Business.Account InviteFriendAccount = Core.Business.Account.Load(inviterId); if (InviteFriendAccount != null) {//邀请用户须存在 AccountInviteInfo ai = new AccountInviteInfo(); ai.Id = Guid.NewGuid(); ai.InviterId = inviterId; ai.InviteeEmail = ae.Email; ai.DateCreated = account.DateCreated; ai.IsAccepted = true; ai.Remark = "从活动过来的"; ai.Save(); CY.UME.Core.Business.Friendship fs = new Friendship(); fs.AccountId = account.Id; fs.DateCreated = DateTime.Now; fs.FriendId = InviteFriendAccount.Id; fs.IsChecked = true; fs.Remark = "活动邀请"; fs.Save(); CY.UME.Core.Business.Friendship fs2 = new Friendship(); fs2.AccountId = InviteFriendAccount.Id; fs2.FriendId = account.Id; fs2.DateCreated = DateTime.Now; fs2.IsChecked = true; fs2.Remark = "活动邀请"; fs2.Save(); } } } if (!string.IsNullOrEmpty(Request.QueryString["invId"])) { long invId = CY.Utility.Common.ConvertUtility.ConvertToLong(Request.QueryString["invId"], -1); if (invId != -1) { Core.Business.AccountInviteInfo InviteAccount = new AccountInviteInfo(); InviteAccount.Id = Guid.NewGuid(); InviteAccount.InviterId = invId; InviteAccount.DateCreated = DateTime.Now; InviteAccount.InviteeEmail = ae.Email; InviteAccount.IsAccepted = true; InviteAccount.Save(); #region 更新邀请人的积分 int inviteFriendCredit; if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditInviteAccount", out inviteFriendCredit) && (inviteFriendCredit != 0)) { CY.UME.Core.Business.Account invitor = CY.UME.Core.Business.Account.Load(invId); if (invitor != null) { CY.UME.Core.Business.Friendship fs = new Friendship(); fs.AccountId = account.Id; fs.DateCreated = DateTime.Now; fs.FriendId = invitor.Id; fs.IsChecked = true; fs.Remark = "被链接邀请"; fs.Save(); CY.UME.Core.Business.Friendship fs2 = new Friendship(); fs2.AccountId = invitor.Id; fs2.FriendId = account.Id; fs2.DateCreated = DateTime.Now; fs2.IsChecked = true; fs2.Remark = "链接邀请"; fs2.Save(); int orgCredit = invitor.Credit; int modifiedCredit = orgCredit + inviteFriendCredit; invitor.Credit = modifiedCredit; invitor.Save(); CreditHistory ch = new CreditHistory(); ch.AccountId = invitor.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = invId.ToString(); ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = inviteFriendCredit; ch.Type = "invitefriend"; ch.Description = "成功邀请用户 " + account.Name; ch.AssistAccountId = account.Id; ch.Save(); // 邀请层级效应 CY.UME.Core.Business.Account invitor2 = invitor.GetInviter(); if (invitor2 != null) { int inviteFriendCredit2; if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditInviteAccount2", out inviteFriendCredit2) && (inviteFriendCredit2 != 0)) { orgCredit = invitor2.Credit; modifiedCredit = orgCredit + inviteFriendCredit2; invitor2.Credit = modifiedCredit; invitor2.Save(); ch = new CreditHistory(); ch.AccountId = invitor2.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = invId.ToString(); ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = inviteFriendCredit2; ch.Type = "invitefriend"; ch.Description = "所邀请用户 " + invitor.Name + " 成功邀请了 " + account.Name; ch.Save(); } } } } #endregion } } } catch (Exception) { } //ShowAlert("注册成功", "恭喜您已经成功注册UME账号,现在系统将引导您至完善个人信息页面"); //ExecuteClientScript("setTimeout(function(){window.location.href='UploadAvatar.aspx?type=firstNum'}, 1000)") SaveAccountCookie(TxtEmail.Text.Trim(), sh.ComputeMD5Hash(TxtUserPassword.Text));//保存Cookie用于问问吧登录 Server.Transfer("UploadAvatar.aspx?type=firstNum"); }
private void AddLoginCredit(Account account) { #region 添加登录积分 int loginCredit; int maxLoginCreditInDay; if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditLogin", out loginCredit) && (loginCredit != 0) && CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditLoginMaxInDay", out maxLoginCreditInDay)) { DateTime now = DateTime.Now; DateTime startOfDay = new DateTime(now.Year, now.Month, now.Day); // 获取用户当日内由登录而获得的积分 int creditsAlreadyGainToday; List<CY.UME.Core.Business.CreditHistory> creditHistories = CY.UME.Core.Business.CreditHistory.GetCreditHistory( "login", account.Id, new long?(), string.Empty, startOfDay, startOfDay.AddDays(1), new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = int.MaxValue } ); creditsAlreadyGainToday = creditHistories.Sum<CY.UME.Core.Business.CreditHistory>(ch => ch.Variation); if (creditsAlreadyGainToday < maxLoginCreditInDay) { loginCredit = (creditsAlreadyGainToday + loginCredit > maxLoginCreditInDay) ? (maxLoginCreditInDay - creditsAlreadyGainToday) : loginCredit; int orgCredit = account.Credit; int modifiedCredit = orgCredit + loginCredit; account.Credit = modifiedCredit; account.Save(); CreditHistory ch = new CreditHistory(); ch.AccountId = account.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = account.Id.ToString(); ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = loginCredit; ch.Type = "login"; ch.Description = "用户登录"; ch.Save(); } } #endregion }
public override List<CreditHistory> GetCreditHistory(long userId) { CreditHistoryList res = new CreditHistoryList(); CreditHistoryList ret = new CreditHistoryList(); CreditHistoryList added = GetCreditHistoryAdded(userId); CreditHistoryList used = GetCreditHistoryUsed(userId); // Now we have all the credits added and used for the specified user foreach (CreditHistory ch in added) { bool found = true; int credits = ch.Credits; while (found) { if (used.Count > 0 && used[0].PurchaseDate < ch.PurchaseDate.AddYears(1)) { credits -= used[0].Credits; used.RemoveAt(0); } else { CreditHistory creditHistory = new CreditHistory(ch.CreditHistoryId, ch.UserId, ch.ProductId, credits, ch.PurchaseDate, ch.Expired, ch.TransactionId); Transaction transaction = null; using (MySqlConnection conn = new MySqlConnection(GetConnectionString())) { string QRY_GET_TRANSACTION_BY_USERID_AND_DATE = string.Empty; if (creditHistory.TransactionId == 0) QRY_GET_TRANSACTION_BY_USERID_AND_DATE = @" SELECT * FROM `transaction` WHERE `user_id`=@userid AND `status`='OK' AND (`date` BETWEEN SUBDATE(@transdate, interval 5 minute) AND ADDDATE(@transdate, interval 5 minute)) LIMIT 1 "; else QRY_GET_TRANSACTION_BY_USERID_AND_DATE = @" SELECT * FROM `transaction` WHERE `user_id`=@userid AND `status`='OK' AND `transaction_id`=@transactionId "; using (MySqlCommand cmd = new MySqlCommand(QRY_GET_TRANSACTION_BY_USERID_AND_DATE, conn)) { cmd.Parameters.Add("@userid", MySqlDbType.Int64).Value = userId; cmd.Parameters.Add("@transdate", MySqlDbType.DateTime).Value = creditHistory.PurchaseDate; cmd.Parameters.Add("@transactionId", MySqlDbType.Int64).Value = creditHistory.TransactionId; try { conn.Open(); using (MySqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { transaction = new Transaction(); transaction.TransactionId = rdr.GetInt64(0); transaction.UserId = userId; transaction.Amount = rdr.GetDecimal(2); transaction.Date = rdr.GetDateTime(3); transaction.Description = rdr.GetString(4); transaction.ProductId = rdr.GetInt64(5); transaction.Status = rdr.GetString(6); transaction.StatusCode = rdr.GetString(7); transaction.Merchant = rdr.GetString(8); transaction.PaymentId = rdr.GetString(9); transaction.TransactionReference = rdr.GetString(10); transaction.PaymentMethod = rdr.GetString(11); } } } catch (Exception ex) { Logger.Instance.Write(LogLevel.Error, ex, "GetCreditHistory<exception>"); } finally { conn.Close(); } } } if (transaction != null) { creditHistory.Description = transaction.Description.Replace(".", ",") ?? ""; creditHistory.InvoiceFile = string.Format("INV{0}.pdf", transaction.PaymentId ?? ""); } found = false; ret.Add(creditHistory); } } } List<CreditHistory> TempRes = (from obj in ret orderby obj.CreditHistoryId descending select obj).ToList<CreditHistory>(); return TempRes; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; CY.UME.Core.Business.Account account; string validateCode = string.Empty; string correctCode; string mobilePhone; #region Validate if (context.Session["mobilevalidatecode"] == null || context.Session["mobilephonenum"] == null) { context.Response.Write("{success: false, msg: '操作超时!'}"); return; } correctCode = context.Session["mobilevalidatecode"].ToString(); mobilePhone = context.Session["mobilephonenum"].ToString(); account = Global.GetCurrentAccount(); if (account == null) { context.Response.Write("{success: false, msg: '用户登录超时,请重新登录!'}"); return; } if (string.IsNullOrEmpty(context.Request.Form["code"])) { context.Response.Write("{success: false, msg: '验证码不能为空!'}"); return; } validateCode = context.Request.Form["code"]; #endregion if (validateCode == correctCode) { CY.UME.Core.Business.AccountExtend ae = account.ExtendInfo; if (ae == null) { ae = new CY.UME.Core.Business.AccountExtend(); ae.Id = account.Id; } string orignalPhone = ae.Telephone; ae.Telephone = mobilePhone; ae.Save(); #region 绑定手机积分 if (string.IsNullOrEmpty(orignalPhone)) { int bindPhoneCredit; if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditBindPhone", out bindPhoneCredit) && (bindPhoneCredit != 0)) { int creditHistoriesCount = CreditHistory.GetCreditHistoryCount( "bindphone", account.Id, new long?(), string.Empty, new DateTime?(), new DateTime?() ); // 由绑定手机而获得的积分次数 if (creditHistoriesCount == 0) { int orgCredit = account.Credit; int modifiedCredit = orgCredit + bindPhoneCredit; account.Credit = modifiedCredit; account.Save(); CreditHistory ch = new CreditHistory(); ch.AccountId = account.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = ""; ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = bindPhoneCredit; ch.Type = "bindphone"; ch.Description = "绑定手机"; ch.Save(); } } } #endregion context.Response.Write("{success:true}"); context.Session.Remove("mobilevalidatecode"); context.Session.Remove("mobilephonenum"); } else { context.Response.Write("{success: false, msg: '验证码不相符,请重新输入!'}"); } }
public static CreditHistory[] GetByCreditID(int credit_id) { DataTable tbl = GetDataTable_ByCreditID(credit_id); CreditHistory[] list = new CreditHistory[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) list[i] = CreditHistoryDB.LoadAll(tbl.Rows[i]); return list; }
public async Task <IActionResult> AgregarHistorial(AddCreditHistory c) { try { if (ModelState.IsValid) { if (c.Files.Count() <= 0) { ModelState.AddModelError("", "Favor seleccionar uno o mas archivos de evidencia"); return(View(c)); } var user = _userManager.GetUserName(User); var persona = _context.Persons.Where(x => x.PersonID == c.PersonID).FirstOrDefault(); if (persona == null) { return(View(c)); } var credit = new CreditHistory { Person = persona, CreateDate = DateTime.Now, Note = c.Description, CreateBy = user }; var credits = new List <CreditHistory> { credit }; //save images var FullfilePath = System.IO.Directory.GetCurrentDirectory(); var relativePath = @"\images\Upload\Evidencia_"; foreach (var formFile in c.Files) { if (formFile.Length > 0) { string strFileExtension = System.IO.Path.GetExtension(formFile.FileName); var relativePath1 = relativePath + $"{Guid.NewGuid()}{strFileExtension}"; var FullfilePath1 = $"{FullfilePath}{relativePath1}"; using (var stream = new FileStream(FullfilePath1, FileMode.Create)) { await formFile.CopyToAsync(stream); } var picture = new Picture { PicturePath = relativePath1, CreditHistory = credit }; _context.Add(picture); } } persona.AddCreditHistory(credits); _context.Update(persona); await _context.SaveChangesAsync(); ModelState.Clear(); c.Resultados = "El historial hasido creado."; c.Description = ""; //return RedirectToAction("Index"); c.FirstName = persona.FirstName; c.LastName = persona.LastName; c.PersonID = persona.PersonID; c.Identification = persona.Identification; } } catch (DbUpdateException ex) { //Log the error (uncomment ex variable name and write a log. ModelState.AddModelError("", ex.Message + " Unable to save changes. " + "Try again, and if the problem persists " + "see your system administrator."); } return(View(c)); }
protected void Save_OnClick(object sender, EventArgs e) { if (TbxAccountName.Text.Trim().Length == 0) { Response.Write("<script language='javascript'>alert('请输入用户姓名!');</script>"); return; } CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(SpaceAccount.Id); CY.UME.Core.Business.AccountExtend accountExtend = account.ExtendInfo; int originalInfoIntegrity = account.GetInfoIntegrity(); account.Name = TbxAccountName.Text.Trim();//姓名 account.NickName = TBXNickName.Text.Trim();//昵称 if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0") { accountExtend.Birthday = UME.Core.Global.MinDateTime; } else if (YearHF.Value == "0" || MonthHF.Value == "0" || DayHF.Value == "0") { Response.Write("<script language='javascript'>alert('请完善您的生日信息!');</script>"); return; } else { int day = 0, month = 0, year = 0; if (int.TryParse(DayHF.Value, out day)) accountExtend.BirthDate = day; if (int.TryParse(MonthHF.Value, out month)) accountExtend.BirthMonth = month; if (int.TryParse(YearHF.Value, out year)) accountExtend.BirthYear = year; accountExtend.Birthday = new DateTime(year, month, day);//生日 } if (RBLGenderMan.Checked)//性别 { accountExtend.Gender = 1; } else if (RBLGenderWoman.Checked) { accountExtend.Gender = 0; } else { accountExtend.Gender = -1; } accountExtend.HometownProvinceId = provinceCityHome.ProvinceId;//家乡城市 accountExtend.HometownCityId = provinceCityHome.CityId;//家乡省份 accountExtend.ResideCityId = provinceCityAddress.CityId;//所在地城市 accountExtend.ResideProvinceId = provinceCityAddress.ProvinceId;//所在地省份 accountExtend.BloodType = DDLBloodType.SelectedValue;//血型 try { account.Save(); accountExtend.Save(); if (originalInfoIntegrity < 90) { int currentInfoIntegrity = account.GetInfoIntegrity(); if (currentInfoIntegrity >= 90) { #region 首次完善个人资料,赠送积分 int editProfileCredit; if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditAddInfo", out editProfileCredit) && (editProfileCredit != 0)) { int creditHistoriesCount = CreditHistory.GetCreditHistoryCount( "editeprofile", account.Id, new long?(), string.Empty, new DateTime?(), new DateTime?() ); // 由完善资料而获得的积分次数 if (creditHistoriesCount == 0) { int orgCredit = account.Credit; int modifiedCredit = orgCredit + editProfileCredit; account.Credit = modifiedCredit; account.Save(); CreditHistory ch = new CreditHistory(); ch.AccountId = account.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = ""; ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = editProfileCredit; ch.Type = "editeprofile"; ch.Description = "完善个人资料"; ch.Save(); } } #endregion } } //Response.Write("<script language='javascript'>alert('您的基本信息更新成功!');</script>"); LblFinish.Text = "<span style='color:#ff0000;'>你的基本信息更新成功!</span>"; UserInfoBind(account); SpaceAccount = account; } catch { throw new Exception("保存失败"); } if (back == "guide") { Response.Redirect("Guide2.aspx"); } }
public AClient(Bank Bank, ulong Account, SqlMoney Amount, CreditHistory creditHistory = CreditHistory.Normal) : this(Bank, Amount, creditHistory) { this.Account = Account; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; CY.UME.Core.Business.Account account; string bigImgPath, smallImgPath, imgExtention, imgName; string sitePath = CY.Utility.Common.SiteUtility.CurSitePath; String Id = context.Request.QueryString["accountId"].ToString(); long accountId = CY.Utility.Common.ConvertUtility.ConvertToInt(Id, -1); #region -Validation and Get Basic Data- //account = CY.UME.Core.Global.GetCurrentAccount(); account = CY.UME.Core.Business.Account.Load(accountId); if (account == null) { context.Response.Write("{success: false, msg: '用户登录超时,请重新登录!'}"); return; } // post data bigImgPath = context.Request.Form["bigImgPath"]; smallImgPath = context.Request.Form["smallImgPath"]; imgExtention = context.Request.Form["imgExtention"]; imgName = context.Request.Form["imgName"]; if (string.IsNullOrEmpty(bigImgPath) || string.IsNullOrEmpty(smallImgPath) || string.IsNullOrEmpty(imgExtention)) { context.Response.Write("{success: false, msg: '参数错误'}"); return; } if (!File.Exists(sitePath + bigImgPath)) { context.Response.Write("{success: false, msg: '照片不存在'}"); return; } if (!File.Exists(sitePath + smallImgPath)) { context.Response.Write("{success: false, msg: '小头像不存在'}"); return; } #endregion CY.UME.Core.Business.Album avatarAlbum = account.GetMyAvatarAlbum(); if (avatarAlbum == null) { avatarAlbum = new CY.UME.Core.Business.Album(); avatarAlbum.AccountId = account.Id; avatarAlbum.DateCreated = DateTime.Now; avatarAlbum.IsAvatar = true; avatarAlbum.LastModifiedTime = avatarAlbum.DateCreated; avatarAlbum.Name = "头像相册"; avatarAlbum.Save(); } // 相册目录为: 网站根目录 + /Content/Avatar/ + 用户标识 string avatarRelativePath = "/Content/Avatar/" + account.Id + "/"; DirectoryInfo di = new DirectoryInfo(sitePath + avatarRelativePath); // 相册目录 if (!di.Exists) { di.Create(); } string uniqueId = Guid.NewGuid().ToString("N"); string bImgName = uniqueId + "_big" + imgExtention; string mImgName = uniqueId + "_mid" + imgExtention; string sImgName = uniqueId + "_small" + imgExtention; try { Bitmap bmp = new Bitmap(sitePath + bigImgPath); int width = bmp.Width; int height = bmp.Height; bmp.Dispose(); if (height <= width && width >= 200) { height = Convert.ToInt32(width > 200 ? (200f / width) * height : height); width = 200; } else if (width < height && height > 200) { width = Convert.ToInt32(height > 200 ? (200f / height) * width : height); height = 200; } // 将大图片压缩为中等缩略图 using (StreamReader reader = new StreamReader(sitePath + bigImgPath)) { CY.Utility.Common.ImageUtility.ThumbAsJPG(reader.BaseStream, di.FullName + mImgName, width, height); } // 将小头像从120*120压缩到48*48 using (StreamReader reader = new StreamReader(sitePath + smallImgPath)) { CY.Utility.Common.ImageUtility.ThumbAsJPG(reader.BaseStream, di.FullName + sImgName, 65, 65);//之前是48 x 48 2010.12.21 刘小平 } // 将大图移动到头像目录下 FileInfo fi = new FileInfo(sitePath + bigImgPath); fi.MoveTo(di.FullName + bImgName); try { // File.Delete(sitePath + bigImgPath); File.Delete(sitePath + smallImgPath); } catch { ; } // 添加照片记录 CY.UME.Core.Business.Picture picture = new CY.UME.Core.Business.Picture(); picture.AlbumId = avatarAlbum.Id; picture.BigPath = avatarRelativePath + bImgName; picture.DateCreated = DateTime.Now; picture.MiddlePath = avatarRelativePath + mImgName; picture.Name = imgName; picture.Remark = string.Empty; picture.SmallPath = avatarRelativePath + sImgName; picture.Save(); if (!account.HasAvatar) { account.HasAvatar = true; #region 积分 int uploadAvatarCredit; if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditUploadAvatar", out uploadAvatarCredit) && (uploadAvatarCredit != 0)) { int orgCredit = account.Credit; int modifiedCredit = orgCredit + uploadAvatarCredit; account.Credit = modifiedCredit; CreditHistory ch = new CreditHistory(); ch.AccountId = account.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = ""; ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = uploadAvatarCredit; ch.Type = "uploadavatar"; ch.Description = "上传头像"; ch.Save(); } #endregion account.Save(); } //添加通知 //account.SendNoticeToAllFriend("picture", "更新了头像", picture.Id.ToString()); context.Response.Write("{success: true}"); return; } catch { context.Response.Write("{success: false, msg: '保存头像失败'}"); return; } }
private void AddCreditHistory(Table table, CreditHistory creditHistory) { CultureInfo ci = new CultureInfo("nl-NL"); if (!string.IsNullOrEmpty(_culture)) ci = new CultureInfo(_culture); TableRow row = new TableRow(); AddCell(row, string.Format("<div style=\"margin-left: 4px;\">{0}</div>", creditHistory.PurchaseDate.ToString("d", ci))); AddCell(row, creditHistory.Description); AddCell(row, creditHistory.PurchaseDate.AddYears(1).ToString("d", ci)); AddCell(row, creditHistory.Credits.ToString(ci)); //AddCell(row, creditHistory.InvoiceFile); string navUrl = Path.Combine(_userDocumentPath, creditHistory.InvoiceFile ?? string.Empty); HyperLink hl = new HyperLink(); if (!string.IsNullOrEmpty(navUrl) && File.Exists(navUrl)) { hl.Text = creditHistory.InvoiceFile; hl.NavigateUrl = string.Format("~/DownloadHandler.ashx?file='{0}'", navUrl); } else { hl.Text = Resources.Resource.NoFile; hl.Enabled = false; hl.NavigateUrl = string.Empty; } TableCell cell = new TableCell(); cell.Width = new Unit("32px"); cell.Controls.Add(hl); row.Cells.Add(cell); table.Rows.Add(row); }
/// <summary> /// 注册 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LBSubmint_Click(object sender, EventArgs e) { try { if (TxtEmail.Text.Length == 0) { return; } log.Info("注册开始"); if (Session["CaptchaImageText"] == null) { ShowAlert("注册失败", "服务器忙,请稍后再试!"); return; } string validateCode = Session["CaptchaImageText"].ToString(); if (TxtValidCode.Text != validateCode) { ShowAlert("注册失败", "验证码错误!"); return; } if (string.IsNullOrEmpty(TxtSudentCode.Text)) { ShowAlert("注册失败", "学号不能为空"); return; } if (string.IsNullOrEmpty(TxtUserName.Text)) { ShowAlert("注册失败", "姓名不能为空"); return; } if (TxtUserPassword.Text.Length < 6 || TxtUserPassword.Text.Length > 20) { ShowAlert("注册失败", "密码长度必须在6至20之间"); return; } String ZipRegex = @"/^\w{0,19}$/"; if (System.Text.RegularExpressions.Regex.IsMatch(TxtUserPassword.Text, ZipRegex)) { ShowAlert("注册失败", "密码含有非法字符,只能输入数字、字母和\"_\"的组合。"); return; } if (String.Compare(TxtUserPassword.Text.Trim(), TxtUserPasswordAgain.Text.Trim()) != 0) { ShowAlert("注册失败", "两次密码输入不一致,请重新输入。"); return; } if (!RBGenderFemale.Checked && !RBGenderMale.Checked) { ShowAlert("注册失败", "性别不能为空"); return; } if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0") { ; } else if ( YearHF.Value == "0" || MonthHF.Value == "0" || DayHF.Value == "0") { ShowAlert("提示", "请完善您的生日信息!"); return; } Guid id = new Guid(Request.QueryString["id"]); CY.UME.Core.Business.AccountInviteInfo aii = CY.UME.Core.Business.AccountInviteInfo.Load(id); if (aii == null) { ShowAlert("注册失败", "邀请已失效!"); return; } CY.Security.SecurityHelper sh = new CY.Security.SecurityHelper(); CY.UME.Core.Business.Account account = new CY.UME.Core.Business.Account(); account.Code = TxtSudentCode.Text; account.DateCreated = DateTime.Now; account.HasAvatar = false; account.IsTeacher = false; account.Name = TxtUserName.Text; account.NickName = string.Empty; account.ViewNumber = 0; account.Save(); // extend info CY.UME.Core.Business.AccountExtend ae = CY.UME.Core.Business.AccountExtend.Load(account.Id); if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0") { ae.Birthday = UME.Core.Global.MinDateTime; } else if (YearHF.Value == "0" || MonthHF.Value == "0" || DayHF.Value == "0") { ShowAlert("提示", "请完善您的生日信息!"); return; } else { int day = 0, month = 0, year = 0; if (int.TryParse(DayHF.Value, out day)) ae.BirthDate = day; if (int.TryParse(MonthHF.Value, out month)) ae.BirthMonth = month; if (int.TryParse(YearHF.Value, out year)) ae.BirthYear = year; ae.Birthday = new DateTime(year, month, day);//生日 } ae.Email = TxtEmail.Text; ae.Gender = RBGenderMale.Checked ? 1 : 0; ae.IsEmailChecked = true; //ae.LibUserId = 0; ae.Password = sh.ComputeMD5Hash(TxtUserPassword.Text); ae.UniversityId = CY.Utility.Common.ConvertUtility.ConvertToInt(selUniversity.Value, -1);// 学校 ae.CollegeId = CY.Utility.Common.ConvertUtility.ConvertToInt(selCollege.Value, -1);// 学院 ae.GradeId = int.Parse(DDLGrades.SelectedValue); ae.Save(); // add friendship CY.UME.Core.Business.Friendship fs = new CY.UME.Core.Business.Friendship(); fs.AccountId = aii.InviterId; fs.DateCreated = DateTime.Now; fs.CommunicateNum = 0; fs.FriendId = account.Id; fs.IsChecked = true; fs.Remark = string.Empty; fs.Save(); fs = new CY.UME.Core.Business.Friendship(); fs.AccountId = account.Id; fs.CommunicateNum = 0; fs.DateCreated = DateTime.Now; fs.FriendId = aii.InviterId; fs.IsChecked = true; fs.Remark = string.Empty; fs.Save(); aii.IsAccepted = true; aii.Save(); #region 更新邀请人的积分 int inviteFriendCredit; if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditInviteAccount", out inviteFriendCredit) && (inviteFriendCredit != 0)) { CY.UME.Core.Business.Account invitor = CY.UME.Core.Business.Account.Load(aii.InviterId); if (invitor != null) { int orgCredit = invitor.Credit; int modifiedCredit = orgCredit + inviteFriendCredit; invitor.Credit = modifiedCredit; invitor.Save(); CreditHistory ch = new CreditHistory(); ch.AccountId = invitor.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = aii.Id.ToString(); ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = inviteFriendCredit; ch.Type = "invitefriend"; ch.Description = "成功邀请用户 " + account.Name; ch.Save(); // 邀请层级效应 CY.UME.Core.Business.Account invitor2 = invitor.GetInviter(); if (invitor2 != null) { int inviteFriendCredit2; if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditInviteAccount2", out inviteFriendCredit2) && (inviteFriendCredit2 != 0)) { orgCredit = invitor2.Credit; modifiedCredit = orgCredit + inviteFriendCredit2; invitor2.Credit = modifiedCredit; invitor2.Save(); ch = new CreditHistory(); ch.AccountId = invitor2.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = aii.Id.ToString(); ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = inviteFriendCredit2; ch.Type = "invitefriend"; ch.Description = "所邀请用户 " + invitor.Name + " 成功邀请了 " + account.Name; ch.Save(); } } } } #endregion log.Info("注册结束"); if (Session["user"] != null) { Session["user"] = account.Id.ToString(); } else { Session.Add("user", account.Id.ToString()); } ShowAlert("注册成功", "恭喜您已经成功注册UME账号,现在系统将引导您至完善个人信息页面"); ExecuteClientScript("setTimeout(function(){window.location.href='UploadAvatar.aspx?type=firstNum'}, 2000)"); } catch (Exception ex) { log.Error("用户注册失败:" + ex.Message); } }
private int GetPointsForCreditHistory(CreditHistory creditHistory) { return((int)creditHistory); }