public List <CompanyBase> GetCompanies(string AspNetUserId)
        {
            List <CompanyBase> cList = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.CompanyPerson_GetCompanies",
                                    inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@AspNetUserId", AspNetUserId);
            }, map : delegate(IDataReader reader, short set)
            {
                CompanyBase company = new CompanyBase();
                int ord             = 0;

                company.Id          = reader.GetSafeInt32(ord++);
                company.Name        = reader.GetSafeString(ord++);
                company.PhoneNumber = reader.GetSafeString(ord++);
                company.Email       = reader.GetSafeString(ord++);

                if (cList == null)
                {
                    cList = new List <CompanyBase>();
                }
                cList.Add(company);
            }
                                    );
            return(cList);
        }
Beispiel #2
0
        private PersonProject MapPersonProject(IDataReader reader)
        {
            PersonProject pp = new PersonProject();
            ProjectBase   pb = new ProjectBase();
            CompanyBase   cb = new CompanyBase();

            pp.Project = pb;
            pp.Company = cb;
            int startingIndex = 0; //startingOrdinal

            pp.PersonId              = reader.GetSafeInt32(startingIndex++);
            pb.Id                    = reader.GetSafeInt32(startingIndex++);
            pb.ProjectName           = reader.GetSafeString(startingIndex++);
            pp.Deadline              = reader.GetSafeDateTime(startingIndex++);
            pp.IsLeader              = reader.GetSafeBool(startingIndex++);
            pp.ProjectPersonStatusId = reader.GetSafeInt32(startingIndex++);
            pp.ProjectPersonStatus   = reader.GetSafeString(startingIndex++);
            cb.Id                    = reader.GetSafeInt32(startingIndex++);
            cb.Name                  = reader.GetSafeString(startingIndex++);
            cb.PhoneNumber           = reader.GetSafeString(startingIndex++);
            cb.Email                 = reader.GetSafeString(startingIndex++);
            pp.CurrentRate           = reader.GetSafeDecimalNullable(startingIndex++);
            pp.TrelloBoardUrl        = reader.GetSafeString(startingIndex++);
            pp.TimeWorked            = reader.GetSafeInt32Nullable(startingIndex++);
            pp.Earnings              = reader.GetSafeDecimalNullable(startingIndex++);

            return(pp);
        }
Beispiel #3
0
        public void GetNonExitsingTimedTaskTest()
        {
            Company c = new Company();

            CompanyBase foundCompanyBase = c.GetCompanyBase(100);

            Assert.AreEqual(null, foundCompanyBase);
        }
