Exemplo n.º 1
0
        private void transferLogs()
        {
            using (UNCAccessWithCredentials unc = new UNCAccessWithCredentials())
            {
                if (unc.NetUseWithCredentials(data["NETWORK"]["LOG_COPY"], data["NETWORK"]["USER"], data["NETWORK"]["MULTI_IP"], global_class.DycryptPass(data["NETWORK"]["PASSWORD"])))
                {
                    String[] log_files = Directory.GetFiles(data["MW"]["LOG_LOC"], "*.*", SearchOption.AllDirectories);

                    if (log_files.Length > 0)
                    {
                        Boolean csv_copy;

                        lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "Transferring Log Files"));
                        Boolean csv_task = init_cls.MOVEFile(data["MW"]["LOG_LOC"], data["NETWORK"]["LOG_COPY"]);

                        csv_copy = csv_task;

                        if (csv_copy)
                        {
                            sendMsg("LOG_COPIED");
                            lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "Transferring Log Files Successfull"));
                        }
                        else
                        {
                            sendMsg("LOG_COPY_ERROR");
                        }
                    }
                    else
                    {
                        lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "No log files to transfer"));
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void copyUpdate()
        {
            using (UNCAccessWithCredentials unc = new UNCAccessWithCredentials())
            {
                if (unc.NetUseWithCredentials(data["NETWORK"]["RD_COPY"], data["NETWORK"]["USER"], data["NETWORK"]["MULTI_IP"], global_class.DycryptPass(data["NETWORK"]["PASSWORD"])))
                {
                    Boolean copied = false;
                    try
                    {
                        sendMsg("COPYING_UPDATE");
                        String[] updateFiles        = Directory.GetFiles(data["NETWORK"]["UPDATE_FOLDER"], "*.*", SearchOption.AllDirectories);
                        String[] updatedDirectories = Directory.GetDirectories(data["NETWORK"]["UPDATE_FOLDER"]);
                        int      count_files        = updateFiles.Length;

                        int copying_files = 1;

                        lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "Copying updates found"));

                        if (Directory.Exists(data["NETWORK"]["UPDATE_FOLDER"]))
                        {
                            foreach (string file in updateFiles)
                            {
                                lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "Copying update (" + copying_files.ToString() + " of " + count_files.ToString() + ")"));
                                copied = init_cls.COPYUpdate(file, data["MW"]["UPDATE"] + @"\" + Path.GetFileName(file));
                                copying_files++;
                            }
                        }
                        copying_files = 0;

                        if (copied)
                        {
                            sendMsg("UPDATE_COPIED");
                            data["MW"]["UPDATE_AVAILABLE"] = "true";

                            parser.WriteFile("app_set.ini", data);

                            update_MW();
                        }
                        else
                        {
                            MessageBox.Show("Unable to copy update!");
                        }
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message);
                        sendMsg("COPY_UPDATE_ERROR");
                    }
                }
                else
                {
                    MessageBox.Show("Failed to connect to " + data["NETWORK"]["MULTI_IP"] +
                                    "\r\nLastError = " + unc.LastError.ToString(),
                                    "Failed to connect",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 3
0
        private void purgeRowData()
        {
            try
            {
                String directory = data["NETWORK"]["HQSTORE"];
                String locDir    = data["HITDATA"]["SVR_HITDATA"];

                String preciseDir    = directory + @"\Zip\" + Convert.ToDateTime(curr_row[2]).ToString("yyyy") + @"\" + Convert.ToDateTime(curr_row[2]).ToString("MM") + @"\" + Convert.ToDateTime(curr_row[2]).ToString("yyyyMMdd") + @"\" + Convert.ToDateTime(curr_row[2]).ToString("HH");
                String preciseLocDir = locDir + @"\Zip\" + Convert.ToDateTime(curr_row[2]).ToString("yyyy") + @"\" + Convert.ToDateTime(curr_row[2]).ToString("MM") + @"\" + Convert.ToDateTime(curr_row[2]).ToString("yyyyMMdd") + @"\" + Convert.ToDateTime(curr_row[2]).ToString("HH");

                String m_ExtFNm = curr_row[3] + "_" + curr_row[33] + ".zip";

                String m_ZipFNm = preciseDir + @"\" + m_ExtFNm;
                String L_ZipFNm = preciseLocDir + @"\" + m_ExtFNm;

                using (UNCAccessWithCredentials unc = new UNCAccessWithCredentials())
                {
                    if (unc.NetUseWithCredentials(data["NETWORK"]["HQSTORE"], data["NETWORK"]["USER"], data["NETWORK"]["HQ1"], global_class.DycryptPass(data["NETWORK"]["PASSWORD"])))
                    {
                        if (File.Exists(m_ZipFNm))
                        {
                            if (File.Exists(L_ZipFNm))
                            {
                                File.Delete(L_ZipFNm);
                                txt_log.AppendText("File Deleted!" + Environment.NewLine);
                                curr_row[48] = DateTime.Now;
                            }
                            else
                            {
                                txt_log.AppendText("File Already Deleted!" + Environment.NewLine);
                                curr_row[48] = DateTime.Now;
                            }
                        }
                        else
                        {
                            txt_log.AppendText("File Not Found on HQ!" + Environment.NewLine);
                            curr_row[47] = DBNull.Value;
                        }
                    }
                    else
                    {
                        txt_log.AppendText("File Cannot be accessed!" + Environment.NewLine);
                    }
                }
            }
            catch (Exception e)
            {
                txt_log.AppendText("Error occur: " + e.Message.ToString() + Environment.NewLine);
            }
        }
Exemplo n.º 4
0
        private void transferCSV()
        {
            try
            {
                using (UNCAccessWithCredentials unc = new UNCAccessWithCredentials())
                {
                    if (unc.NetUseWithCredentials(data["NETWORK"]["CSV_COPY"], data["NETWORK"]["USER"], data["NETWORK"]["MULTI_IP"], global_class.DycryptPass(data["NETWORK"]["PASSWORD"])))
                    {
                        String[] csv_files = Directory.GetFiles(data["MW"]["CSV_LOC"], "*.*", SearchOption.AllDirectories);
                        sendMsg("COPYING_CSV");
                        if (csv_files.Length > 0)
                        {
                            Boolean csv_copy;

                            lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "Transferring CSV Files"));
                            Boolean csv_task = init_cls.MOVEFile(data["MW"]["CSV_LOC"], data["NETWORK"]["CSV_COPY"]);
                            csv_copy = csv_task;

                            if (csv_copy)
                            {
                                sendMsg("CSV_COPIED");
                                lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "Transferring CSV Files Successfull"));
                            }
                            else
                            {
                                sendMsg("CSV_COPY_ERROR");
                            }
                        }
                        else
                        {
                            lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "No CSV files to transfer"));
                            sendMsg("CSV_COPIED");
                        }
                    }
                    else
                    {
                        MessageBox.Show(data["NETWORK"]["CSV_COPY"] + " " + data["NETWORK"]["USER"] + " " + data["NETWORK"]["MULTI_IP"] + " " + global_class.DycryptPass(data["NETWORK"]["PASSWORD"]));
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                sendMsg("CSV_COPY_ERROR");
            }
        }
