Example #1
0
        public void CopyZipFile2(string _processby, Main2 main)
        {
            string dPath = Application.StartupPath + @"\AFT_" + main.batchfile + "_" + _processby + ".zip";
            string sPath = "\\\\192.168.0.254\\captive\\Zips\\Banko_Nuestra\\Test\\AFT_" + main.batchfile + "_" + _processby + ".zip";

            File.Copy(sPath, dPath, true);
            //string dPath2 = "\\\\192.168.0.254\\PrinterFiles\\ISLA\\2019\\";
            //string sPath2 = "\\\\192.168.0.254\\captive\\Auto\\IslaBank\\Test\\";
        }
Example #2
0
        static void Main(string[] args)
        {
            Main2.PureEvil();

            //todo explain named params
            GuessNumberGame game = new GuessNumberGame(100, 6, GuessingPlayer.Human);

            game.Start();
            Console.ReadLine();
        }
Example #3
0
        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                SqlConnection conn = DBConn.GetInstance();

                //SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) from Login where Username = '******'and Password ='******'", conn);
                // SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) from Login where Username = @UN and Password = @PW", conn);
                DataRowView drv = (DataRowView)cmbLogin.SelectedItem;
                username = (string)drv.Row["Username"];
                RoleId   = (int)drv.Row["RoleId"];

                //sda.SelectCommand.Parameters.AddWithValue("@UN", cmbLogin.Text);
                // sda.SelectCommand.Parameters.AddWithValue("@PW", textBox2.Text);
                DataTable dt = new DataTable();
                // sda.Fill(dt);
                try
                {
                    if (cmbLogin.Text != "" && textBox2.Text != "")
                    {
                        //SqlDataAdapter sda1 = new SqlDataAdapter("Select Username from Login where username = '******'and Password ='******'", conn);
                        SqlDataAdapter sda1 = new SqlDataAdapter("Select Count(*) from Login where Username = @UN and Password = @PW", conn);

                        sda1.SelectCommand.Parameters.AddWithValue("@UN", cmbLogin.Text);
                        sda1.SelectCommand.Parameters.AddWithValue("@PW", textBox2.Text);
                        DataTable dt1 = new DataTable();
                        sda1.Fill(dt1);
                        //label4.Text = "Login approved as Admin";
                        if (dt1.Rows[0][0].ToString() == "1")
                        {
                            this.Hide();
                            Main2 FF = new Main2();
                            FF.WindowState = FormWindowState.Maximized;

                            //AdminForm af = new AdminForm();
                            conn.Close();

                            FF.Show();
                        }
                        else
                        {
                            lblincorrectpass.Text = "Password is incorrect";
                        }
                    }
                    else
                    {
                        lblincorrectpass.Text = "please fill all textboxes!";
                    }
                }
                catch (Exception ex)
                {
                    lblmsg.Text = ex.Message;
                }
            }
        }
Example #4
0
        public void ZipFileS2(string _processby, Main2 main)
        {
            string sPath = Application.StartupPath + "\\Output\\" + Main2.outputFolder;
            string dPath = Application.StartupPath + "\\Output\\AFT_" + main.batchfile + "_" + _processby + ".zip";

            DeleteZipfile();
            ZipFile.CreateFromDirectory(sPath, dPath);
            Ionic.Zip.ZipFile zips = new Ionic.Zip.ZipFile(dPath);
            zips.AddItem(Application.StartupPath + "\\Head");
            zips.Save();
            // CopyZipFile2(_processby, main);
            DeleteFiles(".SQL");
        }
Example #5
0
    public static void Main()
    {
        string text;

        //ファイルの読み込み
        using (StreamReader sr = new StreamReader(
                   "view.txt", Encoding.GetEncoding("Shift_JIS")))
        {
            {
                text = sr.ReadToEnd();        //一気に読み込める
            }
            string[] line = text.Split('\n'); //行を配列に格納
            string[] yx   = line[0].Split(' ');

            int y = int.Parse(yx[0]); // y 12
            int x = int.Parse(yx[1]); // x 10

            //Zahyo(二次元配列)に格納
            char[,] Zahyo = new char[y, x];
            for (int yy = 0; yy < y + 1; yy++)
            {
                if (yy == 0)
                {
                    continue;
                }
                for (int xx = 0; xx < x; xx++)
                {
                    Zahyo[yy - 1, xx] = line[yy][xx];
                }
            }

            int count = 0;
            char[,] map = Zahyo;
            for (int i = 0; i < y; i++)
            {
                for (int k = 0; k < x; k++)
                {
                    if (Zahyo[i, k] == 'W')
                    {
                        count++;
                        Main2 A = new Main2(map, y, x);
                        //Console.WriteLine(i +":" +k);
                        A.henkan(i, k);
                    }
                }
            }


            Console.WriteLine(count);
        }
    }
