public async Task <ProjectModule> AddProjectModule(ProjectModule value) { await context.ProjectModule.AddAsync(value); context.SaveChanges(); return(value); }
internal void UpdateCurrent(ProjectModule newValue) { ToolboxModule newCurrent = null; foreach (ToolboxDrawer drawer in drawers) { foreach (ToolboxItem rawItem in drawer.GetContents()) { ToolboxModule item = rawItem as ToolboxModule; if (item != null && item.Module == newValue) { newCurrent = item; } } } ToolboxModule oldCurrent = currentModule; if (oldCurrent != newCurrent) { if (oldCurrent != null && oldCurrent.Name.EndsWith("*")) { oldCurrent.SetName(oldCurrent.Name.Substring(0, oldCurrent.Name.Length - 1)); OnToolboxChanged(ToolboxChangedArgs.ChangeTypes.ItemRenamed, oldCurrent); } if (newCurrent != null) { newCurrent.SetName(newCurrent.Name + "*"); OnToolboxChanged(ToolboxChangedArgs.ChangeTypes.ItemRenamed, newCurrent); } currentModule = newCurrent; } }
private void InitModuleNode(ref TreeNode tn) { tn.Nodes.Clear(); ProjectModule pm = (ProjectModule)tn.Tag; var ms = from m in JianLiLinq.Default.DB.ProjectModules where m.Parent == pm.ID select m; foreach (ProjectModule module in ms) { TreeNode stn = new TreeNode(); stn.Text = module.Name; stn.Tag = module; stn.Nodes.Add(placeholder); stn.ForeColor = Color.Blue; tn.Nodes.Add(stn); } var ts = from t in JianLiLinq.Default.DB.Tasks where t.Parent == pm.ID select t; foreach (Task task in ts) { TreeNode stn = new TreeNode(); stn.Text = task.Title; stn.Tag = task; stn.Nodes.Add(placeholder); tn.Nodes.Add(stn); } }
public async Task <bool> DeleteProjectModule(ProjectModule value) { context.Remove(value); await context.SaveChangesAsync(); return(true); }
public ProjectOverview() { ISqlHelperBase sqlHelperBase = new SqlHelperBase(new ServerLogger()); projectModule = new ProjectModule(sqlHelperBase); timeLogModule = new TimeLogModule(sqlHelperBase); }
protected override void LoadChildren(List <NodeViewModel> children) { if (_assembly == null) { return; } // Modules foreach (var module in _assembly.Modules) { if (!module.Image.IsILOnly) { continue; } AD.ProjectModule projectModule; if (!_projectAssembly.Modules.TryGetValue(module.Name, out projectModule)) { projectModule = new ProjectModule(); } var moduleViewModel = new ModuleViewModel(module, projectModule, this); children.Add(moduleViewModel); } // Resources if (_assembly.Resources.Count > 0) { var resourceFolderViewModel = new ResourceFolderViewModel(_assembly, _projectAssembly, this); children.Add(resourceFolderViewModel); } }
public void SetView(ProjectModule module, LayoutSimulation sim) { if (module.Implementation is LayoutModel) { LayoutModel layoutModel = (LayoutModel)module.Implementation; LayoutSimulation layoutSim; if (sim != null) { layoutSim = sim; moduleSimulations[module] = sim; } else if (!moduleSimulations.TryGetValue(module, out layoutSim)) { SimulationModel simModel = new SimulationModel(); layoutSim = new LayoutSimulation(simModel, layoutModel); moduleSimulations[module] = layoutSim; } SimulationThread newThread = new SimulationThread(layoutSim.SimulationModel); newThread.Start(); SimulationThread oldThread = simThread; simThread = newThread; if (oldThread != null) { oldThread.RequestStop(); } this.CurrentModule = module; ToolboxModel.UpdateCurrent(module); LayoutCanvas.SetView(layoutModel, layoutSim); } else { throw new InvalidOperationException("cannot view this module type"); } }
/// <summary> /// Parses the rules' patterns. /// </summary> /// <param name="proj">The project.</param> /// <param name="module">The module description.</param> /// <param name="context">The working context.</param> /// <returns>Parsed rule patterns.</returns> /// <exception cref="System.ArgumentException"> /// One of the rules has invalid pattern. /// </exception> protected Rules ParseRules(ConfuserProject proj, ProjectModule module, ConfuserContext context) { var ret = new Rules(); var parser = new PatternParser(); foreach (Rule rule in proj.Rules.Concat(module.Rules)) { try { ret.Add(rule, parser.Parse(rule.Pattern)); } catch (InvalidPatternException ex) { context.Logger.ErrorFormat("Invalid rule pattern: " + rule.Pattern + ".", ex); throw new ConfuserException(ex); } foreach (var setting in rule) { if (!protections.ContainsKey(setting.Id)) { context.Logger.ErrorFormat("Cannot find protection with ID '{0}'.", setting.Id); throw new ConfuserException(null); } } } return(ret); }
public void AddModule(IGenericMenuCallback callback) { String name = callback.RequestString("Add Module", "Name for new module:"); if (name != null) { bool success; Transaction xn = new Transaction(); IProjectAccess proj = xn.RequestWriteAccess(window.Project); using (xn.Start()) { ProjectModule cur = proj.GetModule(name); if (cur == null) { success = true; proj.AddModule(name, new LayoutModel()); } else { success = false; } } if (!success) { callback.Notify("Cannot Add", "Cannot add second module of same name."); } } }
public TimeTracking() { ISqlHelperBase sqlHelperBase = new SqlHelperBase(new ServerLogger()); projectModule = new ProjectModule(sqlHelperBase); timeLogModule = new TimeLogModule(sqlHelperBase); }
public ActionResult DeleteprojectModuleConfirmed(int id) { if (!homeController.Authenticated) { return(RedirectToAction("Index", "home")); } ProjectModule projectModule = db.ProjectModule.Find(id); if (projectModule != null) { int pid = projectModule.Project_ID; db.Database.ExecuteSqlCommand("delete from Employee_Request where Project_ID = @pid", new SqlParameter("@pid", pid)); db.Database.ExecuteSqlCommand("delete from WorksOn where ProjectID = @pid", new SqlParameter("@pid", pid)); db.Database.ExecuteSqlCommand("delete from MT_Evaluation where Project_ID = @pid", new SqlParameter("@pid", pid)); db.Database.ExecuteSqlCommand("delete from MD_Cust_Request where Project_ID = @pid", new SqlParameter("@pid", pid)); db.ProjectModule.Remove(projectModule); db.SaveChanges(); Response.Write("<script>alert('You Leaved Project Successfully .');</script>"); Session["msg10"] = "<script>alert('You Leaved Project Successfully !');</script>"; return(RedirectToAction("Index")); } else { int pid = id; db.Database.ExecuteSqlCommand("delete from Employee_Request where Project_ID = @pid", new SqlParameter("@pid", pid)); db.Database.ExecuteSqlCommand("delete from WorksOn where ProjectID = @pid", new SqlParameter("@pid", pid)); db.Database.ExecuteSqlCommand("delete from MT_Evaluation where Project_ID = @pid", new SqlParameter("@pid", pid)); db.Database.ExecuteSqlCommand("delete from MD_Cust_Request where Project_ID = @pid", new SqlParameter("@pid", pid)); Response.Write("<script>alert('You Leaved Project Successfully .');</script>"); Session["msg10"] = "<script>alert('You Leaved Project Successfully !');</script>"; return(RedirectToAction("Index")); } }
public void GestureComplete(IPointerEvent evnt) { Location cur = current; if (currentValid) { // Console.WriteLine("**** Adding {0} ****", master.GetType().Name); layoutModel.Execute((ILayoutAccess lo) => { if (master is ModuleComponent) { ProjectModule sub = ((ModuleComponent)master).Module; if (sub.HasDescendent(lo.Layout)) { return; } } Component clone = lo.AddComponent(master, cur.X, cur.Y); WireTools.CheckForSplits(lo, layoutModel.WiringPoints, new Component[] { clone }); }); } this.current = new Location(0, 0); this.currentValid = false; OnGestureCompleteEvent(true); layoutModel.Gesture = null; evnt.RepaintCanvas(); }
private static ProjectModule GetOrCreateProjectModule(ConfuserProject project, string assemblyPath, bool isExternal = false) { var assemblyFileName = Path.GetFileName(assemblyPath); var assemblyName = Path.GetFileNameWithoutExtension(assemblyPath); foreach (var module in project) { if (string.Equals(module.Path, assemblyFileName) || string.Equals(module.Path, assemblyName)) { return(module); } } if (assemblyPath.StartsWith(project.BaseDirectory)) { assemblyPath = assemblyPath.Substring(project.BaseDirectory.Length).TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); } var result = new ProjectModule { Path = assemblyPath, IsExternal = isExternal }; project.Add(result); return(result); }
/// <summary> /// Load the custom editing settings from the given project. The settings will change extension specific /// properties for this edit tool sample. /// </summary> /// <param name="projectID">Project ID</param> /// <returns></returns> private async Task LoadProjectSettingsAsync(int projectID) { // clear any existing settings if (Settings != null) { Settings.Clear(); } else { Settings = new Dictionary <string, string>(); } // reset the module level variable GenerateComment = false; // retrieve the module settings string projectSettings = await ProjectModule.GetModuleSettingsAsync(projectID, MODULE_NAME); if (String.IsNullOrEmpty(projectSettings)) { return; } // create a XDocument from the stored string XDocument projectSettingsXDoc = XDocument.Parse(projectSettings); // turn the XDocument into a dictionary Settings = projectSettingsXDoc.Root.Descendants().ToDictionary(c => c.Name.LocalName, c => c.Value); if (Settings.ContainsKey(GENCOMMENT_NAME)) { GenerateComment = Convert.ToBoolean(Settings[GENCOMMENT_NAME]); } }
void MarkModule(ProjectModule projModule, ModuleDefMD module, Rules rules, bool isMain) { string snKeyPath = projModule.SNKeyPath, snKeyPass = projModule.SNKeyPassword; var stack = new ProtectionSettingsStack(context, protections); var layer = new List<ProtectionSettingsInfo>(); // Add rules foreach (var rule in rules) layer.Add(ToInfo(rule.Key, rule.Value)); // Add obfuscation attributes foreach (var attr in ReadObfuscationAttributes(module.Assembly)) { if (string.IsNullOrEmpty(attr.FeatureName)) { ProtectionSettingsInfo info; if (ToInfo(attr, out info)) layer.Add(info); } else if (attr.FeatureName.Equals("generate debug symbol", StringComparison.OrdinalIgnoreCase)) { if (!isMain) throw new ArgumentException("Only main module can set 'generate debug symbol'."); project.Debug = bool.Parse(attr.FeatureValue); } else if (attr.FeatureName.Equals("random seed", StringComparison.OrdinalIgnoreCase)) { if (!isMain) throw new ArgumentException("Only main module can set 'random seed'."); project.Seed = attr.FeatureValue; } else if (attr.FeatureName.Equals("strong name key", StringComparison.OrdinalIgnoreCase)) { snKeyPath = Path.Combine(project.BaseDirectory, attr.FeatureValue); } else if (attr.FeatureName.Equals("strong name key password", StringComparison.OrdinalIgnoreCase)) { snKeyPass = attr.FeatureValue; } else if (attr.FeatureName.Equals("packer", StringComparison.OrdinalIgnoreCase)) { if (!isMain) throw new ArgumentException("Only main module can set 'packer'."); new ObfAttrParser(packers).ParsePackerString(attr.FeatureValue, out packer, out packerParams); } else if (attr.FeatureName.Equals("external module", StringComparison.OrdinalIgnoreCase)) { if (!isMain) throw new ArgumentException("Only main module can add external modules."); var rawModule = new ProjectModule { Path = attr.FeatureValue }.LoadRaw(project.BaseDirectory); extModules.Add(rawModule); } else { AddRule(attr, layer); } } if (project.Debug) { module.LoadPdb(); } snKeyPath = snKeyPath == null ? null : Path.Combine(project.BaseDirectory, snKeyPath); var snKey = LoadSNKey(context, snKeyPath, snKeyPass); context.Annotations.Set(module, SNKey, snKey); using (stack.Apply(module, layer)) ProcessModule(module, stack); }
public static void CreateFile(ProjectModule projectModule, string filePath) { var doc = new XDocument(); doc.Add(CreateXmlModules(projectModule)); doc.Save(filePath); }
protected void assigned_button_Click(object sender, EventArgs e) { IList<long> selectedProjects = getSelectedProjects(); ProjectModule projectModule = new ProjectModule(); projectModule.changeProjectStatuses(selectedProjects, APPLICATION_STATUS.ASSIGNED); reloadProjects(); }
protected void terminate_button_Click(object sender, EventArgs e) { IList<long> selectedProjects = getSelectedProjects(); ProjectModule projectModule = new ProjectModule(); projectModule.changeProjectStatuses(selectedProjects, APPLICATION_STATUS.TERMINATED); reloadProjects(); }
public TidsRegController() { var sqlHelperBase = new SqlHelperBase(errorLogger); loginModule = new LoginModule(sqlHelperBase); projectModule = new ProjectModule(sqlHelperBase); timeLogModule = new TimeLogModule(sqlHelperBase); }
protected void loadProjectApplications(long studentId) { ProjectModule projectModule = new ProjectModule(); Session["projectApplications"] = projectModule.getProjectApplicationsByStudentId(studentId); project_application_list.DataSource = Session["projectApplications"]; project_application_list.DataBind(); }
protected void loadProjects(long ownerId) { ProjectModule projectModule = new ProjectModule(); Session["projects"] = projectModule.getProjectsByOwnerId(ownerId); project_list.DataSource = Session["projects"]; project_list.DataBind(); }
protected void loadCategories() { ProjectModule projectModule = new ProjectModule(); IList<Category> allCategories = projectModule.getAllCategories(0, 9999); category_list.DataSource = allCategories; category_list.DataBind(); }
public void UpdateModule(ProjectModule value) { if (this.module != null) { throw new InvalidOperationException("cannot update module after it is set"); } this.module = value; }
// 给模块建立子模块 public static ProjectModule CreateModule(ProjectModule pm) { ModuleCreateForm f = new ModuleCreateForm(); f.ParentModule = pm; f.ShowDialog(); return(f.Module); }
public ActionResult Set_project_Schedule([Bind(Include = "ID,Price,Status,StartDate,EndDate,NoOfHoursPerDay")] ProjectModule projectModule) { if (!homeController.Authenticated) { return(RedirectToAction("Index", "home")); } if (ModelState.IsValid) { if (Session["flag"] != null && Convert.ToInt32(Session["flag"]) == Convert.ToInt32(Session["ProId"])) { //db.Entry(projectModule).State = EntityState.Modified; int pid = Convert.ToInt32(Session["flag"]); ProjectModule pro = new ProjectModule(); pro.MD_ID = Convert.ToInt32(Session["id"]); pro.NoOfHoursPerDay = projectModule.NoOfHoursPerDay; pro.Price = projectModule.Price; pro.Status = projectModule.Status; pro.StartDate = projectModule.StartDate; pro.EndDate = projectModule.EndDate; pro.Project_ID = pid; db.Database.ExecuteSqlCommand("UPDATE ProjectModule set Status = @s ,Price = @p ,StartDate = @st ,EndDate = @et ,NoOfHoursPerDay = @noh where Project_ID = @pid", new SqlParameter("@s", projectModule.Status), new SqlParameter("@pid", pid), new SqlParameter("@p", projectModule.Price), new SqlParameter("@st", projectModule.StartDate), new SqlParameter("@et", projectModule.EndDate), new SqlParameter("@noh", projectModule.NoOfHoursPerDay)); Response.Write("<script>alert('Data Updated Successfully .');</script>"); Session["msg10"] = "<script>alert('Data Updated Successfully .');</script>"; return(RedirectToAction("Index")); } projectModule.MD_ID = Convert.ToInt32(Session["id"]); projectModule.Project_ID = Convert.ToInt32(Session["ProId"]); db.ProjectModule.Add(projectModule); db.SaveChanges(); Response.Write("<script>alert('Project Schedule Setted Successfully');</script>"); Session["msg10"] = "<script>alert('Data Updated Successfully .');</script>"; return(RedirectToAction("Index")); } //ViewBag.MTL_ID = new SelectList(db.Employees, "ID", "FirstName", projectModule.MTL_ID); //ViewBag.MD_ID = new SelectList(db.Employees, "ID", "FirstName", projectModule.MD_ID); projectModule.Project_ID = Convert.ToInt32(Session["ProId"]); var project2 = db.Project.Find(projectModule.Project_ID); if (project2 != null) { ViewData["ProTitle"] = project2.ProjectTitle; } ViewBag.Status = new SelectList(db.ProjectStatus, "ID", "Status", projectModule.Status); return(View(projectModule)); }
// 给模块建立任务,任务相关(需要当前的所有的项目迭代,供选择) public static Task CreateTask(ProjectModule module, Project project) { TaskCreateForm f = new TaskCreateForm(); f.Project = project; f.Module = module; f.ShowDialog(); return(f.Task); }
public MainWindow() { InitializeComponent(); this.projectModule = new ProjectModule(this); this.editModule = new EditModule(this); this.helpModule = new HelpModule(this); this.prepareEventHandler(); }
public bool RemoveModule(ProjectModule toRemove) { bool success = key.Project.modules.Remove(toRemove); if (success) { toIssue.Add(new ProjectModifiedArgs(this, ProjectModifiedArgs.ChangeTypes.ModuleRemoved, toRemove)); } return(success); }
public void Load() { if (File.Exists((string)Settings["FilePathLast"])) { _projectRoot = FileReadWrite.ReadFile((string)Settings["FilePathLast"]); } else { _projectRoot = new ProjectModule("Empty project", ModuleType.Uncategorized); } }
protected void loadProject(long projectid) { ProjectModule projectModule = new ProjectModule(); Project project = projectModule.getProjectById(projectid); project_title.Text = project.PROJECT_TITLE; contact_name.Text = project.CONTACT_NAME; contact_num.Text = project.CONTACT_NUMBER; contact_email.Text = project.CONTACT_EMAIL; project_requirements.Text = project.PROJECT_REQUIREMENTS; }
public ActionResult <bool> DeleteProjectModule([FromBody] ProjectModule value) { Task <bool> data = systemModule.DeleteProjectModule(value); if (data.IsCanceled) { return(BadRequest(data.Exception)); } else { return(Ok(data.Result)); } }
public void ActivateItem(ToolboxItem item) { if (item is ToolboxModule) { ProjectModule newView = ((ToolboxModule)item).Module; window.SetView(newView); ModuleComponent comp = window.CanvasAdding as ModuleComponent; if (comp != null && comp.Module == newView) { window.BeginAdd(null, null); } } }
public bool UpdateModule(ProjectModule modul) { var target = _context.ProjectModules.SingleOrDefault(item => item.Id == modul.Id); if (target != null) { target.Name = modul.Name; target.Description = modul.Description; return(_context.SaveChanges() == 0); } return(false); }
protected void submit_project_button_Click(object sender, EventArgs e) { try { ProjectPromotion projectPromotion = new ProjectPromotion(); if (project_title.Text.Length <= 0) throw new Exception("Please enter project title."); projectPromotion.PROMOTION_TITLE = project_title.Text; if (project_writeup.Text.Length <= 0) throw new Exception("Please write something about the project in Project Write Up."); projectPromotion.PROMOTION_WRITEUP = project_writeup.Text; if (website.Text.Length <= 0) throw new Exception("Please provide a project website."); projectPromotion.PROMOTION_WEBSITE = website.Text; if (Session["zip_file"] == null) throw new Exception("Please upload a zip file."); string zipFile = Session["zip_file"].ToString(); long convertedZipFileId; Int64.TryParse(zipFile, out convertedZipFileId); projectPromotion.PROMOTION_ZIPFILE_ID = convertedZipFileId; if (Session["video_file"] == null) throw new Exception("Please upload a video file."); string videoFile = Session["video_file"].ToString(); long convertedVideoFileId; Int64.TryParse(zipFile, out convertedVideoFileId); projectPromotion.PROMOTION_VIDEOFILE_ID = convertedVideoFileId; long convertedStudentId; if (!Int64.TryParse(Session["userid"].ToString(), out convertedStudentId)) throw new Exception("Cannot find user ID, please contact administrator."); ProjectModule projectModule = new ProjectModule(); projectPromotion = projectModule.promoteProject(convertedStudentId, projectPromotion); Messenger.setMessage(error_message, "Project is submitted successfully!", LEVEL.SUCCESS); } catch (Exception ex) { Messenger.setMessage(error_message, ex.Message, LEVEL.DANGER); } finally { error_modal_control.Show(); refreshUploadedFiles(); } }
public override bool CreateAndSave(LexModuleСonfig config) { var projectModul = new ProjectModule() { Code = ModuleCode, CreatedTime = DateTime.Now, ProjectId = config.ProjectModule.ProjectId, Name = config.ProjectModule.Name, Description = config.ProjectModule.Description }; Context.Repository.AddModule(projectModul); config.ProjectModule = projectModul; Context.Repository.AddLexModuleConfig(config); return(true); }
internal static ProjectModule CreateModule(ProjectModule parentModule, string name, string comment) { ProjectModule newmodule = new ProjectModule(); newmodule.ID = Guid.NewGuid(); newmodule.Name = name; newmodule.Comment = comment; newmodule.Parent = parentModule.ID; JianLiLinq.Default.DB.ProjectModules.InsertOnSubmit(newmodule); JianLiLinq.Default.DB.SubmitChanges(); return(newmodule); }
public static Task CreateTask(ProjectModule module, ProjectIteration iteration, string name, string comment, byte priority) { Task t = new Task(); t.ID = Guid.NewGuid(); t.Parent = module.ID; t.Comment = comment; t.Priority = priority; t.ProjectIteration = iteration; t.Title = name; JianLiLinq.Default.DB.Tasks.InsertOnSubmit(t); JianLiLinq.Default.DB.SubmitChanges(); return(t); }
protected void loadProjects(long UCId) { ProjectModule projectModule = new ProjectModule(); //Only get ASSIGNED and TERMINATED projects IList<Project> allProjects = projectModule.getProjectsByApproverId(UCId); /*IList<Project> assignedAndTerminated = new List<Project>(); foreach (Project project in allProjects) { if (project.PROJECT_STATUS == APPLICATION_STATUS.ASSIGNED || project.PROJECT_STATUS == APPLICATION_STATUS.TERMINATED) assignedAndTerminated.Add(project); } */ Session["projects"] = allProjects; // assignedAndTerminated; project_list.DataSource = Session["projects"]; project_list.DataBind(); selected_projects.Value = ""; }
protected void CreateCategoriesButton_Click(object sender, EventArgs e) { string stringOfCategories = CategoriesInput.Text; ProjectModule projectModule = new ProjectModule(); try { IList<Category> results = projectModule.createCategories(stringOfCategories); Session["categories"] = results; AddedCategoriesTable.DataSource = Session["categories"]; AddedCategoriesTable.DataBind(); Messenger.setMessage(AddCategoriesMessageBox, "Categories created successfully!", LEVEL.SUCCESS); } catch (CategoryException catex) { Messenger.setMessage(AddCategoriesMessageBox, catex.Message, LEVEL.DANGER); } }
protected void TestCreateProjects(object sender, EventArgs e) { ProjectModule projectModule = new ProjectModule(); long partnerIdLong = Convert.ToInt64(partnerIdTextbox.Text); int numProjectsInt = Convert.ToInt32(numProjectsTextbox.Text); IList<Project> projects = projectModule.createRandomProjects(partnerIdLong, numProjectsInt); Session["projects"] = projects; CreatedProjectsTable.DataSource = Session["projects"]; CreatedProjectsTable.DataBind(); }
protected void Delete_Projects(object sender, EventArgs e) { IList<Int64> projects = new List<Int64>(); try { string collectionProjectIds = selected_projects.Value;// Request.Form["selected"]; string[] projectIdsStrings = {}; if (collectionProjectIds != null && collectionProjectIds.Length > 0) { projectIdsStrings = collectionProjectIds.Split(','); foreach (string projectIdString in projectIdsStrings) { long longValue = Convert.ToInt64(projectIdString); projects.Add(longValue); } } ProjectModule projectModule = new ProjectModule(); projectModule.deleteProjects(projects); error_modal_control.Show(); string successMessage = projects.Count + " project" + (projects.Count > 1 ? "s" : "") +" deleted successfully!"; error_message.Controls.Add(new LiteralControl( "<div class='alert alert-success col-sm-10 col-sm-offset-1'>" + successMessage + "</div>")); okButton.Visible = true; errorButton.Visible = false; company_contacts_updatePanel.Update(); project_list_panel.Update(); selected_projects.Value = ""; selected_projects_panel.Update(); } catch (ApproveProjectException apex) { Messenger.setMessage(error_message, apex.Message, LEVEL.DANGER); company_contacts_updatePanel.Update(); okButton.Visible = false; errorButton.Visible = true; } catch (Exception ex) { error_modal_control.Show(); error_message.Controls.Add(new LiteralControl( "<div class='alert alert-danger col-sm-10 col-sm-offset-1'>" + ex.Message + "</div>")); okButton.Text = "Ok"; company_contacts_updatePanel.Update(); okButton.Visible = false; errorButton.Visible = true; } finally { error_modal_control.Show(); //selected_projects.Value = ""; } }
private ProjectModule CreateProjectModule() { ProjectModule module = new ProjectModule(container); return module; }
/// <summary> /// Parses the rules' patterns. /// </summary> /// <param name="proj">The project.</param> /// <param name="module">The module description.</param> /// <param name="context">The working context.</param> /// <returns>Parsed rule patterns.</returns> /// <exception cref="System.ArgumentException"> /// One of the rules has invalid pattern. /// </exception> protected Rules ParseRules(ConfuserProject proj, ProjectModule module, ConfuserContext context) { var ret = new Rules(); var parser = new PatternParser(); foreach (Rule rule in proj.Rules.Concat(module.Rules)) { try { ret.Add(rule, parser.Parse(rule.Pattern)); } catch (InvalidPatternException ex) { context.Logger.ErrorFormat("Invalid rule pattern: " + rule.Pattern + ".", ex); throw new ConfuserException(ex); } foreach (var setting in rule) { if (!protections.ContainsKey(setting.Id)) { context.Logger.ErrorFormat("Cannot find protection with ID '{0}'.", setting.Id); throw new ConfuserException(null); } } } return ret; }
private void loadProjects() { ProjectModule projectModule = new ProjectModule(); project_titles.DataSource = projectModule.getAllOpenedProjects(0, 9999); //Get it up first before we optimize this project_titles.DataBind(); }
private void loadProject(long projectId) { ProjectModule projectModule = new ProjectModule(); Project project = projectModule.getProjectById(projectId); project_id.Value = projectId.ToString(); project_title.Text = project.PROJECT_TITLE; company_name.Text = project.PROJECT_OWNER.USERNAME; contact_name.Text = project.CONTACT_NAME; contact_number.Text = project.CONTACT_NUMBER; contact_email.Text = project.CONTACT_EMAIL; project_requirements.Text = project.PROJECT_REQUIREMENTS; uc_comments.Text = project.UC_REMARKS; allocated_slots.Text = project.RECOMMENDED_SIZE.ToString(); //load categories IList<ProjectCategory> projectCategories = project.CATEGORIES; IList<Category> categories = new List<Category>(); foreach (ProjectCategory projectCategory in projectCategories) { Category c = projectCategory.CATEGORY; categories.Add(c); } //load project applications (only pending) IList<ProjectApplication> pendingApplications = new List<ProjectApplication>(); foreach (ProjectApplication application in project.APPLICATIONS) { if (application.APPLICATION_STATUS == APPLICATION_STATUS.PENDING) pendingApplications.Add(application); } num_applications.Text = pendingApplications.Count.ToString(); Session["applications"] = pendingApplications; project_application_list.DataSource = Session["applications"]; project_application_list.DataBind(); category_list.DataSource = categories; category_list.DataBind(); //enable Apply button assign_button.Enabled = true; //If project has already been assigned, show a disabled overlay and the project members ProjectAssignment projectAssignment = null; //Clear all selected applications from other projects selected_applications.Value = ""; if(project.ASSIGNED_TEAMS != null && project.ASSIGNED_TEAMS.Count > 0) projectAssignment = project.ASSIGNED_TEAMS.First(); //Because it is many-to-many, we use only the first result and assume that it will always have 1 team if (projectAssignment != null) { assigned_project_panel.Visible = true; IList<Student> projectMembers = new List<Student>(); Team assignedTeam = projectAssignment.TEAM; foreach (TeamAssignment assignment in assignedTeam.TEAM_ASSIGNMENT) { Student member = assignment.STUDENT; projectMembers.Add(member); } assigned_project_members.DataSource = projectMembers; assigned_project_members.DataBind(); assign_button.Enabled = false; } else { assigned_project_panel.Visible = false; } }
private void loadProjects(long approverId) { ProjectModule projectModule = new ProjectModule(); project_titles.DataSource = projectModule.getProjectsByApproverId(approverId); project_titles.DataBind(); }
protected void SubmitProjectButton_Click(object sender, EventArgs e) { ProjectModule projectModule = new ProjectModule(); //Get user ID for project owner long ownerId; if(!Int64.TryParse(Session["userid"].ToString(), out ownerId)) { Messenger.setMessage(error_message,"Error getting user ID, please log out and sign in again, or contact administrator.",LEVEL.DANGER); return; } try { //Get all chosen category IDs IList<Int64> categoryIds = new List<Int64>(); string collectionCategoryIds = selected_categories.Value;// Request.Form["selected"]; string[] categoryIdsStrings = new string[]{}; //an empty array if (collectionCategoryIds != null && collectionCategoryIds.Count() > 0) { categoryIdsStrings = collectionCategoryIds.Split(','); } foreach (string categoryIdsString in categoryIdsStrings) { long longValue = 0; Int64.TryParse(categoryIdsString, out longValue); categoryIds.Add(longValue); } //Load all inputs into a Project object Project project = new Project(); if (Session["projectid"] != null) { project.PROJECT_ID = Convert.ToInt64(Session["projectid"].ToString()); } project.PROJECT_TITLE = project_title.Text; project.CONTACT_NAME = contact_name.Text; project.CONTACT_NUMBER = contact_num.Text; project.CONTACT_EMAIL = contact_email.Text; project.PROJECT_REQUIREMENTS = project_requirements.Text; int convertedRecommendedSize; if (!Int32.TryParse(recommended_size.Text, out convertedRecommendedSize)) throw new Exception("Invalid project size."); project.RECOMMENDED_SIZE = convertedRecommendedSize; project.ALLOCATED_SIZE = convertedRecommendedSize; Project newProject = projectModule.submitProject(project, ownerId); Session["projectid"] = newProject.PROJECT_ID; projectModule.registerProjectCategories(newProject, categoryIds); Session["projectid"] = null; //Set projectDocument with projectId FileModule fileModule = new FileModule(); long convertedProjectDocumentId; if (hidden_uploaded_doc_ID.Value.Length > 0) { if (!Int64.TryParse(hidden_uploaded_doc_ID.Value.ToString(), out convertedProjectDocumentId)) throw new Exception("Cannot find projectDocumentId, please contact administrator."); fileModule.updateProjectDocumentOwner(convertedProjectDocumentId, project.PROJECT_ID); } Messenger.setMessage(error_message, "Project registered successfully. You will receive an email to update you of the status.", LEVEL.SUCCESS); clearAllFields(); } catch (ProjectSubmissionException psex) { Messenger.setMessage(error_message, psex.Message, LEVEL.DANGER); } catch (InvalidEmailAddressException ieaex) { Messenger.setMessage(error_message, ieaex.Message, LEVEL.DANGER); } catch (ProjectCategoryRegistrationException pcrex) { Messenger.setMessage(error_message, "Project is submitted but categories are not registered: "+pcrex.Message +"<br />" +"You may still update the project by clicking Update.", LEVEL.DANGER); } catch (Exception ex) { Messenger.setMessage(error_message, ex.Message, LEVEL.DANGER); } finally { error_modal_control.Show(); error_message_update_panel.Update(); //SubmitProjectButton.Text = "Update"; //NewProjectUpdatePanel.Update(); //selected_categories.Value = ""; } }
protected void TestApplyProject(object sender, EventArgs e) { long studentId; long projectId; Int64.TryParse(StudentIdInput.Text,out studentId); Int64.TryParse(ProjectIdInput.Text,out projectId); ProjectModule projectModule = new ProjectModule(); try { ProjectApplication appl = projectModule.ApplyProject(studentId, projectId); Messenger.setMessage(ApplyProjectResults, "Application "+appl.APPLICATION_ID+" has been created by student " +studentId+" for project "+projectId+".", LEVEL.SUCCESS); } catch (ProjectApplicationException paex) { Messenger.setMessage(ApplyProjectResults, paex.Message, LEVEL.DANGER); } catch (Exception ex) { Messenger.setMessage(ApplyProjectResults, ex.Message, LEVEL.DANGER); } }
private ProjectApplication applyProject(long studentId, long projectId) { ProjectModule projectModule = new ProjectModule(); ProjectApplication projectApplication = projectModule.ApplyProject(studentId, projectId); return projectApplication; }
private Team assign_project(long projectId, IList<long> applicationIds, bool rejectOthers) { ProjectModule projectModule = new ProjectModule(); Team newTeam = projectModule.assignProject(projectId, applicationIds, rejectOthers); return newTeam; }
private ProjectModule CreateProjectModule() { ProjectModule module = new ProjectModule(container, new MockRegionContentRegistry()); return module; }
protected void approve_project(object sender, EventArgs e) { long convertedProjectid; ProjectModule projectModule = new ProjectModule(); try { if (!Int64.TryParse(project_id.Value, out convertedProjectid)) throw new Exception("Cannot find project ID, please contact administrator."); Project project = projectModule.getProjectById(convertedProjectid); //set all inputted variables into the Project object //Only set fields that could be changed in the frontend screen project.PROJECT_TITLE = project_title.Text; project.CONTACT_NAME = contact_name.Text; project.CONTACT_NUMBER = contact_number.Text; project.CONTACT_EMAIL = contact_email.Text; project.PROJECT_REQUIREMENTS = project_requirements.Text; project.UC_REMARKS = uc_comments.Text; int convertedAllocatedSize; if (!Int32.TryParse(allocated_size.Text, out convertedAllocatedSize)) throw new Exception("Invalid allocated size entered"); project.ALLOCATED_SIZE = convertedAllocatedSize; int convertedRecommendedSize; if (!Int32.TryParse(allocated_size.Text, out convertedRecommendedSize)) throw new Exception("Invalid recommended size entered"); project.RECOMMENDED_SIZE = convertedRecommendedSize; long convertedUCId; if (!Int64.TryParse(Session["userid"].ToString(), out convertedUCId)) throw new Exception("Cannot find user ID, please contact administrator."); projectModule.approveProject(project, convertedUCId); //Success Messenger.setMessage(approve_project_message, "Project is approved! An email notification has been sent to the project owner.", LEVEL.SUCCESS); okButton.Visible = true; proceedButton.Visible = false; } catch (EmailSendException esex) { Messenger.setMessage(approve_project_message, "Project is approved but email is not sent successfully: "+esex.Message, LEVEL.WARNING); okButton.Visible = true; proceedButton.Visible = false; } catch (Exception ex) { Messenger.setMessage(approve_project_message, ex.Message, LEVEL.DANGER); proceedButton.Visible = true; okButton.Visible = false; } finally { approve_project_popup.Show(); //project_details_panel.Update(); approve_button_panel.Update(); } }
private void loadProject(long projectId) { ProjectModule projectModule = new ProjectModule(); Project project = projectModule.getProjectById(projectId); project_id.Value = projectId.ToString(); project_title.Text = project.PROJECT_TITLE; company_name.Text = project.PROJECT_OWNER.USERNAME; contact_name.Text = project.CONTACT_NAME; contact_number.Text = project.CONTACT_NUMBER; contact_email.Text = project.CONTACT_EMAIL; project_requirements.Text = project.PROJECT_REQUIREMENTS; uc_comments.Text = project.UC_REMARKS; allocated_slots.Text = project.RECOMMENDED_SIZE.ToString(); //load categories IList<ProjectCategory> projectCategories = project.CATEGORIES; IList<Category> categories = new List<Category>(); foreach (ProjectCategory projectCategory in projectCategories) { Category c = projectCategory.CATEGORY; categories.Add(c); } //load project applications IList<ProjectApplication> pendingApplications = new List<ProjectApplication>(); foreach (ProjectApplication application in project.APPLICATIONS) { if (application.APPLICATION_STATUS == APPLICATION_STATUS.PENDING) pendingApplications.Add(application); } num_applications.Text = pendingApplications.Count.ToString(); Session["applications"] = pendingApplications; project_application_list.DataSource = Session["applications"]; project_application_list.DataBind(); category_list.DataSource = categories; category_list.DataBind(); //enable Apply button apply_button.Enabled = true; //If project has already been assigned, show a disabled overlay and the project members ProjectAssignment projectAssignment = null; if (project.ASSIGNED_TEAMS != null && project.ASSIGNED_TEAMS.Count > 0) projectAssignment = project.ASSIGNED_TEAMS.First(); //Because it is many-to-many, we use only the first result and assume that it will always have 1 team if (projectAssignment != null) { assigned_project_panel.Visible = true; IList<Student> projectMembers = new List<Student>(); Team assignedTeam = projectAssignment.TEAM; foreach (TeamAssignment assignment in assignedTeam.TEAM_ASSIGNMENT) { Student member = assignment.STUDENT; projectMembers.Add(member); } assigned_project_members.DataSource = projectMembers; assigned_project_members.DataBind(); apply_button.Enabled = false; } else { assigned_project_panel.Visible = false; } //get project documents FileModule fileModule = new FileModule(); ProjectDocument projectDocument = fileModule.getProjectDocumentByProjectId(project.PROJECT_ID); if (projectDocument != null) { project_document_link.NavigateUrl = "#"; string escapedPath = projectDocument.PROJECTFILE_PATH.Replace("\\","/"); project_document_link.Attributes.Add("onclick", "window.open(\"../../" + escapedPath + "\",\"_blank\",\"menubar=no,height=600,width=800\");"); project_document.Text = projectDocument.PROJECTFILE_NAME; project_document.Visible = true; } else { project_document_link.Attributes.Clear(); project_document.Visible = false; } }
void MarkModule(ModuleDefMD module, bool isMain) { var settingAttrs = new List<ObfuscationAttributeInfo>(); string snKeyPath = null, snKeyPass = null; Dictionary<Regex, List<ObfuscationAttributeInfo>> namespaceAttrs; if (!crossModuleAttrs.TryGetValue(module.Name, out namespaceAttrs)) { namespaceAttrs = new Dictionary<Regex, List<ObfuscationAttributeInfo>>(); } foreach (var attr in ReadObfuscationAttributes(module.Assembly)) { if (attr.FeatureName.Equals("generate debug symbol", StringComparison.OrdinalIgnoreCase)) { if (!isMain) throw new ArgumentException("Only main module can set 'generate debug symbol'."); project.Debug = bool.Parse(attr.FeatureValue); } if (project.Debug) { module.LoadPdb(); } if (attr.FeatureName.Equals("random seed", StringComparison.OrdinalIgnoreCase)) { if (!isMain) throw new ArgumentException("Only main module can set 'random seed'."); project.Seed = attr.FeatureValue; } else if (attr.FeatureName.Equals("strong name key", StringComparison.OrdinalIgnoreCase)) { snKeyPath = Path.Combine(project.BaseDirectory, attr.FeatureValue); } else if (attr.FeatureName.Equals("strong name key password", StringComparison.OrdinalIgnoreCase)) { snKeyPass = attr.FeatureValue; } else if (attr.FeatureName.Equals("packer", StringComparison.OrdinalIgnoreCase)) { if (!isMain) throw new ArgumentException("Only main module can set 'packer'."); new ObfAttrParser(packers).ParsePackerString(attr.FeatureValue, out packer, out packerParams); } else if (attr.FeatureName.Equals("external module", StringComparison.OrdinalIgnoreCase)) { if (!isMain) throw new ArgumentException("Only main module can add external modules."); var rawModule = new ProjectModule { Path = attr.FeatureValue }.LoadRaw(project.BaseDirectory); extModules.Add(rawModule); } else if (attr.FeatureName == "") { settingAttrs.Add(attr); } else { var match = NSInModulePattern.Match(attr.FeatureName); if (match.Success) { if (!isMain) throw new ArgumentException("Only main module can set cross module obfuscation."); var ns = TranslateNamespaceRegex(match.Groups[1].Value); string targetModule = match.Groups[2].Value; var x = attr; x.FeatureName = ""; Dictionary<Regex, List<ObfuscationAttributeInfo>> targetModuleAttrs; if (!crossModuleAttrs.TryGetValue(targetModule, out targetModuleAttrs)) { targetModuleAttrs = new Dictionary<Regex, List<ObfuscationAttributeInfo>>(); crossModuleAttrs[targetModule] = targetModuleAttrs; } targetModuleAttrs.AddListEntry(ns, x); } else { match = NSPattern.Match(attr.FeatureName); if (match.Success) { var ns = TranslateNamespaceRegex(match.Groups[1].Value); var x = attr; x.FeatureName = ""; namespaceAttrs.AddListEntry(ns, x); } } } } ProcessModule(module, snKeyPath, snKeyPass, settingAttrs, namespaceAttrs); }
private void loadProject(long projectId) { ProjectModule projectModule = new ProjectModule(); Project project = projectModule.getProjectById(projectId); project_id.Value = projectId.ToString(); project_title.Text = project.PROJECT_TITLE; company_name.Text = project.PROJECT_OWNER.USERNAME; contact_name.Text = project.CONTACT_NAME; contact_number.Text = project.CONTACT_NUMBER; contact_email.Text = project.CONTACT_EMAIL; project_requirements.Text = project.PROJECT_REQUIREMENTS; uc_comments.Text = project.UC_REMARKS; recommended_size.Text = project.RECOMMENDED_SIZE.ToString(); allocated_size.Text = project.ALLOCATED_SIZE.ToString(); //already set to the same value as recommended size //load categories IList<ProjectCategory> projectCategories = project.CATEGORIES; IList<Category> categories = new List<Category>(); foreach (ProjectCategory projectCategory in projectCategories) { Category c = projectCategory.CATEGORY; categories.Add(c); } //load project applications category_list.DataSource = categories; category_list.DataBind(); //enable Apply button approve_button.Enabled = true; reject_button.Enabled = true; }