Exemplo n.º 5
0
        private void verifyData()
        {
            try
            {
                String directory = data["NETWORK"]["HQSTORE"];

                String preciseDir = directory + @"\Zip\" + Convert.ToDateTime(curr_row[2]).ToString("yyyy") + @"\" + Convert.ToDateTime(curr_row[2]).ToString("MM") + @"\" + Convert.ToDateTime(curr_row[2]).ToString("yyyyMMdd") + @"\" + Convert.ToDateTime(curr_row[2]).ToString("HH");

                String m_ExtFNm = curr_row[3] + "_" + curr_row[33] + ".zip";
                String m_ZipFNm = preciseDir + @"\" + m_ExtFNm;

                using (UNCAccessWithCredentials unc = new UNCAccessWithCredentials())
                {
                    if (unc.NetUseWithCredentials(data["NETWORK"]["HQSTORE"], data["NETWORK"]["USER"], data["NETWORK"]["HQ1"], global_class.DycryptPass(data["NETWORK"]["PASSWORD"])))
                    {
                        if (File.Exists(m_ZipFNm))
                        {
                            txt_log.AppendText("Data Verified!" + Environment.NewLine);
                            curr_row[47] = DateTime.Now;
                        }
                        else
                        {
                            txt_log.AppendText("Data Verified!" + Environment.NewLine);
                            curr_row[47] = DBNull.Value;
                        }
                    }
                    else
                    {
                        txt_log.AppendText("Unable to verify data!" + Environment.NewLine);
                    }
                }
            }
            catch (Exception e)
            {
                txt_log.AppendText("Error Occured :" + e.Message.ToString() + Environment.NewLine);
            }
        }
