private void btnOk_Click(object sender, EventArgs e) { CompanyAccount companyAccount = new CompanyAccount() { CompanyID = this.txtAccount.Text, CompanyName = this.txtCompanyName.Text, CompanyPwd = this.txtPwd.Text, ServiceURL = this.txtUrl.Text }; if (companyAccount.CompanyID.Length == 0) { MessageBox.Show("请输入合法的企业账号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //检查账号密码是否正确,执行一次登录尝试 if (LoginChecker.getInstance().BindingCheck(companyAccount)) { using (CompanyAccountServiceBF bf = new CompanyAccountServiceBF()) { if (bf.ICompanyAccount.BindCompanyAccount(companyAccount) == "") { MessageBox.Show("账号绑定设置成功,请重启收费系统完成绑定操作!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("账号绑定失败,请检查输入的URL、账号和密码是否正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } }
/// <summary> /// 修改 /// </summary> public override void EntityUpdate() { CompanyAccountRule rule = new CompanyAccountRule(); CompanyAccount entity = EntityGet(); rule.RUpdate(entity); }
private void ReadCompanyAccount() { using (CompanyAccountServiceBF bf = new CompanyAccountServiceBF()) { this.companyAccount = bf.ICompanyAccount.ReadComapnyAccount(); } }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { CompanyAccount MasterEntity = (CompanyAccount)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM Data_CompanyAccount WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
public void CompanyAccounts(CompanyAccount obj, string filePath) { var xmlser = new XmlSerializer(typeof(ObservableCollection <CompanyAccount>)); ObservableCollection <CompanyAccount> list; try { using (Stream s = File.OpenRead(filePath)) { list = xmlser.Deserialize(s) as ObservableCollection <CompanyAccount>; } } catch { list = new ObservableCollection <CompanyAccount>(); } if (list == null) { return; } { list.Add(obj); using (Stream s = File.OpenWrite(filePath)) { xmlser.Serialize(s, list); } } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private CompanyAccount EntityGet() { CompanyAccount entity = new CompanyAccount(); entity.ID = HTDataID; return(entity); }
public async Task <IActionResult> OnPostAsync(string returnUrl = null) { ReturnUrl = returnUrl; if (ModelState.IsValid) { var user = new CompanyAccount { UserName = Input.Email, Email = Input.Email }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme); await _signInManager.SignInAsync(user, isPersistent : false); return(LocalRedirect(Url.GetLocalUrl(returnUrl))); } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } // If we got this far, something failed, redisplay form return(Page()); }
public async Task <bool> CreateAccount(AccountRequest accountRequest) { bool resultProcess = false; //-- generating the salt var salt = GenerateSalt(32); if (accountRequest != null) { //-- Creates the new account var user = new CompanyAccount { CompanyId = accountRequest.CompanyId, Username = accountRequest.Username, Email = accountRequest.Email, PasswordSalt = salt, PasswordHash = GetHash(accountRequest.Password, salt), Active = accountRequest.Active }; //-- Connects to the database using the entity using (var entitys = new CompanyBrokerAccountEntities()) { //-- adds a new user to the CompanyAccounts table entitys.CompanyAccounts.Add(user); //-- Saves the changes to the database await entitys.SaveChangesAsync(); resultProcess = true; } } //-- Returns the user wished to be created return(resultProcess); }
public AccountResponse(CompanyAccount account) { CompanyId = account.CompanyId; Email = account.Email; Username = account.Username; Active = account.Active; UserId = account.UserId; }
/// <summary> /// 新增 /// </summary> public override int EntityAdd() { CompanyAccountRule rule = new CompanyAccountRule(); CompanyAccount entity = EntityGet(); rule.RAdd(entity); return(entity.ID); }
public bool BindingCheck(CompanyAccount account) { this.companyAccount = account; string strURL = string.Format("{0}/Login.aspx", this.companyAccount.ServiceURL); Uri url = new System.Uri(strURL, System.UriKind.Absolute); LoginCheck lc = new LoginCheck(url, true, "账号检查,请稍后..."); lc.ShowDialog(); isLogin = lc.OK; return(lc.OK); }
/// <summary> /// 新增 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int AddNew(BaseEntity p_Entity) { try { CompanyAccount MasterEntity = (CompanyAccount)p_Entity; if (MasterEntity.ID == 0) { return(0); } //新增主表数据 StringBuilder MasterField = new StringBuilder(); StringBuilder MasterValue = new StringBuilder(); MasterField.Append("INSERT INTO Data_CompanyAccount("); MasterValue.Append(" VALUES("); MasterField.Append("ID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ","); MasterField.Append("CompanyID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CompanyID) + ","); MasterField.Append("Bank" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Bank) + ","); MasterField.Append("Account" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Account) + ","); MasterField.Append("SwifCode" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SwifCode) + ","); MasterField.Append("Remark" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ","); MasterField.Append("DelFlag" + ")"); MasterValue.Append(SysString.ToDBString(MasterEntity.DelFlag) + ")"); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E); } }
public CompanyAccountFrom() { InitializeComponent(); CompanyAccount companyAccount = LoginChecker.getInstance().CompanyAccount; if (companyAccount != null) { this.txtAccount.Text = companyAccount.CompanyID; this.txtCompanyName.Text = companyAccount.CompanyName; this.txtUrl.Text = companyAccount.ServiceURL; } }
private void Create_Click(object sender, RoutedEventArgs e) { var companyName = NameBox.Text; var nip = NipBox.Text; var email = EmailBox.Text; var street = StreetBox.Text; var city = CityBox.Text; var country = CountryBox.Text; var zipCode = ZipCodeBox.Text; var phone = PhoneBox.Text; var nameValidator = new NameValidator(); var nipValidator = new NipValidator(); var mailValidator = new MailValidator(); var phoneValidator = new PhoneValidator(); if (!nameValidator.ValidateName(companyName)) { MessageBox.Show("Podałeś niedozwoloną nazwę firmy"); } else if (!nipValidator.ValidateNip(nip)) { MessageBox.Show("Podałeś nieprawidłowy nip"); } else if (!mailValidator.ValidateMail(email)) { MessageBox.Show("Podałeś nieprawidłowy adres Email"); } else if (string.IsNullOrEmpty(street) || string.IsNullOrEmpty(zipCode) || string.IsNullOrEmpty(country) || string.IsNullOrEmpty(city)) { MessageBox.Show("Pole adresowe nie może być puste"); } else { var account = new BankAccount(); var companyAccount = new CompanyAccount(companyName, nip, email, zipCode, country, phone, city, street, account) { BankAccount = { Balance = 0.0 } }; var filePath = Environment.CurrentDirectory + @"\" + "Company_Accounts.xml"; var listToXml = new ListToXml(); listToXml.CompanyAccounts(companyAccount, filePath); Close(); } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private CompanyAccount EntityGet() { CompanyAccount entity = new CompanyAccount(); entity.ID = HTDataID; entity.SelectByID(); entity.CompanyID = SysConvert.ToInt32(drpCompanyID.EditValue); entity.Bank = txtBank.Text.Trim(); entity.Account = txtAccount.Text.Trim(); entity.SwifCode = txtSwifCode.Text.Trim(); entity.Remark = txtRemark.Text.Trim(); return(entity); }
private decimal GetFeeRate(Company company, ChannelOverride channelOverride, CompanyAccount account) { if (account.OverrideFeeRate.HasValue) { return(account.OverrideFeeRate.GetValueOrDefault()); } else if (channelOverride.OverrideFeeRate.HasValue) { return(channelOverride.OverrideFeeRate.GetValueOrDefault()); } else { return(company.DefaultFeeRate.GetValueOrDefault()); } }
public Task Consume(ConsumeContext <IMailProcess2Finished> context) { Console.WriteLine($"Have new message. Process started." + context.Message.MailID); //Console.WriteLine("context.Message.CompanyId " + context.Message.CompanyId); //Console.WriteLine("context.Message.CompanyId " + context.Message.MailID); OutMail outMail = outMailRepository.GetById(Convert.ToInt32(context.Message.MailID)); outMail.State = (int)MailState.Delivered; outMailRepository.Update(outMail); CompanyAccount companyAccount = companyAccountRepository.GetById(Convert.ToInt32(context.Message.CompanyId)); System.Threading.Thread.Sleep(1000); Console.WriteLine("MailProcess3 İşlemi Tamamlandı" + context.Message.MailID); return(Task.CompletedTask); }
/// <summary> /// 修改 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Update(BaseEntity p_Entity) { try { CompanyAccount MasterEntity = (CompanyAccount)p_Entity; if (MasterEntity.ID == 0) { return(0); } //更新主表数据 StringBuilder UpdateBuilder = new StringBuilder(); UpdateBuilder.Append("UPDATE Data_CompanyAccount SET "); UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ","); UpdateBuilder.Append(" CompanyID=" + SysString.ToDBString(MasterEntity.CompanyID) + ","); UpdateBuilder.Append(" Bank=" + SysString.ToDBString(MasterEntity.Bank) + ","); UpdateBuilder.Append(" Account=" + SysString.ToDBString(MasterEntity.Account) + ","); UpdateBuilder.Append(" SwifCode=" + SysString.ToDBString(MasterEntity.SwifCode) + ","); UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ","); UpdateBuilder.Append(" DelFlag=" + SysString.ToDBString(MasterEntity.DelFlag)); UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID)); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E); } }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); CompanyAccount entity = (CompanyAccount)p_BE; CompanyAccountCtl control = new CompanyAccountCtl(sqlTrans); control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 设置 /// </summary> public override void EntitySet() { CompanyAccount entity = new CompanyAccount(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); drpCompanyID.EditValue = entity.CompanyID; txtBank.Text = entity.Bank.ToString(); txtAccount.Text = entity.Account.ToString(); txtSwifCode.Text = entity.SwifCode.ToString(); txtRemark.Text = entity.Remark.ToString(); if (!findFlag) { } }
public Task Consume(ConsumeContext <IFileProcess1Finished> context) { Console.WriteLine($"Have new message. Process started."); Console.WriteLine("context.Message.CompanyId " + context.Message.CompanyId); Console.WriteLine("context.Message.CompanyId " + context.Message.FileID); OutFile outFile = outFileRepository.GetById(context.Message.FileID); outFile.State = (int)FileState.Delivered; outFileRepository.Update(outFile); OutFileDocumentModel outFileDocument = outFileDocumentRepository.Get(context.Message.FileID); var outFileBytes = outFileDocumentRepository.GetFile(outFileDocument.FileId); Console.WriteLine("File Size : " + outFileBytes.Length); CompanyAccount companyAccount = companyAccountRepository.GetById(Convert.ToInt32(context.Message.CompanyId)); System.Threading.Thread.Sleep(1000); Console.WriteLine("FileProcess3 İşlemi Tamamlandı"); return(Task.CompletedTask); }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); CompanyAccount entity = (CompanyAccount)p_BE; CompanyAccountCtl control = new CompanyAccountCtl(sqlTrans); //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Data_CompanyAccount,sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 绑定账号 /// </summary> /// <param name="company"></param> /// <returns></returns> public string BindCompanyAccount(CompanyAccount company) { try { CompanyAccount _company = this.GetTable <CompanyAccount>().SingleOrDefault(); if (_company != null) { this.GetTable <CompanyAccount>().DeleteOnSubmit(_company); this.SubmitChanges(); } this.GetTable <CompanyAccount>().InsertOnSubmit(company); this.SubmitChanges(); return(""); } catch { return("绑定失败。"); } }
public JsonResult CompanyAccountSetting(long id = 0, long eId = 0) { if (eId > 0) { var m = MongoHelper.Instance.FindOne <CompanyAccount>(eId); if (m != null) { return(Json(new { result = true, model = m })); } return(Json(new { result = false, model = "找不到相关记录!" })); } else { CompanyAccount model; if (id <= 0) { model = new CompanyAccount(); } else { model = MongoHelper.Instance.FindOne <CompanyAccount>(id); } UpdateModel(model); model.CreationDate = DateTime.Now; if (MongoHelper.Instance.Save(model)) { if (id <= 0) { return(Json(new { result = true, msg = "新增财务帐号成功!" })); } else { return(Json(new { result = true, msg = "更新财务帐号成功!" })); } } return(Json(new { result = false, msg = "提交财务帐号失败,请重试!" })); } }
/// <summary> /// 检查将要操作的数据是否符合业务规则 /// </summary> /// <param name="p_BE"></param> private void CheckCorrect(BaseEntity p_BE) { CompanyAccount entity = (CompanyAccount)p_BE; }
public JsonResult Create([Bind(Include = "CompanyAccountID,CompanyName,Adress,City,State,ZipCode,Fk_CountryID,Email,Phone,Fax,Mobile,ContactName,Fk_Agent")] CompanyAccount CompanyAccount, String[] Classification, String[] Notification) { GenerateId generator = new GenerateId(); CompanyAccount.CompanyAccountID = generator.generateID(); db.CompanyAccounts.Add(CompanyAccount); db.SaveChanges(); if (Classification != null) { ////Add classifications List <AccountClasificationRelation> classificationAccountList = new List <AccountClasificationRelation>(); foreach (var item in Classification) { var idClassification = db.AccountClasifications.Where(x => x.ClasificationName == item).Select(x => x.AccountClasificationID).SingleOrDefault(); AccountClasificationRelation classificacationItem = new AccountClasificationRelation(); classificacationItem.AccountClasificationID = generator.generateID(); classificacationItem.Fk_AccountID = CompanyAccount.CompanyAccountID; classificacationItem.Fk_ClasificationID = idClassification; classificationAccountList.Add(classificacationItem); } foreach (var item in classificationAccountList) { db.AccountClasificationRelations.Add(item); } } if (Notification != null) { ////Add notifications List <NotificationAccountRelation> notificationAccountList = new List <NotificationAccountRelation>(); foreach (var item in Notification) { var idNotification = db.Notifications.Where(x => x.NotificationName == item).Select(x => x.NotificationID).SingleOrDefault(); NotificationAccountRelation notificationItem = new NotificationAccountRelation(); notificationItem.NotificationAccountRelation1 = generator.generateID(); notificationItem.Fk_Account = CompanyAccount.CompanyAccountID; notificationItem.Fk_Notification = idNotification; notificationAccountList.Add(notificationItem); } foreach (var item in notificationAccountList) { db.NotificationAccountRelations.Add(item); } } var account = new { CompanyAccountID = CompanyAccount.CompanyAccountID, CompanyName = CompanyAccount.ContactName, Adress = CompanyAccount.Adress, City = CompanyAccount.City, State = CompanyAccount.State, }; db.SaveChanges(); return(Json(new { data = account }, JsonRequestBehavior.AllowGet)); }
public CompanyAccount ReadComapnyAccount() { CompanyAccount company = this.GetTable <CompanyAccount>().SingleOrDefault(); return(company); }
public ResponseDTO <List <StorageServiceDTO> > CheckSubscription(RequestDTO <string> request) { ResponseDTO <List <StorageServiceDTO> > response = new ResponseDTO <List <StorageServiceDTO> >(); MFPDevice mfpDevice = null; CompanyAccount companyAccount = null; List <StorageServiceEnrollment> storageServiceEnrollmentList = null; List <StorageServiceDTO> storageServiceList = new List <StorageServiceDTO>(); try { mfpDevice = unitOfWork.MFPDeviceRepository.Get(x => x.MFPDeviceSerialNumber == request.Data).FirstOrDefault(); if (mfpDevice != null) { companyAccount = unitOfWork.CompanyAccountRepository.Get(c => c.CompanyID == mfpDevice.CompanyID).FirstOrDefault(); } if (mfpDevice == null) { response.Message = "Device not registered."; } else if (mfpDevice != null && (DateTime.Compare(mfpDevice.MFPDevicDeactivationDate, DateTime.UtcNow) < 0)) { response.Message = "Device Deactivated."; } else if (companyAccount == null) { response.Message = "Company not registered."; } else if (companyAccount != null && (DateTime.Compare(companyAccount.SubscriptionEndDate, DateTime.UtcNow) < 0)) { response.Message = "Company subscription expired."; } else { storageServiceEnrollmentList = unitOfWork.StorageServiceEnrollmentRepository.Get(c => c.MFPDeviceID == mfpDevice.MFPDeviceID).ToList(); foreach (StorageServiceEnrollment storageServiceEnrollment in storageServiceEnrollmentList) { URLListing urlListing = null; if (companyAccount != null && storageServiceEnrollment != null) { urlListing = unitOfWork.URLListingRepository.Get(x => x.CompanyID == companyAccount.CompanyID && x.ServiceID == storageServiceEnrollment.ServiceID).FirstOrDefault(); } StorageService storageService = unitOfWork.StorageServiceRepository.Get(x => x.ServiceID == storageServiceEnrollment.ServiceID).FirstOrDefault(); if (storageService != null) { StorageServiceDTO dto = new StorageServiceDTO { ServiceID = storageService.ServiceID, ServiceName = storageService.ServiceName, ServiceAPIURL = urlListing != null ? urlListing.ServiceAPIURL : "", ServiceSiteURL = urlListing != null ? urlListing.ServiceSiteURL : "", ServiceType = storageService.ServiceType, }; storageServiceList.Add(dto); } } } response.Data = storageServiceList; if (storageServiceList != null && storageServiceList.Count > 0) { response.Status = ResponseStatusEnum.SUCCESS; } else { response.Status = ResponseStatusEnum.ERROR; } } catch (Exception) { response.Data = null; response.Status = ResponseStatusEnum.ERROR; } return(response); }