コード例 #1
0
        private void comboBoxMasterInformation_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                radioInsert.Checked          = false;
                radioUpdate.Checked          = false;
                radioDelete.Checked          = false;
                labelSystemMessage.Text      = Constants.msgLabelDefault;
                labelSystemMessage.ForeColor = System.Drawing.Color.Black;
                textBoxName.Text             = null;

                dataGridViewMasterInformation.DataSource = null;

                switch (comboBoxMasterInformation.SelectedItem.ToString())
                {
                case "Author":
                    AuthorWSIntegration.AuthorWS authorWS = new AuthorWSIntegration.AuthorWS();
                    dataGridViewMasterInformation.DataSource = authorWS.GetAllAuthors();
                    break;

                case "Category":
                    CategoryWSIntegration.CategoryWS categoryWS = new CategoryWSIntegration.CategoryWS();
                    dataGridViewMasterInformation.DataSource = categoryWS.GetAllCategories();
                    break;

                case "Language":
                    LanguageWSIntegration.LanguageWS languageWS = new LanguageWSIntegration.LanguageWS();
                    dataGridViewMasterInformation.DataSource = languageWS.GetAllLanguages();
                    break;
                }

                dataGridViewMasterInformation.Columns[Constants.fieldID].Visible = false;
            }
            catch (SoapException ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                labelSystemMessage.ForeColor = System.Drawing.Color.Red;
                labelSystemMessage.Text      = Constants.msgErrorBusinessToUser + ex.Message;
            }
            catch (Exception ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                labelSystemMessage.ForeColor = System.Drawing.Color.Red;
                labelSystemMessage.Text      = Constants.msgErrorSystemToUser;
            }
        }
コード例 #2
0
        private void BookMaintenanceForm_Load(object sender, EventArgs e)
        {
            try
            {
                AuthorWSIntegration.AuthorWS authorWs = new AuthorWSIntegration.AuthorWS();
                comboBoxAuthor.DataSource    = authorWs.GetAllAuthors();
                comboBoxAuthor.DisplayMember = Constants.fieldDescription;
                comboBoxAuthor.ValueMember   = Constants.fieldID;

                CategoryWSIntegration.CategoryWS categoryWs = new CategoryWSIntegration.CategoryWS();
                comboBoxCategory.DataSource    = categoryWs.GetAllCategories();
                comboBoxCategory.DisplayMember = Constants.fieldDescription;
                comboBoxCategory.ValueMember   = Constants.fieldID;

                LanguageWSIntegration.LanguageWS languageWs = new LanguageWSIntegration.LanguageWS();
                comboBoxLanguage.DataSource    = languageWs.GetAllLanguages();
                comboBoxLanguage.DisplayMember = Constants.fieldDescription;
                comboBoxLanguage.ValueMember   = Constants.fieldID;

                this.disableComboBoxes();
                this.disableFieldsOfMaintenance();

                this.clearAllFields();
            }
            catch (SoapException ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                labelSystemMessage.ForeColor = System.Drawing.Color.Red;
                labelSystemMessage.Text      = Constants.msgErrorBusinessToUser + ex.Message;
            }
            catch (Exception ex)
            {
                //Error log simulate
                Console.WriteLine(ex.ToString());
                Console.WriteLine(ex.GetBaseException().ToString());
                labelSystemMessage.ForeColor = System.Drawing.Color.Red;
                labelSystemMessage.Text      = Constants.msgErrorSystemToUser;
            }
        }