Exemplo n.º 1
0
        public DataTable GetAllAuthors()
        {
            try
            {
                MasterLogic masterLogic = new MasterLogic();
                return(masterLogic.GetAllAuthors().ToDataTable());
            }
            catch (BusinessLogicException ex)
            {
                HandleSoapException handleSoapExceptionnew = new HandleSoapException();
                SoapException       soapException          = new SoapException();
                soapException = handleSoapExceptionnew.CreateSoapException(Constants.faultUri,
                                                                           "GetAllAuthors",
                                                                           ex.Message,
                                                                           AppEnum.FaultSourceWS.BusinessError.ToString(),
                                                                           Constants.faultBusinessError,
                                                                           AppEnum.FaultSourceWS.BusinessError);
                throw soapException;
            }
            catch (Exception ex)
            {
                HandleSoapException handleSoapExceptionnew = new HandleSoapException();
                SoapException       soapException          = new SoapException();

                soapException = handleSoapExceptionnew.CreateSoapException(Constants.faultUri,
                                                                           "GetAllAuthors",
                                                                           ex.Message,
                                                                           AppEnum.FaultSourceWS.AplicationError.ToString(),
                                                                           Constants.faultAplicationError,
                                                                           AppEnum.FaultSourceWS.AplicationError);
                throw soapException;
            }
        }
        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;
                MasterLogic masterLogic = new MasterLogic();

                switch (comboBoxMasterInformation.SelectedItem.ToString())
                {
                case "Author":
                    dataGridViewMasterInformation.DataSource = masterLogic.GetAllAuthors();
                    break;

                case "Category":
                    dataGridViewMasterInformation.DataSource = masterLogic.GetAllCategories();
                    break;

                case "Language":
                    dataGridViewMasterInformation.DataSource = masterLogic.GetAllLanguages();
                    break;
                }

                dataGridViewMasterInformation.Columns[Constants.fieldID].Visible = false;
            }
            catch (BusinessLogicException 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;
            }
        }
Exemplo n.º 3
0
        private void BookMaintenanceForm_Load(object sender, EventArgs e)
        {
            try
            {
                MasterLogic masterLogic = new MasterLogic();
                comboBoxAuthor.DataSource    = masterLogic.GetAllAuthors();
                comboBoxAuthor.DisplayMember = "Description";
                comboBoxAuthor.ValueMember   = "ID";

                comboBoxCategory.DataSource    = masterLogic.GetAllCategories();
                comboBoxCategory.DisplayMember = "Description";
                comboBoxCategory.ValueMember   = "ID";

                comboBoxLanguage.DataSource    = masterLogic.GetAllLanguages();
                comboBoxLanguage.DisplayMember = "Description";
                comboBoxLanguage.ValueMember   = "ID";

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

                this.clearAllFields();
            }
            catch (BusinessLogicException 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;
            }
        }