Example #6
0
        void OpenMain()
        {
            Main2 dummyDoc = new Main2(this);

            if (this.dockPanel1.DocumentStyle == DocumentStyle.SystemMdi)
            {
                dummyDoc.MdiParent = this;
                dummyDoc.Show();
            }
            else
            {
                dummyDoc.Show(this.dockPanel1);
            }
        }
Example #7
0
        public void PackingText2(List <ChequeModel> _checksModel, Main2 _mainForm)
        {
            StreamWriter  file;
            DBConnections db = new DBConnections();
            // db.GetAllData(_checksModel, _mainForm.batchFile);
            var listofcheck = _checksModel.Select(e => e.ChequeType).ToList();

            foreach (string Scheck in listofcheck)
            {
                if (Scheck == "A")
                {
                    string packkingListPath = outputForlder + "\\Regular_Checks\\PackingA.txt";
                    if (File.Exists(packkingListPath))
                    {
                        File.Delete(packkingListPath);
                    }
                    var checks = _checksModel.Where(a => a.ChequeType == Scheck).Distinct().ToList();
                    file = File.CreateText(packkingListPath);
                    file.Close();

                    using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append)))
                    {
                        string output = OutPutProcess.ConvertToPackingList(checks, "PERSONAL", _mainForm.batchfile);

                        file.WriteLine(output);
                    }
                }
            }
            foreach (string Scheck in listofcheck)
            {
                if (Scheck == "B")
                {
                    string packkingListPath = outputForlder + "\\Regular_Checks\\PackingB.txt";
                    if (File.Exists(packkingListPath))
                    {
                        File.Delete(packkingListPath);
                    }
                    var checks = _checksModel.Where(a => a.ChequeType == Scheck).Distinct().ToList();
                    file = File.CreateText(packkingListPath);
                    file.Close();

                    using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append)))
                    {
                        string output = OutPutProcess.ConvertToPackingList(checks, "COMMERCIAL", _mainForm.batchfile);

                        file.WriteLine(output);
                    }
                }
            }
        }
Example #8
0
    public static void Main()
    {
        string text;

        //ファイルの読み込み
        using (StreamReader sr = new StreamReader(
                   "view.txt", Encoding.GetEncoding("Shift_JIS")))
        {
            text = sr.ReadToEnd();
        }

        string[] values = text.Split('\n');
        string[] line   = values[0].Split(' ');

        int y = int.Parse(line[0]); // x 12
        int x = int.Parse(line[1]); // y 10

        //配列に入れる
        char[,] map = new char[y, x];
        for (int i = 0; i < y + 1; i++)
        {
            if (i == 0)
            {
                continue;
            }
            for (int k = 0; k < x; k++)
            {
                map[i - 1, k] = values[i][k];
            }
        }

        int count = 0;

        char[,] B = map;
        for (int i = 0; i < y; i++)
        {
            for (int k = 0; k < x; k++)
            {
                Main2 A = new Main2(B, x, y);
                B = A.Check(i, k);
                if (A.Count())
                {
                    count++;
                }
            }
        }
        Console.WriteLine(count);
    }
Example #9
0
        public static void CopyPrinterFile2(string _checkType, Main2 _mainForm)
        {
            string source      = Application.StartupPath + "\\Output";
            string destination = @"\\192.168.0.254\PrinterFiles\Banko_Nuestra\Test\" + DateTime.Now.Year;


            if (_checkType == "A")
            {
                File.Copy(source + "\\Regular_Checks\\BNU" + _mainForm.batchfile.Substring(0, 4) + "P.txt", destination + "\\BNU" + _mainForm.batchfile.Substring(0, 4) + "P.txt", true);
            }
            else if (_checkType == "B")
            {
                File.Copy(source + "\\Regular_Checks\\BNU" + _mainForm.batchfile.Substring(0, 4) + "C.txt", destination + "\\BNU" + _mainForm.batchfile.Substring(0, 4) + "C.txt", true);
            }
            //else if (_checkType == "CS")
            //    File.Copy(source + "\\Charge_Slip\\BNU" + _mainForm.batchfile.Substring(0, 4) + "CS.txt", destination + "\\BNU" + _mainForm.batchfile.Substring(0, 4) + "CS.txt", true);
        }
