private void ClearText() { fixedAsset = new FixedAsset(); txtNo.Text = fixedAsset.No; txtDescription.Text = fixedAsset.Description; txtSerialNo.Text = fixedAsset.SerialNo; }
public FixedAsset Save(FixedAsset fixedAsset) { var exFixedAsset = erpNodeDBContext.FixedAssets.Find(fixedAsset.Id); if (exFixedAsset != null) { if (exFixedAsset.PostStatus == LedgerPostStatus.Posted) { return(exFixedAsset); } exFixedAsset.FiscalYear = organization.FiscalYears.Find(fixedAsset.StartDeprecationDate); exFixedAsset.Reference = fixedAsset.Reference; exFixedAsset.Memo = fixedAsset.Memo; exFixedAsset.Name = fixedAsset.Name; exFixedAsset.Code = fixedAsset.Code; exFixedAsset.FixedAssetTypeId = fixedAsset.FixedAssetTypeId; exFixedAsset.StartDeprecationDate = fixedAsset.StartDeprecationDate; exFixedAsset.AssetValue = fixedAsset.AssetValue; exFixedAsset.SavageValue = fixedAsset.SavageValue; exFixedAsset.PreDepreciationValue = fixedAsset.PreDepreciationValue; erpNodeDBContext.SaveChanges(); return(exFixedAsset); } else { fixedAsset.FiscalYear = organization.FiscalYears.Find(fixedAsset.StartDeprecationDate); erpNodeDBContext.FixedAssets.Add(fixedAsset); erpNodeDBContext.SaveChanges(); return(fixedAsset); } }
protected virtual void FixedAsset_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { FixedAsset asset = (FixedAsset)e.Row; // AssetID can be <0 when the datasource inserts a temporary record on redirect from selector if (asset == null || asset.AssetID < 0) { return; } FADetailsTransfer det = PXSelect <FADetailsTransfer, Where <FADetailsTransfer.assetID, Equal <Current <FixedAsset.assetID> > > > .SelectSingleBound(this, new object[] { asset }); try { AssetProcess.ThrowDisabled_Transfer(this, asset, det); } catch (PXException exc) { PXUIFieldAttribute.SetEnabled <FixedAsset.selected>(sender, asset, false); sender.RaiseExceptionHandling <FixedAsset.selected>(asset, null, new PXSetPropertyException(exc.MessageNoNumber, PXErrorLevel.RowWarning)); } if (string.IsNullOrEmpty(det.TransferPeriodID)) { PXUIFieldAttribute.SetEnabled <FixedAsset.selected>(sender, asset, false); sender.RaiseExceptionHandling <FADetailsTransfer.transferPeriodID>(asset, null, new PXSetPropertyException(Messages.NextPeriodNotGenerated)); } }
public IncomingCalculationParameters(PXGraph graph, FABookBalance bookBalance) { Graph = graph; BookBalance = bookBalance; FixedAsset = SelectFrom <FixedAsset> .Where <FixedAsset.assetID.IsEqual <@P.AsInt> > .View .Select(Graph, AssetID); Details = SelectFrom <FADetails> .Where <FADetails.assetID.IsEqual <@P.AsInt> > .View .Select(Graph, AssetID); Method = SelectFrom <FADepreciationMethod> .Where <FADepreciationMethod.methodID.IsEqual <@P.AsInt> > .View .Select(Graph, BookBalance.DepreciationMethodID); Precision = (int)SelectFrom <Currency> .InnerJoin <Company> .On <Company.baseCuryID.IsEqual <Currency.curyID> > .View .Select(Graph) .RowCast <Currency>() .FirstOrDefault() .DecimalPlaces; // TODO: CollectAdditions() must be invoked after AC-156072 implementation Additions = CollectAdditionsFromHistory(); }
public ViewResult Details(int id) { FixedAssetBll bll = new FixedAssetBll(); FixedAsset fixedAsset = bll.Gets(x => x.Id == id).SingleOrDefault(); return(View(fixedAsset)); }
public void Insert(FixedAsset fixedAsset) { try { using (AssociationDbContext context = new AssociationDbContext()) { context.FixedAssets.Add(fixedAsset); context.SaveChanges(); }; } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { foreach (var ve in eve.ValidationErrors) { } } throw; } catch { throw; } }
public void RemoveDepreciationSchedule(FixedAsset fixedAsset) { foreach (var schedule in fixedAsset.DepreciationSchedules.ToList()) { fixedAsset.DepreciationSchedules.Remove(schedule); } }
public ActionResult Create(FixedAssetViewModel fixedAssetViewModel) { try { string currUserId = User.Identity.GetUserId(); FixedAsset fixedAsset = new FixedAsset() { ApplicationUserId = currUserId, NameFixedAsset = fixedAssetViewModel.Name, DateFixedAsset = Convert.ToDateTime(fixedAssetViewModel.Date), PurchaseValue = Convert.ToDecimal(fixedAssetViewModel.PurchaseValue), BookValue = Convert.ToDecimal(fixedAssetViewModel.BookValue), JournalEntryNum = fixedAssetViewModel.JournalEntryNum, Lifetime = fixedAssetViewModel.Lifetime, WriteDownValue = Convert.ToDecimal(fixedAssetViewModel.WriteDownValue), WriteDownRate = Convert.ToDecimal(fixedAssetViewModel.WriteDownRate), BookValueAtYearEnd = Convert.ToDecimal(fixedAssetViewModel.BookValueAtYearEnd) }; ctx.FixedAssets.Add(fixedAsset); ctx.SaveChanges(); return(RedirectToAction("Index")); } catch { return(RedirectToAction("Error", "Shared")); } }
protected void btnUpdateFA_Click(object sender, EventArgs e) { int fixedAssetId = (int)Session["fixedAssetId"]; FixedAsset fa = _presenter.GetFixedAsset(fixedAssetId); fa.AssetCode = txtAssetCode.Text; fa.SerialNo = txtSerialNo.Text; fa.Location = txtLocation.Text; fa.Condition = txtCondition.Text; fa.TotalLife = Convert.ToInt32(txtTotalLife.Text); fa.Remark = txtRemark.Text; fa.AssetStatus = "Updated"; FixedAssetHistory fah = new FixedAssetHistory(); fah.TransactionDate = DateTime.Now; fah.Custodian = "Store"; fah.Operation = "Updated"; fa.FixedAssetHistories.Add(fah); _presenter.SaveOrUpdateFixedAsset(fa); BindFixedAssets(); Session["fixedAssetId"] = null; Master.ShowMessage(new AppMessage("Fixed Asset successfully updated!", RMessageType.Info)); }
protected virtual void FATran_RowDeleted(PXCache sender, PXRowDeletedEventArgs e) { FATran tran = e.Row as FATran; if (tran != null && tran.TranType == FATran.tranType.TransferPurchasing && tran.Released != true) { SetCurrentAsset(tran); FixedAsset asset = PXCache <FixedAsset> .CreateCopy(Asset.Current); FADetails details = PXCache <FADetails> .CreateCopy(assetdetails.Current); FALocationHistory lastLocation = locationHistory.SelectSingle(tran.AssetID); locationHistory.Delete(lastLocation); FALocationHistory restoringLocation = locationHistory.SelectSingle(tran.AssetID); if (restoringLocation == null) { throw new PXException(Messages.PrevLocationRevisionNotFound, asset.AssetID); } details.LocationRevID = restoringLocation.RevisionID; assetdetails.Update(details); asset.BranchID = restoringLocation.BranchID ?? asset.BranchID; asset.FASubID = restoringLocation.FASubID ?? asset.FASubID; asset.AccumulatedDepreciationSubID = restoringLocation.AccumulatedDepreciationSubID ?? asset.AccumulatedDepreciationSubID; asset.DepreciatedExpenseSubID = restoringLocation.DepreciatedExpenseSubID ?? asset.DepreciatedExpenseSubID; asset.DisposalSubID = restoringLocation.DisposalSubID ?? asset.DisposalSubID; asset.GainSubID = restoringLocation.GainSubID ?? asset.GainSubID; asset.LossSubID = restoringLocation.LossSubID ?? asset.LossSubID; Asset.Update(asset); } }
protected virtual bool IsAccrualAccount <TAccountID, TSubID>(FATran tran, FixedAsset asset) where TAccountID : IBqlField where TSubID : IBqlField { return((int?)this.Caches <FATran>().GetValue <TAccountID>(tran) == asset.FAAccrualAcctID && (int?)this.Caches <FATran>().GetValue <TSubID>(tran) == asset.FAAccrualSubID); }
protected void btnTransferFA_Click(object sender, EventArgs e) { int fixedAssetId = (int)Session["fixedAssetId"]; FixedAsset fa = _presenter.GetFixedAsset(fixedAssetId); if (fa.Custodian == "Store") { Master.ShowMessage(new AppMessage("Transfer can only be done from a person to another person!", RMessageType.Error)); } else { fa.Custodian = ddlNewCustodian.SelectedValue; FixedAssetHistory fah = new FixedAssetHistory(); fah.TransactionDate = DateTime.Now; fah.Custodian = ddlNewCustodian.SelectedValue; fah.Operation = "Transfered"; fa.FixedAssetHistories.Add(fah); _presenter.SaveOrUpdateFixedAsset(fa); BindFixedAssets(); Session["fixedAssetId"] = null; Master.ShowMessage(new AppMessage("Fixed Asset successfully transfered!", RMessageType.Info)); } }
// // GET: /FixedAsset/Edit/5 public ActionResult Edit(int id) { FixedAsset fixedAsset = ctx.FixedAssets.Where(x => x.IdFixedAsset == id).First(); string currUserId = User.Identity.GetUserId(); //redirects user to the 403 page if he is trying to change data that is not his own if (fixedAsset.ApplicationUserId != currUserId) { throw new HttpException(403, "Forbidden"); } FixedAssetViewModel fixedAssetViewModel = new FixedAssetViewModel() { Id = fixedAsset.IdFixedAsset, ApplicationUserId = fixedAsset.ApplicationUserId, Name = fixedAsset.NameFixedAsset, Date = fixedAsset.DateFixedAsset.ToShortDateString(), PurchaseValue = fixedAsset.PurchaseValue.ToString(), BookValue = fixedAsset.BookValue.ToString(), JournalEntryNum = fixedAsset.JournalEntryNum, Lifetime = fixedAsset.Lifetime, WriteDownValue = fixedAsset.WriteDownValue.ToString(), WriteDownRate = fixedAsset.WriteDownRate.ToString(), BookValueAtYearEnd = fixedAsset.BookValueAtYearEnd.ToString(), }; return(View(fixedAssetViewModel)); }
protected void btnReturn_Click(object sender, EventArgs e) { int fixedAssetId = (int)Session["fixedAssetId"]; FixedAsset fa = _presenter.GetFixedAsset(fixedAssetId); if (fa.Custodian == "Store") { Master.ShowMessage(new AppMessage("The current item is still in the Store!", RMessageType.Error)); } else { fa.Custodian = "Store"; FixedAssetHistory fah = new FixedAssetHistory(); fah.TransactionDate = DateTime.Now; fah.Custodian = "Store"; fah.Operation = "Returned"; fa.FixedAssetHistories.Add(fah); _presenter.SaveOrUpdateFixedAsset(fa); BindFixedAssets(); Session["fixedAssetId"] = null; Master.ShowMessage(new AppMessage("Fixed Asset successfully returned to the Store!", RMessageType.Info)); } }
public async Task <ActionResult <FixedAsset> > PostFixedAsset(FixedAsset fixedAsset) { _context.FixedAsset.Add(fixedAsset); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFixedAsset", new { id = fixedAsset.FixedAssetID }, fixedAsset)); }
public async Task <IActionResult> PutFixedAsset(FixedAsset fixedAsset) { //if (id != fixedAsset.FixedAssetID) //{ // return BadRequest(); //} _context.Entry(fixedAsset).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FixedAssetExists(fixedAsset.FixedAssetID)) { return(NotFound()); } else { throw; } } return(NoContent()); }
protected virtual void FixedAsset_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { FixedAsset asset = (FixedAsset)e.Row; // AssetID can be <0 when the datasource inserts a temporary record on redirect from selector if (asset == null || asset.AssetID < 0) { return; } FADetails assetdet = PXSelect <FADetails, Where <FADetails.assetID, Equal <Required <FADetails.assetID> > > > .Select(this, asset.AssetID); try { AssetProcess.ThrowDisabled_Dispose(this, asset, assetdet, fasetup.Current, (DateTime)Filter.Current.DisposalDate, Filter.Current.DisposalPeriodID, Filter.Current.DeprBeforeDisposal == true); } catch (PXException exc) { PXUIFieldAttribute.SetEnabled <FixedAsset.selected>(sender, asset, false); sender.RaiseExceptionHandling <FixedAsset.selected>(asset, null, new PXSetPropertyException(exc.MessageNoNumber, PXErrorLevel.RowWarning)); } if (Filter.Current.DisposalAmtMode == DisposalFilter.disposalAmtMode.Manual && asset.Selected == true && asset.DisposalAmt == null) { sender.RaiseExceptionHandling <FixedAsset.disposalAmt>(asset, null, new PXSetPropertyException(ErrorMessages.FieldIsEmpty, PXUIFieldAttribute.GetDisplayName <FixedAsset.disposalAmt>(sender))); } }
protected void ddlOperation_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddlOperation = (DropDownList)sender; DataGridItem datagridRow = (DataGridItem)ddlOperation.NamingContainer; int fixedAssetId = (int)dgFixedAsset.DataKeys[datagridRow.ItemIndex]; Session["fixedAssetId"] = fixedAssetId; FixedAsset fa = _presenter.GetFixedAsset(fixedAssetId); if (ddlOperation.SelectedValue == "Update") { txtAssetCode.Text = fa.AssetCode; txtSerialNo.Text = fa.SerialNo; txtLocation.Text = fa.Location; txtCondition.Text = fa.Condition; txtTotalLife.Text = fa.TotalLife.ToString(); txtRemark.Text = fa.Remark; ScriptManager.RegisterStartupScript(this, GetType(), "showUpdateFAModal", "showUpdateFAModal();", true); } else if (ddlOperation.SelectedValue == "Transfer") { lblCurrentCustodian.Text = fa.Custodian; ScriptManager.RegisterStartupScript(this, GetType(), "showTransferFAModal", "showTransferFAModal();", true); } else if (ddlOperation.SelectedValue == "Return") { PopStores(); lblRtrnCrntCust.Text = fa.Custodian; ScriptManager.RegisterStartupScript(this, GetType(), "showReturnFAModal", "showReturnFAModal();", true); } ddlOperation.SelectedValue = ""; }
public void FixedAssetQueryUsingoAuth() { QueryService <FixedAsset> entityQuery = new QueryService <FixedAsset>(qboContextoAuth); FixedAsset existing = Helper.FindOrAdd <FixedAsset>(qboContextoAuth, new FixedAsset()); int count = entityQuery.ExecuteIdsQuery("Select * from FixedAsset where Id='" + existing.Id + "'").Count; Assert.IsTrue(count > 0); }
public void FixedAssetQueryUsingoAuth() { QueryService <FixedAsset> entityQuery = new QueryService <FixedAsset>(qboContextoAuth); FixedAsset existing = Helper.FindOrAdd <FixedAsset>(qboContextoAuth, new FixedAsset()); List <FixedAsset> entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); Assert.IsTrue(entities.Count() > 0); }
public ActionResult DeleteConfirmed(int id) { FixedAsset fixedAsset = _context.FixedAssets.Find(id); _context.FixedAssets.Remove(fixedAsset); _context.SaveChanges(); return(RedirectToAction("Admin", "Home")); }
public void Delete(FixedAsset fixedAsset) { using (AssociationDbContext context = new AssociationDbContext()) { context.Entry(fixedAsset).State = EntityState.Deleted; context.SaveChanges(); } }
public void Post([FromBody] FixedAsset value) { // Get db and collection var client = new MongoClient(ConfigurationManager.AppSettings["MongoDBConnectionString"]); var db = client.GetDatabase(ConfigurationManager.AppSettings["MongoDBName"]); var collection = db.GetCollection <FixedAsset>("Forms"); collection.InsertOne(value); // Insert new form }
public void ActivateFixedAsset(FixedAsset fixedAsset) { var command = new ActivateFixedAssetCommand { FixedAsset = fixedAsset }; processXml.Process(command.ToXml()); }
public FixedAsset Update(FixedAsset FA, string userid) { var sqlQuery = string.Format(@"UPDATE FIXEDASSET SET IDFIXEDASSET = '{0}', FIXEDASSETNAME = '{1}', DESCRIPTION = '{2}', FIXEDASSETGROUP = '{3}', UOM = '{4}', ISACTIVE = '{5}', COMPANYSITE = '{6}', UPDATEBY = {7}, UPDATEDATE = '{8}' WHERE SID = {9}", FA.IDFIXEDASSET, FA.FIXEDASSETNAME, FA.DESCRIPTION, FA.FIXEDASSETGROUP, FA.UOM, FA.ISACTIVE, FA.COMPANYSITE, Convert.ToInt32(userid), DateTime.Now, FA.SID); this._db.Execute(sqlQuery, FA); return(FA); }
public void FixedAssetAddAsyncTestsUsingoAuth() { //Creating the FixedAsset for Add FixedAsset entity = QBOHelper.CreateFixedAsset(qboContextoAuth); FixedAsset added = Helper.AddAsync <FixedAsset>(qboContextoAuth, entity); QBOHelper.VerifyFixedAsset(entity, added); }
public async Task UpdateFixedAsset(FixedAsset FixedAsset) { var response = await httpService.Put(url, FixedAsset); if (!response.Success) { throw new ApplicationException(await response.GetBody()); } }
public FixedAsset Add(FixedAsset FA, string userid) { var sqlQuery = @"INSERT INTO FixedAsset (IDFIXEDASSET, FIXEDASSETNAME, DESCRIPTION, FIXEDASSETGROUP, UOM, ISACTIVE, COMPANYSITE, INPUTBY, INPUTDATE, UPDATEBY, UPDATEDATE) VALUES ('" + FA.IDFIXEDASSET + @"', '" + FA.FIXEDASSETNAME + "', '" + FA.DESCRIPTION + @"', '" + FA.FIXEDASSETGROUP + @"', '" + FA.UOM + @"', '" + FA.ISACTIVE + @"', '" + FA.COMPANYSITE + @"'," + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"', " + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"'); " + "SELECT CAST(SCOPE_IDENTITY() as int)"; var SID = _db.Query <int>(sqlQuery, FA).Single(); FA.SID = SID; return(FA); }
public ActionResult Details(FixedAsset model) { if (model == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } return(View(model)); }
public void FixedAssetVoidAsyncTestsUsingoAuth() { //Creating the FixedAsset for Adding FixedAsset entity = QBOHelper.CreateFixedAsset(qboContextoAuth); //Adding the FixedAsset FixedAsset added = Helper.Add <FixedAsset>(qboContextoAuth, entity); Helper.VoidAsync <FixedAsset>(qboContextoAuth, added); }
private void CustomizeComboBoxes(FixedAssetEditPresenter fixedAssetEditPresenter, FixedAsset asset) { KindMethods kindMethods = new KindMethods(); SubgroupMethods subgroupMethods = new SubgroupMethods(); PersonMethods personMethods = new PersonMethods(); fixedAssetEditPresenter.View.ComboBox_Id_Kind.ItemsSource = kindMethods.GetAllKindsAsStringArray(); fixedAssetEditPresenter.View.ComboBox_id_subgroup.ItemsSource = subgroupMethods.GetAllSubgroupsAsStringArray(); fixedAssetEditPresenter.View.ComboBox_Id_Kind.SelectedValue = KindMethods.GetNameByIdWebServiceMethod((int)asset.id_kind); fixedAssetEditPresenter.View.ComboBox_id_subgroup.SelectedValue = SubgroupMethods.GetNameByIdWebServiceMethod((int)asset.id_subgroup, false); fixedAssetEditPresenter.View.ComboBox_casation.ItemsSource = new List<string>() { "TAK", "NIE" }; fixedAssetEditPresenter.View.ComboBox_Id_Person.ItemsSource = personMethods.GetAllPersonsAsStringArray(); if (asset.cassation) { fixedAssetEditPresenter.View.ComboBox_casation.SelectedValue = "TAK"; } else { fixedAssetEditPresenter.View.ComboBox_casation.SelectedValue = "NIE"; } bool isChecked = asset.date_of_desactivation.HasValue ? true : false; fixedAssetEditPresenter.View.checkBoxDesactivation.IsChecked = isChecked; string person_name = personMethods.GetNameSurnameIdByID((int)asset.id_person).Trim(); fixedAssetEditPresenter.View.ComboBox_Id_Person.SelectedValue = person_name; }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { try { FixedAssetPresenter fixedAssetPresenter = (FixedAssetPresenter)this.DataContext; FixedAsset asset = new FixedAsset(); DeepClone.CopyTo((FixedAsset)(fixedAssetPresenter.View.dataGridFixedAssets.SelectedItem), asset); FixedAssetEditPresenter fixedAssetEditPresenter = new FixedAssetEditPresenter(new FixedAssetEditView(), asset); CustomizeComboBoxes(fixedAssetEditPresenter, asset); fixedAssetEditPresenter.View.Label_AddOrEditFixedAsset.Content = "Edytowanie środka trwałego"; if (fixedAssetEditPresenter.View.ShowDialog() == true) { asset.last_modified_date = DateTime.Now; fixedAssetPresenter.SaveFixedAsset(asset, true); FixedAsset temp = (FixedAsset)fixedAssetPresenter.View.dataGridFixedAssets.SelectedItem; ChangeCurrentRow(fixedAssetPresenter, fixedAssetEditPresenter, temp); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ChangeCurrentRow(FixedAssetPresenter fixedAssetPresenter, FixedAssetEditPresenter fixedassetEdit, FixedAsset obj) { FixedAsset asset = ((FixedAsset)fixedassetEdit.View.DataContext); obj.id = asset.id; obj.cassation = asset.cassation; obj.comment = asset.comment; obj.created_by = asset.created_by; obj.date_of_activation = asset.date_of_activation; obj.date_of_desactivation = asset.date_of_desactivation; obj.id_contractor = asset.id_contractor; obj.id_kind = asset.id_kind; obj.id_person = asset.id_person; obj.id_subgroup = asset.id_subgroup; obj.inventory_number = asset.inventory_number; obj.last_modifed_login = asset.last_modifed_login; obj.last_modified_date = asset.last_modified_date; obj.localization = asset.localization; obj.MPK = asset.MPK; obj.quantity = asset.quantity; obj.serial_number = asset.serial_number; fixedAssetPresenter.View.dataGridFixedAssets.Items.Refresh(); }