Beispiel #1
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         if (_ObjBProposal == null)
         {
             _ObjBProposal = new BProposal();
         }
         _ObjBProposal.GetCategories(ObjEProposal, _TextID);
         if (ObjEProposal.dsCategory != null)
         {
             foreach (DataRow dr in ObjEProposal.dsCategory.Tables[0].Rows)
             {
                 if (dr["CategoryName"].ToString() == txtCategory.Text.Trim())
                 {
                     if (!Utility._IsGermany)
                     {
                         throw new Exception("Category already exist.!");
                     }
                     else
                     {
                         throw new Exception("Diese Kategorie existiert berets.!");
                     }
                 }
             }
         }
         _ObjEProposal.CategoryName = txtCategory.Text;
         _ObjBProposal.SaveCategory(_ObjEProposal, _TextID);
         this.Close();
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }
Beispiel #2
0
 /// <summary>
 /// to bind category data
 /// </summary>
 private void BindCategories()
 {
     try
     {
         ObjBProposal.GetCategories(ObjEProposal, Convert.ToInt32(_TextAreaID));
         if (ObjEProposal.dsCategory != null)
         {
             cmbCategory.DataSource    = null;
             cmbCategory.DataSource    = ObjEProposal.dsCategory.Tables[0];
             cmbCategory.DisplayMember = "CategoryName";
             cmbCategory.ValueMember   = "CategoryID";
             cmbCategory.SelectedIndex = -1;
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }