Beispiel #1
0
        private static void Write_DB()
        {
            Main_Form.Notify("Update and saving values in database");
            int j;

            for (j = 1; j <= Main_Form.Male_List.Count; j++)
            {
                Sheet_Stat.Cells[j, 1] = '\'' + Main_Form.Male_List[j - 1].Name;
                Sheet_Stat.Cells[j, 2] = '\'' + Main_Form.Male_List[j - 1].Atalaya;
                Sheet_Stat.Cells[j, 3] = '\'' + Main_Form.Male_List[j - 1].Capitan;
                Sheet_Stat.Cells[j, 4] = '\'' + Main_Form.Male_List[j - 1].Acomodador;
                Sheet_Stat.Cells[j, 5] = '\'' + Main_Form.Male_List[j - 1].Lector;
                Sheet_Stat.Cells[j, 6] = '\'' + Main_Form.Male_List[j - 1].Pres_RP;
                Sheet_Stat.Cells[j, 7] = '\'' + Main_Form.Male_List[j - 1].Oracion;
                Sheet_Stat.Cells[j, 8] = Main_Form.Male_List[j - 1].Male_Type;
            }
            while (cellValue_stat[j, 1] != null)
            {
                Sheet_Stat.Cells[j, 1] = "";
                Sheet_Stat.Cells[j, 2] = "";
                Sheet_Stat.Cells[j, 3] = "";
                Sheet_Stat.Cells[j, 4] = "";
                Sheet_Stat.Cells[j, 5] = "";
                Sheet_Stat.Cells[j, 6] = "";
                Sheet_Stat.Cells[j, 7] = "";
                Sheet_Stat.Cells[j, 8] = "";
                j++;
            }
            DBBooks.Save();
            Main_Form.Notify("Saved DB with new values");
        }
Beispiel #2
0
        public static void Persistence_Hub(Persistence_Request request)
        {
            attending_persistance = true;
            string req = "";

            if (request.persistence_insight != null)
            {
                req = "Week: " + request.persistence_insight.Num_of_Week;
                Main_Form.Notify("Persistence Request for " + req);
                Persistence_Worker(request.persistence_insight);
                Main_Form.Pending_refresh_status_grids = true;
            }
            if (request.autofill)
            {
                Main_Form.Notify("Executing Autofill handler");
                if (request.autofill_all)
                {
                    Main_Form.Notify("Autofill for all weeks");
                    for (int i = 1; i <= Main_Form.number_of_weeks; i++)
                    {
                        Autofill_Handler(i);
                    }
                }
                else
                {
                    Main_Form.Notify("Autofill for week [" + Main_Form.current_week.ToString() + "]");
                    Autofill_Handler(Main_Form.current_week);
                }
                Main_Form.Pending_Week_Handler_Refresh = true;
            }
            attending_persistance = false;
        }
Beispiel #3
0
 public static void Get_Songs_From_Watchtower()
 {
     try
     {
         bool           song_2_found = false;
         HttpWebRequest request      = (HttpWebRequest)WebRequest.Create(hyperlink_WT);
         using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
             using (Stream stream = response.GetResponseStream())
                 using (StreamReader reader = new StreamReader(stream))
                 {
                     string raw;// = reader.ReadToEnd(); //Test --Do Not Delete Comment!--
                     Main_Form.Notify("Connection ready for Watchtower");
                     while ((raw = reader.ReadLine()) != null)
                     {
                         if (raw.Contains(">CANCIÓN"))
                         {
                             if (!song_2_found)
                             {
                                 insight_Sem_Local.Cancion_RP_2 = Find_Song_Name(Analyze_string(raw));
                                 song_2_found = true;
                             }
                             else
                             {
                                 insight_Sem_Local.Cancion_RP_3 = Find_Song_Name(Analyze_string(raw)) + " y oración final";
                                 break;
                             }
                         }
                     }
                     Main_Form.Notify("Songs from Watchtower retrieved.");
                 }
     }
     catch
     {
     }
 }
