Add() public méthode

public Add ( item ) : void
Résultat void
        private static void Main()
        {
            // LinkedList<string> -sasto moje zaradi polimorfizma
            IEnumerable<string> list = new LinkedList<string>(
                "1st element",
                new LinkedList<string>("2nd element", new LinkedList<string>("3rd element")));

            foreach (var item in list)
            {
                Console.WriteLine(item);
            }

            // ot metoda v LinkedList
            var enumerator = list.GetEnumerator();

            // pak se vliza v sastiat method, v koito i otogore vlizahme, defakto dolnite redove zamestvat foreacha
            while (enumerator.MoveNext())
            {
                Console.WriteLine(enumerator.Current);
            }

            // enumerator.Reset();
            var nums = new CustomList<int>();
            nums.Add(5);
            nums.Add(2);
            nums.Add(4);
            nums.Add(2);
            nums.Add(1);
            foreach (var num in nums)
            {
                Console.WriteLine(num);
            }
        }
        static void Main()
        {
            var list = new CustomList<int>();

            list.Add(-2);
            list.Add(12);
            list.Add(21);
            list.Add(33);

            Console.WriteLine(list.IndexOf(-2));
            Console.WriteLine(list.IndexOf(12));
            Console.WriteLine(list.IndexOf(21));
            Console.WriteLine(list.IndexOf(-22));
            Console.WriteLine(list);

            list.Remove(12);
            Console.WriteLine(list);

            list.Add(5);
            Console.WriteLine(list);

            Console.WriteLine(list.Min());
            Console.WriteLine(list.Max());

            list[0] = 120;
            Console.WriteLine(list);

            Console.WriteLine(list[3]);
        }
Exemple #3
0
    static void Main()
    {
        var doubleList = new CustomList<double>();

        doubleList.Add(5.5);
        doubleList.Add(6.9);
        doubleList.Add(6.4);
        doubleList.Add(6.7);
        doubleList.Add(5.6);

        int count = doubleList.Count;
        double max = doubleList.Max();
        double min = doubleList.Min();

        Console.WriteLine(doubleList);
        Console.WriteLine("Max: {0}; Min: {1}; Count: {2}", max, min, count);

        doubleList.Remove(6.4);
        doubleList.Remove(5.5);
        doubleList.RemoveAt(1);

        count = doubleList.Count;
        max = doubleList.Max();
        min = doubleList.Min();

        Console.WriteLine(doubleList);
        Console.WriteLine("Max: {0}; Min: {1} Count: {2}", max, min, count);

        doubleList.Clear();
        bool isEmpty = doubleList.isEmpty;
        Console.WriteLine(isEmpty);
        Console.WriteLine(doubleList);

        var stringList = new CustomList<string>();

        stringList.Add("Kircho");
        stringList.Add("Jecho");
        stringList.Add("Mecho");
        stringList.Add("Vulcho");

        bool jecho = stringList.Contais("Jecho");
        bool nencho = stringList.Contais("Nencho");

        string who = stringList.ElementOf(0);
        int index = stringList.IndexOf("Vulcho");
        string maxString = stringList.Max();

        Console.WriteLine(stringList);
        Console.WriteLine("jecho: {0} \nnencho: {1} \nElement of 0 index: {2} \nIndex of Vulcho: {3} \nMax: {4}"
            , jecho, nencho,who, index, maxString);

        string indexer = stringList[3];
        Console.WriteLine(indexer);
    }
