} //----------------------------------------- //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(); } //---------------------------------
//###########################################CLASS DeductionUpdate EVENTS########################################################### //event is raised when the class is loaded private void ClassLoad(object sender, EventArgs e) { _earningInfo = new CommonExchange.EarningInformation(); _earningTemp = new CommonExchange.EarningInformation(); this.InitializeControls(); } //-----------------------------------
} //------------------------------------- //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(); } //--------------------------------
} //------------------------------- //##############################################END BUTTON btnUpdate EVENTS############################################################# #endregion #region Programmer-Defined Void Procedures //this procedure initializes the controls private void InitializeControls() { _earningInfo = _incManager.GetDetailsEarningInformation(_earningId); _earningTemp = (CommonExchange.EarningInformation)_earningInfo.Clone(); lblId.Text = _earningInfo.EarningSysId; txtDescription.Text = _earningInfo.Description; }
} //----------------------------- //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(); } //-------------------------------------
public ApplyEarning(CommonExchange.SysAccess userInfo, CommonExchange.EarningInformation incInfo, EarningLogic incManager) { this.InitializeComponent(); _userInfo = userInfo; _incInfo = incInfo; _incManager = incManager; 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 earning information public CommonExchange.EarningInformation GetDetailsEarningInformation(String earningId) { CommonExchange.EarningInformation incInfo = new CommonExchange.EarningInformation(); String strFilter = "sysid_earning = '" + earningId + "'"; DataRow[] selectRow = _classDataSet.Tables["EarningInformationTable"].Select(strFilter, "sysid_earning ASC"); foreach (DataRow decRow in selectRow) { incInfo.EarningSysId = decRow["sysid_earning"].ToString(); incInfo.Description = decRow["earning_description"].ToString(); } return(incInfo); } //------------------------------
} //------------------------------ //this function returns a earning information public CommonExchange.EarningInformation GetDetailsEarningInformation(Int64 earningId) { CommonExchange.EarningInformation incInfo = new CommonExchange.EarningInformation(); String strFilter = "earning_id = '" + earningId + "'"; DataRow[] selectRow = _incTableByDate.Select(strFilter, "earning_id ASC"); foreach (DataRow incRow in selectRow) { incInfo.EarningId = (Int64)incRow["earning_id"]; incInfo.EarningDate = incRow["earning_date"].ToString(); incInfo.Description = incRow["earning_description"].ToString(); incInfo.Amount = (Decimal)incRow["amount"]; } return(incInfo); } //------------------------------
//#############################################CLASS ViewUpdateDeduction EVENTS############################################### //event is raised when the class is loaded private void ClassLoad(object sender, EventArgs e) { _incInfo = new CommonExchange.EarningInformation(); _incInfo = _incManager.GetDetailsEarningInformation(_earningId); _incInfo.EmployeeInfo.EmployeeSysId = _empInfo.EmployeeSysId; _incTemp = (CommonExchange.EarningInformation)_incInfo.Clone(); lblName.Text = RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(_empInfo.PersonInfo.LastName, _empInfo.PersonInfo.FirstName, _empInfo.PersonInfo.MiddleName); lblDate.Text = DateTime.Parse(_incInfo.EarningDate).ToLongDateString(); lblDescription.Text = _incInfo.Description; txtAmount.Text = _incInfo.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) { _earningInfo = new CommonExchange.EarningInformation(); } //--------------------------------------