Example #1
0
        public void PrinterFile(List <CheckModel> _checkModel, frmMain _mainForm)
        {
            DatabaseConnectionsServices db = new DatabaseConnectionsServices();

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

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

            foreach (string checktype in listofchecks)
            {
                if (checktype == "A")
                {
                    string printerFilePathA = Application.StartupPath + "\\Output\\Regular Checks\\ISL" + _mainForm._batchfile.Substring(0, 4) + "P." + DateTime.Now.ToString("yy") + "P";
                    var    check            = _checkModel.Where(e => e.ChkType == 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 = ChecOutputServices.ConvertToPrinterFormat1(check[a].BRSTN, check[a].AccountNo, long.Parse(check[a].StartSeries), check[a].Qty, 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);
                        }
                    }
                    ZipFileServices.CopyPrinterFile(checktype, _mainForm);
                    ZipFileServices.CopyPackingDBF(checktype, _mainForm);
                }
            }
            foreach (string checktype in listofchecks)
            {
                if (checktype == "B")
                {
                    string printerFilePath = Application.StartupPath + "\\Output\\Regular Checks\\ISL" + _mainForm._batchfile.Substring(0, 4) + "C." + DateTime.Now.ToString("yy") + "P";
                    var    check           = _checkModel.Where(e => e.ChkType == 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 = ChecOutputServices.ConvertToPrinterFormat1(check[a].BRSTN, check[a].AccountNo, long.Parse(check[a].StartSeries), check[a].Qty, 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);
                        }
                    }
                    ZipFileServices.CopyPrinterFile(checktype, _mainForm);
                    ZipFileServices.CopyPackingDBF(checktype, _mainForm);
                }
            }
            foreach (string checktype in listofchecks)
            {
                if (checktype == "MC")
                {
                    string printerFilePath = Application.StartupPath + "\\Output\\MC\\MC" + _mainForm._batchfile.Substring(0, 4) + "M." + DateTime.Now.ToString("yy") + "P";
                    var    check           = _checkModel.Where(e => e.ChkType == 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 = ChecOutputServices.ConvertToPrinterFormat1(check[a].BRSTN, check[a].AccountNo, long.Parse(check[a].StartSeries), check[a].Qty, 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);
                        }
                    }
                    ZipFileServices.CopyPrinterFile(checktype, _mainForm);
                    ZipFileServices.CopyPackingDBF(checktype, _mainForm);
                }
            }
            foreach (string checktype in listofchecks)
            {
                if (checktype == "MC_CONT")
                {
                    string printerFilePath = Application.StartupPath + "\\Output\\MC\\MC" + _mainForm._batchfile.Substring(0, 4) + "MC." + DateTime.Now.ToString("yy") + "P";
                    var    check           = _checkModel.Where(e => e.ChkType == 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 = ChecOutputServices.ConvertToPrinterFormat1(check[a].BRSTN, check[a].AccountNo, long.Parse(check[a].StartSeries), check[a].Qty, 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);
                        }
                    }
                    ZipFileServices.CopyPrinterFile(checktype, _mainForm);
                    ZipFileServices.CopyPackingDBF(checktype, _mainForm);
                }
            }
            foreach (string checktype in listofchecks)
            {
                if (checktype == "SR")
                {
                    string printerFilePath = Application.StartupPath + "\\Output\\Self_Responding_Ticket\\ISL" + _mainForm._batchfile.Substring(0, 4) + "S." + DateTime.Now.ToString("yy") + "P";
                    var    check           = _checkModel.Where(e => e.ChkType == 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 = ChecOutputServices.ConvertToPrinterFormat1(check[a].BRSTN, check[a].AccountNo, long.Parse(check[a].StartSeries), check[a].Qty, 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);
                        }
                    }
                    ZipFileServices.CopyPrinterFile(checktype, _mainForm);
                    ZipFileServices.CopyPackingDBF(checktype, _mainForm);
                }
            }

            foreach (string checktype in listofchecks)
            {
                if (checktype == "TD")
                {
                    string printerFilePath = Application.StartupPath + "\\Output\\Time_Deposit\\ISL" + _mainForm._batchfile.Substring(0, 4) + "T." + DateTime.Now.ToString("yy") + "P";
                    var    check           = _checkModel.Where(e => e.ChkType == 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 = ChecOutputServices.ConvertToPrinterFormat1(check[a].BRSTN, check[a].AccountNo, long.Parse(check[a].StartSeries), check[a].Qty, 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);
                        }
                    }
                    ZipFileServices.CopyPrinterFile(checktype, _mainForm);
                    ZipFileServices.CopyPackingDBF(checktype, _mainForm);
                }
            }
        }
