/// <summary> /// Searches TFS using the query provided by the 'q' parameter. /// </summary> public override ActionResult Index(string q, string sortBy, bool? desc, int? page, int? pageSize, string title, string assignedTo, string startDate, string endDate, string status) { IList<WorkItemSummary> summaries = new List<WorkItemSummary>(); ListData data = new ListData(); if (!string.IsNullOrEmpty(q)) { SearchManager manager = new SearchManager(); if (manager.IsId(q)) { // For single work item ids (that exist), redirect straight to their view page int id = int.Parse(q); QueryManager queryManager = new QueryManager(); WorkItemSummary summary = queryManager.ItemById(id); if (summary != null) { return Redirect(SpruceSettings.SiteUrl + "/" + summary.Controller + "/View/" + id); } } else { data.WorkItems = manager.Search(q).ToList(); PageList(data, sortBy, desc, page, pageSize); ViewData["search"] = q; } } return View(data); }
/// <summary> /// Performs a TFS search for the given query. If the query is a numerical work item ID, /// then the list returned is this single work item and the search is skipped. /// </summary> public IEnumerable<WorkItemSummary> Search(string query) { IEnumerable<WorkItemSummary> summaries = new List<WorkItemSummary>(); QueryManager manager = new QueryManager(); // Is it just a number? then it's an id if (IsId(query)) { Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("Id",Convert.ToInt32(query)); string wiql = "SELECT * FROM Issues WHERE [System.Id] = @Id"; return manager.ExecuteWiqlQuery(wiql, parameters, true); } else { QueryParser parser = new QueryParser(); parser.ParseComplete += delegate(object sender, EventArgs e) { Dictionary<string, object> parameters = new Dictionary<string, object>(); string wiql = parser.WiqlBuilder.BuildQuery(parameters); summaries = manager.ExecuteWiqlQuery(wiql, parameters, false); }; parser.SearchFor(query); return summaries; } }
public DataTable ExecuteQuery(string Query) { bool flagTransation = true; DataAccessLayer objDataAccess = new DataAccessLayer(); SqlTransaction objTrans = null; try { if (objTrans == null) { flagTransation = false; objDataAccess.GetConnection.Open(); SqlTransaction objTransaction = objDataAccess.GetConnection.BeginTransaction(); objTrans = objTransaction; } QueryManager objManager = new QueryManager(); DataTable dtQueryResult = objManager.ExecuteQuery(Query, objTrans); if (!flagTransation) objTrans.Commit(); return dtQueryResult; } catch (Exception ex) { if (!flagTransation) objTrans.Rollback(); throw ex; } finally { objDataAccess.GetConnection.Close(); } }
/// <summary> /// Retrieves a new <see cref="DashboardSummary"/> containing information about current bugs, tasks and checkins. /// </summary> public static DashboardSummary GetSummary() { QueryManager<BugSummary> bugQueryManager = new QueryManager<BugSummary>(); QueryManager<TaskSummary> taskQueryManager = new QueryManager<TaskSummary>(); IList<WorkItemSummary> allbugs = bugQueryManager.Execute().ToList(); IList<WorkItemSummary> allTasks = taskQueryManager.Execute().ToList(); DashboardSummary summary = new DashboardSummary(); summary.RecentCheckins = RecentCheckins(); summary.RecentCheckinCount = summary.RecentCheckins.ToList().Count; bugQueryManager.WhereActive(); summary.ActiveBugCount = bugQueryManager.Execute().Count(); summary.BugCount = allbugs.Count; summary.MyActiveBugCount = allbugs.Where(b => b.State == "Active").ToList().Count; summary.MyActiveBugs = allbugs.Where(b => b.State == "Active" && b.AssignedTo == UserContext.Current.Name) .OrderByDescending(b => b.CreatedDate) .Take(5) .ToList(); taskQueryManager.WhereActive(); summary.ActiveTaskCount = allTasks.Count; summary.TaskCount = allTasks.Count; IEnumerable<WorkItemSummary> myActiveTasks = allTasks.Where(b => b.State == "Active" && b.AssignedTo == UserContext.Current.Name) .OrderByDescending(b => b.CreatedDate); summary.MyActiveTasks = myActiveTasks.Take(5).ToList(); summary.MyActiveTaskCount = myActiveTasks.ToList().Count; return summary; }
/// <summary> /// Changes the state of a work item to 'closed'. /// </summary> /// <param name="id">The id of the work item to change the state of.</param> public virtual void Close(int id) { QueryManager manager = new QueryManager(); try { WorkItemSummary summary = manager.ItemById(id); summary.State = "Closed"; Save(summary); } catch (Exception ex) { Log.Warn(ex, "An exception occured closing the work item {0}", id); } }
/// <summary> /// Overrides the base <see cref="WorkItemManager.Resolve"/> method to modify the behaviour so that a resolved by field is included. /// </summary> public override void Resolve(int id) { try { QueryManager manager = new QueryManager(); BugSummary summary = manager.ItemById<BugSummary>(id); summary.ResolvedBy = UserContext.Current.Name; summary.State = "Resolved"; Save(summary); } catch (Exception ex) { throw new SaveException(ex, "Unable to resolve Bug work item {0}", id); } }
/// <summary> /// Overrides the base <see cref="WorkItemManager.Close"/> method to modify the behaviour so that a resolved by field is included. /// </summary> public override void Close(int id) { QueryManager manager = new QueryManager(); try { IssueSummary summary = manager.ItemById<IssueSummary>(id); summary.ResolvedBy = UserContext.Current.Name; summary.State = "Closed"; Save(summary); } catch (Exception ex) { throw new SaveException(ex, "Unable to close Issue work item {0}", id); } }
public ActionResult Edit(int id, string fromUrl) { QueryManager manager = new QueryManager(); IssueSummary item = manager.ItemById<IssueSummary>(id); item.IsNew = false; // Change the user's current project if this work item is different. // The project can be different if they've come from the stored queries page. if (item.ProjectName != UserContext.Current.CurrentProject.Name) UserContext.Current.ChangeCurrentProject(item.ProjectName); MSAgileEditData<IssueSummary> data = new MSAgileEditData<IssueSummary>(); data.WorkItem = item; data.PageTitle = "Issue " + id; data.FromUrl = fromUrl; data.States = item.ValidStates; data.Reasons = item.ValidReasons; data.Priorities = item.ValidPriorities; return View(data); }
/// <summary> /// Constructs a new character controller with the most common configuration options. /// </summary> /// <param name="position">Initial position of the character.</param> /// <param name="radius">Radius of the character body.</param> /// <param name="mass">Mass of the character body.</param> public CylinderCharacterController(Vector3 position, float characterHeight, float radius, float mass) { Body = new Cylinder(position, characterHeight, radius / 2, mass); Body.IgnoreShapeChanges = true; //Wouldn't want inertia tensor recomputations to occur if the shape changes. //Making the character a continuous object prevents it from flying through walls which would be pretty jarring from a player's perspective. Body.PositionUpdateMode = PositionUpdateMode.Continuous; Body.LocalInertiaTensorInverse = new Matrix3X3(); //TODO: In v0.16.2, compound bodies would override the material properties that get set in the CreatingPair event handler. //In a future version where this is changed, change this to conceptually minimally required CreatingPair. Body.CollisionInformation.Events.DetectingInitialCollision += RemoveFriction; Body.LinearDamping = 0; SupportFinder = new SupportFinder(this); HorizontalMotionConstraint = new HorizontalMotionConstraint(this); VerticalMotionConstraint = new VerticalMotionConstraint(this); QueryManager = new QueryManager(this); //Enable multithreading for the sphere characters. //See the bottom of the Update method for more information about using multithreading with this character. IsUpdatedSequentially = false; //Link the character body to the character controller so that it can be identified by the locker. //Any object which replaces this must implement the ICharacterTag for locking to work properly. Body.CollisionInformation.Tag = new CharacterSynchronizer(Body); }
public EarringRanksDAO() { mObjQueryManager = new QueryManager(); }
public GenericRepository(ThunderRaederDbContext dbContext, IMapper mapper, QueryManager <TEntity> queryManager) : base(dbContext, mapper, queryManager) { }
private void Awake() { targetGrid = FindObjectOfType <SpatialGrid>(); queryManager = FindObjectOfType <QueryManager>(); queryManager.AddQuery(this); }
public override void SetIntraDayDetails() { CurrencyIntraDayDetails intraDayDetails = QueryManager.GetCurrencyIntraDayDetails(Symbol); CurrentPrice = intraDayDetails?.CurrentPrice; }
public static void TransformAndPersistAlerts(Verification verifyType, QueryManager <WazeRaw> wazeQueryManager, QueryManager <LeadAlert> Persist, DateTime?startDate = null) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Console.WriteLine("Fetching documents to process.."); List <WazeRaw> toProcess = wazeQueryManager.GetAll(); Console.WriteLine($" {toProcess.Count} documents found!"); int added = 0, replaced = 0, ignored = 0; Console.WriteLine("Processing document, this may take a while.."); foreach (WazeRaw input in toProcess) { foreach (var route in input.Routes) { if (route.LeadAlert != null) { PersistResultDocuments(route.LeadAlert, Persist); } if (route.SubRoutes != null) { foreach (var subroute in route.SubRoutes) { if (subroute.LeadAlert != null) { PersistResultDocuments(subroute.LeadAlert, Persist); } } } } foreach (var route in input.Irregularities) { if (route.SubRoutes != null) { foreach (var subroute in route.SubRoutes) { if (subroute.LeadAlert != null) { PersistResultDocuments(subroute.LeadAlert, Persist); } } } } } stopwatch.Stop(); Console.WriteLine($"Processing finished in {stopwatch.Elapsed}: {added} added, {replaced} replaced and {ignored} ignored"); }
public List <Scanner> GetScans() { return(QueryManager.GetInstance().GetScannings()); }
public InspectionDAO() { mObjQueryManager = new QueryManager(); }
private Expression<Func<Brand, bool>> GetQueryExp(int commodityId, int commodityTypeId) { var clauses = new List<Clause>(); if (commodityId != 0) { clauses.Add(new Clause { PropertyName = "CommodityId", Operator = Operator.Eq, Value = commodityId }); } if (commodityTypeId != 0) { clauses.Add(new Clause { Operator = Operator.Eq, PropertyName = "CommodityTypeId", Value = commodityTypeId }); } var manager = new QueryManager<Brand>(); return manager.Compile(clauses); }
/// <summary> /// Write Csv file of data /// </summary> /// <param name="csvFile"></param> /// <param name="includeProtein"></param> /// <param name="includeElectronDensity"></param> void WriteCsvFile( string csvFile, bool exportSingle, QueryColumn qcProtein, QueryColumn qcDensity, QueryColumn qcTarget, QueryManager qm, string url, string densityMapUrl, string target) { string rec; DataRowMx dr; StringMx sx; List <int> markedRows; //string finalUrl; StreamWriter sw = new StreamWriter(csvFile); rec = "BSL_XRAY_CMPLX_URL,BSL_XRAY_EDENSITY_URL,TRGT_LABEL"; sw.WriteLine(rec); // header string filePath = DownloadFile(url); string mapFilePath = DownloadFile(densityMapUrl); if (qm == null) // export from HTML { rec = ""; //if (!Lex.Contains(url, "edensity")) // assume protein/ligand rec += filePath; rec += ","; if (mapFilePath != null) { rec += mapFilePath; } rec += ","; // nothing for target for now if (target != null) { rec += target; } sw.WriteLine(rec); } else // export from XtraGrid { ResultsFormatter fmtr = qm.ResultsFormatter; if (exportSingle) // put single row to export in table { markedRows = new List <int>(); CellInfo cinf = qm.MoleculeGrid.LastMouseDownCellInfo; markedRows.Add(cinf.DataRowIndex); // indicate current row } else { markedRows = fmtr.MarkedRowIndexes; } foreach (int ri in markedRows) { dr = qm.DataTable.Rows[ri]; rec = ""; if (qcProtein != null) { url = Lex.ToString(dr[qcProtein.VoPosition]); filePath = DownloadFile(url); if (String.IsNullOrEmpty(filePath)) { continue; } rec += filePath; } rec += ","; if (qcDensity != null) { string mapUrl = Lex.ToString(dr[qcDensity.VoPosition]); mapFilePath = DownloadFile(mapUrl); rec += mapFilePath; } else if (!IncludeElectronDensityPyMol.Checked) { // do nothing, user does not want map } else if (densityMapUrl == null && !exportSingle) { densityMapUrl = _xRay2Request ? GetXray2DensityMapUrl(url, _currentMetaTable, _currentPdbColumnName) : GetXray1DensityMapUrl(url, _currentMetaTable); mapFilePath = DownloadFile(densityMapUrl); rec += mapFilePath; } else if (densityMapUrl != null) { mapFilePath = DownloadFile(densityMapUrl); rec += mapFilePath; } rec += ","; if (qcTarget != null) { target = Lex.ToString(dr[qcTarget.VoPosition]); rec += target; } densityMapUrl = null; //we only get the map from the first record sw.WriteLine(rec); } } sw.Close(); return; }
public AuctionBatchService() { mObjBatchDAO = new TableDAO <Batch>(); mObjQueryManager = new QueryManager(); }
/// <summary> /// Export to Vida /// </summary> /// <param name="mtName"></param> /// <param name="mcName"></param> /// <param name="url"></param> //void ExportToVidaMethod( // string url, // QueryManager qm) //{ // StreamWriter sw; // string scriptSourceFile = "", script; // bool includeProtein = false; // IncludeProtein.Checked; // if (!includeProtein) QcProtein = null; // bool includeElectronDensity = false; // IncludeElectronDensityVida.Checked; // if (!includeElectronDensity) QcDensity = null; // if (!includeProtein && !includeElectronDensity) // throw new Exception("Either the protein or the electron density must be selected for VIDA export"); // string csvFile = ClientDirs.TempDir + @"\VidaBatchLoad.csv"; // WriteCsvFile(csvFile, ExportSingle.Checked, QcProtein, QcDensity, QcTarget, qm, url); // try // { // scriptSourceFile = CommonConfigInfo.MiscConfigDir + @"\VidaBatchLoad.py"; // StreamReader sr = new StreamReader(scriptSourceFile); // script = sr.ReadToEnd(); // sr.Close(); // } // catch (Exception ex) // { throw new Exception("Error reading " + scriptSourceFile + ": " + ex.Message); } // // Modify script & send to client for opening by VIDA // script += "\r\nLoadMobiusExport(" + Lex.AddDoubleQuotes(csvFile) + ")\r\n"; // scriptSourceFile = ClientDirs.TempDir + @"\VidaBatchLoad.py"; // sw = new StreamWriter(scriptSourceFile); // sw.Write(script); // sw.Close(); // string vidaPaths = SS.I.ServicesIniFile.Read("VidaPaths", @"Software\Openeye\vida"); // scriptSourceFile = Lex.AddSingleQuotes(scriptSourceFile); // quote file name since it includes spaces // string args = vidaPaths + "\t" + scriptSourceFile; // Progress.Show("Passing data to VIDA..."); // StartVida(args); // System.Threading.Thread.Sleep(3000); // leave message up a bit while VIDA is starting/being activated // Progress.Hide(); //} /// <summary> /// ExportFiles /// </summary> List <string> ExportToFilesMethod( string url, QueryManager qm, ResultsFormatter fmtr, ResultsField rfld) { List <int> markedRows; List <string> fileList = new List <string>(); DataRowMx dr; StringMx sx; string clientPath, clientFolder, clientFileName; clientPath = FileName.Text; // path to file clientFolder = Path.GetDirectoryName(clientPath); if (Lex.IsUndefined(clientFolder) || !Directory.Exists(clientFolder)) { clientFolder = Preferences.Get("DefaultExportFolder", ClientDirs.DefaultMobiusUserDocumentsFolder); if (Lex.IsUndefined(clientFolder) || !Directory.Exists(clientFolder)) { clientFolder = ClientDirs.TempDir; } } clientFileName = Path.GetFileName(clientPath); if (ExportSingle.Checked) // put single row to export in table { if (Lex.IsUndefined(clientFileName)) { return(fileList); } Progress.Show("Retrieving " + clientFileName + " ..."); clientPath = clientFolder + @"\" + clientFileName; try { bool downloadOk = DownloadFile(url, clientPath); fileList.Add(clientPath); } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { Progress.Hide(); } } else // multiple files { markedRows = fmtr.MarkedRowIndexes; foreach (int ri in markedRows) { if (ri < 0) { url = url; // single selected url } else { dr = qm.DataTable.Rows[ri]; sx = dr[rfld.VoPosition] as StringMx; if (sx == null || sx.Hyperlink == null) { continue; } url = sx.Value; // link is in value rather than HyperLink currently } if (String.IsNullOrEmpty(url)) { continue; } clientFileName = Path.GetFileName(url); clientPath = clientFolder + @"\" + clientFileName; Progress.Show("Retrieving " + clientFileName + " ..."); try { bool downloadOk = DownloadFile(url, clientPath); fileList.Add(clientPath); } catch (Exception ex) { Progress.Hide(); throw ex; } } Progress.Hide(); if (markedRows.Count > 0 && fileList.Count == 0) { throw new Exception("No files downloaded"); } } return(fileList); }
/// <summary> /// Handle a click on a link to a 3D structure & open in Vida /// If clicked from an XtraGrid give the user a range of options for the data /// to be exported. If clicked from a HTML page give limited options. /// </summary> /// <param name="mtName"></param> /// <param name="mcName"></param> /// <param name="url"></param> public void ClickFunction( string mtName, string mcName, string url) { ResultsFormatter fmtr = null; ResultsField rfld = null; //DataRowMx dr; StringMx sx; StreamWriter sw; int markedCount = 0; string densityMapUrl = null; string target = null; _currentMetaTable = mtName; _currentPdbColumnName = mcName; IncludeElectronDensityPyMol.Checked = false; MetaTable mt = MetaTableCollection.Get(mtName); if (mt == null) { return; } MetaColumn mc = mt.GetMetaColumnByName(mcName); if (mc == null) { return; } _xRay2Request = Lex.Contains(mtName, "XRay2"); // newer XRay2 database table? _urlFileName = Path.GetFileName(url); // extract file name from url QueryManager qm = ClickFunctions.CurrentClickQueryManager; if (qm != null) { Query q = qm.Query; ResultsFormat rf = qm.ResultsFormat; fmtr = qm.ResultsFormatter; rfld = rf.GetResultsField(mc); if (rfld == null) { return; } QueryTable qt = q.GetQueryTableByNameWithException(mtName); _qcProtein = qt.GetQueryColumnByNameWithException(mcName); if (_xRay2Request) // newer XRay2 database { string mapUrl = ""; if (mcName == "ALIGNED_SPLIT_COMPLEX_URL") { mapUrl = "ALIGNED_SPLIT_MAP_URL"; } else if (mcName == "ALIGNED_FULL_COMPLEX_URL") { mapUrl = "ALIGNED_FULL_MAP_URL"; } else if (mcName == "ORIGINAL_PDB_URL") { mapUrl = "ORIGINAL_MAP_URL"; } //{ mapUrl = "ORIGINAL_MAP_URL"; } _qcDensity = qt.GetQueryColumnByName(mapUrl); //("ALIGNED_SPLIT_MAP_URL"); if (_qcDensity != null && !_qcDensity.Selected) { _qcDensity = null; } _qcTarget = qt.GetQueryColumnByName("primary_gene_name_alias"); if (_qcTarget != null && !_qcTarget.Selected) { _qcTarget = null; } } if (_qcDensity != null) { // if there is a density map url located in the density column, enable the PyMol CheckEdit DataRowMx dr = qm.DataTable.Rows[qm.MoleculeGrid.LastMouseDownCellInfo.DataRowIndex]; densityMapUrl = Lex.ToString(dr[_qcDensity.VoPosition]); } else { // user did not select the map column, try to retrieve the XRay1 or Xray2 density map url fromt he metatable densityMapUrl = _xRay2Request ? GetXray2DensityMapUrl(url, qt.MetaTable.Name, mcName) : GetXray1DensityMapUrl(url, qt.MetaTable.Name); } // default checkbox to false so user does not load electron density maps everytime, since these take // extra time to load. IncludeElectronDensityPyMol.Checked = false; IncludeElectronDensityPyMol.Enabled = !string.IsNullOrEmpty(densityMapUrl); if (_qcProtein == null && _qcDensity == null) { throw new Exception("Neither the PDB nor the MAP column is selected in the query"); } markedCount = fmtr.MarkedRowCount; int unmarkedCount = fmtr.UnmarkedRowCount; if (markedCount == 0 || unmarkedCount == 0) // if no specific selection assume user wants single structure { ExportSingle.Checked = true; FileName.Text = _urlFileName; } else { ExportMarked.Checked = true; // assume wants marked structures } ExportMarked.Enabled = true; } else // simple setup for click from HTML display { ExportSingle.Checked = true; ExportMarked.Enabled = false; FileName.Text = _urlFileName; densityMapUrl = GetXray2DensityMapUrl(url, _currentMetaTable, mcName); target = GetTarget(url, _currentMetaTable, mcName); ////IncludeProtein.Enabled = IncludeElectronDensityEnabled = false; ////if (Lex.Eq(mcName, "bsl_xray_cmplx_url")) //// IncludeProtein.Checked = true; ////else if (Lex.Eq(mcName, "bsl_xray_edensity_url")) //// IncludeElectronDensityChecked = true; } if (mcName == "ALIGNED_SPLIT_MAP_URL" || mcName == "ALIGNED_FULL_MAP_URL" || mcName == "ORIGINAL_MAP_URL") // not viewable fileds { DisablePymol(); DisableMoe(); ExportToFile.Enabled = ExportToFile.Checked = true; } else if (mcName == "ALIGNED_FULL_COMPLEX_URL" || mcName == "ORIGINAL_PDB_URL" || mcName == "ALIGNED_SPLIT_COMPLEX_URL") // viewable by PyMol { EnableMoe(); EnablePymol(); ExportToFile.Enabled = true; ExportToFile.Checked = false; } else //everything else should be viewable by MOE { EnableMoe(); DisablePymol(); ExportToFile.Enabled = true; ExportToFile.Checked = false; } DialogResult dlgRslt = ShowDialog(SessionManager.ActiveForm); if (dlgRslt == DialogResult.Cancel) { return; } bool exportSingle = ExportSingle.Checked; bool exportMarked = !exportSingle; if (!IncludeElectronDensityPyMol.Checked) { densityMapUrl = null; } if (exportMarked) // see if reasonable count if exporting marked rows { string msg; if (markedCount == 0) { msg = "No rows have been marked for export"; MessageBoxMx.Show(msg, "Mobius", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (markedCount > 10) { msg = markedCount + " structures have been selected out export.\n" + "Are you sure these are the structures you want to export?"; dlgRslt = MessageBoxMx.Show(msg, "Mobius", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dlgRslt != DialogResult.Yes) { return; } } } // Export to PyMol (Schrodinger) - Collab with Paul Sprengeler and Ken Schwinn // Relavant Files: // 1. Plugin: CorpView.py (in Mobius config dir) // 2. Script: CorpView.pml - Runs the plugin and then passes in the .csv file (in Mobius config dir) // Expected content (note: <csv-file-name> gets replaced): // import pymol // pluginLocation = 'C:\Progra~1\PyMOL\PyMOL\modules\pmg_tk\startup\CorpView.py' // cmd.do('run ' + pluginLocation) // cmd.do('lv_create_environment') // cmd.do('lv_import_mobius <csv-file-name>') // cmd.do('lv_destroy_environment') // 3. Csv file: PyMolBatchLoad.csv - Csv file in format expected by plugin (in Mobius temp dir) if (ExportToPyMol.Checked) { ExportToPyMolMethod(url, densityMapUrl, target, qm); } else if (ExportToMOE.Checked) // Export to MOE { ExportToMOEMethod(url, qm, fmtr, rfld); } else { ExportToFilesMethod(url, qm, fmtr, rfld); } }
/// <summary> /// ExportToPyMolMethod /// </summary> /// <param name="url"></param> /// <param name="qm"></param> void ExportToPyMolMethod( string url, string densityMapUrl, string target, QueryManager qm) { StreamWriter sw; string rec, msg, scriptSourceFile, pluginSourceFile, script; bool includeProtein = true; // always include protein //bool includeElectronDensity = IncludeElectronDensityPyMol.Checked; if (!IncludeElectronDensityPyMol.Checked) { _qcDensity = null; } pluginSourceFile = CommonConfigInfo.MiscConfigDir + @"\CorpView.py"; // the PyMOL plugin CopyToReadLockedFile(pluginSourceFile, CommonConfigInfo.MiscConfigDir + @"\CorpView2.py"); // move CorpView2.py to CorpView.py if (!File.Exists(pluginSourceFile)) { throw new Exception("Plugin file not found: " + pluginSourceFile); } scriptSourceFile = CommonConfigInfo.MiscConfigDir + @"\CorpView.pml"; // the script that starts pymol & hands it the .csv file CopyToReadLockedFile(scriptSourceFile, CommonConfigInfo.MiscConfigDir + @"\CorpView2.pml"); if (!File.Exists(scriptSourceFile)) { throw new Exception("Script file not found: " + scriptSourceFile); } string csvFile = ClientDirs.TempDir + @"\PyMolBatchLoad.csv"; // the .csv file to write WriteCsvFile(csvFile, ExportSingle.Checked, _qcProtein, _qcDensity, _qcTarget, qm, url, densityMapUrl, target); //qm.Query.Tables[0].MetaTable.Name try // Read the CorpView2.pml that gets edited. { StreamReader sr = new StreamReader(scriptSourceFile); script = sr.ReadToEnd(); sr.Close(); } catch (Exception ex) { throw new Exception("Error reading " + scriptSourceFile + ": " + ex.Message); } // Get the path to the plugin file string pluginFile = null; Lex lex = new Lex("="); lex.OpenString(script); while (true) { string tok = lex.Get(); if (tok == "") { break; } if (Lex.Ne(tok, "pluginLocation")) { continue; } pluginFile = lex.Get(); if (pluginFile == "=") { pluginFile = lex.Get(); } pluginFile = Lex.RemoveSingleQuotes(pluginFile); } if (pluginFile == null) { throw new Exception("Can't find definition of plugin location"); } // Get the proper plugin directory string pluginFolder = Path.GetDirectoryName(pluginFile); if (!Directory.Exists(pluginFolder)) { string pluginFile2 = pluginFile; pluginFile2 = Lex.Replace(pluginFile2, "Progra~1", "Progra~2"); // Win7 x86 folder using 8.3 names pluginFile2 = Lex.Replace(pluginFile2, "Program Files", "Program Files (x86)"); // Win7 x86 folder with regular names string pluginFolder2 = Path.GetDirectoryName(pluginFile2); if (!Directory.Exists(pluginFolder2)) { DebugLog.Message("Can't find PyMOL plugin folder: " + pluginFolder); MessageBox.Show("Can't find PyMol plugin folder " + pluginFolder + ".\rContact Pymol Support team."); Progress.Hide(); return; } script = Lex.Replace(script, pluginFile, pluginFile2); // substitute proper plugin file name in script pluginFile = pluginFile2; } bool update = false; bool pyMolInstalled = File.Exists(pluginFile); ClientLog.Message("Checking for PyMol installation..."); if (pyMolInstalled) { DateTime dt1 = File.GetLastWriteTime(pluginSourceFile); DateTime dt2 = File.GetLastWriteTime(pluginFile); if (DateTime.Compare(dt1, dt2) > 0) { ClientLog.Message(" PyMol file is older than the Mobius version."); update = true; } } else { ClientLog.Message(" Could not find PyMol file: " + pluginFile); update = true; } // Be sure the plugin is up to date if (update) { try { File.Copy(pluginSourceFile, pluginFile, true); // copy CorpView.py to Pymol startup dir } catch (Exception ex) { ClientLog.Message(" Error copying CorpView.py to: " + pluginFile + ", " + ex.Message); if (!pyMolInstalled) { MessageBox.Show("Unable to find Corp Plugin (CorpView.py) for Pymol.\rWindows 7 will not allow Mobius access to copy the plugin to your machine.\rContact Pymol Support team."); Progress.Hide(); return; } } } DebugLog.Message("Error copying CorpView.py to: " + pluginFile); // Plug the csv file name into the script string csvFileNameParm = "<csv-file-name>"; if (!Lex.Contains(script, csvFileNameParm)) { throw new Exception("<csv-file-name> not found in script"); } string csvFileNameForScript = csvFile.Replace(@"\", "/"); // translate backslashes so they aren't interpreted as escapes script = Lex.Replace(script, csvFileNameParm, csvFileNameForScript); string scriptFile = ClientDirs.TempDir + @"\CorpView.pml"; sw = new StreamWriter(scriptFile); sw.Write(script); sw.Close(); Progress.Show("Passing data to PyMOL..."); try { //DebugLog.Message("startFile: " + startFile); //DebugLog.Message("startArgs: " + startArgs); Process p = Process.Start(scriptFile); } catch (Exception ex) { MessageBoxMx.ShowError("Failed to start PyMOL"); Progress.Hide(); return; } System.Threading.Thread.Sleep(3000); // leave message up a bit while PyMOL is starting/being activated Progress.Hide(); }
private Expression<Func<SalesOrder, bool>> GetQueryExp(int companyId, int customerId, int commodityId, int commodityTypeId, int brandId, int warsehouseId, int status, DateTime? startDate, DateTime? endDate, List<int> listCommodity, List<int> listCompany) { var clauses = new List<Clause>(); if (customerId != 0) { clauses.Add(new Clause { PropertyName = "CompanyId", Operator = Operator.Eq, Value = customerId }); } if (companyId != 0) { clauses.Add(new Clause { Operator = Operator.Eq, PropertyName = "Stock.CompanyId", Value = companyId }); } if (commodityId != 0) { clauses.Add(new Clause { Operator = Operator.Eq, PropertyName = "Stock.CommodityId", Value = commodityId }); } if (commodityTypeId != 0) { clauses.Add(new Clause { Operator = Operator.Eq, PropertyName = "Stock.CommodityTypeId", Value = commodityTypeId }); } if (brandId != 0) { clauses.Add(new Clause { Operator = Operator.Eq, PropertyName = "Stock.BrandId", Value = brandId }); } if (warsehouseId != 0) { clauses.Add(new Clause { Operator = Operator.Eq, PropertyName = "Stock.WarehouseId", Value = warsehouseId }); } if (status != 0) { clauses.Add(new Clause { Operator = Operator.Eq, PropertyName = "Status", Value = status }); } if (startDate.HasValue) { clauses.Add(new Clause { Operator = Operator.Ge, PropertyName = "Date", PropertyType = typeof(DateTime), Value = startDate.Value }); } if (endDate.HasValue) { clauses.Add(new Clause { Operator = Operator.Le, PropertyName = "Date", PropertyType = typeof(DateTime), Value = endDate.Value }); } var manager = new QueryManager<SalesOrder>(); return manager.Compile(clauses, o => listCompany.Contains(o.Stock.CompanyId) && listCommodity.Contains(o.Stock.CommodityId)); }
/// <summary> /// Execute delete data /// </summary> /// <param name="data">Data</param> /// <returns>Return delete command</returns> protected override ICommand ExecuteDeleteData(TEntity data) { return(ExecuteDeleteByCondition(QueryManager.AppendEntityIdentityCondition(data))); }
public BusinessPartnerDAO() { mObjQueryManager = new QueryManager(); }
/// <summary> /// 创建查询对象 /// </summary> /// <returns>返回查询对象</returns> public override IQuery CreateQuery() { IQuery query = base.CreateQuery() ?? QueryManager.Create <PermissionEntity>(this); #region 用户授权筛选 if (UserFilter != null) { IQuery userQuery = UserFilter.CreateQuery(); if (userQuery != null) { userQuery.AddQueryFields <UserEntity>(c => c.Id); //用户或者用户绑定角色的授权权限 IQuery userOrRolePermissionQuery = QueryManager.Create(); #region 用户授权 IQuery userBindingPermissionQuery = QueryManager.Create <UserPermissionEntity>(c => c.Disable == false); userBindingPermissionQuery.EqualInnerJoin(userQuery); userBindingPermissionQuery.AddQueryFields <UserPermissionEntity>(c => c.PermissionId); IQuery userPermissionQuery = QueryManager.Create <PermissionEntity>(); userPermissionQuery.In <PermissionEntity>(c => c.Id, userBindingPermissionQuery); userOrRolePermissionQuery.And(userPermissionQuery); #endregion #region 角色授权 //用户绑定的角色 IQuery userRoleQuery = QueryManager.Create <UserRoleEntity>(); userRoleQuery.EqualInnerJoin(userQuery); var roleQuery = QueryManager.Create <RoleEntity>(r => r.Status == RoleStatus.Enable); roleQuery.EqualInnerJoin(userRoleQuery); //角色授权 var roleBindingPermissionQuery = QueryManager.Create <RolePermissionEntity>(); roleBindingPermissionQuery.EqualInnerJoin(roleQuery); roleBindingPermissionQuery.AddQueryFields <RolePermissionEntity>(rp => rp.PermissionId); var rolePermissionQuery = QueryManager.Create <PermissionEntity>(); rolePermissionQuery.In <PermissionEntity>(c => c.Id, roleBindingPermissionQuery); userOrRolePermissionQuery.Or(rolePermissionQuery); #endregion query.And(userOrRolePermissionQuery); #region 用户禁用授权 IQuery userDisablePermissionQuery = QueryManager.Create <UserPermissionEntity>(c => c.Disable == true); userDisablePermissionQuery.EqualInnerJoin(userQuery); userDisablePermissionQuery.AddQueryFields <UserPermissionEntity>(c => c.PermissionId); query.NotIn <PermissionEntity>(c => c.Id, userDisablePermissionQuery); #endregion } } #endregion return(query); }
protected void create_debug_window() { var window = dbwin.root().createWindow("query"); window.createButton("select.done") .setOnPress(() => { for (int i = 0; i < NetConfig.PLAYER_MAX; i++) { var query = new QuerySelectDone(AccountManager.get().getAccountData(i).account_id); QueryManager.get().registerQuery(query); } }); window.createButton("select.finish") .setOnPress(() => { var query = new QuerySelectFinish("Daizuya"); QueryManager.get().registerQuery(query); }); window.createButton("summon dog") .setOnPress(() => { QuerySummonBeast query_summon = new QuerySummonBeast("Daizuya", "Dog"); QueryManager.get().registerQuery(query_summon); }); window.createButton("summon neko") .setOnPress(() => { QuerySummonBeast query_summon = new QuerySummonBeast("Daizuya", "Neko"); QueryManager.get().registerQuery(query_summon); }); window.createButton("cake count") .setOnPress(() => { for (int i = 0; i < PartyControl.get().getFriendCount(); i++) { chrBehaviorPlayer friend = PartyControl.get().getFriend(i); QueryCakeCount query_cake = new QueryCakeCount(friend.getAcountID(), (i + 1) * 10); QueryManager.get().registerQuery(query_cake); } }); #if false window.createButton("버린다") .setOnPress(() => { chrBehaviorLocal player = CharacterRoot.get().findCharacter <chrBehaviorLocal>(GameRoot.getInstance().account_name_local); player.controll.cmdItemQueryDrop(); }); window.createButton("말풍선") .setOnPress(() => { //chrBehaviorLocal player = CharacterRoot.get().findCharacter<chrBehaviorLocal>(GameRoot.getInstance().account_name_local); chrBehaviorNet player = CharacterRoot.get().findCharacter <chrBehaviorNet>("Daizuya"); player.controll.cmdQueryTalk("멀리 있는 사람과 Talk한다", true); }); #endif }
private Expression<Func<Company, bool>> GetQueryExp(string key, int customerType, int userId) { var clauses = new List<Clause> { new Clause { PropertyName = "Type", Operator = Operator.Eq, Value = customerType } }; if (!string.IsNullOrWhiteSpace(key)) { clauses.Add(new Clause { PropertyName = "FullName", Operator = Operator.Like, Value = key }); } List<Company> companies = GetAllCompanyByUser(customerType, userId); var manager = new QueryManager<Company>(); if (customerType == (int)CustomerType.Internal) { List<int> list = companies.Select(u => u.Id).ToList(); return manager.Compile(clauses, o => list.Contains(o.Id)); } else { return manager.Compile(clauses); } }
public SearchDiscountController() { qMgr = new QueryManager(); }
private bool Initialize(System.Windows.Forms.Control renderWindow ) { d3dSettings = new Settings(); d3dDevice = DeviceUtility.CreateDevice( d3dSettings,renderWindow ); if (d3dDevice != null) { d3dCapabilities = new Capabilities(this); // Create subsystems. d3dPrimaryFrameBuffer = FrameBuffer.Create( this ); d3dGeometryManager = GeometryManager.Create( this ); d3dTextureManager = TextureManager.Create(this); d3dQueryManager = QueryManager.Create(this); d3dCompiler = Compiler.Create(this); return true; } return false; }
public RejectedDAO() { mObjQueryManager = new QueryManager(); }
public static QueryManager getInstance() { if(QueryManager.instance == null) { QueryManager.instance = GameObject.Find("GameRoot").GetComponent<QueryManager>(); } return(QueryManager.instance); }
public override void ExecuteCommand(CancellationToken token) { var options = new MockOptionsDictionary(); var ok = new Action <string, MockOptionsDictionary>((result, checkedOptions) => { int numRows = 0; if (!int.TryParse(result, out numRows)) { ShellManager.ShowMessageBox("Please input a valid number"); return; } else { if (numRows <= 0) { numRows = 0; } else if (numRows > 1000) { numRows = 1000; } } string selectedText = ShellManager.GetSelectedText(); var sb = new StringBuilder(); using (var ds = new DataSet()) { QueryManager.Run(ConnectionManager.GetConnectionStringForCurrentWindow(), token, (queryManager) => { queryManager.Fill(string.Format("SET ROWCOUNT {0}; {1}", numRows, selectedText), ds); }); if (ds.Tables.Count == 1) { sb.AppendDropTempTableIfExists("#Actual"); sb.AppendLine(); sb.AppendDropTempTableIfExists("#Expected"); sb.AppendLine(); sb.AppendTempTablesFor(ds.Tables[0], "#Actual"); sb.Append("INSERT INTO #Actual"); ShellManager.AddTextToTopOfSelection(sb.ToString()); sb.Clear(); sb.AppendColumnNameList(ds.Tables[0]); ShellManager.AppendToEndOfSelection( string.Format("{0}SELECT {1}INTO #Expected{0}FROM #Actual{0}WHERE 1=0;{0}", Environment.NewLine, sb.ToString()) ); ShellManager.AppendToEndOfSelection( TsqltManager.GenerateInsertFor(ds.Tables[0], ObjectMetadata.FromQualifiedString("#Expected"), false, false)); } else { return; } } //var meta = ObjectMetadata.FromQualifiedString(selectedText); //ObjectMetadataAccess da = new ObjectMetadataAccess(ConnectionManager.GetConnectionStringForCurrentWindow()); //var table = da.SelectTopNFrom(meta, numRows); //StringBuilder sb = new StringBuilder(); //sb.Append(TsqltManager.GetFakeTableStatement(selectedText)); //sb.AppendLine(); //sb.Append(TsqltManager.GenerateInsertFor(table, meta, options.EachColumnInSelectOnNewRow, options.EachColumnInValuesOnNewRow)); //shellManager.ReplaceSelectionWith(sb.ToString()); }); var diagManager = new DialogManager.InputWithCheckboxesDialogManager <MockOptionsDictionary>(); diagManager.Show("How many rows to select? (0=max)", "1", options, ok, cancelCallback); }
public void InsertMailDB(MailSend ms) { QueryManager qm = new QueryManager(this.ConnectionString); qm.InsertObject <MailSend>(ms); }
/// <summary> /// Displays a list of <see cref="WorkItemSummary"/> objects for the stored query with the given id. This /// action also pages and sorts an existing list. /// </summary> public ActionResult StoredQuery(Guid? id, string sortBy, bool? desc, int? page, int? pageSize) { if (!id.HasValue) return RedirectToAction("StoredQueries"); Guid queryId = id.Value; QueryManager manager = new QueryManager(); ListData data = new ListData(); data.WorkItems = manager.StoredQuery(queryId); PageList(data, sortBy, desc, page, pageSize); ViewData["CurrentQueryId"] = queryId; return View("StoredQueries", data); }
public void Execute(object parameter) { QueryManager.QueryStart(QueryType.Market, QueryType.Market.ToString(), parameter as string); }
static void Main(string[] args) { IScheduler sch; sch = new PriorityScheduler(); //new RoundRobinScheduler(); QueryManager qm = new QueryManager(); clearTables(); ExecuteScheduler("Priority", sch, true, qm.GetQueries()); /*Query[] queries = qm.GetQueries(); dipGlobal.Init(10000); DoQuery[] dqs = new DoQuery[queries.Length]; for (int i = 0; i < dqs.Length; i++) { dqs[i] = ExecuteThread; dqs[i].BeginInvoke(queries[i], dipGlobal, null, null); } Thread.Sleep(Timeout.Infinite);*/ /*while (true) { foreach (Query q in queries) { q.Iterate(dipGlobal.GetItem, dipGlobal.ReleaseItem); } }*/ }
public PrefixesDAO() { mObjQueryManager = new QueryManager(); }
/// <summary> /// Constructor for the DefinitionQueryLibrary class. /// </summary> /// <example> /// <b>C#</b> /// <code> /// // Example: Create a new DefinitionQueryLibrary. /// /// DefinitionQueryLibrary dqLibrary; /// dqLibrary = new DefinitionQueryLibrary(); /// </code> /// <b>VB.Net</b> /// <code> /// ' Example: Create a new DefinitionQueryLibrary. /// /// Dim dqLibrary As DefinitionQueryLibrary /// dqLibrary = new DefinitionQueryLibrary() /// </code> /// </example> public DefinitionQueryLibrary() { // Create an instance of the FileManager. dqFileManager = new FileManager(); // Create an instance of the QueryManager. dqQueryManager = new QueryManager(); // Init default SOP Class UID and System Name. sopClassUID = ""; systemName = ""; }
public static List <DMDefinition> DMList() { QueryManager qm = new QueryManager(); return(qm.GetQueryResultDirect <DMDefinition>("SELECT * FROM dmdefinition where status=1")); }
public bool MailSendTo(string Body, string Subject, string ToEmailID) { bool status = false; try { QueryManager objManager = new QueryManager(); DataTable dtsmtpserver = objManager.getMailSetting(); // string senduserEMail = dtsmtpserver.Rows[0][8].ToString(); int Port = Convert.ToInt32(dtsmtpserver.Rows[0][4].ToString()); string host = dtsmtpserver.Rows[0][3].ToString(); string User = dtsmtpserver.Rows[0][1].ToString(); string Password = dtsmtpserver.Rows[0][2].ToString(); //***************Updated Code********************* // MailAddress from = new MailAddress(senduserEMail); MailAddress from = new MailAddress(dtsmtpserver.Rows[0][10].ToString()); MailAddress to = new MailAddress(ToEmailID); MailMessage msg = new MailMessage(from, to); string[] strUser = ToEmailID.Split(','); for (int i = 1; i < strUser.Length; i++) { msg.To.Add(strUser[i]); } //msg.Body = Body.ToString(); msg.Body = Body; // Subject msg.Subject = Subject; // Html message body msg.IsBodyHtml = true; //assigning Priority msg.Priority = MailPriority.High; //giving the all SMTP server information from web.config for sending mail.... SmtpClient client = new SmtpClient(host, Port);// //client.UseDefaultCredentials = false; client.EnableSsl = true; // System.Net.NetworkCredential theCredential = new System.Net.NetworkCredential("excellent", "m49q3r"); System.Net.NetworkCredential theCredential = new System.Net.NetworkCredential(User, Password); client.Credentials = theCredential; Console.WriteLine("Sending an e-mail message to {0} by using the SMTP host{1}.", to.Address, client.Host); client.Send(msg);//Sending the mail.. status = true; return status; } catch (Exception ex) { throw ex; } finally { } }
public ActionResult GetRevisionHistory(int workItemId, int revisionId) { QueryManager manager = new QueryManager(); BugSummary summary = manager.ItemByIdForRevision<BugSummary>(workItemId, revisionId); return Content(summary.History); }
public BaseController() { _db = new AjaoOkoDb(); _query = new QueryManager(); merchantId = _query.GetId(); }
private Expression<Func<CommodityType, bool>> GetQueryExp(int? commodityId, string commodityTypeName) { var clauses = new List<Clause>(); if (commodityId != null) { clauses.Add(new Clause { PropertyName = "CommodityId", Operator = Operator.Eq, Value = commodityId }); } if (!string.IsNullOrWhiteSpace(commodityTypeName)) { clauses.Add(new Clause { Operator = Operator.Like, PropertyName = "Name", Value = commodityTypeName }); } var manager = new QueryManager<CommodityType>(); return manager.Compile(clauses); }
public void Setup() { // need to clear out the InMemory cache before each test is run so that each is independent and won't effect the next one var cache = MemoryCache.Default; foreach (var item in cache) { cache.Remove(item.Key); } QueryManager = new QueryManager<Contact, int>(new StandardCachingStrategy<Contact, int>() { CachePrefix = "#RepoStandardCache" }); }
public AccountingAccountsSetupLoginService() { mObjAccountingAccountsSetupLoginDAO = new TableDAO <AccountingAccountsSetupLogin>(); mObjQueryManager = new QueryManager(); }
public ActionResult Edit(BugSummary item,string fromUrl) { BugManager manager = new BugManager(); try { item.IsNew = false; manager.Save(item); // Save the files once it's saved (as we can't add an AttachmentsCollection as it has no constructors) if (Request.Files.Count > 0) { try { // Save to the App_Data folder. List<Attachment> attachments = new List<Attachment>(); string filename1 = SaveFile("uploadFile1", item.Id); string filename2 = SaveFile("uploadFile2", item.Id); string filename3 = SaveFile("uploadFile3", item.Id); if (!string.IsNullOrEmpty(filename1)) { attachments.Add(new Attachment(filename1, Request.Form["uploadFile1Comments"])); } if (!string.IsNullOrEmpty(filename2)) { attachments.Add(new Attachment(filename2, Request.Form["uploadFile2Comments"])); } if (!string.IsNullOrEmpty(filename3)) { attachments.Add(new Attachment(filename3, Request.Form["uploadFile3Comments"])); } manager.SaveAttachments(item.Id, attachments); } catch (IOException e) { TempData["Error"] = e.Message; return RedirectToAction("Edit", new { id = item.Id }); } } if (string.IsNullOrEmpty(fromUrl)) return RedirectToAction("View", new { id = item.Id }); else return Redirect(fromUrl); } catch (SaveException e) { TempData["Error"] = e.Message; // Get the original back, to populate the valid reasons. QueryManager queryManager = new QueryManager(); BugSummary summary = queryManager.ItemById<BugSummary>(item.Id); summary.IsNew = false; // Repopulate from the POST'd data summary.Title = item.Title; summary.State = item.State; summary.Reason = item.Reason; summary.Priority = item.Priority; summary.Severity = item.Severity; summary.Description = item.Description; summary.AssignedTo = item.AssignedTo; summary.AreaId = item.AreaId; summary.AreaPath = item.AreaPath; summary.IterationId = item.IterationId; summary.IterationPath = item.IterationPath; MSAgileEditData<BugSummary> data = new MSAgileEditData<BugSummary>(); data.WorkItem = summary; data.PageTitle = "Bug " + item.Id; data.FromUrl = fromUrl; data.States = summary.ValidStates; data.Reasons = summary.ValidReasons; data.Priorities = summary.ValidPriorities; data.Severities = summary.ValidSeverities; return View(data); } }
public void CreatePlaylist(Playlist playlist) { playlist.PlaylistId = QueryManager.CreatePlaylist(ref playlist); PlaylistList.Add(playlist); }
public int getNoOfException(string Query) { bool flagTransation = true; int TotalException=0; DataAccessLayer objDataAccess = new DataAccessLayer(); SqlTransaction objTrans = null; try { if (objTrans == null) { flagTransation = false; objDataAccess.GetConnection.Open(); SqlTransaction objTransaction = objDataAccess.GetConnection.BeginTransaction(); objTrans = objTransaction; } QueryManager objManager = new QueryManager(); TotalException = objManager.getNoOfException(Query, objTrans); if (!flagTransation) objTrans.Commit(); return TotalException; } catch (Exception ex) { if (!flagTransation) objTrans.Rollback(); throw ex; } finally { objDataAccess.GetConnection.Close(); } }
public void DeletePlaylist(Playlist playlist) { QueryManager.DeletePlaylist(playlist); PlaylistList.Remove(playlist); }
public DataSet ExecuteQueryWithDataSet(string Query) { bool flagTransation = true; SqlCommand cmd = new SqlCommand(); DataAccessLayer objDataAccess = new DataAccessLayer(); //EMSPDI.dil.DataAccessLayer objDataAccess = new EMSPDI.dil.DataAccessLayer(); SqlTransaction objTrans = null; try { if (objTrans == null) { flagTransation = false; objDataAccess.GetConnection.Open(); SqlTransaction objTransaction = objDataAccess.GetConnection.BeginTransaction(); objTrans = objTransaction; } QueryManager objManager = new QueryManager(); DataSet dsQueryResult = objManager.ExecuteQueryWithDataSet(Query, objTrans); if (!flagTransation) objTrans.Commit(); return dsQueryResult; } catch (Exception ex) { if (!flagTransation) objTrans.Rollback(); throw ex; } finally { objDataAccess.GetConnection.Close(); } }
public void RemoveSongFromPlaylist(Playlist playlist, Song song) { QueryManager.PlaylistRemoveSong(playlist, song); SongList.Remove(song); }
public void AddSongToPlaylist(Playlist selectedPlaylist, Song song) { QueryManager.PlaylistAddSong(selectedPlaylist, song); SongList.Add(song); }
//I found that User works, ie. User.Identity.Name or User.IsInRole("Administrator")... public ActionResult Index() { String user = User.Identity.Name; ViewData["userName"] = user; bool isEnrolled = false; Student st = db.Students.Find(user); if (st != null) { isEnrolled = st.IsEnrolled; } QueryManager manager = new QueryManager(db); List <FacultyRankList> rankList = manager.getStudentRankList(user); ViewData["enrolledProgramme"] = ""; ViewData["faculty"] = ""; if (isEnrolled) { ViewData["isRankListPublished"] = true; ViewData["isEnrolled"] = true; if (rankList.Count() == 1) { ViewData["enrolledProgramme"] = rankList.First().ProgrammeName; Faculty f = db.Faculties.Find(ViewData["enrolledProgramme"]); ViewData["faculty"] = f.FacultyName; } return(View(model)); } ViewData["isEnrolled"] = false; QueryManager queryManager = new QueryManager(db); List <FacultyRankList> studentRankList = queryManager.getStudentRankList(user); List <String> l = getProgrammes(studentRankList); l.Insert(0, "Please Select"); SelectList pr = new SelectList(l); ViewData["programmes"] = pr; //bool hasFacultyRankListEntries = (db.FacultyRankLists.ToList().Count() != 0 ) ? true : false; //ViewData["isRankListPublished"] = false; //if (hasFacultyRankListEntries) //{ // ViewData["isRankListPublished"] = true; //} QueryManager mng = new QueryManager(db); // класиране първи етап - дати ViewData["isFirstRankListPublished"] = false; if (db.Dates.ToList().Last().FirstRankingDate == "true") { ViewData["isFirstRankListPublished"] = true; } // класиране втори етап - дати ViewData["isSecondRankListPublished"] = false; if (db.Dates.ToList().Last().FirstRankingDate == "true") { ViewData["isSecondRankListPublished"] = true; } // класиране трети етап - дати ViewData["isThirdRankListPublished"] = false; if (db.Dates.ToList().Last().FirstRankingDate == "true") { ViewData["isThirdRankListPublished"] = true; } List <String> studentProgrammes = new List <String>(); foreach (var item in studentRankList) { studentProgrammes.Add(item.ProgrammeName); } Dictionary <String, int> prefNumbers = new Dictionary <String, int>(); foreach (var item in studentProgrammes) { var prefNumber = from pref in db.Preferences where pref.EGN == user && pref.ProgrammeName == item select pref.PrefNumber; prefNumbers.Add(item, prefNumber.First()); } foreach (var item in studentRankList) { String faculty = db.Faculties.Find(item.ProgrammeName).FacultyName; StudentRankingInformation r = new StudentRankingInformation { FacultyName = faculty, FinalResult = item.TotalGrade, ProgrammeName = item.ProgrammeName, PrefNumber = prefNumbers[item.ProgrammeName] }; model.Add(r); } ViewData["result"] = model; // model.Add(new StudentRankingInformation { FacultyName = "FMI", FinalResult = 22.4, PrefNumber = 1, ProgrammeName = "KN" }); return(View(model)); }