Esempio n. 1
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         SiteInfo infoSite = new SiteInfo();
         SiteSP   spSite   = new SiteSP();
         infoSite.SiteName = txtSiteName.Text.Trim();
         infoSite.Address  = txtAddress.Text.Trim();
         infoSite.managed  = chkManaged.Checked;
         infoSite.dflt     = chkDflt.Checked;
         if (spSite.SiteCheckIfExist(txtSiteName.Text.Trim(), 0) == false)
         {
             decIdForOtherForms = spSite.SiteAddWithoutSameName(infoSite);
             if (decIdForOtherForms > 0)
             {
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Site name already exist");
             txtSiteName.Focus();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "G4:" + ex.Message;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Function to Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         SiteInfo infoSites = new SiteInfo();
         SiteSP   spSites   = new SiteSP();
         infoSites.SiteName = txtSiteName.Text.Trim();
         infoSites.Address  = txtAddress.Text.Trim();
         infoSites.managed  = chkManaged.Checked;
         infoSites.dflt     = chkDflt.Checked;
         infoSites.SiteId   = Convert.ToDecimal(dgvSites.CurrentRow.Cells["dgvtxtSiteId"].Value.ToString());
         if (txtSiteName.Text != strSiteName)
         {
             if (spSites.SiteCheckIfExist(txtSiteName.Text.Trim(), infoSites.SiteId) == false)
             {
                 if (spSites.SiteEditParticularField(infoSites))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
             }
             else
             {
                 Messages.InformationMessage("Site name already exist");
                 txtSiteName.Focus();
             }
         }
         else
         {
             spSites.SiteEditParticularField(infoSites);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "G5:" + ex.Message;
     }
 }