Esempio n. 1
0
 internal static Picture FromImage(Image image)
 {
     return((image == null) ? null : new Picture()
     {
         Data = ByteImageConverter.ToByteArray(image, image.RawFormat)
     });
 }
Esempio n. 2
0
        private void LoadIcon(BuildStatusEnum statusValue, bool isInProgress, bool isStuck)
        {
            var status = new BuildStatus(statusValue, isInProgress, isStuck);

            if (iconsByKey.ContainsKey(status.Key))
            {
                return;
            }

            try
            {
                var resourceName = string.Format("JenkinsTray.Resources.StatusIcons.{0}.gif", status.Key);
                var img          = ResourceImageHelper.CreateImageFromResources(resourceName, GetType().Assembly);
                var imgBytes     = ByteImageConverter.ToByteArray(img, ImageFormat.Gif);
                iconsByKey.Add(status.Key, imgBytes);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(JenkinsTrayResources.FailedLoadingIcons_Text,
                                    JenkinsTrayResources.FailedLoadingIcons_Caption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                LoggingHelper.LogError(logger, ex);
                throw new Exception("Failed loading icon: " + status, ex);
            }
        }
Esempio n. 3
0
        private void cmdAbriImagen_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog
            {
                Filter = @"Archivos de imagen|*.jpg;*.jpeg;*.png;*.gif;*.tif;"
            };

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                Image  img  = Image.FromFile(openFileDialog.FileName);
                byte[] data = ByteImageConverter.ToByteArray(img, img.RawFormat);
                iFoto.EditValue = data;
            }
        }
        protected override void OnEditValueChanged()
        {
            if (!(EditValue is EditValueInstance))
            {
                return;
            }
            if ((EditValue != null) && (EditValue as EditValueInstance).Image != null)
            {
                this.image = ByteImageConverter.FromByteArray(ByteImageConverter.ToByteArray((EditValue as EditValueInstance).Image));
            }
            Point offset = new Point(0, 0);

            if ((EditValue as EditValueInstance) != null)
            {
                offset = (EditValue as EditValueInstance).Offset;
            }
            if ((EditValue != null) && (offset != null))
            {
                this.HorizontOffset = offset.X;
                this.VerticalOffset = offset.Y;
            }
        }
Esempio n. 5
0
        private void tableView_RowUpdated(object sender, RowEventArgs e)
        {
            NhanVienViewList row = (NhanVienViewList)grid.SelectedItem;

            if (row == null)
            {
                return;
            }
            grid.RefreshData();

            foreach (NhanVien i in dc.NhanViens.Where(x => x.nvid == row.nvid))
            {
                if (i != null)
                {
                    i.tennv = row.tennv;
                    if (row.gioitinh == "Nam")
                    {
                        i.gioitinh = true;
                    }
                    else
                    {
                        i.gioitinh = false;
                    }
                    i.hinh     = ByteImageConverter.ToByteArray(row.hinh);
                    i.diachi   = row.diachi;
                    i.doanhthu = row.doanhthu;
                    i.ngaysinh = row.ngaysinh;
                    i.matkhau  = row.matkhau;
                    i.email    = row.email;
                    i.sdt      = row.sdt;
                    i.quyen    = row.quyen;
                    dc.SubmitChanges();
                    MessageBox.Show("Đã cập nhật thành công !");
                }
            }
            grid.ItemsSource = new NhanVienModelView().DSNVList;
        }
 internal byte[] ImageToByteArray(Image inp)
 {
     return(ByteImageConverter.ToByteArray(inp));
 }
 internal Image ByteArrayToImage(byte[] inp)
 {
     return(ByteImageConverter.FromByteArray(ByteImageConverter.ToByteArray(inp)));
 }
