private void btnSave_Click(object sender, EventArgs e)
        {
            CurrentList = new List <NewSiteOrList>();

            foreach (DataGridViewRow row in dgNewSites.Rows)
            {
                if (!row.IsNewRow)
                {
                    NewSiteOrList ns = new NewSiteOrList(Util.ToStr(row.Cells[0].Value), Util.ToStr(row.Cells[1].Value));
                    if (ns.UrlName == "")
                    {
                        MessageBox.Show(this, "Site URL Name is blank.", "SUSHI", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        dgNewSites.FirstDisplayedCell = row.Cells[0];
                        dgNewSites.ClearSelection();
                        row.Cells[0].Selected = true;

                        return;
                    }
                    CurrentList.Add(ns);
                }
            }
            CurrentList.Sort(); //note: needed to check for duplicates
            if (_forSitesNotLists)
            {
                ActionBulkSiteCreation.DefInstance.lblSiteCount.Text = "count of sites to create: " + CurrentList.Count;
            }
            else
            {
                ActionBulkListCreation.DefInstance.lblSiteCount.Text = "count of lists to create: " + CurrentList.Count;
            }
            this.Close();
        }
Exemplo n.º 2
0
 private bool listAlreadyExists(List <NewSiteOrList> l, NewSiteOrList candidate)
 {
     foreach (NewSiteOrList nsl in l)
     {
         if (nsl.Title.ToUpper() == candidate.Title.ToUpper() || nsl.UrlName.ToUpper() == candidate.UrlName.ToUpper())
         {
             return(true);
         }
     }
     return(false);
 }