Exemple #4
0
        static void Main()
        {
            //Displaying program version
            var versionAttribute = typeof (CustomList<>).GetCustomAttributes(typeof (VersionAttribute), true);
            Console.WriteLine("Program version: {0}v\n", versionAttribute[0]);

            ComputerParts cpu = new ComputerParts("AMD Athlon II X3 3.20 Ghz", 90m);
            ComputerParts ram = new ComputerParts("Kingston HyperX 4x2 GB", 130m);
            ComputerParts motherboard = new ComputerParts("Asrock PRO X3", 50m);
            ComputerParts dvd = new ComputerParts("DVD-ROM LG DH18NS60", 21m);
            ComputerParts hdd = new ComputerParts("Samsung SSD 256 GB", 110m);
            
            CustomList<ComputerParts> parts = new CustomList<ComputerParts>();

            //Adding elements
            parts.Add(cpu);
            parts.Add(ram);
            parts.Add(motherboard);
            parts.Add(dvd);
            Console.WriteLine(parts);
            Console.WriteLine();

            //Accessing element by index
            Console.WriteLine(parts[2]);
            Console.WriteLine();
            
            //Removing element
            parts.Remove(3);
            Console.WriteLine(parts);
            Console.WriteLine();

            //Insert element
            parts.Insert(hdd, 2);
            Console.WriteLine(parts);
            Console.WriteLine();

            //Find element index by value
            Console.WriteLine("Motherboard index is {0}", parts.IndexOf(motherboard));
            Console.WriteLine();

            //Check if the list contains a value
            Console.WriteLine("Does the list contains HDD ? - {0}", parts.Contains(hdd));
            Console.WriteLine();

            //Cheking the minimum and maximum part by price
            Console.WriteLine("The cheapest part is: {0}", parts.Min());
            Console.WriteLine("The most expensive part is: {0}", parts.Max());
            Console.WriteLine();
            
            //Now we delete all the elements in the list
            parts.Clear();
            Console.WriteLine("We have a brand new list now :) {0}", parts);
        }
        public static CustomList<ParameterFilterValue> GetReportValue(string parent)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            CustomList<ParameterFilterValue> ParameterFilterValueCollection = new CustomList<ParameterFilterValue>();
            IDataReader reader = null;
            String sql = "select OrgKey As ActualValues, OrgName As DisplayMember, OrgName As [Values]  from Gen_Org Where OrgParentKey in(" + parent + ")";//'" + userCode + "'";
            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    ParameterFilterValue newParameterFilterValue = new ParameterFilterValue();
                    newParameterFilterValue.SetData(reader);
                    ParameterFilterValueCollection.Add(newParameterFilterValue);
                }
                return ParameterFilterValueCollection;
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (conManager != null)
                {
                    conManager.CloseConnection();
                    conManager.Dispose();
                }

                if (reader != null && !reader.IsClosed)
                    reader.Close();
            }
        }
 public static CustomList<CmnBankAccountType> GetAllCmnBankAccountType()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<CmnBankAccountType> CmnBankAccountTypeCollection = new CustomList<CmnBankAccountType>();
     IDataReader reader = null;
     const String sql = "select * from CmnBankAccountType";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             CmnBankAccountType newCmnBankAccountType = new CmnBankAccountType();
             newCmnBankAccountType.SetData(reader);
             CmnBankAccountTypeCollection.Add(newCmnBankAccountType);
         }
         return CmnBankAccountTypeCollection;
     }
     catch(Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #7
0
 public static CustomList<SegmentNames> GetAllSegmentNames()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<SegmentNames> SegmentNamesCollection = new CustomList<SegmentNames>();
     IDataReader reader = null;
     const String sql = "select *from SegmentNames";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             SegmentNames newSegmentNames = new SegmentNames();
             newSegmentNames.SetData(reader);
             SegmentNamesCollection.Add(newSegmentNames);
         }
         return SegmentNamesCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
 public static CustomList<HousekeepingHierarchy> GetAllHousekeepingHierarchy(Int32 hKID)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<HousekeepingHierarchy> HousekeepingHierarchyCollection = new CustomList<HousekeepingHierarchy>();
     IDataReader reader = null;
     String sql = "select *from HousekeepingHierarchy where HKID=" + hKID;
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             HousekeepingHierarchy newHousekeepingHierarchy = new HousekeepingHierarchy();
             newHousekeepingHierarchy.SetData(reader);
             HousekeepingHierarchyCollection.Add(newHousekeepingHierarchy);
         }
         return HousekeepingHierarchyCollection;
     }
     catch(Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #9
0
 public static CustomList<Configuration> GetAllConfiguration()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
     CustomList<Configuration> ConfigurationCollection = new CustomList<Configuration>();
     const String sql = "Select *from tblConfiguration";
     IDataReader reader = null; ;
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             Configuration newConfiguration = new Configuration();
             newConfiguration.SetData(reader);
             ConfigurationCollection.Add(newConfiguration);
         }
         reader.Close();
         ConfigurationCollection.SelectSpName = "spSelectConfiguration";
         ConfigurationCollection.InsertSpName = "spInsertConfiguration";
         ConfigurationCollection.UpdateSpName = "spUpdateConfiguration";
         ConfigurationCollection.SelectSpName = "spDeleteConfiguration";
         return ConfigurationCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #10
