public FileTransferMethod GetFileTransferMethod(long submittedJobInfoId, AdaptorUser loggedUser) { log.Info("Getting file transfer method for submitted job info ID " + submittedJobInfoId + " with user " + loggedUser.GetLogIdentification()); SubmittedJobInfo jobInfo = LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetSubmittedJobInfoById(submittedJobInfoId, loggedUser); var certificateGenerator = new CertificateGenerator.CertificateGenerator(); certificateGenerator.GenerateKey(2048); string publicKey = certificateGenerator.DhiPublicKey(); string jobDir = FileSystemUtils.GetJobClusterDirectoryPath(jobInfo.Specification.FileTransferMethod.Cluster.LocalBasepath, jobInfo.Specification); var transferMethod = new FileTransferMethod { Protocol = jobInfo.Specification.FileTransferMethod.Protocol, ServerHostname = jobInfo.Specification.FileTransferMethod.ServerHostname, SharedBasePath = jobDir, Credentials = new AsymmetricKeyCredentials { Username = jobInfo.Specification.ClusterUser.Username, PrivateKey = certificateGenerator.DhiPrivateKey(), PublicKey = publicKey } }; SchedulerFactory.GetInstance(jobInfo.Specification.Cluster.SchedulerType).CreateScheduler(jobInfo.Specification.Cluster).AllowDirectFileTransferAccessForUserToJob(publicKey, jobInfo); return(transferMethod); }
private void method_0() { var action = (ShopNum1_Address_Action)LogicFactory.CreateShopNum1_Address_Action(); try { string str = string.Empty; if (!string.IsNullOrEmpty(base.MemLoginID)) { str = str + " AND MemLoginID= '" + base.MemLoginID + "' "; } var commonModel = new CommonPageModel { Condition = " AND 1=1 " + str + " AND IsDeleted=0", Currentpage = pageid, Tablename = "ShopNum1_Address", Resultnum = "0", PageSize = PageSize }; DataTable table = action.SelectAddress_List(commonModel); var pl = new PageList1 { PageSize = Convert.ToInt32(PageSize), PageID = Convert.ToInt32(pageid) }; if ((table != null) && (table.Rows.Count > 0)) { pl.RecordCount = Convert.ToInt32(table.Rows[0][0]); } else { pl.RecordCount = 0; } pageDiv.InnerHtml = new PageListBll("main/Account/A_ShipAddress.aspx", true).GetPageListNew(pl); commonModel.Resultnum = "1"; DataTable table3 = action.SelectAddress_List(commonModel); if (table3.Rows.Count > 0) { rep_Address.DataSource = table3.DefaultView; rep_Address.DataBind(); } else { Rep_NoValue.Visible = true; rep_Address.Visible = false; var table2 = new DataTable(); table2.Columns.Add("NoValue", typeof(string)); DataRow row = table2.NewRow(); row["NoValue"] = "暂无信息"; table2.Rows.Add(row); Rep_NoValue.DataSource = table2; Rep_NoValue.DataBind(); } } catch (Exception) { throw; } }
public IList <JobFileContent> DownloadPartsOfJobFilesFromCluster(long submittedJobInfoId, TaskFileOffset[] taskFileOffsets, AdaptorUser loggedUser) { log.Info("Getting part of job files from cluster for submitted job info ID " + submittedJobInfoId + " with user " + loggedUser.GetLogIdentification()); SubmittedJobInfo jobInfo = LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetSubmittedJobInfoById(submittedJobInfoId, loggedUser); IRexFileSystemManager fileManager = FileSystemFactory.GetInstance(jobInfo.Specification.FileTransferMethod.Protocol).CreateFileSystemManager(jobInfo.Specification.FileTransferMethod); IList <JobFileContent> result = new List <JobFileContent>(); foreach (SubmittedTaskInfo taskInfo in jobInfo.Tasks) { IList <TaskFileOffset> currentTaskFileOffsets = (from taskFileOffset in taskFileOffsets where taskFileOffset.SubmittedTaskInfoId == taskInfo.Id select taskFileOffset).ToList(); foreach (TaskFileOffset currentOffset in currentTaskFileOffsets) { ICollection <JobFileContent> contents = fileManager.DownloadPartOfJobFileFromCluster(taskInfo, currentOffset.FileType, currentOffset.Offset); if (contents != null) { foreach (JobFileContent content in contents) { result.Add(content); } } } } return(result); }
public MainForm() { InitializeComponent(); Assembly assembly = Assembly.GetExecutingAssembly(); FileInfo fileInfo = new FileInfo(assembly.Location); string databaseFilePath = Path.Combine(fileInfo.DirectoryName, "IPL.sqlite"); string appDataPertagasPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Pertagas"); if (!Directory.Exists(appDataPertagasPath)) { Directory.CreateDirectory(appDataPertagasPath); } if (!File.Exists(Path.Combine(appDataPertagasPath, "IPL.sqlite"))) { File.Copy(databaseFilePath, Path.Combine(appDataPertagasPath, "IPL.sqlite")); } databaseFilePath = Path.Combine(appDataPertagasPath, "IPL.sqlite"); ProgressTrackerForm trackerForm = new ProgressTrackerForm(); trackerForm.ProcessInformation = "Mengkonfigurasi database..."; trackerForm.Task = new ProgressTrackerForm.BackgroundTask( () => { LogicFactory.Initialize(databaseFilePath); }); trackerForm.ShowDialog(); this.FormClosed += MainForm_FormClosed; }
protected void BindPayment() { sel_PayMent.Items.Clear(); sel_PayMentType.Items.Clear(); DataTable table = ((ShopNum1_Payment_Action)LogicFactory.CreateShopNum1_Payment_Action()).SearchByShop(1); var item = new ListItem { Text = "-请选择支付方式-", Value = "-1" }; sel_PayMent.Items.Add(item); sel_PayMentType.Items.Add(item); if (table != null) { foreach (DataRow row in table.Rows) { var item2 = new ListItem(); if (row["Name"].ToString().Trim() != "金币(BV)支付") { item2.Text = row["Name"].ToString().Trim(); item2.Value = row["Guid"].ToString().Trim(); sel_PayMent.Items.Add(item2); sel_PayMentType.Items.Add(item2); } } } }
private void btn_UpPwd_Click(object sender, EventArgs e) { var action = (ShopNum1_Member_Action)LogicFactory.CreateShopNum1_Member_Action(); string str = Encryption.GetMd5Hash(Input_OldPwd.Value.Trim()); string newPwd = Encryption.GetMd5Hash(Input_NewPwd.Value.Trim()); string str3 = Encryption.GetMd5Hash(Input_NewSecondPwd.Value.Trim()); if (action.CheckPassword(base.MemLoginID, str) > 0) { if (newPwd == str3) { if (action.UpdatePwd(base.MemLoginID, newPwd) > 0) { MessageBox.Show("修改成功"); } else { MessageBox.Show("修改失败"); } } } else { MessageBox.Show("旧密码错误"); } }
protected void btn_Image_Click(object sender, EventArgs e) { int imageWidth = int.Parse(txt_width.Text); int imageHeight = int.Parse(txt_height.Text); int pOrigStartPointY = int.Parse(txt_top.Text); int pOrigStartPointX = int.Parse(txt_left.Text); int pPartWidth = int.Parse(txt_DropWidth.Text); int pPartHeight = int.Parse(txt_DropHeight.Text); string str = CutPhotoHelp.SaveCutPic(Page.Server.MapPath(ImageIcon.ImageUrl), Page.Server.MapPath(string_1), 0, 0, pPartWidth, pPartHeight, pOrigStartPointX, pOrigStartPointY, imageWidth, imageHeight); imgphoto.ImageUrl = string_1 + str; var action = (ShopNum1_Member_Action)LogicFactory.CreateShopNum1_Member_Action(); string path = action.SearchByMemLoginID(base.MemLoginID).Rows[0]["Photo"].ToString(); try { if (path != "") { File.Delete(Page.Server.MapPath(path)); } } catch { } finally { action.UpdatePhoto(base.MemLoginID, string_1 + str); File.Delete(Page.Server.MapPath(hid_imgValue.Value)); Page.ClientScript.RegisterStartupScript(typeof(A_LoadUserPhoto), "setPic", "<script type='text/javascript'>setPic('" + imgphoto.ImageUrl + "');</script>"); } }
public AccountsApiController() { LogicFactory lf = new LogicFactory(); this.accLogic = lf.GetAccountLogic(); this.mapper = Models.MapperFactory.CreateMapper(); }
protected override void InitializeSkin(Control skin) { LinkButtonEmail = (LinkButton)skin.FindControl("LinkButtonEmail"); LinkButtonMobile = (LinkButton)skin.FindControl("LinkButtonMobile"); DataTable memInfo = ((ShopNum1_Member_Action)LogicFactory.CreateShopNum1_Member_Action()).GetMemInfo(base.MemLoginID); string str = memInfo.Rows[0]["IsEmailActivation"].ToString(); string str2 = memInfo.Rows[0]["Email"].ToString(); string str3 = memInfo.Rows[0]["IsMobileActivation"].ToString(); string str4 = memInfo.Rows[0]["Mobile"].ToString(); if (str != "1") { LinkButtonEmail.Text = "绑定邮箱之后,可以设置交易密码"; LinkButtonEmail.PostBackUrl = "../A_BindEmail.aspx?Type=3&Email=" + str2; } else { LinkButtonEmail.PostBackUrl = "../A_CheckEmail.aspx"; } if (str3 != "1") { LinkButtonMobile.Text = "账号绑定手机之后,可以设置交易密码"; LinkButtonMobile.PostBackUrl = "../A_BindMobile.aspx?Type=3&Mobile=" + str4; } else { LinkButtonMobile.PostBackUrl = "../A_CheckMobile.aspx"; } }
public HomeController(ILogger <HomeController> logger) { _logger = logger; _offeredServiceLogic = LogicFactory.CreateOfferedServiceLogic(); _userLogic = LogicFactory.CreateUserLogic(); _imageLogic = LogicFactory.CreateImageLogic(); _categoryLogic = LogicFactory.CreateCategoryLogic(); }
internal static AdaptorUser GetUserForSessionCode(string sessionCode, IUnitOfWork unitOfWork) { IUserAndLimitationManagementLogic authenticationLogic = LogicFactory.GetLogicFactory().CreateUserAndLimitationManagementLogic(unitOfWork); AdaptorUser loggedUser = authenticationLogic.GetUserForSessionCode(sessionCode); return(loggedUser); }
public AdminController() { _userLogic = LogicFactory.CreateUserLogic(); _offeredServiceLogic = LogicFactory.CreateOfferedServiceLogic(); _usedServiceLogic = LogicFactory.CreateUsedServiceLogic(); _imageLogic = LogicFactory.CreateImageLogic(); _reviewLogic = LogicFactory.CreateReviewLogic(); }
protected override void InitializeSkin(Control skin) { nextEmail = (Label)skin.FindControl("nextEmail"); Lab_MemLoginID = (Label)skin.FindControl("Lab_MemLoginID"); var action = (ShopNum1_Member_Action)LogicFactory.CreateShopNum1_Member_Action(); nextEmail.Text = action.GetAdvancePayment(base.MemLoginID).Rows[0]["Email"].ToString(); }
/// <summary> /// Enqueues a test assembly. /// </summary> /// <param name="testAssembly">The test assembly metadata.</param> /// <param name="runFilter">The run filter settings for the test assembly's run.</param> public void EnqueueTestAssembly(IAssembly testAssembly, TestRunFilter runFilter) { AssemblyManager assemblyManager = LogicFactory.CreateAssemblyManager(testAssembly.Provider, runFilter, testAssembly); _harnessTasks.Enqueue(assemblyManager); _knownTestMethods = CalculateTotalMethods(assemblyManager, testAssembly, runFilter); ++_validTestAssemblies; }
public ReleaseController(IHostingEnvironment he, IConfiguration configuration) { this.he = he; mapper = new ReleaseMapper(LogicFactory.CreateTimeCalculationLogic()); releaseLogic = LogicFactory.CreateReleaseLogic(); commentLogic = LogicFactory.CreateCommentLogic(); timeLogic = LogicFactory.CreateTimeCalculationLogic(); }
public MarketController() { _offeredServiceLogic = LogicFactory.CreateOfferedServiceLogic(); _userLogic = LogicFactory.CreateUserLogic(); _categoryLogic = LogicFactory.CreateCategoryLogic(); _imageLogic = LogicFactory.CreateImageLogic(); _reviewLogic = LogicFactory.CreateReviewLogic(); }
public GameManager() { Ui = new UI(); var moveCheck = LogicFactory.CreateIMoveChecker(); var checkChecker = LogicFactory.CreateICheckChecker(); Board = new Board(moveCheck, checkChecker); Billy = new Brain(checkChecker, moveCheck); }
/// <summary> /// Get user for given <paramref name="sessionCode"/> and check if the user has <paramref name="requiredUserRole"/>. /// </summary> /// <param name="sessionCode">User session code.</param> /// <param name="unitOfWork">Unit of work.</param> /// <param name="requiredUserRole">Required user role.</param> /// <returns>AdaptorUser object if user has required user role.</returns> /// <exception cref="InsufficientRoleException">Is thrown if the user doesn't have <paramref name="requiredUserRole"/>.</exception> internal static AdaptorUser GetValidatedUserForSessionCode(string sessionCode, IUnitOfWork unitOfWork, UserRoleType requiredUserRole) { IUserAndLimitationManagementLogic authenticationLogic = LogicFactory.GetLogicFactory().CreateUserAndLimitationManagementLogic(unitOfWork); AdaptorUser loggedUser = authenticationLogic.GetUserForSessionCode(sessionCode); CheckUserRole(loggedUser, requiredUserRole); return(loggedUser); }
protected override void InitializeSkin(Control skin) { M_code = (HtmlInputText)skin.FindControl("M_code"); nextmobile = (Label)skin.FindControl("nextmobile"); Lab_MemLoginID = (Label)skin.FindControl("Lab_MemLoginID"); var action = (ShopNum1_Member_Action)LogicFactory.CreateShopNum1_Member_Action(); nextmobile.Text = action.GetAdvancePayment(base.MemLoginID).Rows[0]["Mobile"].ToString(); }
private void method_0() { var action = (ShopNum1_AdvancePaymentModifyLog_Action)LogicFactory.CreateShopNum1_AdvancePaymentModifyLog_Action(); try { string str = string.Empty; str = method_1(str); var commonModel = new CommonPageModel { Condition = " AND 1=1 " + str, Currentpage = pageid, Tablename = "ShopNum1_AdvancePaymentModifyLog", Resultnum = "0", PageSize = PageSize }; DataTable table = action.SelectAdvPaymentModifyLog_List(commonModel); var pl = new PageList1 { PageSize = Convert.ToInt32(PageSize), PageID = Convert.ToInt32(pageid) }; if ((table != null) && (table.Rows.Count > 0)) { pl.RecordCount = Convert.ToInt32(table.Rows[0][0]); } else { pl.RecordCount = 0; } pageDiv.InnerHtml = new PageListBll("main/Account/A_AdPayDetailList.aspx?", true).GetPageListNew(pl); commonModel.Resultnum = "1"; DataTable table2 = action.SelectAdvPaymentModifyLog_List(commonModel); Rep_PayA_AdPayDetailList.DataSource = table2.DefaultView; Rep_PayA_AdPayDetailList.DataBind(); int num = 0; string str3 = Common.Common.GetNameById("COUNT(Guid)", "ShopNum1_AdvancePaymentModifyLog", str); if (!string.IsNullOrEmpty(str3)) { num = Convert.ToInt32(str3); } lab_PayNum.Text = num.ToString(); decimal num2 = 0M; string str2 = Common.Common.GetNameById("SUM(OperateMoney)", "ShopNum1_AdvancePaymentModifyLog", str); if (!string.IsNullOrEmpty(str2)) { num2 = Convert.ToDecimal(str2); } lab_PayDetail.Text = num2.ToString(); } catch { } }
public AccountsController() { LogicFactory lf = new LogicFactory(); this.accLogic = lf.GetAccountLogic(); this.mapper = Models.MapperFactory.CreateMapper(); this.vm = new AccountsViewModel(); vm.CurrentlyEdited = new Account(); vm.AccountsInDatabase = mapper.Map <IEnumerable <CarRental.Logic.DTO.Account>, IEnumerable <CarRental.Web.Models.Account> >(this.accLogic.GetAccountData()); }
/// <summary> /// Initializes a new instance of the <see cref="Display"/> class. /// </summary> public Display() { LogicFactory lf = new LogicFactory(); this.accLogic = lf.GetAccountLogic(); this.carLogic = lf.GetCarLogic(); this.licenseLogic = lf.GetLicenseLogic(); this.rentLogic = lf.GetRentLogic(); this.complaintLogic = lf.GetComplaintLogic(); this.businessLogic = lf.GetBusinessLogic(); }
protected override void RunTask() { using IUnitOfWork unitOfWork = new DatabaseUnitOfWork(); var dataTransferLogic = LogicFactory.GetLogicFactory().CreateDataTransferLogic(unitOfWork); var taskIds = dataTransferLogic.GetTaskIdsWithOpenTunnels(); LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetAllFinishedTaskInfos(taskIds) .ToList() .ForEach(f => dataTransferLogic.CloseAllTunnelsForTask(f)); }
private void btn_Save_Click(object sender, EventArgs e) { if (txt_Address.Value == "") { MessageBox.Show("地址不能为空"); } else if (txt_Post.Value == "") { MessageBox.Show("邮编不能为空"); } else { ShopNum1_Member member; var action = (ShopNum1_Member_Action)LogicFactory.CreateShopNum1_Member_Action(); member = new ShopNum1_Member { AddressCode = hid_AreaCode.Value, AddressValue = hid_AreaValue.Value, Address = txt_Address.Value, Area = string.Empty, //GetAdress(member.AddressValue, member.Address), WebSite = txt_WebSite.Value, Fax = txt_Fax.Value, ModifyUser = StrMemLoginID, ModifyTime = DateTime.Now }; if (txt_Bth.Value != "") { member.Birthday = DateTime.Parse(txt_Bth.Value); DateTime?birthday = member.Birthday; DateTime now = DateTime.Now; if (birthday.HasValue ? (birthday.GetValueOrDefault() > now) : false) { MessageBox.Show("出生日期填写有误"); return; } } else { member.Birthday = DateTime.Now; } member.Vocation = txt_Voc.Value; member.Postalcode = txt_Post.Value; try { if (action.UpdateMemInfoDetail(StrMemLoginID, member) > 0) { MessageBox.Show("信息补充成功"); } } catch { } } }
private double?GetResourceUsageForUser(AdaptorUser user, DateTime startTime, DateTime endTime, out ICollection <NodeTypeAggregatedUsage> nodeTypeAggregatedUsage) { double?userTotalUsage = 0; var selectedJobs = LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork) .GetJobsForUser(user).Where(w => w.SubmitTime >= startTime && w.SubmitTime <= endTime) .ToList(); nodeTypeAggregatedUsage = new List <NodeTypeAggregatedUsage>(); if (selectedJobs is null) { return(default);
public async Task <string> AuthenticateUserAsync(AuthenticationCredentialsExt credentials) { try { AuthenticationCredentials credentialsIn; if (credentials is PasswordCredentialsExt) { credentialsIn = new PasswordCredentials { Username = credentials.Username, Password = ((PasswordCredentialsExt)credentials).Password }; } else if (credentials is DigitalSignatureCredentialsExt) { credentialsIn = new DigitalSignatureCredentials { Username = credentials.Username, DigitalSignature = Array.ConvertAll(((DigitalSignatureCredentialsExt)credentials).DigitalSignature, b => unchecked ((byte)b)), SignedContent = CombineContentWithSalt(credentials.Username) }; } else if (credentials is OpenIdCredentialsExt openIdCredentials) { //Username is extracted from the access_token later. credentialsIn = new OpenIdCredentials { OpenIdAccessToken = openIdCredentials.OpenIdAccessToken, }; } else { log.Error("Credentials of class " + credentials.GetType().Name + " are not supported. Change the HaaSMiddleware.ServiceTier.UserAndLimitationManagement.UserAndLimitationManagementService.AuthenticateUser() method to add support for additional credential types."); throw new ArgumentException("Credentials of class " + credentials.GetType().Name + " are not supported. Change the HaaSMiddleware.ServiceTier.UserAndLimitationManagement.UserAndLimitationManagementService.AuthenticateUser() method to add support for additional credential types."); } using (IUnitOfWork unitOfWork = UnitOfWorkFactory.GetUnitOfWorkFactory().CreateUnitOfWork()) { IUserAndLimitationManagementLogic userLogic = LogicFactory.GetLogicFactory().CreateUserAndLimitationManagementLogic(unitOfWork); var result = await userLogic.AuthenticateUserAsync(credentialsIn); return(result); } } catch (Exception exc) { ExceptionHandler.ThrowProperExternalException(exc); return(null); } }
protected string GetWebFilePath() { ((ShopNum1_Member_Action)LogicFactory.CreateShopNum1_Member_Action()).SearchByMemLoginID(base.MemLoginID); DateTime.Now.ToString("yyyy-MM-dd"); string path = "/ImgUpload/MemberImage/"; if (!Directory.Exists(Page.Server.MapPath(path))) { Directory.CreateDirectory(Page.Server.MapPath(path)); } return(path); }
public ICollection <FileInformation> ListChangedFilesForJob(long submittedJobInfoId, AdaptorUser loggedUser) { SubmittedJobInfo jobInfo = LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetSubmittedJobInfoById(submittedJobInfoId, loggedUser); if (jobInfo.State < JobState.Submitted || jobInfo.State == JobState.WaitingForServiceAccount) { return(null); } IRexFileSystemManager fileManager = FileSystemFactory.GetInstance(jobInfo.Specification.FileTransferMethod.Protocol).CreateFileSystemManager(jobInfo.Specification.FileTransferMethod); return(fileManager.ListChangedFilesForJob(jobInfo, jobInfo.SubmitTime.Value)); }
public void GetCurrentArticle() { //Arrange IArticleLogic logic = LogicFactory.CreateArticleMemoryLogic(); Article article = logic.GetCurrentArticle(3); //Act int expected = 3; int actual = article.ArticleId; //Assert Assert.AreEqual(expected, actual); }
public void GetAllArticles() { //Arrange IArticleLogic logic = LogicFactory.CreateArticleMemoryLogic(); List <Article> AllArticles = logic.GetAllArticles(); //Act int expected = 2; int actual = AllArticles.Count(); //Assert Assert.AreEqual(expected, actual); }
public ISubsystemLogic() { logics = new LogicFactory(); }