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 void Insertion_Label(System.Windows.Forms.Label lbl_Insertion, int count)
        {
            if (count > 0)
            {
                lbl_Insertion.Text = "Insertion - " + count;
            }
            else
            {
                lbl_Insertion.Text = "Insertion";
            }

            lbl_Insertion.Refresh();
            System.Windows.Forms.Application.DoEvents();
        }
        private System.Windows.Forms.Integration.WindowsFormsHost makeToolBoxGUIOItem(HMIConstants.guioNumber guioNumber)
        {
            //windowsFormHost는 WPF element또는 page 내부에 Windows Form contorl을 호스팅하기위해 사용한다.
            System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
            host.HorizontalAlignment = HorizontalAlignment.Left;
            host.Height            = 34;
            host.Width             = 234;
            host.Margin            = new Thickness(0, 1, 0, 0);
            host.VerticalAlignment = VerticalAlignment.Top;

            System.Windows.Forms.Label guioItem = new System.Windows.Forms.Label();
            guioItem.Size       = new System.Drawing.Size(234, 34);
            guioItem.MouseDown += guio_MouseDown;
            guioItem.Image      = (Bitmap)rm.GetObject(HMIConstants.getGUIOName(guioNumber));
            guioItem.Name       = HMIConstants.getGUIOName(guioNumber);
            guioItem.AutoSize   = false;
            guioItem.Refresh();
            host.Name  = HMIConstants.getGUIOName(guioNumber);
            host.Child = guioItem;

            return(host);
        }
Example #4
0
 public void nextTurn()
 {
     if (onTurn == Black)
     {
         onTurn            = White;
         whiteTurn.Visible = true;
         blackTurn.Visible = false;
         thinking.Visible  = false;
     }
     else
     {
         onTurn            = Black;
         whiteTurn.Visible = false;
         blackTurn.Visible = true;
         blackTurn.Refresh();
         if (gameMode == GameMode.CovP)
         {
             thinking.Visible = true;
             thinking.Refresh();
         }
     }
 }
Example #5
0
        public ONIXMessage Work_With_Onix2referenceTags(string filelocation, System.Windows.Forms.Label lbl_Message, System.Windows.Forms.Label lbl_CleanUp, string Company, string MediaType, string FileName, string PublisherName, string OnixVersion, string TagType, string XML_Encoding)
        {
            lbl_CleanUp.BackColor = System.Drawing.Color.Yellow;
            lbl_CleanUp.Refresh();
            System.Windows.Forms.Application.DoEvents();


            #region 'CleanUp ONIX elements'

            ONIXMessage fileInfo_2reference = new ONIXMessage();


            //System.IO.FileInfo file_1 = new System.IO.FileInfo(@"C:\Users\kkoka\Desktop\wfh\harpercollins\HCUK_ONIX_full_20141107.xml");

            System.IO.FileInfo file_1 = new System.IO.FileInfo(filelocation);
            string             CleanedFile_WithName = "";

            try
            {
                //   System.IO.FileInfo file_1 = new System.IO.FileInfo(file);
                Onix_CleanUP cleanup_xml = new Onix_CleanUP(); //(info, sort_filepath, onix_TagType , xml_encoding);

                CleanedFile_WithName = cleanup_xml.CleanUP_LargeXMLFiles(file_1, Company);

                //string CleanedFile_WithName = cleanup_xml.CleanUP_OnixElements(file_1, Company);



                // Create an instance of stream writer.

                //     TextReader txtReader = new StreamReader(filelocation);
                TextReader txtReader = new StreamReader(CleanedFile_WithName, Encoding.GetEncoding(XML_Encoding));


                // Create and instance of XmlSerializer class.
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(ONIXMessage));

                // DeSerialize from the StreamReader
                fileInfo_2reference = (ONIXMessage)xmlSerializer.Deserialize(txtReader);

                // Close the stream reader
                txtReader.Close();

                lbl_CleanUp.BackColor = System.Drawing.Color.Green;
                lbl_CleanUp.Refresh();
                System.Windows.Forms.Application.DoEvents();
            }
            catch (Exception ex)
            {
                lbl_Message.Text = "There has been some problem cleaning up the file.";
                lbl_Message.Refresh();
                System.Windows.Forms.Application.DoEvents();

                lbl_CleanUp.BackColor = System.Drawing.Color.Red;
                lbl_CleanUp.Refresh();
                System.Windows.Forms.Application.DoEvents();

                SQLFunction sqlfnction = new SQLFunction();
                sqlfnction.Insert_ErrorLog(sqlfnction.GetConnectionString(Company), "Error Cleaning/Deserializing the " + MediaType + " file : " + FileName + " from the publisher - " + PublisherName + ". Exception : " + ex.ToString());
            }
            finally
            {
                File.Delete(CleanedFile_WithName);
            }

            return(fileInfo_2reference);

            #endregion
        }
