Example #1
0
        public bool Process_Akashic(string Company, System.Windows.Forms.Label lbl_Processing)
        {
            bool result = false;

            lbl_Processing.BackColor = System.Drawing.Color.Yellow;
            lbl_Processing.Refresh();
            System.Windows.Forms.Application.DoEvents();



            SQLFunction sqlfunction = new SQLFunction();

            result = sqlfunction.ExecuteProc("RB", ConfigurationSettings.AppSettings["RB_Process_Akashic_Ebook"].ToString());

            if (result)
            {
                lbl_Processing.BackColor = System.Drawing.Color.Green;
                lbl_Processing.Refresh();
                System.Windows.Forms.Application.DoEvents();
            }
            else
            {
                lbl_Processing.BackColor = System.Drawing.Color.Red;
                lbl_Processing.Refresh();
                System.Windows.Forms.Application.DoEvents();
            }
            return(result);
        }
Example #2
0
        public bool Upload_Contributor_Reports(string Company)
        {
            bool result = true;

            if (Company == "RB")
            {
                try
                {
                    string ReportPaths = ConfigurationSettings.AppSettings["RB_Reports"].ToString();

                    #region 'Approved Titles'
                    string[] files = Directory.GetFiles(ReportPaths, "Contributor_MetaData_*.xlsx");


                    SQLFunction sqlfunc = new SQLFunction();

                    for (int i = 0; i < files.Length; i++)
                    {
                        string filename = files[i].ToString();
                        result = sqlfunc.UploadFile_RBContribs(Company, filename);

                        if (result)
                        {
                            result = sqlfunc.ExecuteProc(Company, "UpdateApprovedContributors");

                            string destinationReportPaths = filename.Replace(ConfigurationSettings.AppSettings["RB_Reports"].ToString(), ConfigurationSettings.AppSettings["RB_Reports"].ToString() + "\\Approved_Processed\\");

                            if (File.Exists(destinationReportPaths))
                            {
                                File.Delete(destinationReportPaths);
                            }

                            File.Move(files[i], destinationReportPaths);
                        }
                    }
                    #endregion

                    #region 'Incorrect Titles'
                    //string[] files_corrections = Directory.GetFiles(ReportPaths, "WFH_MetaData_Correction_*.xlsx");



                    //for (int i = 0; i < files.Length; i++)
                    //{
                    //    string filename = files[i].ToString();
                    //    sqlfunc.UploadFile(Company, filename);

                    //    sqlfunc.ExecuteProc(Company, "UpdateApprovedTitles");


                    //}
                    #endregion
                }
                catch (Exception ex)
                {
                    result = false;
                }
            }
            else if (Company == "WFH")
            {
                try
                {
                    string ReportPaths = ConfigurationSettings.AppSettings["Reports"].ToString();

                    #region 'Approved Titles'
                    string[] files = Directory.GetFiles(ReportPaths, "WFH_Contributor_MetaData_*.xlsx");


                    SQLFunction sqlfunc = new SQLFunction();

                    for (int i = 0; i < files.Length; i++)
                    {
                        string filename = files[i].ToString();
                        result = sqlfunc.UploadFile_Contribs(Company, filename);

                        if (result)
                        {
                            result = sqlfunc.ExecuteProc(Company, "UpdateApprovedContributors");

                            string destinationReportPaths = filename.Replace(ConfigurationSettings.AppSettings["Reports"].ToString(), ConfigurationSettings.AppSettings["Reports"].ToString() + "\\Approved_Processed\\");

                            if (File.Exists(destinationReportPaths))
                            {
                                File.Delete(destinationReportPaths);
                            }

                            File.Move(files[i], destinationReportPaths);
                        }
                    }
                    #endregion

                    #region 'Incorrect Titles'
                    //string[] files_corrections = Directory.GetFiles(ReportPaths, "WFH_MetaData_Correction_*.xlsx");



                    //for (int i = 0; i < files.Length; i++)
                    //{
                    //    string filename = files[i].ToString();
                    //    sqlfunc.UploadFile(Company, filename);

                    //    sqlfunc.ExecuteProc(Company, "UpdateApprovedTitles");


                    //}
                    #endregion
                }
                catch (Exception ex)
                {
                    result = false;
                }
            }
            else
            {
            }

            return(result);
        }