0
 public static CustomList<UserGroupList> GetAllUserGroupWithUserCode(string userCode)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
     CustomList<UserGroupList> UserGroupListCollection = new CustomList<UserGroupList>();
     String sql = "Exec spUserGroupList'" + userCode + "'";
     IDataReader reader = null;
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             UserGroupList newUserGroup = new UserGroupList();
             newUserGroup.SetData(reader);
             UserGroupListCollection.Add(newUserGroup);
         }
         reader.Close();
         return UserGroupListCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
        public static void Main()
        {
            var list = new CustomList<int>();

            list.Add(0);
            list.Add(5);
            list.Add(-1);
            list.Add(101);

            Console.WriteLine(list.Max());
            Console.WriteLine(list.Min());

            Console.WriteLine(list[0]);
            Console.WriteLine(list[1]);
            Console.WriteLine(string.Join(", ", list));
        }
Exemple #12
0
        static void Main(string[] args)
        {
            CustomList<int> list = new CustomList<int>(3);
            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);
            list.Insert(1, 40);
            Console.WriteLine(list.Count);
            Console.WriteLine(list);

            System.Reflection.MemberInfo info = typeof(CustomList<>);
            foreach (object attribute in info.GetCustomAttributes(false))
            {
                Console.WriteLine(attribute);
            }
        }
Exemple #13
0
        private static void Main(string[] args)
        {
            var list = new CustomList<string>();

            for (int i = 0; i < 100; i++)
            {
                var item = new CustomListItem<string>();
                item.Value = String.Concat("Item #", i);
                list.Add(item);
            }

            list.Reverse();
        }
Exemple #14
0
        static void Main(string[] args)
        {
            CustomList<int> list = new CustomList<int>(4);

            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);
            list.Add(5);
            list.Add(6);
            list.Add(7);
            list.Add(8);
            Console.WriteLine(list.Max());
            Console.WriteLine(list.Min());
        }
Exemple #15
0
        public static void PublicListPermissionTest()
        {
            var expected = new CustomList(dataStorage, userInfo, ListPermission.PUBLIC, TestListName);

            expected.Add(TestListItem);

            Manage(new[] { "-cp", TestListName });

            var differentUserInfo = new UserInfo(userInfo.Id + 1, userInfo.RoleIds);

            Assert.DoesNotThrow(
                () => listManager.Manage(differentUserInfo, new[] { "-a", TestListItem, TestListName })
                );

            var actual = listManager.GetList(TestListName);

            Assert.AreEqual(expected, actual);
        }
Exemple #16
0
        public void GrowArray_ExceedLaterCapacity_CapacityDoubles()
        {
            // arrange
            CustomList <int> testList = new CustomList <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8
            };
            int expected = 16;
            int actual;

            // act
            testList.Add(9);

            actual = testList.Capacity;

            // assert
            Assert.AreEqual(expected, actual);
        }
Exemple #17
0
        public void Combine_combineTwoList_Addiition()
        {
            // arrange
            CustomList <int> testList  = new CustomList <int>();
            CustomList <int> testList2 = new CustomList <int>();
            int expected = 237;
            int actual;

            // act
            testList.Add(234);
            testList2.Add(237);
            CustomList <int> NewList = testList + testList2;

            actual = NewList[1];

            // assert
            Assert.AreEqual(expected, actual);
        }
