public void SaveEntity(ref CustomList<EntityList> EntityList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); ReSetSPName(EntityList); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, EntityList); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
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(); } }
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); } }
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(); } }
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<PopulateDropdownList> GetAllReferenceTransaction(Int32 DocListID,Int32 RefType) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList<PopulateDropdownList> CmnTransactionCollection = new CustomList<PopulateDropdownList>(); IDataReader reader = null; String sql = "spGetReferenceMasterTableData " + DocListID+","+RefType; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { PopulateDropdownList newCmnTransaction = new PopulateDropdownList(); newCmnTransaction.SetData(reader); CmnTransactionCollection.Add(newCmnTransaction); } return CmnTransactionCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }
public void DeleteSecurityRule(ref CustomList<RuleDetails> objSecurityRuleDetailList, ref CustomList<SecurityRule> securityRuleList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); Boolean blnTranStarted = false; try { ReSetSPNameForDelete(securityRuleList, objSecurityRuleDetailList); conManager.BeginTransaction(); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, objSecurityRuleDetailList, securityRuleList); objSecurityRuleDetailList.AcceptChanges(); securityRuleList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception ex) { conManager.RollBack(); throw (ex); } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
public void DeleteVoucher(ref CustomList<Acc_VoucherDet> VoucherDetList, ref CustomList<Acc_Voucher> VoucherList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { ReSetSPName(ref VoucherList, ref VoucherDetList); conManager.BeginTransaction(); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, VoucherDetList, VoucherList); conManager.CommitTransaction(); VoucherDetList.AcceptChanges(); VoucherList.AcceptChanges(); } catch (Exception ex) { conManager.RollBack(); throw (ex); } finally { if (conManager.IsNotNull()) { blnTranStarted = false; conManager.Dispose(); } } }
public void deleteWrokFlow(ref CustomList<CmnWorkFlowMaster> lstCmnWorkFlowMaster, ref CustomList<CmnWorkFlowDetail> lstCmnWorkFlowDetail) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); lstCmnWorkFlowDetail.DeleteSpName = "spDeleteCmnWorkFlowDetail"; lstCmnWorkFlowMaster.DeleteSpName = "spDeleteCmnWorkFlowMaster"; blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstCmnWorkFlowDetail, lstCmnWorkFlowMaster); conManager.CommitTransaction(); blnTranStarted = false; } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
public void SaveCmnDocListTableMapping(ref CustomList<CmnDocListTableMapping> CmnDocListTableMappingList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); ReSetSPName(CmnDocListTableMappingList); Int64 TransactionTypeKey = CmnDocListTableMappingList[0].DocListTableMappingID; blnTranStarted = true; if (CmnDocListTableMappingList[0].IsAdded) TransactionTypeKey = Convert.ToInt64(conManager.InsertData(blnTranStarted, CmnDocListTableMappingList)); else conManager.SaveDataCollectionThroughCollection(blnTranStarted, CmnDocListTableMappingList); CmnDocListTableMappingList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
public void SaveUserProfile(ref CustomList<UserProfile> UserProfileList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); ReSetSPName(UserProfileList); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, UserProfileList); UserProfileList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
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(); } }
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 void Update(CustomList<BaseItem> itemList, Util.OperationType operationType) { String spName = String.Empty; switch (operationType) { case Util.OperationType.Insert: spName = itemList.InsertSpName; break; case Util.OperationType.Update: spName = itemList.UpdateSpName; break; case Util.OperationType.Delete: spName = itemList.DeleteSpName; break; } Object[] parameterValues = null; foreach (BaseItem item in itemList) { parameterValues = item.GetParameterValues(); if (parameterValues.IsNotNull()) { DataAccessHelper.ExecuteNonQueryProcedure(transaction, spName, parameterValues); } } }
public void DeleteHKEntry(ref CustomList<HouseKeepingValue> HKList, ref CustomList<HousekeepingHierarchy> lstChild) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); ReSetSPName(HKList, lstChild); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstChild, HKList); lstChild.AcceptChanges(); HKList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
public void DeleteTempData(ref CustomList<GroupRule> lstGroupSecurityRule) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); Boolean blnTranStarted = false; try { ReSetTempTransactionDeleteSPName(ref lstGroupSecurityRule); conManager.BeginTransaction(); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstGroupSecurityRule); lstGroupSecurityRule.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception ex) { conManager.RollBack(); throw (ex); } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
public void SaveFiscalYear(ref CustomList<Gen_FY> Gen_FYList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); ReSetSPName(Gen_FYList); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, Gen_FYList); //object scope_Identity = conManager.InsertData(blnTranStarted, BankKist); Gen_FYList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
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]); }
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 void SaveReportPermission(ref CustomList<ReportPermission> rPList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); ReSetSPName(rPList); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, rPList); rPList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception Ex) { throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
//zaki - Insert record and get Scope_Identity() public object Insert(CustomList<BaseItem> itemList, Util.OperationType operationType) { String spName = String.Empty; switch (operationType) { case Util.OperationType.Insert: spName = itemList.InsertSpName; break; case Util.OperationType.Update: spName = itemList.UpdateSpName; break; case Util.OperationType.Delete: spName = itemList.DeleteSpName; break; } Object[] parameterValues = null; object retVal = null; parameterValues = itemList[0].GetParameterValues(); if (parameterValues.IsNotNull()) { retVal = DataAccessHelper.ExecuteScalar(transaction, spName, parameterValues); } return retVal; }
static void Main() { try { CustomList<int> list = new CustomList<int>(); list.AddElement(1); list.AddElement(2); list.AddElement(3); list.AddElement(4); list.AddElement(5); list.AddElement(6); list.AddElement(6); list.AddElement(6); list.AddElement(6); list.AddElement(6); list.AddElement(6); list.AddElement(15); list.AddElement(6); list.AddElement(6); list.AddElement(6); list.AddElement(6); list.AddElement(6); //list.AddElement(6); Console.WriteLine(list.Min()); Console.WriteLine(list.Max()); Console.WriteLine(list.IndexOf(15)); } catch (InvalidOperationException ioe) { Console.WriteLine(ioe.Message); } }
public void SaveBankReconciliation(ref CustomList<Acc_Voucher> VoucherList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); VoucherList.UpdateSpName = "spUpdateAcc_VoucherBankReconciliation"; blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, VoucherList); VoucherList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
public void DeleteGroup(ref CustomList<UserGroup> userGroupList, ref CustomList<GroupRule> groupSecurityRuleList, ref CustomList<Group> groupList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); Boolean blnTranStarted = false; try { ReSetDeleteSPName(groupList, groupSecurityRuleList, userGroupList); conManager.BeginTransaction(); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, userGroupList, groupSecurityRuleList, groupList); userGroupList.AcceptChanges(); groupSecurityRuleList.AcceptChanges(); groupList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception ex) { conManager.RollBack(); throw (ex); } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
public void SaveUnitSetup(ref CustomList<ItemSubGroup> lstItemSubGroup) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); ReSetSPName(lstItemSubGroup); blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstItemSubGroup); lstItemSubGroup.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
static void Main(string[] args) { ICustomList<int> sample = new CustomList<int>(); sample.Add(2); sample.Add(1); sample.Add(1); sample.Add(1); sample.Add(1); sample.Add(1); sample.Add(1); sample.Add(3); sample.Add(3); sample.Add(4); sample.Add(4); sample.Add(4); sample.Add(6); sample.Add(8); sample.Add(8); sample.RemoveOddOccurrences(); Console.WriteLine("After removal:"); for (int index = 0; index < sample.Count; index++) { Console.Write(sample[index]); if (index != sample.Count) { Console.Write(','); } } Console.WriteLine(); }
public void SaveMailSetup(CustomList<MailSetup> MailSetupList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); blnTranStarted = true; ReSetSPName(ref MailSetupList); conManager.SaveDataCollectionThroughCollection(blnTranStarted, MailSetupList); MailSetupList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; conManager.Dispose(); } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
public void SaveBankAccount(ref CustomList<CmnBankAccount> BankAccountList) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); ReSetSPName(BankAccountList); Int32 accountID = BankAccountList[0].AccountID; blnTranStarted = true; if (BankAccountList[0].IsAdded) accountID = Convert.ToInt32(conManager.InsertData(blnTranStarted, BankAccountList)); else conManager.SaveDataCollectionThroughCollection(blnTranStarted, BankAccountList); BankAccountList.AcceptChanges(); conManager.CommitTransaction(); blnTranStarted = false; } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
public static CustomList<Signature> GetSignatureForUniqueCode(String sql) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); CustomList<Signature> signatureCollection = new CustomList<Signature>(); IDataReader reader = null; try { conManager.OpenDataReader(sql, out reader); if (reader.NextResult()) { while (reader.Read()) { Signature newSignature = new Signature(); newSignature.SetData(reader); signatureCollection.Add(newSignature); } } return signatureCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }
private void ReSetSPName(CustomList<CmnDocListTableMapping> CmnDocListTableMappingList) { #region MenuWiseTableMappingSP CmnDocListTableMappingList.InsertSpName = "spInsertCmnDocListTableMapping"; CmnDocListTableMappingList.UpdateSpName = "spUpdateCmnDocListTableMapping"; CmnDocListTableMappingList.DeleteSpName = "spDeleteCmnDocListTableMapping"; #endregion }
public void SubtractOperator_ThreeItemsListAndOneCommonValue_ValuesShiftsDownCorrectly() { // Arrange CustomList <int> leftOperand = new CustomList <int>(); for (int i = 0; i < 3; i++) { leftOperand.Add(i); } CustomList <int> rightOperand = new CustomList <int>(); rightOperand.Add(1); CustomList <int> zeroTwo = new CustomList <int>(); zeroTwo.Add(0); zeroTwo.Add(2); // Act string expected = zeroTwo.ToString(); string actual = (leftOperand - rightOperand).ToString(); //Assert Assert.AreEqual(expected, actual); }
protected void btnSave_Click(object sender, EventArgs e) { try { CustomList <ASL.Hr.DAO.OtherSalaryRule> lstOtherSalaryRule = OtherSalaryRuleList; if (lstOtherSalaryRule.Count == 0) { ASL.Hr.DAO.OtherSalaryRule newObj = new ASL.Hr.DAO.OtherSalaryRule(); lstOtherSalaryRule.Add(newObj); } SetDataFromControlToObject(ref lstOtherSalaryRule); CustomList <HourWisePayment> lstHourWisePayment = HourWisePaymentList; manager.SaveOtherSalaryRule(ref lstOtherSalaryRule, ref lstHourWisePayment); this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg); } catch (SqlException ex) { this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
public static CustomList <ShiftRoster> DeleteExistingShiftRoster(string fromDate, string toDate, string tableName) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <ShiftRoster> ShiftRosterCollection = new CustomList <ShiftRoster>(); IDataReader reader = null; String sql = "exec spDeleteExistingShiftRoster '" + fromDate + "','" + toDate + "','" + tableName + "'"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { // ShiftRoster newShiftRoster = new ShiftRoster(); // newShiftRoster.SetDataShiftRoster(reader); // ShiftRosterCollection.Add(newShiftRoster); } ShiftRosterCollection.InsertSpName = "spInsertShiftRoster"; ShiftRosterCollection.UpdateSpName = "spUpdateShiftRoster"; ShiftRosterCollection.DeleteSpName = "spDeleteShiftRoster"; return(ShiftRosterCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public void Remove_Item_Check_Capacity() //removes the 5th item, checks capacity { //Arrange CustomList <int> itemsToRemove = new CustomList <int>(); int number1 = 2; int number2 = 3; int number3 = 4; int number4 = 5; int number5 = 6; int expected = 8; int actual; //Act itemsToRemove.Add(number1); itemsToRemove.Add(number2); itemsToRemove.Add(number3); itemsToRemove.Add(number4); itemsToRemove.Add(number5); itemsToRemove.Remove(number5); actual = itemsToRemove.Capacity; //Assert Assert.AreEqual(expected, actual); }
public void CheckAddListTogetherForDifferentSizeListsTest() { //Arrange CustomList <int> items = new CustomList <int>(); CustomList <int> itemsTwo = new CustomList <int>(); CustomList <int> added; string expected = "135555246"; //Act items.Add(1); items.Add(3); items.Add(5); items.Add(5); items.Add(5); items.Add(5); itemsTwo.Add(2); itemsTwo.Add(4); itemsTwo.Add(6); added = items + itemsTwo; string actual = added.ToString(); //Assert Assert.AreEqual(expected, actual); }
public void Remove_ItemOnlyRemovedOnce_CountDecramentedOnlyOnce() { //ARRANGE CustomList <int> myList = new CustomList <int>(); int firstNumber = 11; int secondNumber = 12; int thirdNumber = 13; int forthNumber = 12; myList.Add(firstNumber); myList.Add(secondNumber); myList.Add(thirdNumber); myList.Add(forthNumber); int expected = 3; int actual; //ACT myList.Remove(secondNumber); actual = myList.Count; //ASSERT Assert.AreEqual(expected, actual); }
public void Zip_Int_SecondListLonger_FullContentCheck() { //ARRANGE CustomList <int> myList1 = new CustomList <int>(); int firstNumber = 1; int secondNumber = 3; int thirdNumber = 5; myList1.Add(firstNumber); myList1.Add(secondNumber); myList1.Add(thirdNumber); CustomList <int> myList2 = new CustomList <int>(); firstNumber = 2; secondNumber = 4; thirdNumber = 6; int forthNumber = 8; myList2.Add(firstNumber); myList2.Add(secondNumber); myList2.Add(thirdNumber); myList2.Add(forthNumber); string expected = "1 2 3 4 5 6 8"; string actual; CustomList <int> newList; //ACT newList = myList1.Zip(myList2); actual = newList.ToString(); //ASSERT Assert.AreEqual(expected, actual); }
private void SetDataFromControlToObj(ref CustomList <CmnWorkFlowMaster> lstCmnWorkFlowMaster) { try { CmnWorkFlowMaster obj = lstCmnWorkFlowMaster[0]; if (ddlDocList.SelectedValue != "") { obj.DocListID = ddlDocList.SelectedValue.ToInt(); } if (ddlCostCenter.SelectedValue != "") { obj.CostCenterID = ddlCostCenter.SelectedValue.ToInt(); } if (ddlDepartment.SelectedValue != "") { obj.DeptID = ddlDepartment.SelectedValue.ToInt(); } obj.Sequence = txtSequence.Text.ToInt(); } catch (Exception ex) { throw (ex); } }
public void ZipListsWithStringsTest() { //Arrange CustomList <string> first = new CustomList <string>(); CustomList <string> second = new CustomList <string>(); CustomList <string> zipped; string expected = "123456810"; //Act first.Add("1"); first.Add("3"); first.Add("5"); second.Add("2"); second.Add("4"); second.Add("6"); second.Add("8"); second.Add("10"); zipped = CustomList <string> .Zip(first, second); string actual = zipped.ToString(); //Assert Assert.AreEqual(expected, actual); }
public void ZipListsSecondListIsLargerTest() { //Arrange CustomList <int> first = new CustomList <int>(); CustomList <int> second = new CustomList <int>(); CustomList <int> zipped; string expected = "123456810"; //Act first.Add(1); first.Add(3); first.Add(5); second.Add(2); second.Add(4); second.Add(6); second.Add(8); second.Add(10); zipped = CustomList <int> .Zip(first, second); string actual = zipped.ToString(); //Assert Assert.AreEqual(expected, actual); }
public void SubtractOperator_SixItemsListAndThreeCommonValues_CapacitySameAsLeftOperand() { // Arrange CustomList <int> leftOperand = new CustomList <int>(); CustomList <int> rightOperand = new CustomList <int>(); CustomList <int> twoOneZero = new CustomList <int>(); for (int i = 0; i < 3; i++) { leftOperand.Add(i); rightOperand.Add(i); twoOneZero.Add(2 - i); } leftOperand.Add(2); leftOperand.Add(1); leftOperand.Add(0); // Act int expected = leftOperand.Capacity; int actual = (leftOperand - rightOperand).Capacity; //Assert Assert.AreEqual(expected, actual); }
public void CheckOrderAfterRemoveTwoItemTest() { //Arrange CustomList <int> items = new CustomList <int>(); int value = 1; int secondValue = 3; int thirdValue = 5; int fourthValue = 7; int fifthValue = 9; int expected = 9; //Act items.Add(value); items.Add(secondValue); items.Add(thirdValue); items.Add(fourthValue); items.Add(fifthValue); items.Remove(secondValue); items.Remove(fourthValue); int actual = items[2]; //Assert Assert.AreEqual(expected, actual); }
public void SubtractOperator_SixItemsListAndThreeCommonValues_RemoveOnlyFirstInstance() { // Arrange CustomList <int> leftOperand = new CustomList <int>(); CustomList <int> rightOperand = new CustomList <int>(); CustomList <int> twoOneZero = new CustomList <int>(); for (int i = 0; i < 3; i++) { leftOperand.Add(i); rightOperand.Add(i); twoOneZero.Add(2 - i); } leftOperand.Add(2); leftOperand.Add(1); leftOperand.Add(0); // Act string expected = twoOneZero.ToString(); string actual = (leftOperand - rightOperand).ToString(); //Assert Assert.AreEqual(expected, actual); }
public void Remove_OneValueToEmptyCustomList_RemoveOne_ItemFive() { // arrange CustomList <int> testList = new CustomList <int>(); int itemToAdd1 = 20; int itemToAdd2 = 21; int itemToAdd3 = 22; int itemToAdd4 = 23; int itemToAdd5 = 24; int expected = 4; int actual; // act testList.Add(itemToAdd1); testList.Add(itemToAdd2); testList.Add(itemToAdd3); testList.Add(itemToAdd4); testList.Add(itemToAdd5); testList.Remove(itemToAdd5); actual = testList.capacityProperty; // assert Assert.AreEqual(expected, actual); }
public void Add_TwoValues_CountOf10() { //Arrange CustomList <int> customList = new CustomList <int>(); int value1 = 2; int value2 = 4; int expected = 10; int actual; //Act customList.Add(value1); customList.Add(value2); customList.Add(value1); customList.Add(value2); customList.Add(value1); customList.Add(value2); customList.Add(value1); customList.Add(value2); customList.Add(value1); customList.Add(value2); actual = customList.Count; //Assert Assert.AreEqual(expected, actual); }
public void Save(ref CustomList <Acc_COA> list) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); Boolean blnTranStarted = false; try { conManager.BeginTransaction(); list.InsertSpName = "spInsertAcc_COA"; list.UpdateSpName = "spUpdateAcc_COA"; list.DeleteSpName = "spDeleteAcc_COA"; blnTranStarted = true; conManager.SaveDataCollectionThroughCollection(blnTranStarted, list); conManager.CommitTransaction(); list.AcceptChanges(); blnTranStarted = false; conManager.Dispose(); } catch (Exception Ex) { conManager.RollBack(); throw Ex; } finally { if (conManager.IsNotNull()) { conManager.Dispose(); } } }
private void EmployeeHKInfoSave(ArrayList empInfo) { CustomList <EmployeeHKInfo> EmpHKList = new CustomList <EmployeeHKInfo>(); foreach (ASL.Hr.DAO.EntityList M in _EntityList) { if (M.IsUsed) { DropDownList ddl = new DropDownList(); EmployeeHKInfo newEHKI = new EmployeeHKInfo(); ddl = (DropDownList)Panel1.FindControl("ddl" + M.EntityName.ToString()); if (ddl.SelectedValue == "") { continue; } newEHKI.HKID = ddl.SelectedValue.ToInt(); newEHKI.HKName = M.EntityName.ToString(); EmpHKList.Add(newEHKI); } } var empHKInfoList = (CustomList <EmployeeHKInfo>)EmpHKList; empInfo.Add(empHKInfoList); }
public void Remove_MultipleValueToEmptyCustomList_RemoveOne_CheckingIndexZero() { // arrange CustomList <int> testList = new CustomList <int>(); int value1 = 20; int value2 = 25; int value3 = 30; int value4 = 35; int value5 = 40; int expected = 25; int actual; // act testList.Add(value1); testList.Add(value2); testList.Add(value3); testList.Add(value4); testList.Add(value5); testList.Remove(value1); actual = testList[0]; // assert Assert.AreEqual(expected, actual); }
public void Remove_StringName() { CustomList <string> allstar = new CustomList <string>(); string exceptedResult = "Giannis"; string actualResult; allstar.Add("Curry"); allstar.Add("Harden"); allstar.Add("Griffen"); allstar.Add("Green"); allstar.Add("James"); allstar.Add("Ball"); allstar.Add("Bronny"); allstar.Add("Giannis"); allstar.Add("Leanord"); allstar.Add("Irving"); allstar.Add("Wade"); allstar.Remove("Bronny"); allstar.Remove("Ball"); actualResult = allstar[5]; Assert.AreEqual(exceptedResult, actualResult); }
public void Remove_RemovingThreeStringItemsAfterAddingEight_EigthItemBecomesFifth() { CustomList <string> name = new CustomList <string>(); string exceptedResult = "Cook"; string actualResult; name.Add("Rodgers"); name.Add("Wilson"); name.Add("Brady"); name.Add("Vick"); name.Add("Farve"); name.Add("Starr"); name.Add("McNabb"); name.Add("Cook"); name.Remove("Farve"); name.Remove("Starr"); name.Remove("McNabb"); actualResult = name[4]; Assert.AreEqual(exceptedResult, actualResult); }
public void Zipper_ZipTwoListWithMultipleItems_Zipper() { // arrange CustomList <int> testList = new CustomList <int>(); CustomList <int> testList2 = new CustomList <int>(); int[] NewList; int expected = 237; int acutual; // act testList.Add(234); testList.Add(235); testList.Add(236); testList2.Add(237); testList2.Add(238); testList2.Add(239); NewList = CustomList <int> .Zipper(testList, testList2); acutual = NewList[1]; // assert Assert.AreEqual(expected, acutual); }
public void MinusOperator_OneListWithRepeatedValue_ReturnListwithAllRepeatsRemoved() { //Arrange CustomList <string> customList1 = new CustomList <string>(); CustomList <string> customList2 = new CustomList <string>(); string expected = "dogfox"; //Act customList1.Add("cat"); customList1.Add("bat"); customList1.Add("cat"); customList1.Add("cat"); customList1.Add("cat"); customList1.Add("dog"); customList1.Add("cat"); customList1.Add("fox"); customList2.Add("cat"); customList2.Add("bat"); customList2.Add("hat"); CustomList <string> customList3 = customList1 - customList2; //Assert Assert.AreEqual(expected, customList3.ToString()); }
public void MinusOperator_TwoCustomListsBothWithValues_ReturnsModifiedList() { int[] valsOne = new int[3] { 1, 1, 1 }; int[] valsTwo = new int[3] { 1, 2, 3 }; int[] expectedVals = new int[2] { 1, 1 }; CustomList <int> testOne = new CustomList <int>(valsOne); CustomList <int> testTwo = new CustomList <int>(valsTwo); CustomList <int> result; CustomList <int> expectedResult = new CustomList <int>(expectedVals); bool resultBool = true; result = testOne - testTwo; if (result.Count != expectedResult.Count) { Assert.Fail("CustomList objects are of inequal length."); } else { for (int i = 0; i < result.Count; i++) { if (result[i] != expectedResult[i]) { resultBool = false; break; } } Assert.IsTrue(resultBool); } }
public void MinusOperator_NotEmptyMinusEmpty_ResultNoChange() { // Arrange CustomList <int> minuend = new CustomList <int>(); minuend.Add(1); minuend.Add(2); minuend.Add(3); CustomList <int> subtrahend = new CustomList <int>(); CustomList <int> expected = new CustomList <int>(); expected.Add(1); expected.Add(2); expected.Add(3); CustomList <int> actual; // Act actual = minuend - subtrahend; // Assert Assert.AreEqual(expected, actual); }
public void AddAtIndex_AddStringAtIndexThreeToListOfStrings_VerifyResultingListUsingToString() { //Arrange CustomList <string> list = new CustomList <string>(); string firstString = "One"; string secondString = "Two"; string thirdString = "Three"; string fourthString = "Four"; string fifthString = "Five"; string sixthString = "Six"; string stringToBeInserted = "Three-and-a-Half"; string expected = "OneTwoThreeThree-and-a-HalfFourFiveSix"; //Act list.Add(firstString); list.Add(secondString); list.Add(thirdString); list.Add(fourthString); list.Add(fifthString); list.Add(sixthString); list.AddAtIndex(stringToBeInserted, 3); //Assert Assert.AreEqual(expected, list.ToString()); }
public void Add_Add6Values_CountOf6() { { //arrange CustomList <int> customList = new CustomList <int>(); int value1 = 1; int value2 = 2; int expected = 6; int actual; //act customList.Add(value1); customList.Add(value2); customList.Add(value1); customList.Add(value2); customList.Add(value1); customList.Add(value2); actual = customList.Count; //assert Assert.AreEqual(expected, actual); } }
public void Remove_ItemNotRemoved_CountRemains() { //ARRANGE CustomList <int> myList = new CustomList <int>(); int firstNumber = 11; int secondNumber = 12; int thirdNumber = 13; int forthNumber = 12; myList.Add(firstNumber); myList.Add(secondNumber); myList.Add(thirdNumber); myList.Add(forthNumber); int expected = 4; int actual; //ACT myList.Remove(15); actual = myList.Count; //ASSERT Assert.AreEqual(expected, actual); }
protected void btnSave_Click(object sender, EventArgs e) { try { CustomList <HRM_EvalItem> lstBank = (CustomList <HRM_EvalItem>)HRM_EvalItemList; if (lstBank.IsNotNull()) { if (!CheckUserAuthentication(lstBank)) { return; } manager.SaveFiscalYear(ref lstBank); this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg); } } catch (SqlException ex) { this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
public void Remove_ItemOnlyRemovedOnce_SecondInstancePersists() { //ARRANGE CustomList <int> myList = new CustomList <int>(); int firstNumber = 11; int secondNumber = 12; int thirdNumber = 13; int forthNumber = 12; myList.Add(firstNumber); myList.Add(secondNumber); myList.Add(thirdNumber); myList.Add(forthNumber); int expected = forthNumber; int actual; //ACT myList.Remove(secondNumber); actual = myList[2]; //ASSERT Assert.AreEqual(expected, actual); }
public void AddAtIndex_AddStringAtIndexThreeToListOfStrings_CountHasIncreasedByOne() { //Arrange CustomList <string> list = new CustomList <string>(); string firstString = "One"; string secondString = "Two"; string thirdString = "Three"; string fourthString = "Four"; string fifthString = "Five"; string sixthString = "Six"; string stringToBeInserted = "Three-and-a-Half"; int expected = 7; //Act list.Add(firstString); list.Add(secondString); list.Add(thirdString); list.Add(fourthString); list.Add(fifthString); list.Add(sixthString); list.AddAtIndex(stringToBeInserted, 3); //Assert Assert.AreEqual(expected, list.Count); }