} //----------------------------------------- //this procedure deletes an employee earning public void DeleteEmployeeEarning(CommonExchange.SysAccess userInfo, CommonExchange.EarningInformation incInfo) { using (RemoteClient.RemCntEarningManager remClient = new RemoteClient.RemCntEarningManager()) { remClient.DeleteEmployeeEarning(userInfo, incInfo); } Int32 index = 0; foreach (DataRow incRow in _incTableByDate.Rows) { if (incRow.RowState != DataRowState.Deleted) { if ((Int64)incRow["earning_id"] == incInfo.EarningId) { DataRow delRow = _incTableByDate.Rows[index]; delRow.Delete(); break; } index++; } } _incTableByDate.AcceptChanges(); } //---------------------------------
} //------------------------------------- //this procedure updates a earning information public void UpdateEarningInformation(CommonExchange.SysAccess userInfo, CommonExchange.EarningInformation incInfo) { using (RemoteClient.RemCntEarningManager remClient = new RemoteClient.RemCntEarningManager()) { remClient.UpdateEarningInformation(userInfo, incInfo); } Int32 index = 0; foreach (DataRow incRow in _classDataSet.Tables["EarningInformationTable"].Rows) { if (String.Equals(incInfo.EarningSysId, incRow["sysid_earning"].ToString())) { DataRow editRow = _classDataSet.Tables["EarningInformationTable"].Rows[index]; editRow.BeginEdit(); editRow["earning_description"] = incInfo.Description; editRow.EndEdit(); break; } index++; } _classDataSet.Tables["EarningInformationTable"].AcceptChanges(); } //-------------------------------------
} //-------------------------------- //this procedure insert an employee earning public void InsertEmployeeEarning(CommonExchange.SysAccess userInfo, CommonExchange.EarningInformation incInfo, CheckedListBox cbxBase) { if (cbxBase.CheckedItems.Count != 0) { DataTable incTable = new DataTable("EmployeeEarningsApplied"); incTable.Columns.Add("earning_date", System.Type.GetType("System.String")); incTable.Columns.Add("sysid_earning", System.Type.GetType("System.String")); incTable.Columns.Add("sysid_employee", System.Type.GetType("System.String")); incTable.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 = incTable.NewRow(); newRow["earning_date"] = incInfo.EarningDate; newRow["sysid_earning"] = incInfo.EarningSysId; newRow["sysid_employee"] = empRow["sysid_employee"].ToString(); newRow["amount"] = incInfo.Amount; incTable.Rows.Add(newRow); } using (RemoteClient.RemCntEarningManager remClient = new RemoteClient.RemCntEarningManager()) { remClient.InsertEmployeeEarning(userInfo, incTable); } } } //-----------------------------
} //--------------------------------- //this procedure updates an employee earning public void UpdateEmployeeEarning(CommonExchange.SysAccess userInfo, CommonExchange.EarningInformation incInfo) { using (RemoteClient.RemCntEarningManager remClient = new RemoteClient.RemCntEarningManager()) { remClient.UpdateEmployeeEarning(userInfo, incInfo); } Int32 index = 0; foreach (DataRow incRow in _incTableByDate.Rows) { if (incRow.RowState != DataRowState.Deleted) { if ((Int64)incRow["earning_id"] == incInfo.EarningId) { DataRow editRow = _incTableByDate.Rows[index]; editRow.BeginEdit(); editRow["earning_date"] = DateTime.Parse(incInfo.EarningDate).ToString(); editRow["amount"] = incInfo.Amount; editRow.EndEdit(); break; } index++; } } _incTableByDate.AcceptChanges(); } //--------------------------------
} //------------------------------------- //this function gets the selected employee earning public void SetSelectedEmployeeEarningByDate(CommonExchange.SysAccess userInfo, String employeeSysId, String dateFrom, String dateTo) { using (RemoteClient.RemCntEarningManager remClient = new RemoteClient.RemCntEarningManager()) { _incTableByDate = remClient.GetByDateFromDateToEmployeeEarning(userInfo, employeeSysId, dateFrom, dateTo, _serverDateTime); } _incTableBySearch = _incTableByDate; } //-----------------------------------
} //-------------------------------- //this function is used to determine if the card number exists public Boolean IsEarningDescriptionExist(CommonExchange.SysAccess userInfo, String description, String earningSysId) { Boolean isExist = false; using (RemoteClient.RemCntEarningManager remClient = new RemoteClient.RemCntEarningManager()) { isExist = remClient.IsEarningDescriptionExist(userInfo, description, earningSysId); } 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.RemCntEarningManager remClient = new RemoteClient.RemCntEarningManager()) { _classDataSet = remClient.GetDataSetForEarningInfo(userInfo); } //--------------------------------- } //--------------------------
} //----------------------------- //this procedure insert a earning information public void InsertEarningInformation(CommonExchange.SysAccess userInfo, CommonExchange.EarningInformation incInfo) { using (RemoteClient.RemCntEarningManager remClient = new RemoteClient.RemCntEarningManager()) { remClient.InsertEarningInformation(userInfo, ref incInfo); } DataRow newRow = _classDataSet.Tables["EarningInformationTable"].NewRow(); newRow["sysid_earning"] = incInfo.EarningSysId; newRow["earning_description"] = incInfo.Description; _classDataSet.Tables["EarningInformationTable"].Rows.Add(newRow); _classDataSet.Tables["EarningInformationTable"].AcceptChanges(); } //-------------------------------------