public void Add(List <InnerMovementDTO> dtos, int userId) { new ProductStockBL().UpdateProductStocks(dtos); new InnerMovementDalFacade().Add(dtos); #region Income // INCOME SECTION var incomeProducts = new List <IncomeProductDTO>(); foreach (var dto in dtos) { incomeProducts.Add(new IncomeProductDTO() { ProductId = dto.ProductId, Quantity = dto.Quantity, }); } var incomeDTO = new IncomeDTO() { FromWorkplaceId = dtos.FirstOrDefault().FromWorkPlaceId, ToWorkplaceId = dtos.FirstOrDefault().ToWorkPlaceId, UserId = userId, IncomeProducts = incomeProducts, IsProductStock = false, }; new IncomeDalFacade().AddIncome(incomeDTO); #endregion }
public ModifyIncomePage(IncomeDTO selectedItem) { InitializeComponent(); this.modMoneirecieved.Text = (selectedItem.Moneyrecieved).ToString(); this.modIncomename.Text = selectedItem.Incomename; incomeId = selectedItem.Incomeid; }
private void Init() { Entity = new IncomeDTO(); SearchEntity = new IncomeDTO(); ValidationErrors = new List <KeyValuePair <string, string> >(); _manager = new IncomeManager(); Date = DateTime.Today.ToString("d", CultureInfo.CurrentCulture); AutoTransferPaycheckContributions = false; }
protected void btnLuu_Click(object sender, EventArgs e) { InvoiceDTO invdto = new InvoiceDTO(); invdto.MaClaim = txtId_claim.Text; invdto.NoInvoice = txtInvoice.Text; invdto.GrandTotal = float.Parse(txtTongTien.Text); invdto.DateIssue = DateTime.Parse(txtIssueDate.Text); bool kq = inv.Insert(invdto); if (kq == true) { IncomeDTO idto = new IncomeDTO(); //int idgdv = int.Parse(drDSGDV.SelectedItem.Value.ToString()); int idgdv = 0; //idto.MaGDV = 0; string thamchieu = txtId_claim.Text; //bool kttrung = idao.KiemTraTrung(thamchieu, idgdv); DataTable dt = ts.ListIDGDV(thamchieu); List <string> ListID = new List <string>(); if (dt.Rows.Count > 0) { //foreach (DataRow dr in dt.Rows) for (int t = 0; t < dt.Rows.Count; t++) { ListID.Add(dt.Rows[t][0].ToString()); } } //int maLA = int.Parse(ListID[0].ToString()); //foreach (DataRow ID_GDV in ListID) for (int i = 0; i < ListID.Count; i++) { //Response.Write("<script>alert('" + ListID[i].ToString()+ "');</script>"); idgdv = int.Parse(ListID[i].ToString()); idto.MaGDV = idgdv; int maInvoice = inv.SelectMaMax(); idto.MaInvoice = maInvoice; idto.MaClaim = thamchieu; float feeissue = float.Parse(txtIssueFee.Text); idto.IssueFee = feeissue; float feereal = float.Parse(txtRealfee.Text); idto.RealFee = feereal; float percentage = feereal / feeissue; idto.Percentage = percentage; float magicincome = ts.CyberIncomeGDV(thamchieu, idgdv); idto.CyberIncome = magicincome; float realincome = percentage * magicincome / 4; idto.RealIncome = realincome; bool them = ic.Insert(idto); } Session["ThamChieu"] = thamchieu; Response.Redirect("~/Pages/detailincome.aspx"); } }
private void Apply() { income = facade.GetIncome(StartDate, EndDate); RaisePropertyChangedEvent("WonBetsCount"); RaisePropertyChangedEvent("LostBetsCount"); RaisePropertyChangedEvent("Profits"); RaisePropertyChangedEvent("Costs"); RaisePropertyChangedEvent("Income"); }
public IncomeViewModel(AnalysisFacade facade) { this.facade = facade; this.income = new IncomeDTO(); this.ApplyCommand = new DelegateCommand(Apply, obj => true); StartDate = new DateTime(DateTime.Now.Year, 01, 01); EndDate = new DateTime(DateTime.Now.Year + 1, 01, 01); }
public void Update(InnerMovementDTO[] dtos, int userId) { string exMsg = null; foreach (var dto in dtos) { var inMovement = new InnerMovementDalFacade().GetInnerMovement(dto.Id.Value); var diff = dto.Quantity - inMovement.Quantity; // should-Be - was var productInStockFrom = new ProductStockDalFacade().GetProductStockByPlaceAndProduct(dto.FromWorkPlaceId, dto.ProductId); var productInStockTo = new ProductStockDalFacade().GetProductStockByPlaceAndProduct(dto.ToWorkPlaceId, dto.ProductId); if (diff != 0 && productInStockFrom.Quantity > diff && (productInStockTo.Quantity + diff) >= 0) { productInStockFrom.Quantity -= diff;// dto.Quantity - inMovement.Quantity; new ProductStockDalFacade().Update(productInStockFrom); productInStockTo.Quantity += diff; new ProductStockDalFacade().Update(productInStockTo); } else if (diff == 0) { } else { exMsg = $"Not Enough Product ({dto.ProductId}-{dto.ProductName}) in ProductStock to complete transaction."; } } if (exMsg != null) { throw new ArgumentOutOfRangeException(exMsg); } foreach (var dto in dtos) { var inMovement = new InnerMovementDalFacade().GetInnerMovement(dto.Id.Value); var quantity = inMovement.Quantity - dto.Quantity; var incomeProducts = new List <IncomeProductDTO>(); incomeProducts.Add(new IncomeProductDTO() { ProductId = dto.ProductId, Quantity = quantity }); var incomeDTO = new IncomeDTO() { FromWorkplaceId = dto.FromWorkPlaceId, ToWorkplaceId = dto.ToWorkPlaceId, IncomeProducts = incomeProducts, IsProductStock = false, UserId = userId }; new IncomeDalFacade().AddIncome(incomeDTO); new InnerMovementDalFacade().Update(dto); } }
public async Task <IActionResult> Update(IncomeDTO dto) { try { return(Ok(await _repo.Update(dto))); } catch (Exception ex) { return(StatusCode(500, ex)); } }
private Income MapToIncome(IncomeDTO income) { return(new Income { Id = income.Id, Name = income.Name, Description = income.Description, Date = income.Date, AccountId = Account.Id, Cash = income.Cash }); }
public static Income DTOtoDAL(IncomeDTO income) { return(new Income() { Remarks = income.remark, // Payment_method = income.Payment_method, Amount = income.Amount, Date = income.Date, From = income.From, Id = income.Id, GmachId = income.Id_Gmach }); }
public IncomeDTO GetIncome(DateTime dateStart, DateTime dateEnd) { IncomeDTO income = null; using (IAnalysisService service = factory.CreateAnalysisService()) { DataServiceMessage <IncomeDTO> serviceMessage = service.GetIncome(dateStart, dateEnd); RaiseReceivedMessageEvent(serviceMessage); income = serviceMessage.IsSuccessful ? serviceMessage.Data : new IncomeDTO(); } return(income); }
public HttpResponseMessage AddIncome(IncomeDTO dto) { try { new IncomeBL().AddIncome(dto); var result = Request.CreateResponse(HttpStatusCode.OK, true); return(result); } catch (Exception ex) { LogManager.Instance.Error(ex); return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }
public async Task <Boolean> Create(IncomeDTO dto) { try { Income income = new Income(dto); _db.Income.Add(income); await _db.SaveChangesAsync(); return(true); } catch (Exception ex) { throw new Exception("Error in IncomeRepository.Create - " + ex.Message); } }
public bool Insert(IncomeDTO i) { string sql = "sp_Income_Insert"; List <SqlParameter> ds = new List <SqlParameter>(); ds.Add(new SqlParameter("@id_invoice", i.MaInvoice)); ds.Add(new SqlParameter("@issuefee", i.IssueFee)); ds.Add(new SqlParameter("@realfee", i.RealFee)); ds.Add(new SqlParameter("@percentage", i.Percentage)); ds.Add(new SqlParameter("@cyberincome", i.CyberIncome)); ds.Add(new SqlParameter("@realincome", i.RealIncome)); ds.Add(new SqlParameter("@id_gdv", i.MaGDV)); bool kq = false; kq = SqlDataAcessHelper.exNonStoreParas(sql, ds); return(kq); }
public async Task <Boolean> Update(IncomeDTO dto) { try { var income = await _db.Income.FirstOrDefaultAsync(i => i.Id == dto.Id); income.Name = dto.Name; income.Amount = dto.Amount; await _db.SaveChangesAsync(); return(true); } catch (Exception ex) { throw new Exception("Error in IncomeRepository.Update - " + ex.Message); } }
public async Task <ActionResult> AddIncome(string monzoTransId, decimal amount, string date, int selectedId, int?secondCatId = null) { var dto = new IncomeDTO { Amount = amount, SourceId = selectedId, SecondSourceId = secondCatId, Date = DateTime.ParseExact(date, "yyyy-MM-ddTHH:mm", new CultureInfo("en-GB")), MonzoTransId = monzoTransId }; await monzoService.AddIncome(dto); await monzoService.DeleteMonzoTransaction(monzoTransId); return(View("Close")); }
public void AddIncome(IncomeDTO dto) { var income = new Income() { UserId = dto.UserId, FromWorkPlaceId = dto.FromWorkplaceId, ToWorkplaceId = dto.FromWorkplaceId, CreatedDate = DateTime.Now, UpdatedDate = DateTime.Now, IsProductStock = dto.IsProductStock, IncomeProducts = new EntitySet <IncomeProduct>() }; db.Incomes.InsertOnSubmit(income); db.SubmitChanges(); AddIncomeProducts(income.Id, dto.IncomeProducts); }
public static void Add(IncomeDTO income) { DB db = new DB(); try { Income IncomeDAL = new Income(); IncomeDAL = IncomeConvert.DTOtoDAL(income); db.Incoms.Add(IncomeDAL); FundBL.AddBalance((int)income.Amount); db.SaveChanges(); } catch (Exception e) { throw new Exception(e.ToString() + ' ' + income.ToString()); } }
public async Task <IActionResult> PutIncome(int id, [FromBody] IncomeDTO incomeDTO) { if (id != incomeDTO.Id) { return(BadRequest()); } try { await _mediator.Send(new UpdateIncomeCommand { IncomeDTO = incomeDTO }); return(Ok()); } catch (ArgumentException argumentException) { return(BadRequest(argumentException.Message)); } }
public ActionResult <IncomeDTO> AddIncome([FromBody] IncomeDTO income) { // System.Text.Json.JsonElement // IncomeDTO incomeDTO; try { // incomeDTO= System.Text.Json.JsonSerializer.Deserialize<IncomeDTO>(income.ToString()); // incomeDTO=income.ToObject<IncomeDTO>(); // IncomeDTO incomeDTO=Convert.ChangeType(IncomeDTO,income); // IncomeDTO income1=IncomeConvert.DTOtoDAL(incomeDTO); IncomeBL.Add(income); } catch (Exception e) { return(BadRequest(e.ToString())); } return(Ok(income)); }
protected void btnInsert_Click(object sender, EventArgs e) { IncomeDTO idto = new IncomeDTO(); int idgdv = int.Parse(drDSGDV.SelectedItem.Value.ToString()); idto.MaGDV = idgdv; string thamchieu = drDSClaimInvoice.SelectedItem.ToString(); bool kttrung = idao.KiemTraTrung(thamchieu, idgdv); int maInvoice = int.Parse(drDSClaimInvoice.SelectedItem.Value.ToString()); idto.MaInvoice = maInvoice; idto.MaClaim = thamchieu; float feeissue = float.Parse(txtPhiCG.Text); idto.IssueFee = feeissue; float feereal = float.Parse(txtPhiTT.Text); idto.RealFee = feereal; float percentage = feereal / feeissue; idto.Percentage = percentage; float magicincome = ts.CyberIncomeGDV(thamchieu, idgdv); idto.CyberIncome = magicincome; float realincome = percentage * magicincome / 4; idto.RealIncome = realincome; if (kttrung == false) { bool kq = idao.Insert(idto); if (kq == true) { loadIncomeClaim(thamchieu); } lblThongBao.Text = ""; } else { lblThongBao.Text = "It was exist!"; } }
public IHttpActionResult Get(int id) { try { var result = _incomeService.Get(id); IncomeDTO incomeDTO = IncomeDTO.From(result); return(Ok(incomeDTO)); } catch (Exception ex) { if (ex.InnerException == null) { return(Content(HttpStatusCode.InternalServerError, ex.Message)); } else { return(Content(HttpStatusCode.InternalServerError, ex.InnerException.Message)); } } }
public DataServiceMessage <IncomeDTO> GetIncome(DateTime startDate, DateTime endDate) { string message = ""; bool success = true; IncomeDTO income = new IncomeDTO(); try { IEnumerable <BetEntity> betEntities = unitOfWork .Bets .GetAll(b => startDate.Date < b.RegistrationDate && b.RegistrationDate < endDate.Date); decimal win = betEntities .Where(b => b.Coefficient.Win.HasValue && b.Coefficient.Win.Value) .Select(b => b.Sum * b.Coefficient.Value) .Sum(); decimal lost = betEntities .Where(b => b.Coefficient.Win.HasValue && !b.Coefficient.Win.Value) .Select(b => b.Sum) .Sum(); income.WonBets = betEntities.Count(b => b.Coefficient.Win.HasValue && b.Coefficient.Win.Value); income.LostBets = betEntities.Count(b => b.Coefficient.Win.HasValue && !b.Coefficient.Win.Value); income.Profits = lost; income.Costs = win; income.Income = lost - win; message = "Analyzed income"; } catch (Exception ex) { message = ExceptionMessageBuilder.BuildMessage(ex); success = false; } return(new DataServiceMessage <IncomeDTO>(income, message, success)); }
public async Task <HttpResponseMessage> InsertAsync(SpendingDTO dto) { // hack for now if (dto.FinanceId == 0) { dto.FinanceId = null; } if (dto.CatId == 0) { dto.CatId = null; } if (dto.FinanceId.HasValue && dto.CatId.HasValue) { dto.CatId = null; } if (!dto.FinanceId.HasValue && !dto.CatId.HasValue) { return(Request.CreateResponse(HttpStatusCode.BadRequest, false)); } if (dto.CatId == (int)Categories.Savings) { var potIncomeDto = new IncomeDTO { Amount = dto.Amount, SourceId = (int)Categories.SavingsPot, Date = dto.Date, }; await incomeService.InsertIncomeAsync(potIncomeDto); } await spendingService.InsertAsync(dto); return(Request.CreateResponse(HttpStatusCode.OK, true)); }
private IncomeDTO CreateLogIncome(int userId, int productId, decimal quantity, int?workPlaceId) { var incomeProducts = new List <IncomeProductDTO>(); incomeProducts.Add(new IncomeProductDTO() { ProductId = productId, Quantity = quantity }); var income = new IncomeDTO() { FromWorkplaceId = workPlaceId.Value, ToWorkplaceId = workPlaceId.Value, UserId = userId, CreatedDate = DateTime.Now, UpdatedDate = DateTime.Now, IsProductStock = true, IncomeProducts = incomeProducts }; return(income); }
public void Add(InnerMovementDTO dto, int userId) { new ProductStockBL().UpdateProductStock(dto); new InnerMovementDalFacade().Add(dto); var incomeProducts = new List <IncomeProductDTO>(); incomeProducts.Add(new IncomeProductDTO() { ProductId = dto.ProductId, Quantity = dto.Quantity }); var incomeDTO = new IncomeDTO() { FromWorkplaceId = dto.FromWorkPlaceId, ToWorkplaceId = dto.ToWorkPlaceId, IncomeProducts = incomeProducts, IsProductStock = false, UserId = userId }; new IncomeDalFacade().AddIncome(incomeDTO); }
private async Task <long> SaveIncome(TransactionDTO entity) { IncomeDTO income = new IncomeDTO() { Date = entity.Date, CartNumber = entity.CartNumber, CategoryId = entity.CategoryId, DriverId = entity.DriverId, FarmId = entity.FarmId, Quantity = entity.SupplierQuantity, KiloDiscount = entity.Pardon, KiloPrice = entity.SupplierPrice, StationId = entity.StationId, TransactionId = entity.Id }; if (_ISEDITMODE)//Edit Mode { var oldIncome = await GetIncomeByTransactionId(entity.Id); income.Id = oldIncome.Id; } return(await _incomeDSL.Save(income)); }
public async Task <long> Save(IncomeDTO entity) { return(await _incomeDAL.Save(_mapper.Map <Income>(entity))); }
/// <summary> /// Get the checkboxes checkced status in IncomeGateway page and NickName. /// </summary> /// <param name="userId"></param> /// <param name="userDataId"></param> /// <returns></returns> public IncomeDTO GetIncomeGatewayData(long userId, long userDataId) { //bool hasW2 = false, hasInterestIncome = false, hasUnemployment = false, hasOtherIncome = false, showInterestIncomeChkListPage = false; //string nickName = string.Empty; IncomeDTO incomeDTO = new IncomeDTO(); //Get TaxObject. BusinessObject.Tax1040 taxObject = Utilities.GetTaxObjectByUserIdAndUserDataId(userId, userDataId); if (taxObject != null) { //Get Nick Name. if (taxObject.PersonalDetails != null && taxObject.PersonalDetails.PrimaryTaxPayer != null && taxObject.PersonalDetails.PrimaryTaxPayer.Person != null && taxObject.PersonalDetails.PrimaryTaxPayer.Person.NickName != null && taxObject.PersonalDetails.PrimaryTaxPayer.Person.NickName != string.Empty) { incomeDTO.NickName = taxObject.PersonalDetails.PrimaryTaxPayer.Person.NickName; } //Yogalakshmi - 2nd June 2014 - To bind the Firstname if Nickname is null. else if (taxObject.PersonalDetails != null && taxObject.PersonalDetails.PrimaryTaxPayer != null && taxObject.PersonalDetails.PrimaryTaxPayer.Person != null && taxObject.PersonalDetails.PrimaryTaxPayer.Person.FirstName != null && taxObject.PersonalDetails.PrimaryTaxPayer.Person.FirstName != string.Empty) { incomeDTO.NickName = taxObject.PersonalDetails.PrimaryTaxPayer.Person.FirstName; } //Get IncomeGateway checkbox status. if (taxObject.Income != null) { incomeDTO.HasW2Wages = taxObject.Income.HasW2Wages; incomeDTO.HasInterestIncome = taxObject.Income.HasInterestIncome; incomeDTO.HasUnemploymentCompensation = taxObject.Income.HasUnemploymentCompensation; incomeDTO.HasOtherIncome = taxObject.Income.HasOtherIncome; //Saravanan N - 27th May, 2014 - It will decide whether IncomeGateway > InterestIncome link click functionality. var form1099INTKnt = taxObject.Income.Form1099INT != null ? taxObject.Income.Form1099INT.Count : 0; var form1099OIDKnt = taxObject.Income.Form1099OID != null ? taxObject.Income.Form1099OID.Count : 0; //if (form1099INTKnt > 0 || form1099OIDKnt > 0) //{ // incomeDTO.ShowInterestIncomeChkListPage = false; //} //else //{ // incomeDTO.ShowInterestIncomeChkListPage = true; //} //Saravanan N - 6th Aug, 2014 - This property used to decide whether Interest Income Checklist or Interest Income Summary page. incomeDTO.showInterestIncomeChecklist = ((form1099INTKnt > 0 || form1099OIDKnt > 0 || (taxObject.F1040EZEligibility != null && taxObject.F1040EZEligibility.InterestIncomeEligibility != null)) ? false : true); incomeDTO.W2WagesCount = taxObject.Income.W2Wages != null ? taxObject.Income.W2Wages.Count : 0; //Saravanan N - 6th Aug, 2014 - These two properties used to decide whether Interest Income Checklist or Interest Income Summary page. //incomeDTO.Form1099INTCount = taxObject.Income.Form1099INT != null ? taxObject.Income.Form1099INT.Count : 0; //incomeDTO.Form1099OIDCount = taxObject.Income.Form1099OID != null ? taxObject.Income.Form1099OID.Count : 0; incomeDTO.Form1099GCount = taxObject.Income.Form1099G != null ? 1 : 0; incomeDTO.OtherIncomeCount = taxObject.Income.OtherIncome != null ? 1 : 0; } } //02-Sep-2014 Bhavani Audit functionality implementation string description = "Get Income Gateway data, ClassName: {0}, Method Name: {1}"; Utilities.PersistAuditInfo(userId, userDataId, description, this.GetType().Name, Constants.Tab_INCOME, Constants.TOPIC_INCOME_GATEWAY); return(incomeDTO); //return new Tuple<bool, bool, bool, bool, string, bool>(hasW2, hasInterestIncome, hasUnemployment, hasOtherIncome, //nickName, showInterestIncomeChkListPage); }
public async Task <ActionResult <Income> > PostIncome([FromBody] IncomeDTO incomeDTO) { await _mediator.Send(new CreateIncomeCommand { IncomeDTO = incomeDTO }); return(Ok()); }