Beispiel #4
0
 public void AddTimedItemWithExistingIdTest()
 {
     Company     c  = new Company();
     CompanyBase t1 = c.AddToDo(1, "Dummy To Do 1",
                                "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                DateTime.Now.AddDays(2), Priority.NORMAL);
     CompanyBase t2 = c.AddToDo(1, "Dummy To Do 2",
                                "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                DateTime.Now.AddDays(2), Priority.NORMAL);
 }
Beispiel #5
0
        public void AddCompanyBaseTest()
        {
            Company c = new Company();

            CompanyBase t1 = c.AddToDo(1, "Dummy To Do 1",
                                       "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                       DateTime.Now.AddDays(2), Priority.NORMAL);

            CollectionAssert.AreEquivalent(new CompanyBase[] { t1 }, c.GetCompanyBases());
        }
Beispiel #6
0
        private CompanyBase MapCompany(IDataReader reader, out int personId)
        {
            CompanyBase company       = new CompanyBase();
            int         startingIndex = 0; //startingOrdinal

            personId            = reader.GetSafeInt32(startingIndex++);
            company.Id          = reader.GetSafeInt32(startingIndex++);
            company.Name        = reader.GetSafeString(startingIndex++);
            company.PhoneNumber = reader.GetSafeString(startingIndex++);
            company.Email       = reader.GetSafeString(startingIndex++);

            return(company);
        }
 public CompanyName GetBread(CompanyBase CompName)
 {
     CompanyName vBread = null;
     switch (CompName)
     {
         case CompanyBase.OntheRoad:
             vBread = new OntheRoad();
             break;
         case CompanyBase.SSD:
             vBread = new SSD();
             break;
     }
     return vBread;
 }
Beispiel #8
0
        /// <summary>
        /// Prints the with CR layout.
        /// </summary>
        /// <param name="nomor">The nomor.</param>
        /// <param name="loket">The loket.</param>
        /// <param name="copies">The copies.</param>
        /// <param name="sender">The sender.</param>
        public static void PrintWithCRLayout(string nomor, string loket, int copies, IWin32Window sender)
        {
            using (var f = new QWaitingWidget("Sedang proses mencetak, tunggu sejenak"))
            {
                // show PROGRESS
                f.Show(sender);
                Application.DoEvents();

                // load REPORT FILES
                var crDocument = new ReportDocument();
                crDocument.Load(Application.StartupPath + "/Reports/PrintNomor.Rpt");
                crDocument.DataDefinition.FormulaFields["nomor"].Text =
                    (char)34 + nomor + (char)34;
                crDocument.DataDefinition.FormulaFields["loket"].Text =
                    (char)34 + loket + (char)34;

                // get company profile
                var db = new CompanyBase();
                List<Company> companies = db.GetAll();
                db.Dispose();

                if (companies != null)
                {
                    crDocument.DataDefinition.FormulaFields["companyname"].Text =
                        (char)34 + companies[0].CompanyName + (char)34;
                    crDocument.DataDefinition.FormulaFields["phone"].Text =
                        (char)34 + companies[0].Phone + (char)34;
                    crDocument.DataDefinition.FormulaFields["email"].Text =
                        (char)34 + companies[0].Email + (char)34;
                }

                try
                {
                    // Get Default Printer Name
                    var pname = new StringBuilder(255);
                    int length = 255;
                    Printer.GetDefaultPrinter(pname, ref length);

                    // start PRINTING
                    crDocument.PrintOptions.PrinterName = pname.ToString().Trim();
                    crDocument.PrintToPrinter(copies, false, 1, 1);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, @"Error !",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #9
0
        public void GetCompanyBasesTest()
        {
            Company c = new Company();

            CompanyBase t1 = c.AddToDo(1, "Dummy To Do 1",
                                       "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                       DateTime.Now.AddDays(2), Priority.NORMAL);
            CompanyBase t2 = c.AddToDo(2, "Dummy To Do 2",
                                       "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                       DateTime.Now.AddDays(2), Priority.NORMAL);

            CompanyBase foundCompanyBase = c.GetCompanyBase(2);

            Assert.AreEqual(t2, foundCompanyBase);
        }
Beispiel #10
0
        public void AddCompanyBasesByPriorityTest()
        {
            Company c = new Company();

            // Priority NORMAL
            CompanyBase t1 = c.AddToDo(1, "Dummy To Do 1",
                                       "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                       DateTime.Now.AddDays(2), Priority.NORMAL);

            // Priority HIGH
            CompanyBase t2 = c.AddMeeting(2, "Dummy Meeting 1",
                                          "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                          DateTime.Now.AddDays(2), Priority.HIGH);

            CompanyBase t3 = c.AddMeeting(3, "Dummy Meeting 2",
                                          "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                          DateTime.Now.AddDays(2), Priority.HIGH);

            CollectionAssert.AreEquivalent(new CompanyBase[] { t2, t3 }, c.GetCompanyBasesByPriority(Priority.HIGH));
        }
 /// <summary>
 /// Add common parameters before calling a procedure
 /// </summary>
 /// <param name="cmd">command object, where parameters will be added</param>
 /// <param name="companyObject"></param>
 private void AddCommonParams(SqlCommand cmd, CompanyBase companyObject)
 {
     AddParameter(cmd, pGuid(CompanyBase.Property_CompanyId, companyObject.CompanyId));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_CompanyName, 50, companyObject.CompanyName));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_UserName, 150, companyObject.UserName));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_EmailAdress, 150, companyObject.EmailAdress));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_FirstName, 150, companyObject.FirstName));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_LastName, 150, companyObject.LastName));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_Phone, 50, companyObject.Phone));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_Fax, 50, companyObject.Fax));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_Address, companyObject.Address));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_Street, 500, companyObject.Street));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_City, 50, companyObject.City));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_State, 50, companyObject.State));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_ZipCode, 50, companyObject.ZipCode));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_Website, 50, companyObject.Website));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_CompanyType, 50, companyObject.CompanyType));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_Note, companyObject.Note));
     AddParameter(cmd, pNVarChar(CompanyBase.Property_CompanyLogo, 250, companyObject.CompanyLogo));
 }
        /// <summary>
        /// Updates Company
        /// </summary>
        /// <param name="companyObject">Object to be updated</param>
        /// <returns>Number of rows affected</returns>
        public long Update(CompanyBase companyObject)
        {
            try
            {
                SqlCommand cmd = GetSPCommand(UPDATECOMPANY);

                AddParameter(cmd, pInt32(CompanyBase.Property_Id, companyObject.Id));
                AddCommonParams(cmd, companyObject);

                long result = UpdateRecord(cmd);
                if (result > 0)
                {
                    companyObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
                }
                return(result);
            }
            catch (SqlException x)
            {
                throw new ObjectUpdateException(companyObject, x);
            }
        }
        /// <summary>
        /// Inserts Company
        /// </summary>
        /// <param name="companyObject">Object to be inserted</param>
        /// <returns>Number of rows affected</returns>
        public long Insert(CompanyBase companyObject)
        {
            try
            {
                SqlCommand cmd = GetSPCommand(INSERTCOMPANY);

                AddParameter(cmd, pInt32Out(CompanyBase.Property_Id));
                AddCommonParams(cmd, companyObject);

                long result = InsertRecord(cmd);
                if (result > 0)
                {
                    companyObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
                    companyObject.Id       = (Int32)GetOutParameter(cmd, CompanyBase.Property_Id);
                }
                return(result);
            }
            catch (SqlException x)
            {
                throw new ObjectInsertException(companyObject, x);
            }
        }
