Esempio n. 1
0
        /// <summary>
        /// Add new file to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_addNew_Click(object sender, EventArgs e)
        {
            this.textBox_ShowDetails.Clear();
            this.FileProgress.Value = 0;
            if (this.Parse_Article != null && this.L_Art != null)
            {
                // delegate
                Article_Controller.Operated    += new ArticleController.OperationHandler(this.UpdateStatic);
                Mark_Controller.Operated       += new MarkController.OperationHandler(this.UpdateStatic);
                SubFamilly_Conreoller.Operated += new SubFamillyController.OperationHandler(this.UpdateStatic);
                Familly_Controller.Operated    += new FamillyController.OperationHandler(this.UpdateStatic);

                // delete
                Article_Controller.DeleteAllArticle();
                Mark_Controller.DeleteAllMark();
                SubFamilly_Conreoller.DeleteAllSubFamilly();
                Familly_Controller.DeleteAllFamilly();

                // insert into data base

                Response Response_Art = Article_Controller.InsertArticles(L_Art);

                //insert mark

                Response Response_Mark = Mark_Controller.InsertMarks(Parse_Article.L_Mark1);

                //insert subfamilly

                Response Response_SubFamilly = SubFamilly_Conreoller.InsertSubFamillys(Parse_Article.L_SubFamilly1);

                //insert familly

                Response Response_Familly = Familly_Controller.InsertFamillys(Parse_Article.L_Familly1);

                this.textBox_ShowDetails.AppendText("Finished!\n");

                this.label_ShowProgressState.Text = "Finished!";
            }
            else
            {
                // error no file
                this.textBox_ShowDetails.AppendText("No file to import!\n");
                //this.textBox_ShowDetails.Text = "No file to import!";
            }
        }