Example #10
0
        public static void CopyPackingDBF2(string _checkType, Main2 _mainForm)
        {
            string source      = Application.StartupPath + "\\Output";
            string destination = @"\\192.168.0.254\Packing\Banko_Nuestra\TEST\";
            {
                Directory.CreateDirectory(destination + _mainForm.batchfile);
            }

            string destination1 = @"\\192.168.0.254\Packing\Banko_Nuestra\TEST\" + _mainForm.batchfile;


            if (_checkType == "A" || _checkType == "B")
            {
                File.Copy(source + "\\Regular_Checks\\Packing.dbf", destination1 + "\\Packing.dbf", true);
            }

            //else if (_checkType == "CS")
            //    File.Copy(source + "\\Charge_Slip\\Packing.dbf", destination1 + "\\Packing.dbf", true);
        }
Example #11
0
        static void Main()
        {
            foreach (var process in Process.GetProcessesByName("GTFS_U.exe"))
            {
                process.Kill();
            }

            if (!checkSingleInstance())
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                //Application.Run(new Main());
                MetroFramework.Forms.MetroForm mainForm = new Main2();
                //MetroFramework.Forms.MetroForm mainForm = new Login();
                Application.Run(mainForm);
            }
            else
            {
                Application.Exit();
            }
        }
Example #12
0
 static void Main(string[] args)
 {
     //Main1.Execute();
     Main2.Execute();
 }
Example #13
0
        public void ProcessCheck2(List <ChequeModel> _checkm, Main2 _mainForm)
        {
            string        doBlockPath;
            StreamWriter  file;
            DBConnections db = new DBConnections();
            //  db.GetAllData(_checkm, _mainForm.batchfile);
            var chkList = _checkm.Select(e => e.ChequeType).Distinct().ToList();

            foreach (string chk in chkList)
            {
                doBlockPath = Application.StartupPath + "\\Output\\Regular_Checks\\BlockP.txt";

                if (chk == "A")
                {
                    if (File.Exists(doBlockPath))
                    {
                        File.Delete(doBlockPath);
                    }

                    file = File.CreateText(doBlockPath);
                    file.Close();

                    var chkA = _checkm.Where(e => e.ChequeType == chk).ToList();

                    using (file = new StreamWriter(File.Open(doBlockPath, FileMode.Append)))
                    {
                        string output = OutPutProcess.ConvertToBlockText(chkA, "PERSONAL", _mainForm.batchfile, _mainForm.deliveryDate, frmLogIn._userName, _mainForm.filename);

                        file.WriteLine(output);
                    }
                }
            }
            foreach (string chk in chkList)
            {
                if (chk == "B")
                {
                    var chkB = _checkm.Where(e => e.ChequeType == chk).ToList();
                    doBlockPath = Application.StartupPath + "\\Output\\Regular_Checks\\BlockC.txt";
                    if (File.Exists(doBlockPath))
                    {
                        File.Delete(doBlockPath);
                    }

                    file = File.CreateText(doBlockPath);
                    file.Close();

                    using (file = new StreamWriter(File.Open(doBlockPath, FileMode.Append)))
                    {
                        string output = OutPutProcess.ConvertToBlockText(chkB, "COMMERCIAL", _mainForm.batchfile, _mainForm.deliveryDate, frmLogIn._userName, _mainForm.filename);

                        file.WriteLine(output);
                    }
                }
            }
            //foreach (string chk in chkList)
            //{

            //    if (chk == "CS")
            //    {

            //        var chkB = _checkm.Where(e => e.ChequeType == chk).ToList();
            //        doBlockPath = Application.StartupPath + "\\Output\\Charge_Slip\\BlockA.txt";
            //        if (File.Exists(doBlockPath))
            //            File.Delete(doBlockPath);

            //        file = File.CreateText(doBlockPath);
            //        file.Close();

            //        using (file = new StreamWriter(File.Open(doBlockPath, FileMode.Append)))
            //        {
            //            string output = OutPutProcess.ConvertToBlockText(chkB, "CHARGE-SLIP", _mainForm.batchFile, _mainForm.deliveryDate, frmLogIn._userName, _mainForm.fileName);

            //            file.WriteLine(output);
            //        }
            //    }

            //}
        }