Beispiel #14
0
        public void AddCompanyBasesSortedTest()
        {
            Company c = new Company();

            // Priority NORMAL
            CompanyBase t1 = c.AddToDo(1, "Dummy To Do 1",
                                       "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                       DateTime.Now.AddDays(2), Priority.NORMAL);

            // Priority HIGH
            CompanyBase t2 = c.AddMeeting(2, "Dummy Meeting 1",
                                          "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                          DateTime.Now.AddDays(1), Priority.HIGH);

            CompanyBase t3 = c.AddMeeting(3, "A",
                                          "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                          DateTime.Now.AddDays(2), Priority.HIGH);

            CompanyBase t4 = c.AddMeeting(4, "Dummy Meeting 3",
                                          "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                          DateTime.Now.AddDays(4), Priority.HIGH);

            CompanyBase t5 = c.AddMeeting(5, "Z",
                                          "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.",
                                          DateTime.Now.AddDays(2), Priority.HIGH);

            // Take all tasks by Priority
            CollectionAssert.AreEquivalent(new CompanyBase[] { t2, t3, t4, t5 }, c.GetCompanyBasesSorted(Priority.HIGH));

            // Are they sorted
            int[] expectedIDs = { 2, 3, 5, 4 };
            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(expectedIDs[i], c.GetCompanyBasesSorted(Priority.HIGH)[i].Id);
            }
        }
Beispiel #15
0
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            Company obj;
            try
            {
                obj =
                    new Company
                        {
                            CompanyName = txtCompanyName.Text.Trim(),
                            Address = txtCompanyAddress.Text.Trim(),
                            City = txtCompanyCity.Text.Trim(),
                            Phone = txtCompanyPhone.Text.Trim(),
                            Fax = txtCompanyFax.Text.Trim(),
                            Email = txtCompanyEmail.Text.Trim(),
                            Url = txtCompanyUrl.Text.Trim()
                        };
            }
            catch (ArgumentNullException ex)
            {
                MessageBox.Show(ex.Message,
                                @"Warning!",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            if ((Confirm("Are you sure to update your company profile?") == DialogResult.Yes))
            {
                DialogResult dlg;
                using (var f = new LogonPresentation())
                {
                    dlg = f.ShowDialog(this);
                }

                if (dlg == DialogResult.OK)
                {
                    // --- TRUNCATE
                    var companyDao = new CompanyBase();
                    companyDao.Truncate();

                    // --- SAVE
                    if (companyDao.Save(obj) == 1)
                    {
                        Close();
                        Dispose();
                    }
                }
            }
        }
Beispiel #16
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        private void Initialize()
        {
            IDataAccess<Company> db = new CompanyBase();
            List<Company> companies = db.GetAll();

            if (companies.Count == 0) return;
            try
            {
                txtCompanyName.Text = companies[0].CompanyName;
                txtCompanyAddress.Text = companies[0].Address;
                txtCompanyCity.Text = companies[0].City;
                txtCompanyPhone.Text = companies[0].Phone;
                txtCompanyFax.Text = companies[0].Fax;
                txtCompanyEmail.Text = companies[0].Email;
                txtCompanyUrl.Text = companies[0].Url;
            }
            catch (NullReferenceException)
            {
            }
        }
        /// <summary>
        /// Fills Company object
        /// </summary>
        /// <param name="companyObject">The object to be filled</param>
        /// <param name="reader">The reader to use to fill a single object</param>
        /// <param name="start">The ordinal position from which to start reading the reader</param>
        protected void FillObject(CompanyBase companyObject, SqlDataReader reader, int start)
        {
            companyObject.Id        = reader.GetInt32(start + 0);
            companyObject.CompanyId = reader.GetGuid(start + 1);
            if (!reader.IsDBNull(2))
            {
                companyObject.CompanyName = reader.GetString(start + 2);
            }
            if (!reader.IsDBNull(3))
            {
                companyObject.UserName = reader.GetString(start + 3);
            }
            if (!reader.IsDBNull(4))
            {
                companyObject.EmailAdress = reader.GetString(start + 4);
            }
            if (!reader.IsDBNull(5))
            {
                companyObject.FirstName = reader.GetString(start + 5);
            }
            if (!reader.IsDBNull(6))
            {
                companyObject.LastName = reader.GetString(start + 6);
            }
            if (!reader.IsDBNull(7))
            {
                companyObject.Phone = reader.GetString(start + 7);
            }
            if (!reader.IsDBNull(8))
            {
                companyObject.Fax = reader.GetString(start + 8);
            }
            if (!reader.IsDBNull(9))
            {
                companyObject.Address = reader.GetString(start + 9);
            }
            if (!reader.IsDBNull(10))
            {
                companyObject.Street = reader.GetString(start + 10);
            }
            if (!reader.IsDBNull(11))
            {
                companyObject.City = reader.GetString(start + 11);
            }
            if (!reader.IsDBNull(12))
            {
                companyObject.State = reader.GetString(start + 12);
            }
            if (!reader.IsDBNull(13))
            {
                companyObject.ZipCode = reader.GetString(start + 13);
            }
            if (!reader.IsDBNull(14))
            {
                companyObject.Website = reader.GetString(start + 14);
            }
            if (!reader.IsDBNull(15))
            {
                companyObject.CompanyType = reader.GetString(start + 15);
            }
            if (!reader.IsDBNull(16))
            {
                companyObject.Note = reader.GetString(start + 16);
            }
            if (!reader.IsDBNull(17))
            {
                companyObject.CompanyLogo = reader.GetString(start + 17);
            }
            FillBaseObject(companyObject, reader, (start + 18));


            companyObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow;
        }
 /// <summary>
 /// Fills Company object
 /// </summary>
 /// <param name="companyObject">The object to be filled</param>
 /// <param name="reader">The reader to use to fill a single object</param>
 protected void FillObject(CompanyBase companyObject, SqlDataReader reader)
 {
     FillObject(companyObject, reader, 0);
 }
Beispiel #19
0
        public Person PublicSelect(int id)
        {
            Person person = null;
            List <MilitaryBase>   mbList = null;
            List <PersonLanguage> laList = null;
            List <Skill>          skList = null;


            DataProvider.ExecuteCmd(GetConnection, "dbo.Person_SelectById",
                                    inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@Id", id);
            }
                                    , map : delegate(IDataReader reader, short set)
            {
                switch (set)
                {
                case 0:
                    person = MapPerson(reader);
                    break;

                case 1:
                    int personId    = 0;
                    MilitaryBase mb = MapMilitaryBaseList(reader, out personId);
                    if (mbList == null)
                    {
                        mbList = new List <MilitaryBase>();
                    }
                    mbList.Add(mb);
                    break;

                case 2:
                    PersonLanguage la = MapLanguageList(reader, out personId);
                    if (laList == null)
                    {
                        laList = new List <PersonLanguage>();
                    }
                    laList.Add(la);
                    break;

                case 3:
                    Skill sk = MapSkillList(reader, out personId);
                    if (skList == null)
                    {
                        skList = new List <Skill>();
                    }
                    skList.Add(sk);
                    break;

                case 4:
                    CompanyBase cb = MapCompany(reader, out personId);
                    if (person.Companies == null)
                    {
                        person.Companies = new List <CompanyBase>();
                    }
                    person.Companies.Add(cb);
                    break;

                case 5:
                    SquadBase sq = MapSquad(reader, out personId);
                    if (person.Squads == null)
                    {
                        person.Squads = new List <SquadBase>();
                    }
                    person.Squads.Add(sq);
                    break;

                case 6:
                    PersonNotificationPreference pnp = PreferenceMap(reader, out personId);
                    if (person.Preferences == null)
                    {
                        person.Preferences = new List <PersonNotificationPreference>();
                    }
                    person.Preferences.Add(pnp);
                    break;
                }
            }
                                    );
            person.MilitaryBases = mbList;
            person.Languages     = laList;
            person.Skills        = skList;
            return(person);
        }
Beispiel #20
0
        /// <summary>
        /// Prints the with ESC.
        /// </summary>
        /// <param name="nomor">The nomor.</param>
        /// <param name="loket">The loket.</param>
        /// <param name="copies">The copies.</param>
        /// <param name="sender">The sender.</param>
        public static void PrintWithESC(string nomor, string loket, int copies, IWin32Window sender)
        {
            using (var f = new QWaitingWidget("Sedang proses mencetak, silahkan tunggu !"))
            {
                f.Show(sender);
                Application.DoEvents();

                // get company profile
                var db = new CompanyBase();
                List<Company> companies = db.GetAll();
                db.Dispose();

                var pr = new StringBuilder();

                pr.Append(DirectPrint.InitializePrinter());
                pr.Append(DirectPrint.PrintCenterText() + "SELAMAT DATANG");

                if (companies != null && companies.Count > 0)
                {
                    pr.Append(DirectPrint.FeedPaper(1) +
                              DirectPrint.PrintCenterText() + companies[0].CompanyName);
                }

                pr.Append(DirectPrint.FeedPaper(1));
                pr.Append(DirectPrint.Bold(true));
                pr.Append(DirectPrint.Strong(Settings.Default.StrongSize));
                pr.Append(DirectPrint.FeedPaper(1) + DirectPrint.PrintCenterText() + nomor);
                pr.Append(DirectPrint.Strong(0));
                pr.Append(DirectPrint.Bold(false));
                pr.Append(DirectPrint.FeedPaper(1) + DirectPrint.PrintCenterText() + loket);
                pr.Append(DirectPrint.FeedPaper(2) +
                          DirectPrint.PrintCenterText() + DateTime.Now.ToString("dddd, dd-MM-yyyy"));
                pr.Append("  -  " + DateTime.Now.ToString("HH:mm:ss"));
                pr.Append(DirectPrint.FeedPaper(1) +
                          DirectPrint.PrintCenterText() + "SILAHKAN TUNGGU, TERIMA KASIH");

                pr.Append(DirectPrint.FeedPaper(8));

                if (Settings.Default.AutoCutter)
                {
                    pr.Append(DirectPrint.CutPaper());
                }

                try
                {
                    var pname = new StringBuilder(255);
                    int length = 255;

                    // get default printer name
                    Printer.GetDefaultPrinter(pname, ref length);

                    // loop print by copies
                    for (int i = 1; i <= copies; i++)
                        RawPrinterHelper.SendStringToPrinter(pname.ToString().Trim(), pr.ToString().Trim());

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, @"Error !",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
 public BuildingDto(string name, bool ownedByMy, CompanyBase company)
 {
     Name      = name;
     OwnedByMy = ownedByMy;
     Company   = company;
 }
Beispiel #22
0
 static void Main(string[] args)
 {
     CompanyBase b = new CompanyBase();
     b.CreateNew();
     Console.ReadLine();
 }
Beispiel #23
0
 /// <summary>
 /// Sets the company.
 /// </summary>
 /// <param name="stateInfo">The state info.</param>
 private void SetCompany(object stateInfo)
 {
     try
     {
         if (lblCompanyName.InvokeRequired)
         {
             var o = new DelegateTimer(SetCompany);
             lblCompanyName.Invoke(o, stateInfo);
         }
         else
         {
             List<Company> cmp = new CompanyBase().GetAll();
             if (cmp != null)
             {
                 lblCompanyName.Text = cmp[0].CompanyName;
                 lblCompanyDescription.Text =
                     string.Format("{0} {1}\r\nPhone: {2} Fax: {3}\r\nEmail: {4} ",
                                   cmp[0].Address, cmp[0].City, cmp[0].Phone,
                                   cmp[0].Fax, cmp[0].Email);
             }
         }
     }
     catch (Exception)
     {
     }
 }