コード例 #1
0
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            string User = FormInicio.PcUsuario;

            if (User == "ROBERT")
            {
                User = "******";
            }

            Electricos El   = NAgInspeccion.Datos(User).First();
            string     RUT  = El.RUT;
            string     PASS = El.Contraseña;

            if (WB.Document.Url.OriginalString == "http://intranet08.minvu.cl/ServiuVIII/login.aspx")
            {
                WB.Document.GetElementById("txt_login").InnerText = RUT.ToString();

                WB.Document.GetElementById("txt_pass").InnerText = PASS.ToString();
                //System.Threading.Thread.Sleep(5000);
                WB.Document.GetElementById("Aceptar").InvokeMember("click");
                WB.Navigate("http://intranet08.minvu.cl/ServiuVIII/sys_serviu/cometidofuncionario/grilla_solicitudes.aspx?id=qvuqusyuqrstuvwxypq&id_grupo=0&id_calidad_jefe=1");
            }
            //if (WB.Document.Url.OriginalString == "http://intranet08.minvu.cl/ServiuVIII/login.aspx") MessageBox.Show("Compuebe su contraseña", "Aplicación Eléctricos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //System.Threading.Thread.Sleep(5000);
        }
コード例 #2
0
        private void BtAgregar_Click(object sender, EventArgs e)
        {
            {
                if (CapaEntidad.Boton.Btn)
                {
                    try
                    {
                        string rpta = "";
                        if (this.CbNombre.Text == string.Empty || this.DtFecha.Text == string.Empty || this.CbElectrico.Text == string.Empty)
                        {
                            MensajeError("Falta ingresar datos, Los datos con * son Obligatorios");
                        }
                        else
                        {
                            //System.IO.MemoryStream ms = new System.IO.MemoryStream();
                            //this.PbFolio.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                            //byte[] image = ms.GetBuffer();
                            FileStream pdf          = File.OpenRead(ruta);
                            byte[]     contenidoPdf = new byte[pdf.Length];
                            pdf.Read(contenidoPdf, 0, (int)pdf.Length);
                            pdf.Close();

                            rpta = NAgInspeccion.Editar(Convert.ToInt32(this.LbID.Text), Convert.ToInt16(this.CbNombre.SelectedValue),
                                                        Convert.ToInt32(this.CbElectrico.SelectedValue), Convert.ToDateTime(this.DtFecha.Value), contenidoPdf);

                            if (rpta.Equals("OK"))
                            {
                                this.MensajeOk("Se Modificó el registro correctamente");
                            }

                            else
                            {
                                this.MensajeError(rpta);
                            }
                        }
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show(ex.Message + ex.StackTrace);
                    }
                }
                else
                {
                    try
                    {
                        string rpta = "";
                        if (this.CbNombre.Text == string.Empty || this.DtFecha.Text == string.Empty || this.CbElectrico.Text == string.Empty)
                        {
                            MensajeError("Falta ingresar datos, Los datos con * son Obligatorios");
                        }
                        else
                        {
                            //System.IO.MemoryStream ms = new System.IO.MemoryStream();
                            ////System.IO.MemoryStream ms2 = new System.IO.MemoryStream();
                            //this.PbFolio.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

                            FileStream pdf          = File.OpenRead(ruta);
                            byte[]     contenidoPdf = new byte[pdf.Length];
                            pdf.Read(contenidoPdf, 0, (int)pdf.Length);
                            pdf.Close();
                            //byte[] image = ms.GetBuffer();

                            rpta = NAgInspeccion.Agregar(Convert.ToInt16(this.CbNombre.SelectedValue),
                                                         Convert.ToInt32(this.CbElectrico.SelectedValue), Convert.ToDateTime(this.DtFecha.Value), contenidoPdf);

                            if (this.CkOutlook.Checked == true)
                            {
                                // usar el objeto de outlook para crear el recordatorio
                                Outlook._Application     App = (Outlook._Application) new Outlook.Application();
                                Outlook._AppointmentItem apt = (Outlook._AppointmentItem)
                                                               App.CreateItem(Outlook.OlItemType.olAppointmentItem);
                                // algunas propiedades
                                apt.Subject = "Inspeccion obra" + this.CbNombre.Text;
                                apt.Body    = "reminderComment";
                                apt.Start   = this.DtFecha.Value;
                                apt.End     = this.DtFecha.Value.AddHours(6);
                                apt.ReminderMinutesBeforeStart = 1;
                                apt.BusyStatus  = Outlook.OlBusyStatus.olTentative;
                                apt.AllDayEvent = false;
                                apt.Save();
                            }
                            if (rpta.Equals("OK"))
                            {
                                this.MensajeOk("Se Agregó el registro correctamente");
                            }
                            else
                            {
                                this.MensajeError(rpta);
                            }
                        }
                    }
                    catch (System.Exception ex)
                    {
                        MessageBox.Show(ex.Message + ex.StackTrace);
                    }
                }
            }
        }