Example #6
0
 public void Refresh()
 {
     lblDispResources.Text = "Power: " + Power + " / Recruit: " + Recruit + " / Victory: " + VictoryPoints;
     lblDispResources.Refresh();
 }
Example #7
0
        public bool RB_Akashic_Extraction(string filePath, int pubid, string FileName, string MediaType,
                                          System.Windows.Forms.Label lbl_Extraction,
                                          System.Windows.Forms.Label lbl_Insert,
                                          System.Windows.Forms.Label lbl_Message)
        {
            bool   result = true;
            string Step   = "";

            try
            {
                lbl_Extraction.BackColor = System.Drawing.Color.Yellow;
                lbl_Extraction.Refresh();
                System.Windows.Forms.Application.DoEvents();

                #region 'DataTable Creation'

                DataTable dt_MainTitles = new DataTable("MainTitles");
                #region 'Columns Declaration'

                dt_MainTitles.Columns.Add("MetaDataID", typeof(int));
                dt_MainTitles.Columns.Add("ProductID", typeof(int));
                dt_MainTitles.Columns.Add("RowCnt", typeof(int));
                dt_MainTitles.Columns.Add("ISBN", typeof(string));
                dt_MainTitles.Columns.Add("Title", typeof(string));
                dt_MainTitles.Columns.Add("SubTitle", typeof(string));
                dt_MainTitles.Columns.Add("Description", typeof(string));
                dt_MainTitles.Columns.Add("PageCount", typeof(string));
                dt_MainTitles.Columns.Add("Unabridged", typeof(string));
                dt_MainTitles.Columns.Add("Language", typeof(string));
                dt_MainTitles.Columns.Add("BISAC", typeof(string));
                dt_MainTitles.Columns.Add("PublishDate", typeof(string));
                dt_MainTitles.Columns.Add("ReleaseDate", typeof(string));
                dt_MainTitles.Columns.Add("RightsCountry", typeof(string));
                dt_MainTitles.Columns.Add("SeriesName", typeof(string));
                dt_MainTitles.Columns.Add("SeriesPositionNumber", typeof(string));
                dt_MainTitles.Columns.Add("Status", typeof(string));
                dt_MainTitles.Columns.Add("PublisherName", typeof(string));


                #endregion


                DataTable dt_Price = new DataTable("Price");
                #region 'Columns Declaration'

                dt_Price.Columns.Add("MetaDataID", typeof(int));
                dt_Price.Columns.Add("ProductID", typeof(int));
                dt_Price.Columns.Add("RowCnt", typeof(int));
                dt_Price.Columns.Add("PriceType_j148", typeof(string));
                dt_Price.Columns.Add("LibraryPrice_j151", typeof(string));
                dt_Price.Columns.Add("CurrencyCode_j152", typeof(string));
                dt_Price.Columns.Add("j261", typeof(string));


                #endregion


                DataTable dt_SalesRights = new DataTable("SalesRights");
                #region 'Columns Declaration'

                dt_SalesRights.Columns.Add("MetaDataID", typeof(int));
                dt_SalesRights.Columns.Add("ProductID", typeof(int));
                dt_SalesRights.Columns.Add("RowCnt", typeof(int));
                dt_SalesRights.Columns.Add("SalesRightsTypeCode_b089", typeof(string));
                dt_SalesRights.Columns.Add("RightsCountry_b090", typeof(string));
                dt_SalesRights.Columns.Add("RightsTerritory_b388", typeof(string));

                #endregion


                DataTable dt_contributor = new DataTable("Contributor");
                #region 'Columns Declaration'

                dt_contributor.Columns.Add("MetaDataID", typeof(int));
                dt_contributor.Columns.Add("ProductID", typeof(int));
                dt_contributor.Columns.Add("RowCnt", typeof(int));
                dt_contributor.Columns.Add("Contribs_SequenceNumber_b034", typeof(string));
                dt_contributor.Columns.Add("Contribs_ContribCode_b035", typeof(string));
                dt_contributor.Columns.Add("Contribs_FNF_b036", typeof(string));
                dt_contributor.Columns.Add("Contribs_LNF_b037", typeof(string));
                dt_contributor.Columns.Add("Contribs_Prefix_b038", typeof(string));
                dt_contributor.Columns.Add("Contribs_FirstName_b039", typeof(string));
                dt_contributor.Columns.Add("Contribs_LastName_b040", typeof(string));
                dt_contributor.Columns.Add("Contribs_CorporateAuthors_b047", typeof(string));

                #endregion


                #endregion

                DataTable dt_Excel = new DataTable();

                SQLFunction sqlfunction = new SQLFunction();

                dt_Excel = sqlfunction.ReadExcel(filePath, dt_Excel);

                if (
                    CheckIfColumnExist(dt_Excel, "publisher") &&
                    CheckIfColumnExist(dt_Excel, "isbn") &&
                    CheckIfColumnExist(dt_Excel, "title") &&
                    CheckIfColumnExist(dt_Excel, "subtitle") &&
                    CheckIfColumnExist(dt_Excel, "author(s)") &&
                    CheckIfColumnExist(dt_Excel, "illustrator(s)") &&
                    CheckIfColumnExist(dt_Excel, "unabridged") &&
                    CheckIfColumnExist(dt_Excel, "bisac code") &&
                    CheckIfColumnExist(dt_Excel, "publish date") &&
                    CheckIfColumnExist(dt_Excel, "release date") &&
                    CheckIfColumnExist(dt_Excel, "page count") &&
                    CheckIfColumnExist(dt_Excel, "library price") &&
                    CheckIfColumnExist(dt_Excel, "currency type") &&
                    CheckIfColumnExist(dt_Excel, "distribution territory") &&
                    CheckIfColumnExist(dt_Excel, "specific countries") &&
                    CheckIfColumnExist(dt_Excel, "description") &&
                    CheckIfColumnExist(dt_Excel, "language (3 digit country code)") &&
                    CheckIfColumnExist(dt_Excel, "series name") &&
                    CheckIfColumnExist(dt_Excel, "series position number") &&
                    CheckIfColumnExist(dt_Excel, "status")
                    )
                {
                    int MetaDataID = InsertMetaData_Info(pubid, FileName, MediaType, "RB");

                    if (MetaDataID > 0)
                    {
                        for (int i = 0; i < dt_Excel.Rows.Count; i++)
                        {
                            #region 'MainTitles'
                            Step          = "MainTitles";
                            dt_MainTitles = MainTitles(dt_MainTitles, dt_Excel, MetaDataID, i);
                            #endregion


                            #region 'Price'
                            Step     = "Price";
                            dt_Price = Price(dt_Price, dt_Excel, MetaDataID, i);
                            #endregion


                            #region 'SalesRights'
                            Step           = "SalesRights";
                            dt_SalesRights = SalesRights(dt_SalesRights, dt_Excel, MetaDataID, i);

                            #endregion

                            #region 'Contributor'
                            Step           = "Contributor";
                            dt_contributor = Contributor(dt_contributor, dt_Excel, MetaDataID, i);

                            #endregion
                        }
                    }
                }



                lbl_Extraction.BackColor = System.Drawing.Color.Green;
                lbl_Extraction.Refresh();
                System.Windows.Forms.Application.DoEvents();



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


                #region 'Insert the Data into the SQL Table'

                int count = 4;

                result = InsertRecords(dt_MainTitles, "RB");
                Insertion_Label(lbl_Insert, count);
                count--;


                if (result)
                {
                    result = InsertRecords(dt_Price, "RB");
                    Insertion_Label(lbl_Insert, count);
                }
                count--;


                if (result)
                {
                    result = InsertRecords(dt_SalesRights, "RB");
                    Insertion_Label(lbl_Insert, count);
                }
                count--;

                if (result)
                {
                    result = InsertRecords(dt_contributor, "RB");
                    Insertion_Label(lbl_Insert, count);
                }
                count--;

                if (result)
                {
                    lbl_Insert.BackColor = System.Drawing.Color.Green;
                    lbl_Insert.Refresh();
                    System.Windows.Forms.Application.DoEvents();
                }



                #endregion
            }
            catch (Exception ex)
            {
                result = false;
                SQLFunction sqlfnction = new SQLFunction();
                sqlfnction.Insert_ErrorLog(sqlfnction.GetConnectionString("RB"), "Error at " + Step + " : " + ex.ToString());
            }

            return(result);
        }