Example #1
0
        public void DeleteOpenForm(object sender)
        {
            EntryFormName = ((Button)sender).Name;

            newform = new NewEntry(this, EntryFormName);

            newform.ShowDialog();
        }
Example #2
0
 /// <summary>
 /// Fires when click Add new entry
 /// creates new NewEntry form and then displays
 /// which effectiveley gives control to the
 /// new NewEntry form and passes Mainform instance object
 /// </summary>
 private void btn_AddNewEntry_Click(object sender, EventArgs e)
 {
     newform = new NewEntry(this, "");
     UpdateColor();
     OpenFormName  = "";
     EntryFormName = "";
     newform.ShowDialog();
     //https://www.youtube.com/watch?v=NxfYFAw0JDs
     //UpdateColours(NewSvcEnty);
 }
Example #3
0
        private void BtnCopy_Click(object sender, EventArgs e)
        {
            OpenFormName      = EntryFormName;
            CopyEntryFormName = EntryFormName.Trim() + " (Copy)";

            btnDelete.Enabled = false;

            foreach (NewSeviceEntry nse in NewSvcEnty)
            {
                if (nse.NewSeviceEntryName == CopyEntryFormName)
                {
                    MessageBox.Show(CopyEntryFormName + " already exists! - please rename service entry called " + CopyEntryFormName);
                    return;
                }
            }

            var res = (from p in NewSvcEnty
                       where p.NewSeviceEntryName == EntryFormName
                       select p).ToList();

            List <NewSeviceEntry> ns = res;

            AddEntriesToMainForm(null, true);

            newform = new NewEntry(this, "");

            newform.SaveImportToXMLSettings(ns, true);

            string xmlfile = Environment.CurrentDirectory + "\\settings2.xml";

            NewSvcEnty.AddNewEntry(XDocument.Load(xmlfile));

            CopyEntryFormName = "";

            UpdateColor();
            UpdateCopyColor(NewSvcEnty);
            EntryFormName   = "";
            OpenFormName    = "";
            btnCopy.Enabled = false;
        }
Example #4
0
        public void OpenForm(object sender)
        {
            //EntryFormName = ((Label)sender).Text;

            // Initialise NewEntry object
            newform = new NewEntry(this, sender.ToString());

            foreach (NewSeviceEntry nsec in NewSvcEnty)
            {
                if (nsec.NewSeviceEntryName == sender.ToString())
                {
                    // Enabled
                    if (nsec.Enabled.ToLower() == "true")
                    {
                        ((CheckBox)newform.Controls[2]).Checked = true;
                    }
                    else
                    {
                        ((CheckBox)newform.Controls[2]).Checked = false;
                    }

                    // Folders
                    //######
                    if (string.IsNullOrEmpty(nsec.NewSeviceEntryFolders[0].NewSeviceEntryFolderFail))
                    {
                        newform.Controls[8].Controls[1].Text = nsec.NewSeviceEntryFolders[0].NewSeviceEntryMainFolder + "\\Failed";
                    }
                    else
                    {
                        newform.Controls[8].Controls[1].Text = nsec.NewSeviceEntryFolders[0].NewSeviceEntryFolderFail;
                    }
                    //########
                    if (string.IsNullOrEmpty(nsec.NewSeviceEntryFolders[0].NewSeviceEntryBackup))
                    {
                        newform.Controls[8].Controls[2].Text = nsec.NewSeviceEntryFolders[0].NewSeviceEntryMainFolder + "\\Backup";
                    }
                    else
                    {
                        newform.Controls[8].Controls[2].Text = nsec.NewSeviceEntryFolders[0].NewSeviceEntryBackup;
                    }

                    newform.Controls[8].Controls[3].Text = nsec.NewSeviceEntryFolders[0].NewSeviceEntryMainFolder;

                    // Command
                    newform.Controls[9].Controls[0].Text = nsec.NewSeviceEntryCommands[0].NewSeviceEntrySProc;
                    newform.Controls[9].Controls[1].Text = nsec.NewSeviceEntryCommands[0].NewSeviceEntrySQL;

                    newform.Controls[11].Controls[0].Text    = nsec.NewSeviceEntryDataBases[0].NewSeviceEntryDBPass;
                    newform.Controls[11].Controls[0].TabStop = false;
                    newform.Controls[11].Controls[1].Text    = nsec.NewSeviceEntryDataBases[0].NewSeviceEntryDBUName;
                    newform.Controls[11].Controls[1].TabStop = false;
                    newform.Controls[11].Controls[2].Text    = nsec.NewSeviceEntryDataBases[0].NewSeviceEntryDB;
                    newform.Controls[11].Controls[2].TabStop = false;

                    // Name
                    if (!string.IsNullOrEmpty(CopyEntryFormName))
                    {
                        newform.Controls[6].Text = CopyEntryFormName;
                    }
                    else
                    {
                        newform.Controls[6].Text = sender.ToString();
                    }

                    // GroupBox2
                    newform.Controls[10].Controls[0].Text = "";

                    // FileTypes
                    newform.Controls[7].Controls[0].Text = "csv";

                    // Associate File Button text and backcolor
                    newform.Controls[0].Text      = nsec.AssociateMappings ? "Disassociate File" : "Assosiate File";
                    newform.Controls[0].BackColor = nsec.AssociateMappings ? Color.Red : default(Color);
                    newform.Controls[0].ForeColor = nsec.AssociateMappings ? Color.White : Color.Black;

                    Control.ControlCollection c = newform.Controls[1].Controls;

                    //List<NewSeviceEntry.NewSeviceEntryFileMappings> nsfm = nsec.NewSeviceEntryMap;

                    List <NewSeviceEntry.NewSeviceEntryFileAssoc> nsfm = nsec.NewSeviceEntryFileAss;
                    if (nsfm != null)
                    {
                        if (nsfm.Count > 0)
                        {
                            newform.NewEntrydgv.Rows.Add(nsfm.Count);
                            for (int j = 0; j < nsfm.Count; j++)
                            {
                                newform.NewEntrydgv.Rows[j].Cells[0].Value = nsfm[j].ColNum;
                                newform.NewEntrydgv.Rows[j].Cells[1].Value = nsfm[j].ColName;
                                newform.NewEntrydgv.Rows[j].Cells[2].Value = nsfm[j].ColDataType;
                            }
                        }
                    }
                }                //dgvFileImpsvc
            }

            newform.ShowDialog();
        }