示例#1
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         BrandBll  BllBrand  = new BrandBll();
         BrandInfo infoBrand = new BrandInfo();
         infoBrand.BrandName    = txtBrandName.Text.Trim();
         infoBrand.Narration    = txtNarration.Text.Trim();
         infoBrand.Manufacturer = txtManufacturer.Text.Trim();
         infoBrand.Extra1       = string.Empty;
         infoBrand.Extra2       = string.Empty;
         infoBrand.ExtraDate    = DateTime.Now;
         infoBrand.BrandId      = decBrandId;
         if (txtBrandName.Text != strBrandName)
         {
             if (CheckExistenceOfBrandName() == false)
             {
                 if (BllBrand.BrandEdit(infoBrand))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                     txtBrandName.Focus();
                 }
                 else if (infoBrand.BrandId == 1)
                 {
                     Messages.InformationMessage("Cannot update");
                     Clear();
                     txtBrandName.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Brand name already exists");
                 txtBrandName.Focus();
             }
         }
         else if (infoBrand.BrandId == 1)
         {
             Messages.InformationMessage("Cannot update");
             Clear();
             txtBrandName.Focus();
         }
         else
         {
             if (BllBrand.BrandEdit(infoBrand))
             {
                 Messages.UpdatedMessage();
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }