public void TaxPayerFederalTaxWithheldGreaterThanTaxpayerNetBenefits() { //Prepare Other Income var expectedOtherIncome = new OtherIncome() { SSB = new SocialSecurityBenefits() { TaxpayerNetBenefits = 500, TaxPayerFederalTaxWithheld = 1000, SpouseNetBenefits = 500, SpouseFederalTaxWithheld = 1000 } }; mTaxReturnData.TaxData = JsonConvert.SerializeObject(expectedOtherIncome); //Persist Other Income mUserData.userId = mUserId; mUserData.TaxReturnData = JsonConvert.SerializeObject(mTaxReturnData); var actualOtherIncomeData = mOtherIncomeRepository.PersistOtherIncome(mUserData); //Get Other Income BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(mUserData.userId, actualOtherIncomeData.Item1); Assert.IsTrue(taxObject.ErrorMessages.Count > 0); mLstTaxObjectErrors = taxObject.ErrorMessages.Where(err => err.Topic == Constants.TOPIC_UNEMPLOYMENT_COMPENSATION && err.MessageType.StartsWith("BR")); foreach (var errorMsg in mLstTaxObjectErrors) { Assert.IsNotNull(errorMsg.ErrorCode); } }
public void PrimaryTaxpayerAlaskaFundDividendAndSpouseAlaskaFundDividendNotGiven() { var hasEligibilityDiagnostics = false; //Prepare Other Income var expectedOtherIncome = new OtherIncome() { HasAlaskaPermanantFund = true, AlaskaPermanentFundDividend = new AlaskaPermanentFundDividend() { PrimaryTaxpayerAlaskaFundDividend = null, SpouseAlaskaFundDividend = null } }; mTaxReturnData.TaxData = JsonConvert.SerializeObject(expectedOtherIncome); //Persist Other Income mUserData.userId = mUserId; mUserData.TaxReturnData = JsonConvert.SerializeObject(mTaxReturnData); var actualOtherIncomeData = mOtherIncomeRepository.PersistOtherIncome(mUserData); //Get Other Income BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(mUserData.userId, actualOtherIncomeData.Item1); Assert.IsTrue(taxObject.ErrorMessages.Count > 0); hasEligibilityDiagnostics = taxObject.ErrorMessages.Any(em => (em.ErrorCode == "OtherIncome_RF2")); Assert.IsTrue(hasEligibilityDiagnostics); }
public void HasStateAndLocalTaxDeductionPriorYear() { //Prepare Other Income var expectedOtherIncome = new OtherIncome() { StateOrLocalIncomeTaxRefunds = new StateOrLocalIncomeTaxRefunds() { HasStateAndLocalTaxDeductionPriorYear = true }, HasClaimedItemizedDeductionPriorYear = true, HasStateAndLocalTaxDeductionPriorYear = true }; mTaxReturnData.TaxData = JsonConvert.SerializeObject(expectedOtherIncome); //Persist Other Income mUserData.userId = mUserId; mUserData.TaxReturnData = JsonConvert.SerializeObject(mTaxReturnData); var actualOtherIncomeData = mOtherIncomeRepository.PersistOtherIncome(mUserData); //Get Other Income BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(mUserData.userId, actualOtherIncomeData.Item1); Assert.IsTrue(taxObject.ErrorMessages.Count > 0); mLstTaxObjectErrors = taxObject.ErrorMessages.Where(err => err.Topic == Constants.TOPIC_OTHER_INCOME && err.MessageType.StartsWith("ER")); foreach (var actualOtherIncome in mLstTaxObjectErrors) { Assert.IsNotNull(actualOtherIncome.ErrorCode); } }
public void HasStateAndLocalTaxDeductionPriorYearNotGiven() { var hasEligibilityDiagnostics = false; //Prepare Other Income var expectedOtherIncome = new OtherIncome() { HasStateTaxRefund = true, StateOrLocalIncomeTaxRefunds = new StateOrLocalIncomeTaxRefunds() { HasClaimedItemizedDeductionPriorYear = true, HasStateAndLocalTaxDeductionPriorYear = null } }; mTaxReturnData.TaxData = JsonConvert.SerializeObject(expectedOtherIncome); //Persist Other Income mUserData.userId = mUserId; mUserData.TaxReturnData = JsonConvert.SerializeObject(mTaxReturnData); var actualOtherIncomeData = mOtherIncomeRepository.PersistOtherIncome(mUserData); //Get Other Income BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(mUserData.userId, actualOtherIncomeData.Item1); Assert.IsTrue(taxObject.ErrorMessages.Count > 0); hasEligibilityDiagnostics = taxObject.ErrorMessages.Any(em => (em.ErrorCode == "OtherIncome_RF4")); Assert.IsTrue(hasEligibilityDiagnostics); }
public void TaxpayerNetBenefitsAndTaxpayerNetBenefitsNotGiven() { var hasEligibilityDiagnostics = false; //Prepare Other Income var expectedOtherIncome = new OtherIncome() { HasSsbAndRrb = true, SSB = new SocialSecurityBenefits() { TaxpayerNetBenefits = null }, RRB = new RailroadRetirementIncome() { TaxpayerNetBenefits = null } }; mTaxReturnData.TaxData = JsonConvert.SerializeObject(expectedOtherIncome); //Persist Other Income mUserData.userId = mUserId; mUserData.TaxReturnData = JsonConvert.SerializeObject(mTaxReturnData); var actualOtherIncomeData = mOtherIncomeRepository.PersistOtherIncome(mUserData); //Get Other Income BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(mUserData.userId, actualOtherIncomeData.Item1); Assert.IsTrue(taxObject.ErrorMessages.Count > 0); hasEligibilityDiagnostics = taxObject.ErrorMessages.Any(em => (em.ErrorCode == "OtherIncome_RF1")); Assert.IsTrue(hasEligibilityDiagnostics); }
public dynamic GetDefaultInfo() { OtherIncome model = new OtherIncome(); try { model = _otherIncomeService.GetQueryable().FirstOrDefault(); } catch (Exception ex) { LOG.Error("GetInfo", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } return(Json(new { model.Id, model.SalaryItemId, model.Code, model.Name, model.Description, model.SalaryStatus, model.Errors }, JsonRequestBehavior.AllowGet)); }
public OtherIncomeDetail FixDate(OtherIncomeDetail otherIncomeDetail, IOtherIncomeService _otherIncomeService) { otherIncomeDetail.EndDate = otherIncomeDetail.EffectiveDate; OtherIncome otherIncome = _otherIncomeService.GetObjectById(otherIncomeDetail.OtherIncomeId); if (otherIncome != null) { DateTime curDay = otherIncomeDetail.EffectiveDate; int cnt = otherIncomeDetail.Recurring; while (cnt > 1) { switch ((Constant.SalaryItemStatus)otherIncome.SalaryStatus) { case Constant.SalaryItemStatus.Daily: otherIncomeDetail.EndDate = curDay.AddDays(1); break; case Constant.SalaryItemStatus.Weekly: otherIncomeDetail.EndDate = curDay.AddDays(7); break; case Constant.SalaryItemStatus.Monthly: otherIncomeDetail.EndDate = curDay.AddMonths(1); break; case Constant.SalaryItemStatus.Yearly: otherIncomeDetail.EndDate = curDay.AddYears(1); break; } curDay = otherIncomeDetail.EndDate; cnt--; } } return(otherIncomeDetail); }
public dynamic Insert(OtherIncome model) { try { if (!AuthenticationModel.IsAllowed("Create", Core.Constants.Constant.MenuName.OtherIncome, Core.Constants.Constant.MenuGroupName.Setting)) { Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "You are Not Allowed to Add record"); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } model = _otherIncomeService.CreateObject(model, _salaryItemService); } catch (Exception ex) { LOG.Error("Insert Failed", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } return(Json(new { model.Errors })); }
public OtherIncome UpdateObject(OtherIncome otherIncome, ISalaryItemService _salaryItemService) { if (_validator.ValidUpdateObject(otherIncome, this)) { SalaryItem salaryItem = _salaryItemService.GetObjectById(otherIncome.SalaryItemId.GetValueOrDefault()); if (salaryItem == null) { salaryItem = _salaryItemService.CreateObject(otherIncome.Code, otherIncome.Name, (int)Constant.SalarySign.Income, (int)Constant.SalaryItemType.SalarySlip, otherIncome.SalaryStatus, otherIncome.IsMainSalary, otherIncome.IsDetailSalary, false); otherIncome.SalaryItemId = salaryItem.Id; } else { salaryItem.Code = otherIncome.Code; salaryItem.Name = otherIncome.Name; salaryItem.SalaryItemStatus = otherIncome.SalaryStatus; _salaryItemService.UpdateObject(salaryItem); if (salaryItem.Errors.Any()) { otherIncome.Errors.Clear(); otherIncome.Errors.Add("Code", "Tidak dapat mengubah SalaryItem dengan Code ini"); } } _repository.UpdateObject(otherIncome); } return(otherIncome); }
public async Task <OtherIncome> DeleteOtherIncome(OtherIncome otherIncome) { var url = URLBuilder.GetURL(Controllers.FINANCE, EndPoint.FINANCE_OTHER_INCOME_DELETE); return(await requestProvider.DeleteAsync(url, otherIncome, new Dictionary <string, string> { ["id"] = otherIncome.Id.ToString() })); }
public OtherIncome VHasSalaryItem(OtherIncome otherIncome, ISalaryItemService _salaryItemService) { SalaryItem salaryItem = _salaryItemService.GetObjectById(otherIncome.SalaryItemId.GetValueOrDefault()); if (salaryItem == null) { otherIncome.Errors.Add("SalaryItem", "Tidak valid"); } return(otherIncome); }
public OtherIncomeDetail VHasOtherIncome(OtherIncomeDetail otherIncomeDetail, IOtherIncomeService _otherIncomeService) { OtherIncome otherIncome = _otherIncomeService.GetObjectById(otherIncomeDetail.OtherIncomeId); if (otherIncome == null) { otherIncomeDetail.Errors.Add("OtherIncome", "Tidak ada"); } return(otherIncomeDetail); }
//Vivekkumar - 10th April, 2014 - Business validations added. public void BusinessFieldValidations(OtherIncome otherIncome, List <ErrorMessage> errorMessageList, ErrorMessages errorMessages) { ErrorMessage errorMessage; //Required field validations 1. if (otherIncome.HasSsbAndRrb.HasValue && otherIncome.HasSsbAndRrb.Value) { //Vincent-16July2014-Check the SSB & RRB TaxpayerNet Benefits as NULL //Vincent-6 jun 2014 - fixed the issue number -TAX1040-13971 //Saravanan N - 24th July, 2014 - SSB and RRB SpouseNetBenefits added as per spec ver 2.4. if (otherIncome == null || otherIncome.SSB == null || otherIncome.RRB == null || (otherIncome.SSB.TaxpayerNetBenefits == null && otherIncome.SSB.SpouseNetBenefits == null && otherIncome.RRB.TaxpayerNetBenefits == null && otherIncome.RRB.SpouseNetBenefits == null)) { errorMessage = errorMessages[Constants.OTHERINCOME_NET_BENEFITS]; errorMessageList.Add(errorMessage); } } if (otherIncome.HasAlaskaPermanantFund.HasValue && otherIncome.HasAlaskaPermanantFund.Value) { //Required Entry 2 if (otherIncome == null || otherIncome.AlaskaPermanentFundDividend == null || (otherIncome.AlaskaPermanentFundDividend.PrimaryTaxpayerAlaskaFundDividend == null && otherIncome.AlaskaPermanentFundDividend.SpouseAlaskaFundDividend == null)) { errorMessage = errorMessages[Constants.OTHERINCOME_ALASKA_DIVIDEND_INCOME_MISSING]; errorMessageList.Add(errorMessage); } } //Vincent-2/6/14- Worked on State & local required validation if (otherIncome.HasStateTaxRefund.HasValue && otherIncome.HasStateTaxRefund.Value) { //Required Entry 3 if (otherIncome == null || otherIncome.StateOrLocalIncomeTaxRefunds == null || otherIncome.StateOrLocalIncomeTaxRefunds.HasClaimedItemizedDeductionPriorYear == null) { errorMessage = errorMessages[Constants.OTHERINCOME_WHOSE_TAXREFUND_IS_THIS]; errorMessageList.Add(errorMessage); } else { //Saravanan N - 17th July, 2014 - Condition optimized. //Required Entry 4 if (otherIncome != null && otherIncome.StateOrLocalIncomeTaxRefunds != null && (otherIncome.StateOrLocalIncomeTaxRefunds.HasClaimedItemizedDeductionPriorYear.HasValue && otherIncome.StateOrLocalIncomeTaxRefunds.HasClaimedItemizedDeductionPriorYear.Value) && !otherIncome.StateOrLocalIncomeTaxRefunds.HasStateAndLocalTaxDeductionPriorYear.HasValue) { errorMessage = errorMessages[Constants.OTHERINCOME_STATE_CODE]; errorMessageList.Add(errorMessage); } } } }
public OtherIncome UpdateOtherIncome(OtherIncome _otherIncomeObj) { try { return(_iOtherIncomeRepository.UpdateOtherIncome(_otherIncomeObj)); } catch (Exception ex) { throw ex; } }
public OtherIncome GetOtherIncomeDetails(Guid ID) { OtherIncome otherIncomeObj = new OtherIncome(); otherIncomeObj = _iOtherIncomeRepository.GetOtherIncomeDetails(ID); if (otherIncomeObj != null) { otherIncomeObj.creditAmountFormatted = _commonBusiness.ConvertCurrency(otherIncomeObj.Amount, 2); } return(otherIncomeObj); }
public OtherIncome VHasUniqueCode(OtherIncome otherIncome, IOtherIncomeService _otherIncomeService) { if (String.IsNullOrEmpty(otherIncome.Code) || otherIncome.Code.Trim() == "") { otherIncome.Errors.Add("Code", "Tidak boleh kosong"); } else if (_otherIncomeService.IsCodeDuplicated(otherIncome)) { otherIncome.Errors.Add("Code", "Tidak boleh ada duplikasi"); } return(otherIncome); }
public string PrintError(OtherIncome obj) { string erroroutput = ""; KeyValuePair <string, string> first = obj.Errors.ElementAt(0); erroroutput += first.Key + "," + first.Value; foreach (KeyValuePair <string, string> pair in obj.Errors.Skip(1)) { erroroutput += Environment.NewLine; erroroutput += pair.Key + "," + pair.Value; } return(erroroutput); }
public OtherIncome SoftDeleteObject(OtherIncome otherIncome, ISalaryItemService _salaryItemService) { if (_validator.ValidDeleteObject(otherIncome)) { SalaryItem salaryItem = _salaryItemService.GetObjectById(otherIncome.SalaryItemId.GetValueOrDefault()); _repository.SoftDeleteObject(otherIncome); if (salaryItem != null) { _salaryItemService.SoftDeleteObject(salaryItem); } } return(otherIncome); }
public void UpdateOtherIncome(OtherIncome otherIncome) { var otherIncomeFromDb = otherIncomeRepository.Get(otherIncome.Id); if (otherIncomeFromDb != null) { _util.CopyProperties(otherIncome, otherIncomeFromDb); otherIncomeRepository.Update(otherIncomeFromDb); } else { throw new Exception("This other income record does not exist"); } }
//Added by Prasanna on 07 July 2014 public static OtherIncome CreateOtherIncome() { var otherIncome = new OtherIncome() { HasSsbAndRrb = Utilities.CreateRandomNumber(0, 1).ConvertToBoolean(), HasAlaskaPermanantFund = Utilities.CreateRandomNumber(0, 1).ConvertToBoolean(), HasStateTaxRefund = Utilities.CreateRandomNumber(0, 1).ConvertToBoolean(), HasClaimedItemizedDeductionPriorYear = Utilities.CreateRandomNumber(0, 1).ConvertToBoolean(), HasStateAndLocalTaxDeductionPriorYear = Utilities.CreateRandomNumber(0, 1).ConvertToBoolean(), AlaskaPermanentFundDividend = new AlaskaPermanentFundDividend() { PrimaryTaxpayerAlaskaFundDividend = Utilities.CreateRandomNumber(0, 20), SpouseAlaskaFundDividend = Utilities.CreateRandomNumber(0, 20) }, StateOrLocalIncomeTaxRefunds = new StateOrLocalIncomeTaxRefunds() { HasClaimedItemizedDeductionPriorYear = Utilities.CreateRandomNumber(0, 1).ConvertToBoolean(), HasStateAndLocalTaxDeductionPriorYear = Utilities.CreateRandomNumber(0, 1).ConvertToBoolean() }, SSB = new SocialSecurityBenefits() { HasTaxableSocialSecurityBenefits = Utilities.CreateRandomNumber(0, 1).ConvertToBoolean(), TaxpayerNetBenefits = Utilities.CreateRandomNumber(0, 20), TaxPayerFederalTaxWithheld = Utilities.CreateRandomNumber(0, 20), SpouseNetBenefits = Utilities.CreateRandomNumber(0, 20), SpouseFederalTaxWithheld = Utilities.CreateRandomNumber(0, 20) }, RRB = new RailroadRetirementIncome() { NetBenefits = Utilities.CreateRandomNumber(0, 20), FederalTaxWithholdingAmount = Utilities.CreateRandomNumber(0, 20), TaxpayerNetBenefits = Utilities.CreateRandomNumber(0, 20), TaxPayerFederalTaxWithheld = Utilities.CreateRandomNumber(0, 20), SpouseNetBenefits = Utilities.CreateRandomNumber(0, 20), SpouseFederalTaxWithheld = Utilities.CreateRandomNumber(0, 20) } }; return(otherIncome); }
private void button_Click(object sender, RoutedEventArgs e) { try { using (var db = new DMSIPayrollEntities()) { if (tbAmount.Text == "" || cbIncomeType.SelectedItem == null || cbPeriod.SelectedItem == null || dpStartDate.SelectedDate == null || dpToDate.SelectedDate == null) { MessageBox.Show("Required fields cannot be empty.", "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (mode == 1) { OtherIncome otherIncome = new OtherIncome(); otherIncome.EmployeeID = empid; otherIncome.Amount = Decimal.Parse(tbAmount.Text); otherIncome.StDate = dpStartDate.SelectedDate.Value; otherIncome.ToDate = dpToDate.SelectedDate.Value; otherIncome.IncomeTypeID = Convert.ToInt32(cbIncomeType.SelectedValue); otherIncome.PeriodID = Convert.ToInt32(cbPeriod.SelectedValue); db.OtherIncomes.Add(otherIncome); db.SaveChanges(); MessageBox.Show("Add Succesful", "System Succes!", MessageBoxButton.OK, MessageBoxImage.Information); clear(); } else if (mode == 2) { var otherIncome = db.OtherIncomes.Where(m => m.OtherIncomeID == otherincid).FirstOrDefault(); otherIncome.EmployeeID = empid; otherIncome.Amount = Decimal.Parse(tbAmount.Text); otherIncome.StDate = dpStartDate.SelectedDate.Value; otherIncome.ToDate = dpToDate.SelectedDate.Value; otherIncome.IncomeTypeID = Convert.ToInt32(cbIncomeType.SelectedValue); otherIncome.PeriodID = Convert.ToInt32(cbPeriod.SelectedValue); db.SaveChanges(); MessageBox.Show("Update Succesful", "System Succes!", MessageBoxButton.OK, MessageBoxImage.Information); } } } catch (Exception) { MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public ActionResult UpdateOtherIncome(OtherIncome otherIncome) { if (otherIncome != null) { try { financeService.UpdateOtherIncome(otherIncome); } catch (Exception e) { Program.Logger.Error(e); return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Error occurred while updating the other income record")))); } return(Ok(GetResponse(ResponseType.ACK, ResponseStatusCode.SUCCESS))); } else { return(BadRequest(GetResponse(ResponseType.ERROR, ResponseStatusCode.ERROR, GetError(ErrorCodes.invalidData, "Invalid input", "Please enter proper other income record")))); } }
public dynamic Update(OtherIncome model) { try { if (!AuthenticationModel.IsAllowed("Edit", Core.Constants.Constant.MenuName.OtherIncome, Core.Constants.Constant.MenuGroupName.Setting)) { Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "You are Not Allowed to Edit record"); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } var data = _otherIncomeService.GetObjectById(model.Id); //data.SalaryItemId = model.SalaryItemId; data.Code = model.Code; data.Name = model.Name; data.Description = model.Description; data.SalaryStatus = model.SalaryStatus; model = _otherIncomeService.UpdateObject(data, _salaryItemService); } catch (Exception ex) { LOG.Error("Update Failed", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } return(Json(new { model.Errors })); }
//Saravanan N - 20th May, 2014 - Code refactored from its Controller. /// <summary> /// Get OtherIncome /// </summary> /// <param name="userInputData"></param> /// <returns></returns> public Tuple <OtherIncome, FilingStatus, IEnumerable <ErrorMessage> > GetOtherIncome(UserDTO userDTO) { try { FilingStatus filingStatus = FilingStatus.None; IEnumerable <ErrorMessage> otherIncomeErrorList = null; OtherIncome otherIncome = null; BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userDTO.UserId.ConvertToLong(), userDTO.UserDataId.ConvertToLong()); if (taxObject != null) { if (taxObject.Income != null && taxObject.Income.OtherIncome != null) { otherIncome = taxObject.Income.OtherIncome; } if (taxObject.PersonalDetails != null && taxObject.PersonalDetails.PrimaryTaxPayer != null) { filingStatus = taxObject.PersonalDetails.PrimaryTaxPayer.FilingStatus; } //vivek - 6-Aug-14 -Added the error message list for the error message focus if (taxObject.ErrorMessages != null) { otherIncomeErrorList = taxObject.ErrorMessages.Where(err => (err.Topic == Constants.TOPIC_OTHER_INCOME || err.Topic == Constants.TOPIC_OTHER_INCOME_Alaska || err.Topic == Constants.TOPIC_OTHER_INCOME_SSB_RRB || err.Topic == Constants.TOPIC_OTHER_INCOME_State_And_Local) && (err.MessageType == Constants.MESSAGE_TYPE_RF || err.MessageType == Constants.MESSAGE_TYPE_V)).ToList(); } } //02-Sep-2014 Bhavani Audit functionality implementation var description = "Get OtherIncome, ClassName: {0}, Method Name: {1}"; Utilities.PersistAuditInfo(userDTO.UserId, userDTO.UserDataId, description, GetType().Name, Constants.Tab_INCOME, Constants.TOPIC_OTHER_INCOME); return(new Tuple <OtherIncome, FilingStatus, IEnumerable <ErrorMessage> >(otherIncome, filingStatus, otherIncomeErrorList)); } catch (Exception ex) { throw ex; } }
public object Validate(OtherIncome _otherincome) { AppConst appcust = new AppConst(); SqlParameter outputStatus = null; SqlParameter outputStatus1 = null; try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[ValidateOtherIncome]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ReferenceNo", SqlDbType.VarChar, 20).Value = _otherincome.IncomeRef; cmd.Parameters.Add("@id", SqlDbType.UniqueIdentifier).Value = _otherincome.ID; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus1 = cmd.Parameters.Add("@message", SqlDbType.VarChar, 100); outputStatus.Direction = ParameterDirection.Output; outputStatus1.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } } catch (Exception ex) { return(new { Message = ex.ToString(), Status = -1 }); } return(new { Message = outputStatus1.Value.ToString(), Status = outputStatus.Value }); }
public OtherIncome CreateObject(OtherIncome otherIncome, ISalaryItemService _salaryItemService) { otherIncome.Errors = new Dictionary <String, String>(); if (_validator.ValidCreateObject(otherIncome, this)) { SalaryItem salaryItem = _salaryItemService.GetObjectByCode(otherIncome.Code); if (salaryItem != null) { otherIncome.Errors = new Dictionary <string, string>(); otherIncome.Errors.Add("Code", "SalaryItem dengan Code ini sudah ada"); return(otherIncome); } salaryItem = _salaryItemService.CreateObject(otherIncome.Code, otherIncome.Name, (int)Constant.SalarySign.Income, (int)Constant.SalaryItemType.OtherIncome, otherIncome.SalaryStatus, otherIncome.IsMainSalary, otherIncome.IsDetailSalary, false); if (salaryItem == null) { otherIncome.Errors = new Dictionary <string, string>(); otherIncome.Errors.Add("Code", "Tidak dapat membuat SalaryItem dengan Code ini"); return(otherIncome); } otherIncome.SalaryItemId = salaryItem.Id; _repository.CreateObject(otherIncome); } return(otherIncome); }
public dynamic Delete(OtherIncome model) { try { if (!AuthenticationModel.IsAllowed("Delete", Core.Constants.Constant.MenuName.OtherIncome, Core.Constants.Constant.MenuGroupName.Setting)) { Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "You are Not Allowed to Delete Record"); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } var data = _otherIncomeService.GetObjectById(model.Id); model = _otherIncomeService.SoftDeleteObject(data, _salaryItemService); } catch (Exception ex) { LOG.Error("Delete Failed", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } return(Json(new { model.Errors })); }
public OtherIncome GetOtherIncomeDetails(Guid ID) { OtherIncome _otherIncomeObj = new OtherIncome(); try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[GetOtherIncomeByID]"; cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = ID; cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader sdr = cmd.ExecuteReader()) { if ((sdr != null) && (sdr.HasRows)) { if (sdr.Read()) { _otherIncomeObj.ID = (sdr["ID"].ToString() != "" ? Guid.Parse(sdr["ID"].ToString()) : _otherIncomeObj.ID); _otherIncomeObj.IncomeDate = (sdr["IncomeDate"].ToString() != "" ? DateTime.Parse(sdr["IncomeDate"].ToString()) : _otherIncomeObj.IncomeDate); _otherIncomeObj.PaymentRcdComanyCode = (sdr["PaymentRcdComanyCode"].ToString() != "" ? sdr["PaymentRcdComanyCode"].ToString() : _otherIncomeObj.PaymentRcdComanyCode); _otherIncomeObj.PaymentMode = (sdr["PaymentMode"].ToString() != "" ? sdr["PaymentMode"].ToString() : _otherIncomeObj.PaymentMode); _otherIncomeObj.DepWithdID = (sdr["DepWithdID"].ToString() != "" ? Guid.Parse(sdr["DepWithdID"].ToString()) : _otherIncomeObj.DepWithdID); _otherIncomeObj.BankCode = (sdr["BankCode"].ToString() != "" ? (sdr["BankCode"].ToString()) : _otherIncomeObj.BankCode); _otherIncomeObj.IncomeRef = (sdr["IncomeRef"].ToString() != "" ? sdr["IncomeRef"].ToString() : _otherIncomeObj.IncomeRef); _otherIncomeObj.Description = (sdr["Description"].ToString() != "" ? sdr["Description"].ToString() : _otherIncomeObj.Description); _otherIncomeObj.ReferenceBank = (sdr["ReferenceBank"].ToString() != "" ? sdr["ReferenceBank"].ToString() : _otherIncomeObj.ReferenceBank); _otherIncomeObj.Amount = (sdr["Amount"].ToString() != "" ? decimal.Parse(sdr["Amount"].ToString()) : _otherIncomeObj.Amount); _otherIncomeObj.IncomeDateFormatted = (sdr["IncomeDate"].ToString() != "" ? DateTime.Parse(sdr["IncomeDate"].ToString()).ToString(s.dateformat) : _otherIncomeObj.IncomeDateFormatted); _otherIncomeObj.ChequeDate = (sdr["ChequeDate"].ToString() != "" ? DateTime.Parse(sdr["ChequeDate"].ToString()).ToString(s.dateformat) : _otherIncomeObj.ChequeDate); _otherIncomeObj.EmpTypeCode = (sdr["EmpType"].ToString() != "" ? sdr["EmpType"].ToString() : string.Empty); _otherIncomeObj.employeeObj = new Employee(); { _otherIncomeObj.employeeObj.ID = (sdr["EmpID"].ToString() != "" ? Guid.Parse(sdr["EmpID"].ToString()) : _otherIncomeObj.employeeObj.ID); _otherIncomeObj.employeeObj.Name = (sdr["EmpName"].ToString() != "" ? sdr["EmpName"].ToString() : _otherIncomeObj.employeeObj.Name); }; _otherIncomeObj.chartOfAccountsObj = new ChartOfAccounts(); { _otherIncomeObj.chartOfAccountsObj.Code = (sdr["AccountCode"].ToString() != "" ? sdr["AccountCode"].ToString() : string.Empty); _otherIncomeObj.chartOfAccountsObj.TypeDesc = (sdr["AccountTypeDescription"].ToString() != "" ? sdr["AccountTypeDescription"].ToString() : string.Empty); _otherIncomeObj.chartOfAccountsObj.ISEmploy = (sdr["ISEmpApplicable"].ToString() != "" ? bool.Parse(sdr["ISEmpApplicable"].ToString()) : false); }; _otherIncomeObj.AccountCode = (sdr["AccountCode"].ToString() != "" ? (sdr["AccountCode"].ToString()) : _otherIncomeObj.AccountCode); } } } } } } catch (Exception ex) { throw ex; } return(_otherIncomeObj); }
public OtherIncome UpdateOtherIncome(OtherIncome _otherIncomeObj) { SqlParameter outputStatus = null; try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[UpdateOtherIncome]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = _otherIncomeObj.ID; cmd.Parameters.Add("@IncomeDate", SqlDbType.DateTime).Value = _otherIncomeObj.IncomeDateFormatted; cmd.Parameters.Add("@AccountCode", SqlDbType.VarChar, 10).Value = _otherIncomeObj.AccountCode; cmd.Parameters.Add("@EmpID", SqlDbType.UniqueIdentifier).Value = _otherIncomeObj.EmpID; cmd.Parameters.Add("@PaymentRcdComanyCode", SqlDbType.VarChar, 10).Value = _otherIncomeObj.PaymentRcdComanyCode; cmd.Parameters.Add("@PaymentMode", SqlDbType.VarChar, 10).Value = _otherIncomeObj.PaymentMode; if (_otherIncomeObj.DepWithdID != Guid.Empty) { cmd.Parameters.Add("@DepWithdID", SqlDbType.UniqueIdentifier).Value = _otherIncomeObj.DepWithdID; } cmd.Parameters.Add("@BankCode", SqlDbType.VarChar, 5).Value = _otherIncomeObj.BankCode; cmd.Parameters.Add("@Refbank", SqlDbType.NVarChar, 50).Value = _otherIncomeObj.ReferenceBank; cmd.Parameters.Add("@IncomeRef", SqlDbType.VarChar, 20).Value = _otherIncomeObj.IncomeRef; cmd.Parameters.Add("@Description", SqlDbType.NVarChar, -1).Value = _otherIncomeObj.Description; cmd.Parameters.Add("@Amount", SqlDbType.Decimal).Value = _otherIncomeObj.Amount; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = _otherIncomeObj.commonObj.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = _otherIncomeObj.commonObj.UpdatedDate; cmd.Parameters.Add("@ChequeDate", SqlDbType.DateTime).Value = _otherIncomeObj.ChequeDate; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } switch (outputStatus.Value.ToString()) { case "0": AppConst Cobj = new AppConst(); throw new Exception(Cobj.UpdateFailure); case "1": break; default: break; } } catch (Exception ex) { throw ex; } return(_otherIncomeObj); }
public List <OtherIncome> GetAllOtherIncome(string IncomeDate, string DefaultDate) { List <OtherIncome> otherIncomeList = null; try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[GetAllOtherIncome]"; if (!string.IsNullOrEmpty(IncomeDate)) { cmd.Parameters.Add("@IncomeDate", SqlDbType.DateTime).Value = DateTime.Parse(IncomeDate); } if (!string.IsNullOrEmpty(DefaultDate)) { cmd.Parameters.Add("@DefaultDate", SqlDbType.Int).Value = Convert.ToInt32(DefaultDate); } cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader sdr = cmd.ExecuteReader()) { if ((sdr != null) && (sdr.HasRows)) { otherIncomeList = new List <OtherIncome>(); while (sdr.Read()) { OtherIncome _otherIncomeObj = new OtherIncome(); { _otherIncomeObj.ID = (sdr["ID"].ToString() != "" ? Guid.Parse(sdr["ID"].ToString()) : _otherIncomeObj.ID); _otherIncomeObj.IncomeDate = (sdr["IncomeDate"].ToString() != "" ? DateTime.Parse(sdr["IncomeDate"].ToString()) : _otherIncomeObj.IncomeDate); _otherIncomeObj.AccountCode = (sdr["AccountCode"].ToString() != "" ? (sdr["AccountCode"].ToString()) : _otherIncomeObj.AccountCode); // _otherIncomeObj.EmpTypeCode = (sdr["EmpType"].ToString() != "" ? sdr["EmpType"].ToString() : string.Empty); _otherIncomeObj.PaymentRcdComanyCode = (sdr["PaymentRcdComanyCode"].ToString() != "" ? sdr["PaymentRcdComanyCode"].ToString() : _otherIncomeObj.PaymentRcdComanyCode); _otherIncomeObj.PaymentMode = (sdr["PaymentMode"].ToString() != "" ? sdr["PaymentMode"].ToString() : _otherIncomeObj.PaymentMode); //_otherIncomeObj.employeeObj = new Employee() //{ // ID = (sdr["EmpID"].ToString() != "" ? Guid.Parse(sdr["EmpID"].ToString()) : Guid.Empty), // Name = (sdr["EmpName"].ToString() != "" ? sdr["EmpName"].ToString() : string.Empty) //}; _otherIncomeObj.DepWithdID = (sdr["DepWithdID"].ToString() != "" ? Guid.Parse(sdr["DepWithdID"].ToString()) : _otherIncomeObj.DepWithdID); _otherIncomeObj.BankCode = (sdr["BankCode"].ToString() != "" ? (sdr["BankCode"].ToString()) : _otherIncomeObj.BankCode); _otherIncomeObj.IncomeRef = (sdr["IncomeRef"].ToString() != "" ? sdr["IncomeRef"].ToString() : _otherIncomeObj.IncomeRef); _otherIncomeObj.Description = (sdr["Description"].ToString() != "" ? sdr["Description"].ToString() : _otherIncomeObj.Description); _otherIncomeObj.Amount = (sdr["Amount"].ToString() != "" ? decimal.Parse(sdr["Amount"].ToString()) : _otherIncomeObj.Amount); _otherIncomeObj.AccountDesc = (sdr["TypeDesc"].ToString() != "" ? (sdr["TypeDesc"].ToString()) : _otherIncomeObj.AccountDesc); //_otherIncomeObj.TotalAmt = (sdr["totalamt"].ToString() != "" ? decimal.Parse(sdr["totalamt"].ToString()) : _otherIncomeObj.TotalAmt); _otherIncomeObj.IncomeDateFormatted = (sdr["IncomeDate"].ToString() != "" ? DateTime.Parse(sdr["IncomeDate"].ToString()).ToString(s.dateformat) : _otherIncomeObj.IncomeDateFormatted); } otherIncomeList.Add(_otherIncomeObj); } } } } } } catch (Exception ex) { throw ex; } return(otherIncomeList); }