Beispiel #4
0
 public static void Create_Overwatch_Objs()
 {
     Main_Form.Notify("Create Overwatch Objects");
     Semana1.Name       = "Semana 1";
     Semana1.Percentaje = "0%";
     Semana1.Special_VyM_Meeting_Type = Main_Form.Special_Meeting_Type.Non_status;
     Semana1.Special_RP_Meeting_Type  = Main_Form.Special_Meeting_Type.Non_status;
     Semana2.Name       = "Semana 2";
     Semana2.Percentaje = "0%";
     Semana2.Special_VyM_Meeting_Type = Main_Form.Special_Meeting_Type.Non_status;
     Semana2.Special_RP_Meeting_Type  = Main_Form.Special_Meeting_Type.Non_status;
     Semana3.Name       = "Semana 3";
     Semana3.Percentaje = "0%";
     Semana3.Special_VyM_Meeting_Type = Main_Form.Special_Meeting_Type.Non_status;
     Semana3.Special_RP_Meeting_Type  = Main_Form.Special_Meeting_Type.Non_status;
     Semana4.Name       = "Semana 4";
     Semana4.Percentaje = "0%";
     Semana4.Special_VyM_Meeting_Type = Main_Form.Special_Meeting_Type.Non_status;
     Semana4.Special_RP_Meeting_Type  = Main_Form.Special_Meeting_Type.Non_status;
     Semana5.Name       = "Semana 5";
     Semana5.Percentaje = "0%";
     Semana5.Special_VyM_Meeting_Type = Main_Form.Special_Meeting_Type.Non_status;
     Semana5.Special_RP_Meeting_Type  = Main_Form.Special_Meeting_Type.Non_status;
     Main_Form.Overwatch_Information_List.Add(Semana1);
     Main_Form.Overwatch_Information_List.Add(Semana2);
     Main_Form.Overwatch_Information_List.Add(Semana3);
     Main_Form.Overwatch_Information_List.Add(Semana4);
     if (Main_Form.week_five_exist)
     {
         Total_Num_weeks = 5;
         Main_Form.Overwatch_Information_List.Add(Semana5);
     }
     Main_Form.Pending_Overwatch_Refresh = true;
 }
Beispiel #5
0
        private static void Read_DB()
        {
            /*Read Status males*/
            Main_Form.Notify("Retrieve values from Status database");
            Main_Form.Elders_Count       = 0;
            Main_Form.Ministerials_Count = 0;
            Main_Form.Generals_Count     = 0;
            Main_Form.Males_Count        = 0;
            for (int i = 1; i < 100; i++)
            {
                if (cellValue_stat[i, 1] == null)
                {
                    break;
                }
                else
                {
                    Males aux_male = new Males
                    {
                        Name       = cellValue_stat[i, 1].ToString(),
                        Atalaya    = cellValue_stat[i, 2].ToString(),
                        Capitan    = cellValue_stat[i, 3].ToString(),
                        Acomodador = cellValue_stat[i, 4].ToString(),
                        Lector     = cellValue_stat[i, 5].ToString(),
                        Pres_RP    = cellValue_stat[i, 6].ToString(),
                        Oracion    = cellValue_stat[i, 7].ToString(),
                        Male_Type  = (Main_Form.Male_Type)Convert.ToInt16(cellValue_stat[i, 8].ToString()),
                    };
                    switch (aux_male.Male_Type)
                    {
                    case Main_Form.Male_Type.Anciano:
                    {
                        Main_Form.Elders_Count++;
                        break;
                    }

                    case Main_Form.Male_Type.Ministerial:
                    {
                        Main_Form.Ministerials_Count++;
                        break;
                    }

                    case Main_Form.Male_Type.Publicador:
                    {
                        Main_Form.Generals_Count++;
                        break;
                    }
                    }
                    Main_Form.Male_List.Add(aux_male);
                }
            }
            Main_Form.Male_List_filled = true;
            Males_Rules_Handler();
            Main_Form.Pending_refresh_status_grids = true;
            Main_Form.Males_Count = Main_Form.Elders_Count + Main_Form.Ministerials_Count + Main_Form.Generals_Count;
            Main_Form.Notify("Read Successfull:\nElders: " + Main_Form.Elders_Count.ToString() + "\nMinisterials: " + Main_Form.Ministerials_Count.ToString() + "\nGeneral Males: " + Main_Form.Generals_Count.ToString() + "\nMales Count: " + Main_Form.Males_Count);
        }
