Example #1
0
        public static void Sua(ArrayList arrayList)
        {
            CTCC cTCC = Find(arrayList);

            Console.WriteLine("Nhập tên CTCC");
            cTCC.Tenctcc = Nhap.NhapString();
            Console.WriteLine("Nhập địa chỉ");
            cTCC.Diachi = Nhap.NhapString();
            Console.WriteLine("Nhập số điện thoại");
            cTCC.Sdt = Nhap.NhapString();
        }
Example #2
0
        public static CTCC Find(ArrayList arrayList)
        {
            CTCC kq = null;

            Console.WriteLine("Nhập mã ctcc: ");
            string tk = Nhap.NhapString();

            foreach (CTCC cTCC in arrayList)
            {
                if (tk == cTCC.Mactcc.ToString())
                {
                    kq = cTCC;
                }
            }
            return(kq);
        }
Example #3
0
        public void ExecuteCommand()
        {
            using (var process = new System.Diagnostics.Process())
            {
                process.StartInfo.FileName               = filename;
                process.StartInfo.Arguments              = argument;
                process.StartInfo.WorkingDirectory       = workingDirectory;
                process.StartInfo.CreateNoWindow         = true;
                process.StartInfo.UseShellExecute        = false;
                process.StartInfo.RedirectStandardError  = true;
                process.StartInfo.RedirectStandardInput  = true;
                process.StartInfo.RedirectStandardOutput = true;

                process.ErrorDataReceived += (o, e) =>
                {
                    CTCC.CrossThreadControlCall(controlOutput, () =>
                    {
                        if (e.Data != null)
                        {
                            controlOutput.Text += "\r\n[ERROR]: " + e.Data + "\r\n";
                        }
                    });
                };

                process.OutputDataReceived += (o, e) =>
                {
                    CTCC.CrossThreadControlCall(controlOutput, () =>
                    {
                        if (e.Data != null)
                        {
                            controlOutput.Text += e.Data + "\r\n";
                        }
                    });
                };

                process.Start();

                controlOutput.Text += (controlOutput.Text.Length == 0 ? "" : "\r\n") + "Please wait...\r\n";

                // Feed command to Console
                process.StandardInput.WriteLine(argument);

                // Begin Asynchronous reading of Console's StdError and StdOutput
                process.BeginErrorReadLine();
                process.BeginOutputReadLine();
            }
        }
Example #4
0
 public static void HienThiCTCC(CTCC cTCC)
 {
     Console.WriteLine("|{0,-20}|{1,-20}|{2,-20}|{3,-20}|", cTCC.Mactcc, cTCC.Tenctcc, cTCC.Diachi, cTCC.Sdt);
 }