Esempio n. 8
0
        private void Aceptar_simpleButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ValidaFormulario())
                {
                    return;
                }
                ConfiguracionGeneral configuracion = AConfiguracionId == 0 ? (new ConfiguracionGeneral()) : AGlobalDataContext.ConfiguracionGeneral.FirstOrDefault();
                if (configuracion != null)
                {
                    configuracion.Agencia           = Convert.ToString(NombreCentro_textEdit.EditValue);
                    configuracion.DireccionEmpresa  = Convert.ToString(Direccion_textEdit.EditValue);
                    configuracion.TelefonosAgencia  = Convert.ToString(Tel_textEdit.EditValue);
                    configuracion.CorreoElectronico = Convert.ToString(Email_textEdit.EditValue);
                    configuracion.SitioWeb          = Convert.ToString(SitioWeb_textEdit.EditValue);



                    if (pictureEdit1.Image != null)
                    {
                        {
                            Image  img  = pictureEdit1.Image;
                            byte[] data = ByteImageConverter.ToByteArray(img, img.RawFormat);
                            configuracion.LogoAgencia = data;
                        }
                    }
                    // pictureEdit1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                    //pictureEdit1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                    //binary = new Binary(ms.GetBuffer());
                    //byte[] _Imagen = binary.ToArray();
                    //configuracion.LogoAgencia = _Imagen;



                    #region Generales

                    configuracion.AnnoDeTrabajo = Convert.ToInt32(Anno_textEdit.EditValue);

                    configuracion.PrimerNumeroContratoNacionalAnual = Convert.ToInt32(PrimerCttoNacional_textEdit5.EditValue);
                    configuracion.CaminoContratosNacionales         = Convert.ToString(CaminoCttoNacional_buttonEdit.EditValue);

                    configuracion.PrimerNumeroContratoInternacionalAnual =
                        Convert.ToInt32(PrimerCttoIntern_textEdit.EditValue);
                    configuracion.CaminoContratoInternacionales =
                        Convert.ToString(CaminoCttoInternacional_buttonEdit.EditValue);

                    configuracion.Reup         = Convert.ToString(Reup_textEdit.EditValue).Trim();
                    configuracion.NitAgencia   = Convert.ToString(NIT_textEdit.EditValue).Trim();
                    configuracion.CerrandoAnno = EnCierre_checkEdit.Checked;

                    #endregion

                    #region cargos

                    configuracion.NombreDeJefeAgencia  = Convert.ToString(NombreDirigeAgencia_textEdit.EditValue);
                    configuracion.CargoDeJefeDeAgencia = Convert.ToString(CargoDirigeAgencia_textEdit.EditValue);

                    configuracion.NombreJefeDeDptoTramite = Convert.ToString(NombreDirigTram_textEdit.EditValue);
                    configuracion.CargoJefeDptoTramite    = Convert.ToString(CargoDirTram_textEdit.EditValue);

                    configuracion.Destinatario_O_DirigidoA = Convert.ToString(NombreDirEmpRect_textEdit.EditValue);
                    configuracion.CargoDestinatario        = Convert.ToString(CargoDirEmpRect_textEdit.EditValue);
                    configuracion.EmpresaDestinatario      = Convert.ToString(NombEmpRect_textEdit.EditValue);

                    #endregion

                    #region Otras
                    configuracion.VigenciaContrato = VigenciaContrato_textEdit.EditValue == null ? 0 : Convert.ToInt32(VigenciaContrato_textEdit.EditValue);
                    if (IndiceIngInst_textEdit.EditValue != null)
                    {
                        configuracion.IndiceParticipacionInstitucion = Convert.ToDecimal(IndiceIngInst_textEdit.EditValue);
                    }

                    #endregion

                    if (AConfiguracionId == 0)
                    {
                        AGlobalDataContext.ConfiguracionGeneral.InsertOnSubmit(configuracion);
                    }
                }

                AGlobalDataContext.SubmitChanges();
                ACambiosRealizados = true;
            }
            catch (Exception exception)
            {
                XtraMessageBox.Show(exception.Message);
            }
        }