Beispiel #6
0
 public static void Open_DB()
 {
     db_open = true;
     Main_Form.Notify("Opening Database file");
     DBApp          = new Excel.Application();
     DBBooks        = DBApp.Workbooks.Open(Main_Form.Path_DB, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", true, false, 0, true, 1, 0);
     DBSheets       = DBBooks.Worksheets;
     Sheet_Stat     = (Excel.Worksheet)DBSheets.get_Item(1);
     range_stat     = Sheet_Stat.get_Range("A1", "I137");
     cellValue_stat = range_stat.get_Value();
 }
Beispiel #7
0
        /*-------------------- Attending request -------------------- */

        private static void Access_Heaven()
        {
            Hw_inProgress = true;
            int max_sem = 4;

            if (Main_Form.week_five_exist)
            {
                max_sem = 5;
            }
            for (current_week = 1; current_week <= max_sem; current_week++)
            {
                Copy_Main_Week();
                if (!insight_Sem_Local.HW_Data)
                {
                    string fecha = Main_Form.meetings_days[current_week - 1, 0].ToString("yyyy/MM/dd");
                    string url   = "https://wol.jw.org/es/wol/dt/r4/lp-s/" + fecha;
                    month = Main_Form.meetings_days[current_week - 1, 0].ToString("MMMM");
                    Main_Form.Notify("Gather information from heavensward for " + month);
                    try
                    {
                        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                            using (Stream stream = response.GetResponseStream())
                                using (StreamReader reader = new StreamReader(stream))
                                {
                                    string raw;// = reader.ReadToEnd(); //Test --Do Not Delete Comment!--
                                    CleanUp();
                                    //Main_Form.Notify("Connection Successfull. Reading info");
                                    while ((raw = reader.ReadLine()) != null)
                                    {
                                        if (break_reader)
                                        {
                                            break;
                                        }
                                        String_Handler(raw);
                                    }
                                    Main_Form.Notify("Information successfully recieved from wol.jw.org for " + fecha);
                                }
                    }
                    catch
                    {
                        Main_Form.Warn("Unable to connect to wol.jw.org at " + fecha + "\n");
                    }
                }
            }
            Return_Values_From_Heavensward();
            Overwatch.OW_Request = true;
            Main_Form.Heavensward_request_complete = true;
            Main_Form.Notify("Heavensward Request Complete");
            Hw_inProgress       = false;
            Request_Heavensward = false;
        }
Beispiel #8
0
 private static void Initial_Database_check()
 {
     if (File.Exists(Main_Form.Path_DB))
     {
         Main_Form.Notify("Initial Check: Database file exist");
         DB_Allowed = true;
     }
     else
     {
         Main_Form.Warn("Initial Check: Database file missing");
         Main_Form.Warn("Disabling Persistence features");
         DB_Allowed = false;
     }
 }
Beispiel #9
0
        private static void Return_Values_From_Heavensward()
        {
            Main_Form.Notify("Storing info from Heavensward into Main");

            Main_Form.Insight_month.Semana1.Save_Heavensward_Info(insight_Month_Local.Semana1);

            Main_Form.Insight_month.Semana2.Save_Heavensward_Info(insight_Month_Local.Semana2);

            Main_Form.Insight_month.Semana3.Save_Heavensward_Info(insight_Month_Local.Semana3);

            Main_Form.Insight_month.Semana4.Save_Heavensward_Info(insight_Month_Local.Semana4);

            if (Main_Form.week_five_exist)
            {
                Main_Form.Insight_month.Semana5.Save_Heavensward_Info(insight_Month_Local.Semana5);
            }
        }
Beispiel #10
0
 private static void Initial_Heavensward_Check()
 {
     try
     {
         /*ToDo
          * Change Initialization
          * Get Random ID
          * Write in Firebase
          * Give 5 tries to read and compare that value
          * */
         using (var client = new WebClient())
             using (client.OpenRead("http://clients3.google.com/generate_204"))
             {
                 Main_Form.Notify("Initial Check: Internet Connection: Granted!");
             }
     }
     catch
     {
         Main_Form.Warn("Initial Check: Internet Connection: Denied!");
     }
 }
Beispiel #11
0
        public static void Overwatch_Thread_Handler()
        {
            while (true)
            {
                if (OW_Request && !Attending_OW_Request && Objects_Created)
                {
                    OW_Request           = false;
                    Attending_OW_Request = true;
                    Overwatch_Control();
                }

                if (!Initial_Check)
                {
                    Initial_Check = true;
                    Main_Form.Notify("Initial Check: Overwatch reporting");
                }
                if (!Objects_Created && Main_Form.UI_running)
                {
                    Create_Overwatch_Objs();
                    Objects_Created = true;
                }
                Thread.Sleep(2000);
            }
        }
Beispiel #12
0
        /*----------------------------------- Celestial Aeon Project -----------------------------------*/

        private static void Heavensward_Oracle_Handler(HW_Oracle_Request request)
        {
            Hw_oracle_inProgress = true;
            string asignee       = Properties.Settings.Default.Heavensward_User;
            bool   asignee_found = false;
            string asig          = "";
            string date          = "";

            if (request.hw_oracle_vym != null)
            {
                List <string> VyM_Asignee = request.hw_oracle_vym.Get_Asignee_List();
                if (VyM_Asignee[0] != null)
                {
                    for (int i = 0; i < VyM_Asignee.Count; i++)
                    {
                        if (VyM_Asignee[i].Contains(asignee))
                        {
                            Main_Form.Notify("Noel Belin Found in " + Assignment_VyM_List[i] + ", date " + request.hw_oracle_vym.Fecha.ToString("dddd, dd MMMM, yyyy"));
                            asig          = Assignment_VyM_List[i];
                            date          = request.hw_oracle_vym.Fecha.ToString("dddd, dd MMMM");;
                            asignee_found = true;
                        }
                    }
                }
            }
            else if (request.hw_oracle_rp != null)
            {
                List <string> RP_Asignee = request.hw_oracle_rp.Get_Asignee_List();
                if (RP_Asignee[0] != null)
                {
                    for (int i = 0; i < RP_Asignee.Count; i++)
                    {
                        if (RP_Asignee[i].Contains(asignee))
                        {
                            Main_Form.Notify("Noel Belin Found in " + Assignment_RP_List[i] + ", date " + request.hw_oracle_rp.Fecha.ToString("dddd, dd MMMM, yyyy"));
                            asig          = Assignment_RP_List[i];
                            date          = request.hw_oracle_rp.Fecha.ToString("dddd, dd MMMM");
                            asignee_found = true;
                        }
                    }
                }
            }
            else if (request.hw_oracle_ac != null)
            {
                List <string> AC_Asignee = request.hw_oracle_ac.Get_Asignee_List();
                if (AC_Asignee[0] != null)
                {
                    for (int i = 0; i < AC_Asignee.Count; i++)
                    {
                        if (AC_Asignee[i].Contains(asignee))
                        {
                            string fecha;
                            if (i < 3)
                            {
                                fecha = request.hw_oracle_ac.Fecha_VyM.ToString("dddd, dd MMMM, yyyy");
                            }
                            else
                            {
                                fecha = request.hw_oracle_ac.Fecha_RP.ToString("dddd, dd MMMM, yyyy");
                            }
                            Main_Form.Notify("Noel Belin Found in " + Assignment_AC_List[i] + ", date " + fecha);
                            asig          = Assignment_AC_List[i];
                            date          = fecha;
                            asignee_found = true;
                        }
                    }
                }
            }

            if (asignee_found)
            {
                date = date.Replace(" ", "+");
                try
                {
                    Main_Form.Notify("Accesing to Heavensward Oracle Network");
                    string         url_local      = "https://us-central1-agr-connected-services.cloudfunctions.net/Heavensward_Oracle";
                    string         modifier1      = "?rw=write";
                    string         modifier2      = "&asig=" + asig;
                    string         modifier3      = "&date=" + date;
                    HttpWebRequest Oracle_Request = (HttpWebRequest)WebRequest.Create(url_local + modifier1 + modifier2 + modifier3);
                    using (HttpWebResponse response = (HttpWebResponse)Oracle_Request.GetResponse())
                        using (Stream stream = response.GetResponseStream())
                            using (StreamReader reader = new StreamReader(stream))
                            {
                                string raw = reader.ReadToEnd();
                                Main_Form.Notify(raw);
                            }
                }
                catch
                {
                    Main_Form.Warn("Connection: Denied!");
                }
            }
            HW_Oracle_Requests_List.RemoveAt(0);
            Hw_oracle_inProgress = false;
        }