Exemple #18
0
        public void AdditionOverload_OneItemAndEmptyList_ShouldEqualOneItemList()
        {
            // Arrange
            CustomList <int> left = new CustomList <int>();

            left.Add(1);
            CustomList <int> right = new CustomList <int>();

            // Act
            CustomList <int> temp = new CustomList <int>();

            temp.Add(1);
            string expected = temp.ToString();
            string actual   = (left + right).ToString();

            // Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #19
0
        public void Remove_RemoveFromList_VerifyRemoveAtIndex()
        {
            //Arrange
            CustomList <int> expectedlList = new CustomList <int>();
            CustomList <int> actualList    = new CustomList <int>();
            int expected;
            int actual;

            //Act
            expectedlList.Add(1);
            actualList.Add(1);
            actualList.Add(1);
            actualList.Remove(1);
            expected = expectedlList.Count;
            actual   = actualList.Count;
            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void AddMethod_Add1ThroughyIs500_CapacityIs512()  // FIX- Capacity should double
        {
            //  Arrange
            CustomList <int> customList = new CustomList <int>();

            int expected = 512;
            int actual;

            //  Act
            for (int i = 1; i <= 500; i++)
            {
                customList.Add(i);
            }
            actual = customList.Capacity;

            //  Assert
            Assert.AreEqual(expected, actual);
        }
        public void SubtractionOperator_AllInstanceRemovedFromList()
        {
            CustomList <int> customList  = new CustomList <int>();
            CustomList <int> customList1 = new CustomList <int>();

            customList.Add(1);
            customList.Add(2);
            customList.Add(3);
            customList.Add(2);
            customList1.Add(2);
            int actual;
            int expected = 3;

            customList = customList - customList1;
            actual     = customList[1];

            Assert.AreEqual(expected, actual);
        }
Exemple #22
0
        private static void ImplementCommand(CustomList <string> customList, string[] tokens, string command)
        {
            switch (command)
            {
            case "Add":
                customList.Add(tokens[1]);
                break;

            case "Remove":
                customList.Remove(int.Parse(tokens[1]));
                break;

            case "Contains":
                Console.WriteLine(customList.Contains(tokens[1]));
                break;

            case "Swap":
                customList.Swap(int.Parse(tokens[1]), int.Parse(tokens[2]));
                break;

            case "Greater":
                Console.WriteLine(customList.CountGreaterThan(tokens[1]));
                break;

            case "Max":
                Console.WriteLine(customList.Max());
                break;

            case "Min":
                Console.WriteLine(customList.Min());
                break;

            case "Sort":
                customList.Sort();
                break;

            case "Print":
                foreach (var item in customList)
                {
                    Console.WriteLine(item);
                }
                break;
            }
        }
Exemple #23
0
        static void Main(string[] args)
        {
            CustomList<int> sample = new CustomList<int>();
            sample.Add(1);
            sample.Add(0);
            sample.Add(-3);
            sample.Add(-12);
            sample.Add(-2);
            sample.Add(100);
            sample.Add(-1);
            sample.Add(1);
            sample.Add(-1);

            Console.WriteLine("Befoure we remove negative elements:");
            for (int index = 0; index < sample.Count; index++)
            {
                Console.Write(sample[index]);
                if (index != sample.Count - 1)
                {
                    Console.Write(',');
                }
            }
            Console.WriteLine();
            sample.RemoveNegativeElements();

            Console.WriteLine("After we removed negative elements:");
            for (int index = 0; index < sample.Count; index++)
            {
                Console.Write(sample[index]);
                if (index != sample.Count - 1)
                {
                    Console.Write(',');
                }
            }
            Console.WriteLine();
        }
        static void Main(string[] args)
        {
            CustomList<int> list = new CustomList<int>();
            list.Add(5);
            list.Add(-55555);
            list.Add(1000);
            list.Add(55481000);
            list.Add(5);
            list.Add(1000);
            Console.WriteLine(list.Min);
            list.Remove(1000);
            list[1] = 50;

            Console.WriteLine(list);
        }
Exemple #25
0
 public static CustomList<LatestNews> GetAllLatestNewsForDisplay()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<LatestNews> LatestNewsCollection = new CustomList<LatestNews>();
     IDataReader reader = null;
     String sql = "Exec GetLatestNews";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             LatestNews newLatestNews = new LatestNews();
             newLatestNews.NewsDetails = reader.GetString("NewsDetails");
             LatestNewsCollection.Add(newLatestNews);
         }
         return LatestNewsCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #26
0
 public static CustomList<StockView> StockView1()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<StockView> StockViewCollection = new CustomList<StockView>();
     IDataReader reader = null;
     String sql = "EXEC spGetStockView";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             StockView newStockView = new StockView();
             newStockView.SetData(reader);
             StockViewCollection.Add(newStockView);
         }
         return StockViewCollection;
     }
     catch(Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
 public static CustomList<ContactTypeChild> GetAllContactTypeChild()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<ContactTypeChild> ContactTypeChildCollection = new CustomList<ContactTypeChild>();
     IDataReader reader = null;
     const String sql = "select *from ContactTypeChild";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             ContactTypeChild newContactTypeChild = new ContactTypeChild();
             newContactTypeChild.SetData(reader);
             ContactTypeChildCollection.Add(newContactTypeChild);
         }
         ContactTypeChildCollection.InsertSpName = "spInsertContactTypeChild";
         ContactTypeChildCollection.UpdateSpName = "spUpdateContactTypeChild";
         ContactTypeChildCollection.DeleteSpName = "spDeleteContactTypeChild";
         return ContactTypeChildCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
 public static CustomList<AccReportConfigurationHead> GetAllAccReportConfigurationHead(Int32 ReportTypeID)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<AccReportConfigurationHead> AccReportConfigurationHeadCollection = new CustomList<AccReportConfigurationHead>();
     IDataReader reader = null;
     String sql = "Exec spGetHeadCategoryMap "+ReportTypeID;
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             AccReportConfigurationHead newAccReportConfigurationHead = new AccReportConfigurationHead();
             newAccReportConfigurationHead.SetData(reader);
             AccReportConfigurationHeadCollection.Add(newAccReportConfigurationHead);
         }
         return AccReportConfigurationHeadCollection;
     }
     catch(Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #29
0
 public static CustomList<ItemMaster> GetAllItemMasterByItemCode(String itemCode)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<ItemMaster> ItemMasterCollection = new CustomList<ItemMaster>();
     IDataReader reader = null;
     String sql = "select *from ItemMaster Where ItemCode='"+itemCode+"'";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             ItemMaster newItemMaster = new ItemMaster();
             newItemMaster.SetData(reader);
             ItemMasterCollection.Add(newItemMaster);
         }
         return ItemMasterCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #30