Example #14
0
        public void PrinterFile2(List <ChequeModel> _checkModel, Main2 _mainForm)
        {
            DBConnections db = new DBConnections();

            db.GetAllData(_checkModel, _mainForm.batchfile);
            StreamWriter file;

            var listofchecks = _checkModel.Select(e => e.ChequeType).ToList();


            foreach (string checktype in listofchecks)
            {
                if (checktype == "A")
                {
                    string printerFilePathA = Application.StartupPath + "\\Output\\Regular_Checks\\BNU" + _mainForm.batchfile.Substring(0, 4) + "P.txt";
                    var    check            = _checkModel.Where(e => e.ChequeType == checktype).ToList();
                    if (File.Exists(printerFilePathA))
                    {
                        File.Delete(printerFilePathA);
                    }

                    file = File.CreateText(printerFilePathA);
                    file.Close();

                    for (int a = 0; a < check.Count; a++)
                    {
                        using (file = new StreamWriter(File.Open(printerFilePathA, FileMode.Append)))
                        {
                            string output = OutPutProcess.ConvertToPrinterFormat1(check[a].BRSTN, check[a].AccountNo, long.Parse(check[a].StartingSerial), check[a].PcsPerBook, check[a].Name1, check[a].Name2, check[a].Address1, check[a].Address2, check[a].Address3, check[a].Address4, check[a].Address5, check[a].Address6, check[a].Address1, "A");

                            file.WriteLine(output);
                        }
                    }
                    ZipCopyProcess.CopyPrinterFile2(checktype, _mainForm);
                    ZipCopyProcess.CopyPackingDBF2(checktype, _mainForm);
                }
            }


            foreach (string checktype in listofchecks)
            {
                if (checktype == "B")
                {
                    string printerFilePath = Application.StartupPath + "\\Output\\Regular_Checks\\BNU" + _mainForm.batchfile.Substring(0, 4) + "C.txt";
                    var    check           = _checkModel.Where(e => e.ChequeType == checktype).ToList();
                    if (File.Exists(printerFilePath))
                    {
                        File.Delete(printerFilePath);
                    }

                    file = File.CreateText(printerFilePath);
                    file.Close();
                    for (int a = 0; a < check.Count; a++)
                    {
                        using (file = new StreamWriter(File.Open(printerFilePath, FileMode.Append)))
                        {
                            string output = OutPutProcess.ConvertToPrinterFormat1(check[a].BRSTN, check[a].AccountNo, long.Parse(check[a].StartingSerial), check[a].PcsPerBook, check[a].Name1, check[a].Name2, check[a].Address1, check[a].Address2, check[a].Address3, check[a].Address4, check[a].Address5, check[a].Address6, check[a].Address1, "B");

                            file.WriteLine(output);
                        }
                    }
                    ZipCopyProcess.CopyPrinterFile2(checktype, _mainForm);
                    ZipCopyProcess.CopyPackingDBF2(checktype, _mainForm);
                }
            }

            //foreach (string checktype in listofchecks)
            //{
            //    if (checktype == "CS")
            //    {
            //        string printerFilePath = Application.StartupPath + "\\Output\\Charge_Slip\\BNU" + _mainForm.batchFile.Substring(0, 4) + "CS.txt";
            //        var check = _checkModel.Where(e => e.ChequeType == checktype).ToList();
            //        if (File.Exists(printerFilePath))
            //            File.Delete(printerFilePath);

            //        file = File.CreateText(printerFilePath);
            //        file.Close();
            //        for (int a = 0; a < check.Count; a++)
            //        {


            //            using (file = new StreamWriter(File.Open(printerFilePath, FileMode.Append)))
            //            {
            //                string output = OutPutProcess.ConvertToPrinterFormat1(check[a].BRSTN, check[a].AccountNo, long.Parse(check[a].StartingSerial), check[a].PcsPerBook, check[a].Name1, check[a].Name2, check[a].Address1, check[a].Address2, check[a].Address3, check[a].Address4, check[a].Address5, check[a].Address6, check[a].Address1, "CS");

            //                file.WriteLine(output);
            //            }
            //        }
            //        ZipCopyProcess.CopyPrinterFile(checktype, _mainForm);
            //        ZipCopyProcess.CopyPackingDBF(checktype, _mainForm);
            //    }
            //}
        }
