示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Class_Contrato Con = new Class_Contrato();

            if (TXT_NumCon.Text == "")
            {
                this.ShowMessageAsync("ERROR: ", "Ingrese el Numero de contrato");
            }
            else
            {
                if (TXT_NumCon.Text == Con.ID_Contrato)
                {
                    this.ShowMessageAsync("ERROR:", "El contrato ingresado ya existe");
                }
                else
                {
                    Con.ID_Contrato    = TXT_NumCon.Text;
                    Con.ID_seguro      = null;
                    Con.Destino        = TXT_Destino.Text;
                    Con.Escuela        = TXT_Escuela.Text;
                    Con.Run_Emp        = UserLoginCache.Run_Emp;
                    Con.Fecha_Salida   = DATETIME_FECHA_IDA.SelectedDate;
                    Con.Fecha_llegada  = DATETIME_FECHA_VUELTA.SelectedDate;
                    Con.Valor_Contrato = TXT_VALOR_CONTRATO.Text;
                    if (TXT_NUM_ALUMNOS.Text == "" || TXT_Destino.Text == "" ||
                        TXT_NumCon.Text == "" || TXT_VALOR_CONTRATO.Text == "" || DATETIME_FECHA_IDA.SelectedDate == null || DATETIME_FECHA_VUELTA.SelectedDate == null)
                    {
                        this.ShowMessageAsync("ERROR:", "Por favor, ingrese todos los campos");
                    }
                    else
                    {
                        Con.N_alumnos = int.Parse(TXT_NUM_ALUMNOS.Text);
                        if (Con.Agregar())
                        {
                            this.ShowMessageAsync("PROCESO COMPLETADO", "Contrato grabado con exito");
                            TXT_Destino.Clear();
                            TXT_Escuela.Clear();
                            TXT_NumCon.Clear();
                            TXT_NUM_ALUMNOS.Clear();
                            TXT_VALOR_CONTRATO.Clear();
                        }
                        else
                        {
                            this.ShowMessageAsync("ERROR AL INGRESAR DATOS ", "Error al registrar datos, asegurese de que todos los campos estan completados de manera correcta e intente nuevamente");
                        }
                    }
                }
            }
        }
示例#2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
            {
                var caminhoOrigem  = FB_Origem.SelectedPath;
                var caminhoDestino = FB_Destino.SelectedPath;

                Process          My_Process      = new Process();
                ProcessStartInfo My_Process_Info = new ProcessStartInfo();


                My_Process_Info.FileName = "cmd.exe";



                if (caminhoOrigem != "" && caminhoDestino != "")
                {
                    var      splitOrigem  = caminhoOrigem;
                    string[] strOrigem    = splitOrigem.Split('\\');
                    var      pastaDestino = strOrigem[strOrigem.Length - 1];

                    My_Process_Info.WorkingDirectory       = @"c:\temp";
                    My_Process_Info.Arguments              = "/c robocopy \"" + caminhoOrigem + "\"" + " " + "\"" + caminhoDestino + "\\" + pastaDestino + "\"" + " /e /z /eta /v /bytes";
                    My_Process_Info.CreateNoWindow         = false;
                    My_Process_Info.UseShellExecute        = false;
                    My_Process_Info.RedirectStandardOutput = false;
                    My_Process_Info.RedirectStandardError  = false;
                    My_Process.EnableRaisingEvents         = true;
                    My_Process.StartInfo = My_Process_Info;
                    My_Process.Start();
                    My_Process.WaitForExit();

                    MessageBox.Show("Transferência concluída.", "Concluído", MessageBoxButtons.OK);
                }


                TXT_Origem.Clear();
                TXT_Destino.Clear();
            }
            else if (radioButton2.Checked)
            {
                var caminhoOrigem  = fileorigem.FileName;
                var caminhoDestino = FB_Destino.SelectedPath;

                Process          My_Process      = new Process();
                ProcessStartInfo My_Process_Info = new ProcessStartInfo();



                My_Process_Info.FileName = "cmd.exe";



                if (caminhoOrigem != "" && caminhoDestino != "")
                {
                    My_Process_Info.WorkingDirectory       = @"c:\temp";
                    My_Process_Info.Arguments              = "/c copy \"" + caminhoOrigem + "\"" + " " + "\"" + caminhoDestino + "\"";
                    My_Process_Info.CreateNoWindow         = false;
                    My_Process_Info.UseShellExecute        = false;
                    My_Process_Info.RedirectStandardOutput = false;
                    My_Process_Info.RedirectStandardError  = false;
                    My_Process.EnableRaisingEvents         = true;
                    My_Process.StartInfo = My_Process_Info;
                    My_Process.Start();
                    My_Process.WaitForExit();

                    MessageBox.Show("Transferência concluída.", "Concluído", MessageBoxButtons.OK);

                    TXT_Destino.Clear();
                    TXT_Origem.Clear();
                    caminhoOrigem  = "";
                    caminhoDestino = "";
                }
            }
            else
            {
                string ndselect = "Por favor, Verifique os caminhos de origem e destino.";
                MessageBox.Show(ndselect);
            }
        }