Exemplo n.º 6
0
        private void transferRD()
        {
            String[] all_file = Directory.GetFiles(data["MW"]["RD_LOC"], "*.*", SearchOption.AllDirectories);

            if (all_file.Length > 0)
            {
                refreshHD.Enabled = false;
                refreshHD.Stop();
                using (UNCAccessWithCredentials unc = new UNCAccessWithCredentials())
                {
                    if (unc.NetUseWithCredentials(data["NETWORK"]["RD_COPY"], data["NETWORK"]["USER"], data["NETWORK"]["MULTI_IP"], global_class.DycryptPass(data["NETWORK"]["PASSWORD"])))
                    {
                        String rd_loc = data["MW"]["RD_LOC"] + @"\" + DateTime.Today.Year.ToString() + @"\" + DateTime.Today.Month.ToString() + @"\" + (DateTime.Today.Day - 1).ToString();

                        Boolean copied;
                        lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "Transferring RD Images"));


                        if (Directory.Exists(data["MW"]["RD_LOC"]))
                        {
                            String new_dir = data["NETWORK"]["RD_COPY"] + @"\" + init_cls.PCname();

                            if (Directory.Exists(new_dir) == false)
                            {
                                Directory.CreateDirectory(new_dir);
                            }


                            String[] all_dir = Directory.GetDirectories(data["MW"]["RD_LOC"], "*.*", SearchOption.AllDirectories);

                            prog_stat.BeginInvoke(new Action(() => prog_stat.Visible = true));
                            prog_stat.BeginInvoke(new Action(() => prog_stat.Maximum = all_file.Length));
                            prog_stat.BeginInvoke(new Action(() => prog_stat.Minimum = 0));
                            prog_stat.BeginInvoke(new Action(() => prog_stat.Value   = 1));
                            prog_stat.BeginInvoke(new Action(() => prog_stat.Step    = 1));

                            foreach (string newPath in all_file)
                            {
                                String net_path     = Path.GetDirectoryName(newPath).Replace(data["MW"]["RD_LOC"], "");
                                String copy_to_path = new_dir + newPath.Replace(data["MW"]["RD_LOC"], "");
                                if (Directory.Exists(new_dir + net_path) == false)
                                {
                                    Directory.CreateDirectory(new_dir + @"\" + net_path);
                                }
                                File.Copy(newPath, copy_to_path, true);

                                File.Delete(newPath);

                                prog_stat.BeginInvoke(new Action(() => prog_stat.PerformStep()));
                            }

                            prog_stat.BeginInvoke(new Action(() => prog_stat.Visible = false));
                            prog_stat.BeginInvoke(new Action(() => prog_stat.Value   = 0));
                        }
                        else
                        {
                        }
                        Boolean task = init_cls.MOVEFile(data["MW"]["RD_LOC"], data["NETWORK"]["RD_COPY"]);

                        copied = task;

                        if (copied)
                        {
                            sendMsg("RD_COPIED");
                        }
                        else
                        {
                            sendMsg("RD_COPY_ERROR");
                        }

                        lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = ""));
                    }
                    else
                    {
                        MessageBox.Show("Failed to connect to " + data["NETWORK"]["MULTI_IP"] +
                                        "\r\nLastError = " + unc.LastError.ToString(),
                                        "Failed to connect",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                }

                refreshHD.Enabled = true;
                refreshHD.Start();
            }
            else
            {
                lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "No RD Images found"));

                try
                {
                    transferCSV();
                }
                catch (Exception e)
                {
                    lbl_mgr_stat.BeginInvoke(new Action(() => lbl_mgr_stat.Text = "Exception Occured!, Unable to transfer CSV Files!"));
                }
            }
        }