Example #15
0
        public void SaveToPackingDBF2(List <ChequeModel> _checks, string _batchNumber, Main2 _mainForm)
        {
            string        dbConnection;
            string        tempCheckType = "";
            int           blockNo = 0, blockCounter = 0;
            DBConnections db = new DBConnections();
            // db.GetAllData(_checks, _mainForm.batchfile);

            var listofchecks = _checks.Select(e => e.ChequeType).Distinct().ToList();

            foreach (string checktype in listofchecks)
            {
                if (checktype == "A" || checktype == "B")
                {
                    dbConnection = "Provider=VfpOleDB.1; Data Source=" + Application.StartupPath + "\\Output\\Regular_Checks\\Packing.dbf" + "; Mode=ReadWrite;";

                    //Check if packing file exists
                    //if (!File.Exists(_filepath))
                    //{
                    OleDbConnection oConnect = new OleDbConnection(dbConnection);
                    OleDbCommand    oCommand;
                    oConnect.Open();
                    oCommand = new OleDbCommand("DELETE FROM PACKING", oConnect);
                    oCommand.ExecuteNonQuery();
                    foreach (var check in _checks)
                    {
                        if (tempCheckType != check.ChequeType)
                        {
                            blockNo = 1;
                        }

                        tempCheckType = check.ChequeType;

                        if (blockCounter < 4)
                        {
                            blockCounter++;
                        }
                        else
                        {
                            blockCounter = 1;
                            blockNo++;
                        }

                        string sql = "INSERT INTO PACKING (BATCHNO, BLOCK, RT_NO, BRANCH, ACCT_NO, ACCT_NO_P, CHKTYPE, ACCT_NAME1, ACCT_NAME2," +
                                     "NO_BKS, CK_NO_P, CK_NO_B, CK_NOE, CK_NO_E, DELIVERTO, M) VALUES('" + _batchNumber + "'," + blockNo.ToString() + ",'" + check.BRSTN + "','" + check.Address1 +
                                     "','" + check.AccountNo + "','" + check.AccountNo + "','" + check.ChequeType + "','" + check.Name1.Replace("'", "''") + "','" + check.Name2.Replace("'", "''") + "',1," +
                                     check.StartingSerial + ",'" + check.StartingSerial + "'," + check.StartingSerial + ",'" + check.EndingSerial + "','R', '')";

                        oCommand = new OleDbCommand(sql, oConnect);

                        oCommand.ExecuteNonQuery();
                    }
                    oConnect.Close();
                }
            }
            //foreach (string checktype in listofchecks)
            //{

            //    if (checktype == "CS")
            //    {
            //        dbConnection = "Provider=VfpOleDB.1; Data Source=" + Application.StartupPath + "\\Output\\Charge_Slip\\Packing.dbf" + "; Mode=ReadWrite;";

            //        //Check if packing file exists
            //        //if (!File.Exists(_filepath))
            //        //{
            //        OleDbConnection oConnect = new OleDbConnection(dbConnection);
            //        OleDbCommand oCommand;
            //        oConnect.Open();
            //        oCommand = new OleDbCommand("DELETE FROM PACKING", oConnect);
            //        oCommand.ExecuteNonQuery();
            //        foreach (var check in _checks)
            //        {
            //            if (tempCheckType != check.ChequeType)
            //                blockNo = 1;

            //            tempCheckType = check.ChequeType;

            //            if (blockCounter < 4)
            //                blockCounter++;
            //            else
            //            {
            //                blockCounter = 1;
            //                blockNo++;
            //            }

            //            string sql = "INSERT INTO PACKING (BATCHNO, BLOCK, RT_NO, BRANCH, ACCT_NO, ACCT_NO_P, CHKTYPE, ACCT_NAME1, ACCT_NAME2," +
            //             "NO_BKS, CK_NO_P, CK_NO_B, CK_NOE, CK_NO_E, DELIVERTO, M) VALUES('" + _batchNumber + "'," + blockNo.ToString() + ",'" + check.BRSTN + "','" + check.Address1 +
            //             "','" + check.AccountNo + "','" + check.AccountNo + "','" + check.ChequeType + "','" + check.Name1.Replace("'", "''") + "','" + check.Name2.Replace("'", "''") + "',1," +
            //             check.StartingSerial + ",'" + check.StartingSerial + "'," + check.StartingSerial + ",'" + check.EndingSerial + "','R', '')";

            //            oCommand = new OleDbCommand(sql, oConnect);

            //            oCommand.ExecuteNonQuery();
            //        }
            //        oConnect.Close();
            //    }
            //}
        }