Пример #1
0
        void put_This_User_Name_In_The_Registry(string username)
        {
            Microsoft.Win32.RegistryKey temp   = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry32);
            Microsoft.Win32.RegistryKey temp_0 = temp.OpenSubKey("SOFTWARE", true);
            if (!temp_0.GetSubKeyNames().Contains("Resume View"))
            {
                temp_0.CreateSubKey("Resume View");
            }

            Microsoft.Win32.RegistryKey resume_View_Key = temp_0.OpenSubKey("Resume View", true);
            resume_View_Key.SetValue("username", crypting_Object.EncryptToString(username));
        }
Пример #2
0
        private static void load_Settings_To_Registry()
        {
            Microsoft.Win32.RegistryKey temp   = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry32);
            Microsoft.Win32.RegistryKey temp_0 = temp.OpenSubKey("SOFTWARE", true);
            if (!temp_0.GetSubKeyNames().Contains("Resume View"))
            {
                temp_0.CreateSubKey("Resume View");
            }

            Microsoft.Win32.RegistryKey resume_View_Key = temp_0.OpenSubKey("Resume View", true);

            string encrypted_String = "";

            encrypted_String = crypting_Object.EncryptToString(database_Server);
            resume_View_Key.SetValue("database_Server", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(database_Name);
            resume_View_Key.SetValue("database_Name", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(database_Uid);
            resume_View_Key.SetValue("database_Uid", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(database_Password);
            resume_View_Key.SetValue("database_Password", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(ftp_Server);
            resume_View_Key.SetValue("ftp_Server", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(ftp_Username);
            resume_View_Key.SetValue("ftp_Username", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(ftp_Password);
            resume_View_Key.SetValue("ftp_Password", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(doc_To_Html_Server_Address);

            resume_View_Key.SetValue("doc_To_Html_Server_Address", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(doc_To_Html_Server_Port);
            resume_View_Key.SetValue("doc_To_Html_Server_Port", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(doc_To_Html_Server_Max_Connection);
            resume_View_Key.SetValue("doc_To_Html_Server_Max_Connection", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(doc_To_Html_Server_Max_Command_Length);
            resume_View_Key.SetValue("doc_To_Html_Server_Max_Command_Length", encrypted_String);

            encrypted_String = crypting_Object.EncryptToString(resume_View_Server_Address);
            resume_View_Key.SetValue("resume_View_Server_Address", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(resume_View_Server_Port);
            resume_View_Key.SetValue("resume_View_Server_Port", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(resume_View_Server_Max_Connection);
            resume_View_Key.SetValue("resume_View_Server_Max_Connection", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(resume_View_Server_Max_Command_Length);
            resume_View_Key.SetValue("resume_View_Server_Max_Command_Length", encrypted_String);


            encrypted_String = crypting_Object.EncryptToString(reminder_Server_Address);
            resume_View_Key.SetValue("reminder_Server_Address", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(reminder_Server_Port);
            resume_View_Key.SetValue("reminder_Server_Port", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(reminder_Server_Max_Connection);
            resume_View_Key.SetValue("reminder_Server_Max_Connection", encrypted_String);
            encrypted_String = crypting_Object.EncryptToString(reminder_Server_Max_Command_Length);
            resume_View_Key.SetValue("reminder_Server_Max_Command_Length", encrypted_String);

            encrypted_String = crypting_Object.EncryptToString(company_Name);
            resume_View_Key.SetValue("company_Name", encrypted_String);
        }
Пример #3
0
        public Form_Reminder()
        {
            InitializeComponent();

            crypting_Object = new Useful_Functions.SimpleAES();
            load_Values_From_Registry();

            reset_Event       = new System.Threading.ManualResetEvent(false);
            login_Reset_Event = new System.Threading.ManualResetEvent(false);
            db_Connect        = new DBConnect(database_Server, database_Name, database_Uid, database_Password);

            wipe_Out_The_User_Name_In_The_Registry();
            LoginWindow  login_Window      = new LoginWindow();
            bool         cancel_Pressed    = false;
            Company_Info temp_Company_Info = null;

            login_Window.button_Ok_Login.Click += new EventHandler((sender_0, e_0) =>
            {
                if (login_Window.textBox_Username_Login.Text == "")
                {
                    MessageBox.Show(login_Window, "Username can't be Empty", "Suggestion");
                    return;
                }
                else if (login_Window.textBox_Password_Login.Text == "")
                {
                    MessageBox.Show(login_Window, "Password can't be Empty");
                    return;
                }
                string encrypted_General_password = crypting_Object.EncryptToString(login_Window.textBox_Password_Login.Text);
                if (!db_Connect.Check_User_Account(login_Window.textBox_Username_Login.Text, encrypted_General_password, company_Name))
                {
                    MessageBox.Show(login_Window, "Username/Password is wrong");
                }
                else
                {
                    temp_Company_Info = db_Connect.get_Company_Info_For_This_Company_Name(company_Name);
                    username          = login_Window.textBox_Username_Login.Text;
                    put_This_User_Name_In_The_Registry(username);
                    login_Window.Hide();
                }
                login_Reset_Event.Set();
            });
            login_Window.button_Cancel_Login.Click += new EventHandler((sender_0, e_0) => {
                login_Window.Hide();
                cancel_Pressed = true;
                login_Reset_Event.Set();
            });
            login_Window.FormClosed += new FormClosedEventHandler((sender_0, e_0) => {
                login_Window.Hide();
                cancel_Pressed = true;
                login_Reset_Event.Set();
            });
            login_Window.ShowDialog();
            login_Reset_Event.WaitOne();

            if (cancel_Pressed)
            {
                Environment.Exit(0);
            }

            if (temp_Company_Info != null)
            {
                if (temp_Company_Info.message_Image_Path != "")
                {
                    Welcome_Window temp_Welcome_Window = new Welcome_Window(temp_Company_Info.message_Image_Path, temp_Company_Info.message);
                    temp_Welcome_Window.ShowDialog();
                }
            }

            Initialize_WebSocket();
            reset_Event.WaitOne();

            this.MouseClick += new MouseEventHandler(form_Reminder_MouseClick);

            clicked_My_PictureBox = null;
            picture_Boxes         = new List <My_PictureBox>();
            align_Picture_Boxes();

            this.Load   += new EventHandler(Form_Reminder_Load);
            this.Resize += new EventHandler((sender, e) => {
                if (WindowState == FormWindowState.Minimized)
                {
                    this.Hide();
                }
            });
            this.MinimizeBox = true;
            this.MaximizeBox = false;

            job_Display_Form = new Job_Display_Form();
            job_Display_Form.Hide();

            threads        = new List <System.Threading.Thread>();
            exit_Requested = false;
        }
Пример #4
0
        private void button_Add_Click(object sender, EventArgs e)
        {
            if (textBox_Company_Name.Text == "")
            {
                MessageBox.Show("Company Name can't be empty");
                return;
            }

            string web_Page_Base_Address = create_This_Folder_Through_FTP_And_Return_WebPage_Base_Address(textBox_Company_Name.Text);

            if (web_Page_Base_Address == "")
            {
                MessageBox.Show("Ftp server is not allowing to create a folder,Aborting");
                return;
            }

            if (create_This_Folder_Through_FTP_And_Return_WebPage_Base_Address(textBox_Company_Name.Text + "/LocalDatabase") != "")
            {
                create_This_Folder_Through_FTP_And_Return_WebPage_Base_Address(textBox_Company_Name.Text + "/LocalDatabase/DOC");
                create_This_Folder_Through_FTP_And_Return_WebPage_Base_Address(textBox_Company_Name.Text + "/LocalDatabase/PDF");
                create_This_Folder_Through_FTP_And_Return_WebPage_Base_Address(textBox_Company_Name.Text + "/LocalDatabase/HTML");
            }
            create_This_Folder_Through_FTP_And_Return_WebPage_Base_Address(textBox_Company_Name.Text + "/Photos");

            string ftp_Home_Folder_Path = "C:\\\\Inetpub\\\\wwwroot\\\\MyWeb\\\\" + textBox_Company_Name.Text;

            string file_Name = "message_" + Useful_Functions.Useful_Functions.get_Guid_String();
            string file_Type = "";

            if (image_Path != "")
            {
                file_Type = image_Path.Substring(image_Path.LastIndexOf("."));
            }
            file_Name += file_Type;
            string image_Web_Path = "";

            if (image_Path != "")
            {
                image_Web_Path = upload_The_File_Return_Web_Address(file_Name, image_Path);
            }

            db_Connect.add_Company_Info(textBox_Company_Name.Text,
                                        web_Page_Base_Address + "/",
                                        dateTimePicker_Expiry_Date.Value,
                                        textBox_Message.Text,
                                        image_Web_Path,
                                        Convert.ToInt32(numericUpDown_SMS_Count.Value),
                                        ftp_Home_Folder_Path
                                        );

            db_Connect.Add_User_Info("Admin",
                                     crypting_Object.EncryptToString("admin"),
                                     "0000000000",
                                     "Management",
                                     textBox_Company_Name.Text,
                                     image_Path,
                                     "mail Id");

            // This will create client side precursor file
            string temp_Content = System.IO.File.ReadAllText("Program.cs");

            temp_Content = temp_Content.Replace("\"imiko\"", "\"" + textBox_Company_Name.Text + "\"");
            System.IO.File.WriteAllText("Program.cs", temp_Content);

            load_The_Company_Names();
            clear_Fields(true);

            MessageBox.Show("Company Got Added Successfully");
        }