private void settings_Load(object sender, EventArgs e)
 {
     txt_add.Text         = data["NETWORK"]["MULTI_IP"];
     txt_csvDir.Text      = data["MW"]["CSV_LOC"];
     txt_netPass.Text     = global_class.DycryptPass(data["NETWORK"]["PASSWORD"]);
     txt_netUser.Text     = data["NETWORK"]["USER"];
     txt_port.Text        = data["NETWORK"]["MULTI_PORT"];
     txt_rdDir.Text       = data["MW"]["RD_LOC"];
     txt_rollBackDir.Text = data["MW"]["ROLLBACK"];
     txt_updateDir.Text   = data["MW"]["UPDATE"];
 }
Example #2
0
        //Start Query, return query result in dataset

        public String connString(string datasource, string database, string user, string password)
        {
            String dataSource = "Data Source=" + datasource + "; ";
            String dataBase   = "Initial Catalog=" + database + "; ";
            String userName   = "******" + user + "; ";
            String passWord   = "******" + global_class.DycryptPass(password) + "; ";
            String strConn;

            strConn = dataSource + dataBase + userName + passWord + "MultipleActiveResultSets=True";

            return(strConn);
        }
Example #3
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);
            }
        }
Example #4
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);
                }
            }
        }