0
 public static CustomList<ItemMaster> FindAllItemMasterGroupWise()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<ItemMaster> ItemMasterCollection = new CustomList<ItemMaster>();
     IDataReader reader = null;
     String sql = "select ItemCode,ItemDescription,ItemGroupID,ItemSubGroupID from ItemMaster";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             ItemMaster newItemMaster = new ItemMaster();
             newItemMaster.SetDataItem(reader);
             ItemMasterCollection.Add(newItemMaster);
         }
         return ItemMasterCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #31
0
 public static CustomList<ItemStructure> GetAllItemStructure(Int32 itemGroupID)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<ItemStructure> ItemStructureCollection = new CustomList<ItemStructure>();
     IDataReader reader = null;
     String sql = "select *from ItemStructure Where GroupItemID=" + itemGroupID;
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             ItemStructure newItemStructure = new ItemStructure();
             newItemStructure.SetData(reader);
             ItemStructureCollection.Add(newItemStructure);
         }
         return ItemStructureCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #32
0
        public static CustomList<ReportSuiteMenu> GetReportSuiteMenu()
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            CustomList<ReportSuiteMenu> ReportSuiteMenuCollection = new CustomList<ReportSuiteMenu>();
            IDataReader reader = null;
            String sql = "EXEC spGetUserWiseProfileReport";
            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    ReportSuiteMenu newReportSuiteMenu = new ReportSuiteMenu();
                    newReportSuiteMenu.SetData(reader);
                    ReportSuiteMenuCollection.Add(newReportSuiteMenu);
                }
                return ReportSuiteMenuCollection;
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (conManager != null)
                {
                    conManager.CloseConnection();
                    conManager.Dispose();
                }

                if (reader != null && !reader.IsClosed)
                    reader.Close();
            }
        }
