public bool CheckMarketingMaterialsParams(Marketingsource ms)
 {
     if (ms.msName.Equals(string.Empty))
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
        private void button10_Click(object sender, EventArgs e)
        {
            try
            {
                Marketingsource ms = new Marketingsource();
                ms.msName = textBoxMedimName.Text;

                if (textBoxMediumContact.Text.Trim().Equals(string.Empty))
                {
                    ms.msContact = null;
                }
                else
                {
                    ms.msContact = textBoxMediumContact.Text;
                }

                if (textBoxMediumDetails.Text.Trim().Equals(string.Empty))
                {
                    ms.msDetails = null;
                }
                else
                {
                    ms.msDetails = textBoxMediumDetails.Text;
                }

                if (textBoxMediumPrice.Text.Equals(string.Empty))
                {
                    ms.msPrice = 0;
                }
                else
                {
                    ms.msPrice = Convert.ToDecimal(textBoxMediumPrice.Text);
                }
                ms.VersionCode = 1;

                if (CheckMarketingMaterialsParams(ms) == true)
                {
                    broker.InsertMarketingsource(ms);

                    SetMarketingSourceDataGrid();

                    MessageBox.Show("Marketing source added!");

                    textBoxMediumPrice.Clear();
                    textBoxMediumDetails.Clear();
                    textBoxMediumContact.Clear();
                    textBoxMedimName.Clear();
                }
                else
                {
                    MessageBox.Show("Please check the fields and their values!");
                }
            }
            catch (System.FormatException)
            {
                MessageBox.Show("Please check the price of the item!");
            }
            catch (System.Exception)
            {
                MessageBox.Show("Error!!");
            }
        }