Example #2
0
        //string outputForlder = "\\\\192.168.0.254\\captive\\Auto\\IslaBank\\Test";
        public void PackingText(List <CheckModel> _checksModel, frmMain _mainForm)
        {
            StreamWriter file;
            DatabaseConnectionsServices db = new DatabaseConnectionsServices();

            db.GetAllData(_checksModel, _mainForm._batchfile);
            var listofcheck = _checksModel.Select(e => e.ChkType).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.ChkType == Scheck).Distinct().ToList();
                    file = File.CreateText(packkingListPath);
                    file.Close();

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

                        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.ChkType == Scheck).Distinct().ToList();
                    file = File.CreateText(packkingListPath);
                    file.Close();

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

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

                    using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append)))
                    {
                        string output = ChecOutputServices.ConvertToPackingList(checks, "MANAGER'S CHECK", _mainForm);

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

                    using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append)))
                    {
                        string output = ChecOutputServices.ConvertToPackingList(checks, "MANAGER'S CHECK CONTINUES", _mainForm);

                        file.WriteLine(output);
                    }
                }
            }

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

                    using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append)))
                    {
                        string output = ChecOutputServices.ConvertToPackingList(checks, "SELF RESPONDING TICKET", _mainForm);

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

                    using (file = new StreamWriter(File.Open(packkingListPath, FileMode.Append)))
                    {
                        string output = ChecOutputServices.ConvertToPackingList(checks, "TIME DEPOSIT", _mainForm);

                        file.WriteLine(output);
                    }
                }
            }
        }
Example #3
0
        // string outputForlder = "\\\\192.168.0.254\\captive\\Auto\\IslaBank\\Test";
        public void ProcessCheck(List <CheckModel> _checkm, frmMain _mainForm)
        {
            string       doBlockPath;
            StreamWriter file;
            DatabaseConnectionsServices db = new DatabaseConnectionsServices();

            db.GetAllData(_checkm, _mainForm._batchfile);
            var chkList = _checkm.Select(e => e.ChkType).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.ChkType == chk).ToList();

                    using (file = new StreamWriter(File.Open(doBlockPath, FileMode.Append)))
                    {
                        string output = ChecOutputServices.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.ChkType == chk).ToList();
                    doBlockPath = Application.StartupPath + "\\Output\\Regular Checks\\BlockC.txt";
                    //    db.GetAllData(_checkModel, _mainForm._batchfile);
                    if (File.Exists(doBlockPath))
                    {
                        File.Delete(doBlockPath);
                    }

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

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

                        file.WriteLine(output);
                    }
                }
            }
            foreach (string chk in chkList)
            {
                if (chk == "MC")
                {
                    var chkB = _checkm.Where(e => e.ChkType == chk).ToList();
                    doBlockPath = Application.StartupPath + "\\Output\\MC\\BlockM.txt";
                    //db.GetAllData(_checkModel, _mainForm._batchfile);
                    if (File.Exists(doBlockPath))
                    {
                        File.Delete(doBlockPath);
                    }

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

                    using (file = new StreamWriter(File.Open(doBlockPath, FileMode.Append)))
                    {
                        string output = ChecOutputServices.ConvertToBlockText(chkB, "MANAGER'S CHECK", _mainForm._batchfile, _mainForm.deliveryDate, frmLogIn._userName, _mainForm.fileName);

                        file.WriteLine(output);
                    }
                }
            }
            foreach (string chk in chkList)
            {
                if (chk == "MC_CONT")
                {
                    var chkB = _checkm.Where(e => e.ChkType == chk).ToList();
                    doBlockPath = Application.StartupPath + "\\Output\\MC\\BlockMC.txt";
                    //   db.GetAllData(_checkModel, _mainForm._batchfile);
                    if (File.Exists(doBlockPath))
                    {
                        File.Delete(doBlockPath);
                    }

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

                    using (file = new StreamWriter(File.Open(doBlockPath, FileMode.Append)))
                    {
                        string output = ChecOutputServices.ConvertToBlockText(chkB, "MANAGER'S CHECK CONTINUES", _mainForm._batchfile, _mainForm.deliveryDate, frmLogIn._userName, _mainForm.fileName);

                        file.WriteLine(output);
                    }
                }
            }
            foreach (string chk in chkList)
            {
                if (chk == "SR")
                {
                    // db.GetAllData(_checkModel, _mainForm._batchfile);
                    var chkB = _checkm.Where(e => e.ChkType == chk).ToList();
                    doBlockPath = Application.StartupPath + "\\Output\\Self_Responding_Ticket\\BlockS.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 = ChecOutputServices.ConvertToBlockText(chkB, "SELF RESPONDING TICKET", _mainForm._batchfile, _mainForm.deliveryDate, frmLogIn._userName, _mainForm.fileName);

                        file.WriteLine(output);
                    }
                }
            }
            foreach (string chk in chkList)
            {
                if (chk == "TD")
                {
                    var chkB = _checkm.Where(e => e.ChkType == chk).ToList();
                    doBlockPath = Application.StartupPath + "\\Output\\Time_Deposit\\BlockT.txt";
                    //  db.GetAllData(_checkModel, _mainForm._batchfile);
                    if (File.Exists(doBlockPath))
                    {
                        File.Delete(doBlockPath);
                    }

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

                    using (file = new StreamWriter(File.Open(doBlockPath, FileMode.Append)))
                    {
                        string output = ChecOutputServices.ConvertToBlockText(chkB, "TIME DEPOSIT", _mainForm._batchfile, _mainForm.deliveryDate, frmLogIn._userName, _mainForm.fileName);

                        file.WriteLine(output);
                    }
                }
            }
        }