} //----------------------------------------- //this procedure deletes an employee deduction public void DeleteEmployeeDeduction(CommonExchange.SysAccess userInfo, CommonExchange.DeductionInformation decInfo) { using (RemoteClient.RemCntDeductionManager remClient = new RemoteClient.RemCntDeductionManager()) { remClient.DeleteEmployeeDeduction(userInfo, decInfo); } Int32 index = 0; foreach (DataRow decRow in _decTableByDate.Rows) { if (decRow.RowState != DataRowState.Deleted) { if ((Int64)decRow["deduction_id"] == decInfo.DeductionId) { DataRow delRow = _decTableByDate.Rows[index]; delRow.Delete(); break; } index++; } } _decTableByDate.AcceptChanges(); } //---------------------------------
} //------------------------------------- //this procedure updates a deduction information public void UpdateDeductionInformation(CommonExchange.SysAccess userInfo, CommonExchange.DeductionInformation decInfo) { using (RemoteClient.RemCntDeductionManager remClient = new RemoteClient.RemCntDeductionManager()) { remClient.UpdateDeductionInformation(userInfo, decInfo); } Int32 index = 0; foreach (DataRow decRow in _classDataSet.Tables["DeductionInformationTable"].Rows) { if (String.Equals(decInfo.DeductionSysId, decRow["sysid_deduction"].ToString())) { DataRow editRow = _classDataSet.Tables["DeductionInformationTable"].Rows[index]; editRow.BeginEdit(); editRow["deduction_description"] = decInfo.Description; editRow.EndEdit(); break; } index++; } _classDataSet.Tables["DeductionInformationTable"].AcceptChanges(); } //-------------------------------------
} //-------------------------------- //this procedure insert an employee deduction public void InsertEmployeeDeduction(CommonExchange.SysAccess userInfo, CommonExchange.DeductionInformation decInfo, CheckedListBox cbxBase) { if (cbxBase.CheckedItems.Count != 0) { DataTable decTable = new DataTable("EmployeeDeductionsApplied"); decTable.Columns.Add("deduction_date", System.Type.GetType("System.String")); decTable.Columns.Add("sysid_deduction", System.Type.GetType("System.String")); decTable.Columns.Add("sysid_employee", System.Type.GetType("System.String")); decTable.Columns.Add("amount", System.Type.GetType("System.Decimal")); IEnumerator myEnum = cbxBase.CheckedIndices.GetEnumerator(); Int32 i; while (myEnum.MoveNext() != false) { i = (Int32)myEnum.Current; DataRow empRow = _empTableBySearch.Rows[i]; DataRow newRow = decTable.NewRow(); newRow["deduction_date"] = decInfo.DeductionDate; newRow["sysid_deduction"] = decInfo.DeductionSysId; newRow["sysid_employee"] = empRow["sysid_employee"].ToString(); newRow["amount"] = decInfo.Amount; decTable.Rows.Add(newRow); } using (RemoteClient.RemCntDeductionManager remClient = new RemoteClient.RemCntDeductionManager()) { remClient.InsertEmployeeDeduction(userInfo, decTable); } } } //-----------------------------
} //--------------------------------- //this procedure updates an employee deduction public void UpdateEmployeeDeduction(CommonExchange.SysAccess userInfo, CommonExchange.DeductionInformation decInfo) { using (RemoteClient.RemCntDeductionManager remClient = new RemoteClient.RemCntDeductionManager()) { remClient.UpdateEmployeeDeduction(userInfo, decInfo); } Int32 index = 0; foreach (DataRow decRow in _decTableByDate.Rows) { if (decRow.RowState != DataRowState.Deleted) { if ((Int64)decRow["deduction_id"] == decInfo.DeductionId) { DataRow editRow = _decTableByDate.Rows[index]; editRow.BeginEdit(); editRow["deduction_date"] = DateTime.Parse(decInfo.DeductionDate).ToString(); editRow["amount"] = decInfo.Amount; editRow.EndEdit(); break; } index++; } } _decTableByDate.AcceptChanges(); } //--------------------------------
} //------------------------------------- //this function gets the selected employee deduction public void SetSelectedEmployeeDeductionByDate(CommonExchange.SysAccess userInfo, String employeeSysId, String dateFrom, String dateTo) { using (RemoteClient.RemCntDeductionManager remClient = new RemoteClient.RemCntDeductionManager()) { _decTableByDate = remClient.GetByDateFromDateToEmployeeDeduction(userInfo, employeeSysId, dateFrom, dateTo, _serverDateTime); } _decTableBySearch = _decTableByDate; } //-----------------------------------
} //-------------------------------- //this function is used to determine if the card number exists public Boolean IsDeductionDescriptionExist(CommonExchange.SysAccess userInfo, String description, String deductionSysId) { Boolean isExist = false; using (RemoteClient.RemCntDeductionManager remClient = new RemoteClient.RemCntDeductionManager()) { isExist = remClient.IsDeductionDescriptionExist(userInfo, description, deductionSysId); } return(isExist); } //-------------------------------------
} //----------------------------- //this procedure initializes the class private void InitializeClass(CommonExchange.SysAccess userInfo) { //gets the server date and time using (RemoteClient.RemCntBaseManager remClient = new RemoteClient.RemCntBaseManager()) { _serverDateTime = remClient.GetServerDateTime(userInfo); } //---------------------- //get the dataset for employee information using (RemoteClient.RemCntDeductionManager remClient = new RemoteClient.RemCntDeductionManager()) { _classDataSet = remClient.GetDataSetForDeductionInfo(userInfo); } //--------------------------------- } //--------------------------
} //----------------------------- //this procedure insert a deduction information public void InsertDeductionInformation(CommonExchange.SysAccess userInfo, CommonExchange.DeductionInformation deductionInfo) { using (RemoteClient.RemCntDeductionManager remClient = new RemoteClient.RemCntDeductionManager()) { remClient.InsertDeductionInformation(userInfo, ref deductionInfo); } DataRow newRow = _classDataSet.Tables["DeductionInformationTable"].NewRow(); newRow["sysid_deduction"] = deductionInfo.DeductionSysId; newRow["deduction_description"] = deductionInfo.Description; _classDataSet.Tables["DeductionInformationTable"].Rows.Add(newRow); _classDataSet.Tables["DeductionInformationTable"].AcceptChanges(); } //-------------------------------------