protected void btnSubmit_Click(object sender, EventArgs e) { User user = IUserService.GetDataByPropertyName(nameof(Utility.User.UniqueKey), key, true, 0, 0, false).FirstOrDefault(); if (user != null) { if (txtNewPassword.Text != "" && txtConfirmPassword.Text != "" && txtNewPassword.Text == txtConfirmPassword.Text) { string encryptPassword = CustomEncryptorDecryptor.EncryptPassword(txtNewPassword.Text); if (encryptPassword != user.Password) { user.Password = encryptPassword; user.TransPwd = encryptPassword; user.UniqueKey = CustomGenerator.GenerateUniqueKeyForUser(user.Username); user.UpdatedOn = DateTime.Now; user.UpdatedBy = user.Id; user.IsPasswordReset = 0; IUserService.UpdateData(user); Response.Redirect("Login.aspx"); } else { resetPasswordResponse.InnerHtml = "Please enter new password!"; } } } }
private FBurnCustom() { InitializeComponent(); _generator = new CustomGenerator( Global.Skola.Namn, new [] { Global.Skola }, null, new Size(Global.Porträttfotobredd, Global.Porträttfotobredd*3/2), null); cboType.Items.Add( _generator.PresetArkivJpg ); cboType.Items.Add( _generator.PresetSport ); cboType.Items.Add( _generator.PresetVimmel ); cboType.SelectedIndex = 0; var iml = new ImageList { ColorDepth = ColorDepth.Depth24Bit, TransparentColor = Color.Magenta, ImageSize = new Size(16, 16) }; iml.Images.AddStrip( new Bitmap( typeof(FMain), "grfx.treeicons.bmp" ) ); tv.ImageList = iml; _queThumbnails = Queue.Synchronized( new Queue() ); }
public IActionResult GenerateAllTable([FromBody] object data) { Dictionary <string, string> resultCollectionDic = new Dictionary <string, string>(); var builder = new StringBuilder(""); var fileContentMarkdown = ""; var markdownHeader = @" # 資料庫說明文件 # 目錄 [TOC] # 修訂歷程 | Date | Author | Version | Change Reference | | ---------- | ------ | ------- | ------------------------ | | | | | | # 資料表設計 "; builder.AppendLine(markdownHeader); try { string webRootPath = _hostingEnvironment.WebRootPath; //From wwwroot string contentRootPath = _hostingEnvironment.ContentRootPath; //From Others var postData = JsonConvert.DeserializeObject <dynamic>(data.ToString()); var databaseJson = postData.database; bool enableMap = (bool)postData.enableMap; string dbName = databaseJson.DatabaseName; List <TableInfo> tableInfo = getAllTableFromDb(dbName); //Markdown var markdown = _genDefineDic.Where(m => m.Key == "Markdown").FirstOrDefault(); foreach (TableInfo table in tableInfo) { var tableName = table.TableName; List <ColumnInfo> columnInfos = getColumnsFromTable(dbName, tableName); var tableInfoForLiquid = new TableInfoForLiquid(table); var columnInfosForLiquid = columnInfos.Select(m => new ColumnInfoForLiquid(m)).ToList(); var otherInfoForLiquid = getOtherInfoForLiquid(tableInfoForLiquid, columnInfosForLiquid); fileContentMarkdown = new CustomGenerator(markdown.Value).Generate(tableInfoForLiquid, columnInfosForLiquid, otherInfoForLiquid, webRootPath); builder.AppendLine(fileContentMarkdown); } resultCollectionDic.Add(markdown.Key, builder.ToString()); } catch (Exception ex) { ex.ToString(); } return(Json(resultCollectionDic)); }
protected void btnSubmit_Click(object sender, EventArgs e) { Int32 LoginUserId = 0; if (HttpContext.Current.Session["UserId"] != null) { LoginUserId = Convert.ToInt32(HttpContext.Current.Session["UserId"].ToString()); } if (Session["UserId"] == null) { } else { Int32 UserId = Convert.ToInt32(Session["UserId"].ToString()); User user = IUserService.GetSingle(UserId); if (user != null) { if (txtOldPassword.Text != "" && txtNewPassword.Text != "" && txtConfirmPassword.Text != "") { string encryptOldPassword = CustomEncryptorDecryptor.EncryptPassword(txtOldPassword.Text); if (encryptOldPassword == user.Password) { if (txtNewPassword.Text == txtConfirmPassword.Text) { string encryptPassword = CustomEncryptorDecryptor.EncryptPassword(txtNewPassword.Text); if (encryptPassword != user.Password) { user.Password = encryptPassword; user.TransPwd = encryptPassword; user.UniqueKey = CustomGenerator.GenerateUniqueKeyForUser(user.Username); user.UpdatedOn = DateTime.Now; user.UpdatedBy = LoginUserId; IUserService.UpdateData(user); resetPasswordResponse.InnerHtml = "Updated successfully!"; } else { resetPasswordResponse.InnerHtml = "Please enter new password!"; } } else { resetPasswordResponse.InnerHtml = "Passwords doesn't match!"; } } else { resetPasswordResponse.InnerHtml = "Please enter correct password!"; } } else { resetPasswordResponse.InnerHtml = "Please enter all fields!"; } } } }
public static object SubmitClick(string txtOldPassword, string txtNewPassword, string txtConfirmPassword) { if (HttpContext.Current.Session["UserId"] == null) { return(null); } else { Int32 UserId = Convert.ToInt32(HttpContext.Current.Session["UserId"].ToString()); User user = IUserService.GetSingle(UserId); if (user != null) { if (txtOldPassword != "" && txtNewPassword != "" && txtConfirmPassword != "") { string encryptOldPassword = CustomEncryptorDecryptor.EncryptPassword(txtOldPassword); if (encryptOldPassword == user.Password) { if (txtNewPassword == txtConfirmPassword) { string encryptPassword = CustomEncryptorDecryptor.EncryptPassword(txtNewPassword); if (encryptPassword != user.Password) { user.Password = encryptPassword; user.TransPwd = encryptPassword; user.UniqueKey = CustomGenerator.GenerateUniqueKeyForUser(user.Username); user.UpdatedOn = DateTime.Now; user.UpdatedBy = UserId; IUserService.UpdateData(user); return("Updated successfully!"); } else { return("Please enter new password!"); } } else { return("Passwords doesn't match!"); } } else { return("Please enter correct password!"); } } else { return("Please enter all fields!"); } } else { return("No user!"); } } }
private FCreateCustomCD( CustomGenerator generator, string strTitle ) { InitializeComponent(); if ( strTitle != null ) this.Text = "Skapar " + strTitle; _generator = generator; _jpgSaver = new JpegSaver( 88 ); }
public static void showDialog( Form parent, CustomGenerator generator, string strTitle ) { using ( var dlg = new FCreateCustomCD( generator, strTitle ) ) if ( dlg.ShowDialog( parent ) == DialogResult.Cancel ) { foreach ( var bfi in dlg._alDest ) Util.safeKillFile( bfi.LocalFullFileName ); } }
private FCreatePhotoArkiv(Skola skola) { InitializeComponent(); _skola = skola; _jpgSaver = new JpegSaver(88); _strFotobok = Global.getAppPath("Fotobok"); if (!Directory.Exists(_strFotobok) || Directory.GetFiles(_strFotobok).Length == 0) { chkFotobok.Enabled = false; chkFotobok.Checked = false; } _generatorVimmel = new CustomGenerator( Global.Skola.Namn, new [] {Global.Skola}, null, new Size(Global.Porträttfotobredd, Global.Porträttfotobredd*3/2), null); _generatorVimmel.selectPreset(_generatorVimmel.PresetVimmel); _generatorVimmel.GenerateFiles(false, false, true); var installEXE = Global.getAppPath("PhotoArkiv\\install.exe"); var strInstVer = FileVersion.getFileVersion(installEXE); string instFolder = null; if (string.IsNullOrEmpty(strInstVer)) lblVersion.Text = "CD:n kommer att brännas utan installationsprogram eftersom det saknas i denna Plåta-installtion!"; else { lblVersion.Text = string.Format("PhotoArkiv-version: {0}.", strInstVer); instFolder = Path.GetDirectoryName(installEXE); } _cp = new CreatePhotoArkiv( DateTime.Now, instFolder, Global.GetTempPath()); }
public IActionResult GenerateCode([FromBody] object data) { Dictionary <string, string> resultCollectionDic = new Dictionary <string, string>(); try { string webRootPath = _hostingEnvironment.WebRootPath; //From wwwroot string contentRootPath = _hostingEnvironment.ContentRootPath; //From Others var postData = JsonConvert.DeserializeObject <dynamic>(data.ToString()); var tableJson = postData.table; var columnsJson = postData.columns; //(TW)取得Table資訊 var tableInfo = JsonConvert.DeserializeObject <TableInfo>(tableJson.ToString()); //(TW)頁面上勾選的Table Columns資訊反序列化 (包括從DB取得的資訊內容) List <ColumnInfo> columnInfos = JsonConvert.DeserializeObject <List <ColumnInfo> >(columnsJson.ToString()); var tableInfoForLiquid = new TableInfoForLiquid(tableInfo); var columnInfosForLiquid = columnInfos.Select(m => new ColumnInfoForLiquid(m)).ToList(); var otherInfoForLiquid = getOtherInfoForLiquid(tableInfoForLiquid, columnInfosForLiquid); foreach (var item in _genDefineDic) { var result = new CustomGenerator(item.Value).Generate(tableInfoForLiquid, columnInfosForLiquid, otherInfoForLiquid, webRootPath); resultCollectionDic.Add(item.Key, result); } } catch (Exception ex) { ex.ToString(); } return(Json(resultCollectionDic)); }
private void cmdBurnSport_Click(object sender, System.EventArgs e) { var generator = new CustomGenerator( Global.Skola.Namn, new[] {Global.Skola}, null, new Size(Global.Porträttfotobredd, Global.Porträttfotobredd*3/2), null); generator.selectPreset(generator.PresetSport); generator.GenerateFiles(true, true, true); FCreateCustomCD.showDialog(this, generator, "Sportfotoarkiv"); }
private void cmdBurnProgArkiv_Click( object sender, System.EventArgs e ) { var sk = Global.Skola; var iff = sk.CustomProgFormat!=ImageFileFormat.Null ? sk.CustomProgFormat : ImageFileFormat.JPG; var customName = !string.IsNullOrEmpty(sk.CustomProgNaming) ? sk.CustomProgNaming : "bilder\\?K"; int nMaxWidth, nMaxHeight; if ( sk.CustomProgWidth!=0 || sk.CustomProgHeight!=0 ) { nMaxWidth = sk.CustomProgWidth; nMaxHeight = sk.CustomProgHeight; } else { nMaxWidth = 256; nMaxHeight = 384; } var generator = new CustomGenerator( sk.Namn, new [] {sk}, null, new Size(Global.Porträttfotobredd, Global.Porträttfotobredd*3/2), null); generator.CustomPorträtt.Add( new CustomBurnInfo( iff, customName, nMaxWidth, nMaxHeight, false, PhotoType.Portrait ) ); generator.GenerateFiles( false, true, true ); FCreateCustomCD.showDialog( this, generator, null ); }
private void cmdBurnPEAB_Click( object sender, EventArgs e ) { var generator = new CustomGenerator( Global.Skola.Namn, new [] {Global.Skola}, null, new Size(Global.Porträttfotobredd, Global.Porträttfotobredd*3/2), null); generator.CustomPorträtt.Add(new CustomBurnInfo( ImageFileFormat.JPG, @"?F,?E,?P", 0, 0, false, PhotoType.Portrait)); generator.GenerateFiles(false, true, false); FCreateCustomCD.showDialog(this, generator, "PEAB-arkiv"); }
public static Generator <T> Set <T>(this CustomGenerator <T> customGenerator, IContinousDistribution newDistribution) where T : new() { Generator <T> .Distributions[customGenerator.PointedProperty] = newDistribution; return(customGenerator.Generator); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserId"] == null) { Response.Redirect("Login.aspx"); } Int32 LoginUserId = 0; if (HttpContext.Current.Session["UserId"] != null) { LoginUserId = Convert.ToInt32(HttpContext.Current.Session["UserId"].ToString()); } string isSubmit = Request.QueryString["isSubmit"]; if (isSubmit != null) { if (isSubmit.ToString() == "1") { string oldPassword = Request.QueryString["txtOldPassword"].ToString(); txtOldPassword.Text = oldPassword; string newPassword = Request.QueryString["txtNewPassword"].ToString(); txtNewPassword.Text = newPassword; string confirmPassword = Request.QueryString["txtConfirmPassword"].ToString(); txtConfirmPassword.Text = confirmPassword; if (txtOldPassword.Text != "" && txtNewPassword.Text != "" && txtConfirmPassword.Text != "") { Int32 UserId = Convert.ToInt32(HttpContext.Current.Session["UserId"].ToString()); User user = IUserService.GetSingle(UserId); if (user != null) { string encryptOldPassword = CustomEncryptorDecryptor.EncryptPassword(txtOldPassword.Text); if (encryptOldPassword == user.Password) { if (txtNewPassword.Text == txtConfirmPassword.Text) { string encryptPassword = CustomEncryptorDecryptor.EncryptPassword(txtNewPassword.Text); if (encryptPassword != user.Password) { user.Password = encryptPassword; user.TransPwd = encryptPassword; user.UniqueKey = CustomGenerator.GenerateUniqueKeyForUser(user.Username); user.UpdatedOn = DateTime.Now; user.UpdatedBy = LoginUserId; IUserService.UpdateData(user); resetPasswordResponse.InnerHtml = "Updated successfully!"; } else { resetPasswordResponse.InnerHtml = "Please enter new password!"; } } else { resetPasswordResponse.InnerHtml = "Passwords doesn't match!"; } } else { resetPasswordResponse.InnerHtml = "Please enter correct password!"; } } else { resetPasswordResponse.InnerHtml = "No user!"; } } } } }