Exemple #33
0
        public static CustomList<ReportSuiteMenu> GetReportList()
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            CustomList<ReportSuiteMenu> ReportSuiteMenuCollection = new CustomList<ReportSuiteMenu>();
            IDataReader reader = null;
            String sql = "EXEC spGetReportList";
            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    ReportSuiteMenu newReportSuiteMenu = new ReportSuiteMenu();
                    newReportSuiteMenu.REPORTID = reader.GetInt32("REPORTID");
                    newReportSuiteMenu.NODE_TEXT = reader.GetString("NODE_TEXT");
                    ReportSuiteMenuCollection.Add(newReportSuiteMenu);
                }
                return ReportSuiteMenuCollection;
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (conManager != null)
                {
                    conManager.CloseConnection();
                    conManager.Dispose();
                }

                if (reader != null && !reader.IsClosed)
                    reader.Close();
            }
        }
Exemple #34
0
 public static CustomList<GroupRule> GetAllGroupSecurityRule(string groupCode)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan);
     CustomList<GroupRule> GroupSecurityRuleCollection = new CustomList<GroupRule>();
     String sql = "Select  *from GroupRule where GroupCode='" + groupCode + "'";
     IDataReader reader = null;
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             GroupRule newGroupSecurityRule = new GroupRule();
             newGroupSecurityRule.SetData(reader);
             GroupSecurityRuleCollection.Add(newGroupSecurityRule);
         }
         reader.Close();
         GroupSecurityRuleCollection.InsertSpName = "spInsertGroupRule";
         GroupSecurityRuleCollection.SelectSpName = "spDeleteGroupRule";
         return GroupSecurityRuleCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #35
0
 public static CustomList<CmnBankAccount> GetAllCmnBankAccount()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<CmnBankAccount> CmnBankAccountCollection = new CustomList<CmnBankAccount>();
     IDataReader reader = null;
     String sql = "spFindBankAccount";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             CmnBankAccount newCmnBankAccount = new CmnBankAccount();
             newCmnBankAccount.SetData(reader);
             CmnBankAccountCollection.Add(newCmnBankAccount);
         }
         return CmnBankAccountCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #36
0
 public static CustomList<LatestNews> GetAllLatestNews()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<LatestNews> LatestNewsCollection = new CustomList<LatestNews>();
     IDataReader reader = null;
     const String sql = "select *from LatestNews";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             LatestNews newLatestNews = new LatestNews();
             newLatestNews.SetData(reader);
             LatestNewsCollection.Add(newLatestNews);
         }
         LatestNewsCollection.InsertSpName = "spInsertLatestNews";
         LatestNewsCollection.UpdateSpName = "spUpdateLatestNews";
         LatestNewsCollection.DeleteSpName = "spDeleteLatestNews";
         return LatestNewsCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
 public static CustomList<CmnDocListTableMapping> GetAllCmnTransactionReferenceFind()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<CmnDocListTableMapping> CmnTransRefCollection = new CustomList<CmnDocListTableMapping>();
     IDataReader reader = null;
     String sql = "EXEC spFindDocListTableMaping";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             CmnDocListTableMapping newCmnTransactionReference = new CmnDocListTableMapping();
             newCmnTransactionReference.SetData(reader);
             CmnTransRefCollection.Add(newCmnTransactionReference);
         }
         return CmnTransRefCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Exemple #38
0
 public static CustomList<ItemMaster> FindAllItemMaster()
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<ItemMaster> ItemMasterCollection = new CustomList<ItemMaster>();
     IDataReader reader = null;
     const String sql = "spFindItem";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             ItemMaster newItemMaster = new ItemMaster();
             newItemMaster.SetDataFindItem(reader);
             ItemMasterCollection.Add(newItemMaster);
         }
         return ItemMasterCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }