public void PreencheDadosEmployee(Employee employee) { lblEmployeeId.Text = UtilConvert.ToString(employee.EmployeeId); //lblWords.Text = UtilConvert.ToString(employee.Words); //lblWordsLanguage.Text = UtilConvert.ToString(employee.WordsLanguage); lblArchiveId.Text = UtilConvert.ToString(employee.ArchiveId); picProfilePhoto.Image = UtilImage.ByteToImage(new Archive { ArchiveId = employee.ArchiveId }.ObterPorCod().Blob); uiTxtPNome.Text = UtilConvert.ToString(employee.FirstName); uiTxtUNome.Text = UtilConvert.ToString(employee.LastName); uiTxtDataNasc.Text = UtilConvert.ToString(employee.DateBirth.ToString("dd/MM/yyyy")); uiTxtSexo.Text = UtilConvert.ToString(employee.Gender); uiTxtCPF.Text = UtilConvert.ToString(employee.CPF); uiTxtRG.Text = UtilConvert.ToString(employee.RG); uiTxtEmail.Text = UtilConvert.ToString(employee.Email); uiTxtLogradouro.Text = UtilConvert.ToString(employee.StreetLine); //uiPanelEndereco.Text = UtilConvert.ToString("0"); uiTxtBairro.Text = UtilConvert.ToString(employee.Neighborhood); uiTxtPais.Text = UtilConvert.ToString(employee.Country); uiTxtCidade.Text = UtilConvert.ToString(employee.City); uiTxtEstado.Text = UtilConvert.ToString(employee.Region); uiTxtNumero.Text = UtilConvert.ToString(employee.Number); uiTxtCep.Text = UtilConvert.ToString(employee.PostCode); uiTxtTelCel.Text = UtilConvert.ToString(employee.MobileNumber); uiTxtTelFixo.Text = UtilConvert.ToString(employee.PhoneNumber); btnCriar.Visible = false; btnCancelar.Visible = true; btnAtualizar.Visible = true; uiTxtCPF.ReadOnly = true; }
protected void rauFotoEmpleado_FileUploaded(object sender, FileUploadedEventArgs e) { EliminarDocumento(vIdItemFotografia.ToString()); using (Stream fileStream = rauFotoEmpleado.UploadedFiles[0].InputStream) { using (System.Drawing.Image bitmapImage = UtilImage.ResizeImage(System.Drawing.Image.FromStream(fileStream), 200, 200)) { using (MemoryStream stream = new MemoryStream()) { vNbLogotipo = rauFotoEmpleado.UploadedFiles[0].GetName(); if ((vNbLogotipo.Length != 0) && (vNbLogotipo.Length >= 50)) { UtilMensajes.MensajeResultadoDB(rwmAlertas, "El nombre de la imagen no puede ser tan largo", E_TIPO_RESPUESTA_DB.WARNING, 400, 150, null); vNbLogotipo = null; return; } else { bitmapImage.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); vFiLogotipo = Convert.ToBase64String(stream.ToArray()); rbiFotoEmpleado.DataValue = stream.ToArray(); } } } } btnEliminarFotoEmpleado.Visible = true; AddDocumento("FOTOGRAFIA", rauFotoEmpleado); grdDocumentos.Rebind(); }
private void CreateUserPanel(Employee employee, FlowLayoutPanel flowLayoutPanel) { uiPanel uiPanel = new uiPanel(); uiPanel.Name = "pnlEmployee" + employee.EmployeeId; uiPanel.Size = new Size(221, 86); uiPanel.PanelRadius = 5; uiPanel.Tag = employee.EmployeeId; uiPanel.BackColor = Color.FromArgb(215, 223, 255); uiPanel.Click += new EventHandler(Employee_Click); PictureBox pictureBox = new PictureBox(); pictureBox.Name = "picEmployee" + employee.EmployeeId; pictureBox.Size = new Size(77, 77); pictureBox.Image = UtilImage.ByteToImage(new Archive { ArchiveId = employee.ArchiveId }.ObterPorCod().Blob); pictureBox.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox.Tag = employee.EmployeeId; pictureBox.BackColor = Color.Transparent; uiPanel.Controls.Add(pictureBox); pictureBox.Location = new Point(4, 4); pictureBox.Click += new EventHandler(Employee_Click); Label label = new Label(); label.Name = "lblEmployee" + employee.EmployeeId; label.Font = new Font("Gadugi", 14, FontStyle.Bold); label.ForeColor = Color.FromArgb(80, 63, 153); label.Tag = employee.EmployeeId; label.BackColor = Color.FromArgb(242, 245, 255); label.Text = employee.FirstName + " " + employee.LastName; label.AutoEllipsis = true; label.AutoSize = false; label.Size = new Size(133, 21); uiPanel.Controls.Add(label); label.Location = new Point(85, 6); label.Click += new EventHandler(Employee_Click); Label labelCPF = new Label(); labelCPF.Name = "lblEmployeeCPF" + employee.EmployeeId; labelCPF.Font = new Font("Gadugi", 8); labelCPF.ForeColor = Color.FromArgb(180, 182, 194); labelCPF.BackColor = Color.FromArgb(242, 245, 255); labelCPF.Text = UtilConvert.ToString(employee.CPF); labelCPF.AutoEllipsis = true; labelCPF.Tag = employee.EmployeeId; labelCPF.AutoSize = false; labelCPF.Size = new Size(131, 14); uiPanel.Controls.Add(labelCPF); labelCPF.Location = new Point(87, 27); labelCPF.Click += new EventHandler(Employee_Click); flowLayoutPanel.Controls.Add(uiPanel); //flowLayoutPanel.Controls.Add(uiPanelEmployee); }
private void btnAtualizar_Click(object sender, EventArgs e) { try { if (UtilValidar.CamposValidos(uiPanelCryptocurrency)) { if (newImage) { int archiveId = new Archive { Blob = UtilImage.ImageToByte(picCriptocurrency.Image), }.Gravar(); bool updated = new Cryptocurency { ArchiveId = archiveId, Name = uiTxtCriptocurrency.Text, Base = uiTxtCryptocurrencyBase.Text, Description = uiTxtDescription.Text, CryptocurrencyBalance = UtilConvert.ToInt(uiTxtCryptocurrencyBalance.Text), CryptocurrencyUnit = uiTxtCryptocurrencyUnit.Text }.AlterarPorId(); if (updated) { new Alert(String.Format("A criptomoeda {0} foi cadastrada.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Info); newImage = false; } else { new Alert(String.Format("A criptomoeda {0} não foi cadastrada. Tente novamente mais tarde.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Warning); newImage = true; } } else { bool response = new Cryptocurency { ArchiveId = UtilConvert.ToInt(lblArchiveId.Text), Name = uiTxtCriptocurrency.Text, Base = uiTxtCryptocurrencyBase.Text, Description = uiTxtDescription.Text, CryptocurrencyBalance = UtilConvert.ToInt(uiTxtCryptocurrencyBalance.Text), CryptocurrencyUnit = uiTxtCryptocurrencyUnit.Text }.AlterarPorId(); new Alert(String.Format("A criptomoeda {0} foi cadastrada.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Info); } } } catch (Exception ex) { new Alert(ex.Message, uiCSB.Toastr.Type.Warning); } finally { ObterCriptomoedas(); } }
protected void rauLogoOrganizacion_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e) { System.Drawing.Image bitmapImage = UtilImage.ResizeImage(System.Drawing.Image.FromStream(rauLogoOrganizacion.UploadedFiles[0].InputStream), 200, 200); MemoryStream stream = new MemoryStream(); bitmapImage.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); vFiLogotipo = Convert.ToBase64String(stream.ToArray()); vNbLogotipo = rauLogoOrganizacion.UploadedFiles[0].GetName(); rbiLogoOrganizacion.DataValue = stream.ToArray(); }
private void lblNaviBar2_VisibleChanged(object sender, EventArgs e) { if (lblNaviBar2.Visible) { this.lblNaviBar1.Image = UtilImage.ResizeImage(global::ManagerPartient.Properties.Resources.button_menu_1, 120, 34); this.lblNaviBar2.Image = UtilImage.ResizeImage(global::ManagerPartient.Properties.Resources.button_menu_2, 120, 34); } else { this.lblNaviBar1.Image = UtilImage.ResizeImage(global::ManagerPartient.Properties.Resources.button_menu_2, 120, 34); } }
public frmBase() { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.None; RoundedForm roundedForm = new RoundedForm(this, pnlBackground); //Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width - 3, Height - 3, 20, 20)); //pnlBackground.Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, pnlBackground.Width, pnlBackground.Height, 20, 20)); UtilChangePanel.MudarConteudo(pnlConteudo, new uctBase()); lblNome.Text = AppDesktop.ActualEmployee.FirstName + " " + AppDesktop.ActualEmployee.LastName; picProfilePhoto.Image = UtilImage.ByteToImage(AppDesktop.ActualArchive.Blob); }
private void btnCriar_Click(object sender, EventArgs e) { try { if (UtilValidar.CamposValidos(uiPanelCryptocurrency)) { if (newImage) { int archiveId = new Archive { Blob = UtilImage.ImageToByte(picCriptocurrency.Image), }.Gravar(); int response = new Cryptocurency { ArchiveId = archiveId, Name = uiTxtCriptocurrency.Text, Base = uiTxtCryptocurrencyBase.Text, Description = uiTxtDescription.Text, CryptocurrencyBalance = UtilConvert.ToInt(uiTxtCryptocurrencyBalance.Text), CryptocurrencyUnit = uiTxtCryptocurrencyUnit.Text }.Gravar(); new Alert(String.Format("A criptomoeda {0} foi cadastrada.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Info); newImage = false; } else { int response = new Cryptocurency { ArchiveId = 1, Name = uiTxtCriptocurrency.Text, Base = uiTxtCryptocurrencyBase.Text, Description = uiTxtDescription.Text, CryptocurrencyBalance = UtilConvert.ToInt(uiTxtCryptocurrencyBalance.Text), CryptocurrencyUnit = uiTxtCryptocurrencyUnit.Text }.Gravar(); new Alert(String.Format("A criptomoeda {0} foi cadastrada.", uiTxtCriptocurrency.Text), uiCSB.Toastr.Type.Info); } } } catch (Exception ex) { new Alert(ex.Message, uiCSB.Toastr.Type.Warning); } }
private void uiFlowPanelMoedas_ParentChanged(object sender, EventArgs e) { List <Cryptocurency> cryptocurrencys = new Cryptocurency().ObterTodos(); foreach (Cryptocurency cryptocurrency in cryptocurrencys) { uiPicture uiPicture = uiPicture1; uiPicture.BackgroundImage = UtilImage.ByteToImage(new Archive() { ArchiveId = cryptocurrency.ArchiveId }.ObterPorCod().Blob); uiPicture.Tag = UtilConvert.ToString(cryptocurrency.CryptocurrencyId); //uiPicture.Click += new EventHandler(UiPicture_Click); uiPicture.Visible = true; uiFlowPanelMoedas.Controls.Add(uiPicture); } }
public void PreencheDadosCryptocurrency(Cryptocurency cryptocurency) { newImage = false; picCriptocurrency.Image = UtilImage.ByteToImage(new Archive { ArchiveId = cryptocurency.ArchiveId }.ObterPorCod().Blob); lblCryptocurrencyId.Text = UtilConvert.ToString(cryptocurency.CryptocurrencyId); lblArchiveId.Text = UtilConvert.ToString(cryptocurency.ArchiveId); uiTxtCriptocurrency.Text = UtilConvert.ToString(cryptocurency.Name); uiTxtCryptocurrencyBalance.Text = UtilConvert.ToString(cryptocurency.CryptocurrencyBalance); uiTxtCryptocurrencyUnit.Text = UtilConvert.ToString(cryptocurency.CryptocurrencyUnit); uiTxtDescription.Text = UtilConvert.ToString(cryptocurency.Description); uiTxtCryptocurrencyBase.Text = UtilConvert.ToString(cryptocurency.Base); uiTxtCryptocurrencyBalance.ReadOnly = true; uiTxtCryptocurrencyUnit.ReadOnly = true; btnCriar.Visible = false; btnAtualizar.Visible = true; }
protected void rauFotoEmpleado_FileUploaded(object sender, FileUploadedEventArgs e) { EliminarDocumento(vIdItemFotografia.ToString()); using (Stream fileStream = rauFotoEmpleado.UploadedFiles[0].InputStream) { using (System.Drawing.Image bitmapImage = UtilImage.ResizeImage(System.Drawing.Image.FromStream(fileStream), 200, 200)) { using (MemoryStream stream = new MemoryStream()) { bitmapImage.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); vFiLogotipo = Convert.ToBase64String(stream.ToArray()); vNbLogotipo = rauFotoEmpleado.UploadedFiles[0].GetName(); rbiFotoEmpleado.DataValue = stream.ToArray(); } } } btnEliminarFotoEmpleado.Visible = true; AddDocumento("FOTOGRAFIA", rauFotoEmpleado); grdDocumentos.Rebind(); }
/** * Properties **/ public FormMain() { InitializeComponent(); this.lblNaviBar1.Image = UtilImage.ResizeImage(global::ManagerPartient.Properties.Resources.button_menu_2, 120, 34); this.lblNaviBar2.Image = UtilImage.ResizeImage(global::ManagerPartient.Properties.Resources.button_menu_1, 120, 34); this.lblNaviBar3.Image = UtilImage.ResizeImage(global::ManagerPartient.Properties.Resources.button_menu_1, 120, 34); panelHome = new PanelHome(); panelListPatient = new PanelListPatient(); panelHome.DisplayPanelEvent += new DisplayPanelHander(DisplayPanel); panelListPatient.DisplayPanelEvent += new DisplayPanelHander(DisplayPanel); panelMain.SuspendLayout(); panelMain.Controls.Add(panelHome); panelMain.Controls.Add(panelListPatient); panelMain.ResumeLayout(); panelHome.Show(); panelListPatient.Hide(); panelMain.Name = typeof(PanelHome).Name; }
public void ProcessRequest(HttpContext context) { try { int NumCount = 4;//预设产生4位数 //取得亂數 string str_ValidateCode = UtilNumber.RandomNumber(NumCount); /*用於驗證的Session*/ context.Session["ValidateNumber"] = str_ValidateCode; //取得圖片物件 System.Drawing.Image image = UtilImage.CreateCheckCodeImage(str_ValidateCode); System.IO.MemoryStream ms = new System.IO.MemoryStream(); image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); /*輸出圖片*/ context.Response.Clear(); context.Response.ContentType = "image/jpeg"; context.Response.BinaryWrite(ms.ToArray()); ms.Close(); } catch (Exception ex) { Console.WriteLine("发生异常:" + ex.Message); } }
private void btnCriar_ClickAsync(object sender, EventArgs e) { try { if (UtilValidar.CamposValidos(uiPanelDados)) { if (newImage) { new Employee { ArchiveId = new Archive { Blob = UtilImage.ImageToByte(picProfilePhoto.Image) }.Gravar(), Words = UtilConvert.ToString(RandomWordsAsync(12)), WordsLanguage = UtilConvert.ToString("en-US"), FirstName = UtilConvert.ToString(uiTxtPNome.Text), LastName = UtilConvert.ToString(uiTxtUNome.Text), DateBirth = UtilConvert.ToDateTime(uiTxtDataNasc.Text), Gender = UtilConvert.ToChar(uiTxtSexo.Text), CPF = uiTxtCPF.Text, RG = uiTxtRG.Text, Email = uiTxtEmail.Text, StreetLine = uiTxtLogradouro.Text, //uiTxtNumero.Text, //uiTxtBairro.Text, Country = uiTxtPais.Text, City = uiTxtCidade.Text, Neighborhood = uiTxtBairro.Text, Region = uiTxtEstado.Text, Number = uiTxtNumero.Text, PostCode = uiTxtCep.Text, MobileNumber = uiTxtTelCel.Text, PhoneNumber = uiTxtTelFixo.Text }.Gravar(); } else { new Employee { ArchiveId = UtilConvert.ToInt(lblArchiveId.Text), Words = UtilConvert.ToString(RandomWordsAsync(12)), WordsLanguage = UtilConvert.ToString("en-US"), FirstName = UtilConvert.ToString(uiTxtPNome.Text), LastName = UtilConvert.ToString(uiTxtUNome.Text), DateBirth = UtilConvert.ToDateTime(uiTxtDataNasc.Text), Gender = UtilConvert.ToChar(uiTxtSexo.Text), CPF = uiTxtCPF.Text, RG = uiTxtRG.Text, Email = uiTxtEmail.Text, StreetLine = uiTxtLogradouro.Text, //uiTxtNumero.Text, //uiTxtBairro.Text, Country = uiTxtPais.Text, City = uiTxtCidade.Text, Neighborhood = uiTxtBairro.Text, Region = uiTxtEstado.Text, Number = uiTxtNumero.Text, PostCode = uiTxtCep.Text, MobileNumber = uiTxtTelCel.Text, PhoneNumber = uiTxtTelFixo.Text }.Gravar(); } } } catch (NullReferenceException) { new Alert("Preencha todos os campos antes de atualizar.", Type.Warning); } catch (Exception ex) { new Alert(ex.Message, Type.Warning); } }