} //----------------------------------------- //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 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 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 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(); } //--------------------------------
//###########################################CLASS DeductionUpdate EVENTS########################################################### //event is raised when the class is loaded private void ClassLoad(object sender, EventArgs e) { _deductionInfo = new CommonExchange.DeductionInformation(); _deductionTemp = new CommonExchange.DeductionInformation(); this.InitializeControls(); } //-----------------------------------
} //------------------------------- //##############################################END BUTTON btnUpdate EVENTS############################################################# #endregion #region Programmer-Defined Void Procedures //this procedure initializes the controls private void InitializeControls() { _deductionInfo = _decManager.GetDetailsDeductionInformation(_deductionId); _deductionTemp = (CommonExchange.DeductionInformation)_deductionInfo.Clone(); lblId.Text = _deductionInfo.DeductionSysId; txtDescription.Text = _deductionInfo.Description; }
} //----------------------------- //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(); } //-------------------------------------
public ApplyDeduction(CommonExchange.SysAccess userInfo, CommonExchange.DeductionInformation decInfo, DeductionLogic decManager) { this.InitializeComponent(); _userInfo = userInfo; _decInfo = decInfo; _decManager = decManager; this.Load += new EventHandler(ClassLoad); this.FormClosing += new FormClosingEventHandler(ClassClosing); this.ctlManager.OnClose += new RemoteClient.ControlManagerCloseButtonClick(ctlManagerOnClose); this.ctlManager.OnRefresh += new RemoteClient.ControlManagerRefreshButtonClick(ctlManagerOnRefresh); this.ctlManager.OnTextBoxKeyUp += new RemoteClient.ControlManagerTextBoxSearchKeyUp(ctlManagerOnTextBoxKeyUp); this.ctlManager.OnStatusCheckedChanged += new RemoteClient.ControlEmployeeManagerStatusOptionCheckedChanged(ctlManagerOnStatusCheckedChanged); this.lnkChange.LinkClicked += new LinkLabelLinkClickedEventHandler(lnkChangeLinkClicked); }
} //------------------------------------- //this function returns a deduction information public CommonExchange.DeductionInformation GetDetailsDeductionInformation(String deductionId) { CommonExchange.DeductionInformation deductionInfo = new CommonExchange.DeductionInformation(); String strFilter = "sysid_deduction = '" + deductionId + "'"; DataRow[] selectRow = _classDataSet.Tables["DeductionInformationTable"].Select(strFilter, "sysid_deduction ASC"); foreach (DataRow decRow in selectRow) { deductionInfo.DeductionSysId = decRow["sysid_deduction"].ToString(); deductionInfo.Description = decRow["deduction_description"].ToString(); } return(deductionInfo); } //------------------------------
} //------------------------------ //this function returns a deduction information public CommonExchange.DeductionInformation GetDetailsDeductionInformation(Int64 deductionId) { CommonExchange.DeductionInformation decInfo = new CommonExchange.DeductionInformation(); String strFilter = "deduction_id = '" + deductionId + "'"; DataRow[] selectRow = _decTableByDate.Select(strFilter, "deduction_id ASC"); foreach (DataRow decRow in selectRow) { decInfo.DeductionId = (Int64)decRow["deduction_id"]; decInfo.DeductionDate = decRow["deduction_date"].ToString(); decInfo.Description = decRow["deduction_description"].ToString(); decInfo.Amount = (Decimal)decRow["amount"]; } return(decInfo); } //------------------------------
//#############################################CLASS ViewUpdateDeduction EVENTS############################################### //event is raised when the class is loaded private void ClassLoad(object sender, EventArgs e) { _decInfo = new CommonExchange.DeductionInformation(); _decInfo = _decManager.GetDetailsDeductionInformation(_deductionId); _decInfo.EmployeeInfo.EmployeeSysId = _empInfo.EmployeeSysId; _decTemp = (CommonExchange.DeductionInformation)_decInfo.Clone(); lblName.Text = _empInfo.PersonInfo.LastName + ", " + _empInfo.PersonInfo.FirstName + " " + _empInfo.PersonInfo.MiddleName; lblDate.Text = DateTime.Parse(_decInfo.DeductionDate).ToLongDateString(); lblDescription.Text = _decInfo.Description; txtAmount.Text = _decInfo.Amount.ToString("N"); if (_empInfo.SalaryInfo.EmployeeStatusInfo.StatusId == (Byte)CommonExchange.EmploymentStatusNo.LayOff) { lnkChange.Visible = false; txtAmount.Enabled = false; btnUpdate.Visible = false; btnDelete.Visible = false; } } //---------------------------------
//########################################CLASS DeductionCreate EVENTS############################################## //event is raised when the class is loaded private void ClassLoad(object sender, EventArgs e) { _deductionInfo = new CommonExchange.DeductionInformation(); } //--------------------------------------