public long Save(long tranId, DateTime valueDate, int storeId, string partyCode, int priceTypeId, string referenceNumber, string data, string statementReference, string attachmentsJSON) { if (!StockTransaction.IsValidStockTransactionByTransactionMasterId(tranId)) { throw new InvalidOperationException(Resources.Warnings.InvalidStockTransaction); } if (!StockTransaction.IsValidPartyByTransactionMasterId(tranId, partyCode)) { throw new InvalidOperationException(Resources.Warnings.InvalidParty); } Collection <StockDetail> details = CollectionHelper.GetStockMasterDetailCollection(data, storeId); if (!this.ValidateDetails(details, tranId)) { return(0); } Collection <Attachment> attachments = CollectionHelper.GetAttachmentCollection(attachmentsJSON); int officeId = CurrentSession.GetOfficeId(); int userId = CurrentSession.GetUserId(); long loginId = CurrentSession.GetLogOnId(); return(Data.Transactions.Return.PostTransaction(tranId, valueDate, officeId, userId, loginId, storeId, partyCode, priceTypeId, referenceNumber, statementReference, details, attachments)); }
public override void OnControlLoad(object sender, EventArgs e) { string itemCode = this.Page.Request["ItemCode"]; DateTime from = Conversion.TryCastDate(this.Page.Request["From"]); DateTime to = Conversion.TryCastDate(this.Page.Request["To"]); int storeId = Conversion.TryCastInteger(this.Page.Request["StoreId"]); int userId = CurrentSession.GetUserId(); Collection <KeyValuePair <string, object> > parameter1 = new Collection <KeyValuePair <string, object> >(); parameter1.Add(new KeyValuePair <string, object>("@ItemCode", itemCode)); Collection <KeyValuePair <string, object> > parameter2 = new Collection <KeyValuePair <string, object> >(); parameter2.Add(new KeyValuePair <string, object>("@From", from)); parameter2.Add(new KeyValuePair <string, object>("@To", to)); parameter2.Add(new KeyValuePair <string, object>("@UserId", userId.ToString(CultureInfo.InvariantCulture))); parameter2.Add(new KeyValuePair <string, object>("@ItemCode", itemCode)); parameter2.Add(new KeyValuePair <string, object>("@StoreId", storeId.ToString(CultureInfo.InvariantCulture))); using (Report report = new Report()) { report.AddParameterToCollection(parameter1); report.AddParameterToCollection(parameter2); report.RunningTotalText = Titles.RunningTotal; report.ResourceAssembly = Assembly.GetAssembly(typeof(AccountStatementReport)); report.Path = "~/Modules/Inventory/Reports/Source/Inventory.AccountStatement.xml"; report.AutoInitialize = true; this.Controls.Add(report); } }
public override void OnControlLoad(object sender, EventArgs e) { string accountNumber = this.Page.Request["AccountNumber"]; DateTime from = Conversion.TryCastDate(this.Page.Request["From"]); DateTime to = Conversion.TryCastDate(this.Page.Request["To"]); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); Collection <KeyValuePair <string, object> > parameter1 = new Collection <KeyValuePair <string, object> >(); parameter1.Add(new KeyValuePair <string, object>("@OfficeId", officeId.ToString(CultureInfo.InvariantCulture))); parameter1.Add(new KeyValuePair <string, object>("@AccountNumber", accountNumber)); Collection <KeyValuePair <string, object> > parameter2 = new Collection <KeyValuePair <string, object> >(); parameter2.Add(new KeyValuePair <string, object>("@From", from)); parameter2.Add(new KeyValuePair <string, object>("@To", to)); parameter2.Add(new KeyValuePair <string, object>("@UserId", userId.ToString(CultureInfo.InvariantCulture))); parameter2.Add(new KeyValuePair <string, object>("@AccountNumber", accountNumber)); parameter2.Add(new KeyValuePair <string, object>("@OfficeId", officeId.ToString(CultureInfo.InvariantCulture))); using (Report report = new Report()) { report.AddParameterToCollection(parameter1); report.AddParameterToCollection(parameter2); report.RunningTotalText = Titles.RunningTotal; report.ResourceAssembly = Assembly.GetAssembly(typeof(GLAdviceReport)); report.Path = "~/Modules/Finance/Reports/Source/Transactions.AccountStatement.xml"; report.AutoInitialize = true; this.Placeholder1.Controls.Add(report); } }
public void Save(string key, string value) { int userId = CurrentSession.GetUserId(); if (userId.Equals(0)) { return; } if (string.IsNullOrWhiteSpace(key)) { return; } if (string.IsNullOrWhiteSpace(value)) { return; } const string sessionKey = BackOffice.Admin.LocalizeMixERP.sessionKey; string cultureCode = Conversion.TryCastString(SessionHelper.GetSessionKey(sessionKey)); if (string.IsNullOrWhiteSpace(cultureCode)) { return; } Data.Admin.LocalizeMixERP.Save(cultureCode, key, value); }
public static IEnumerable <Entities.Core.Menu> GetRootMenuCollection(string path) { int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); string culture = CurrentSession.GetCulture().TwoLetterISOLanguageName; return(Factory.Get <Entities.Core.Menu>("SELECT * FROM policy.get_menu(@0, @1, @2) WHERE parent_menu_id=core.get_root_parent_menu_id(@3) ORDER BY menu_id;", userId, officeId, culture, path)); }
public void Reject(long tranId, string reason) { int officeId = CurrentSession.GetOfficeId(); int userId = CurrentSession.GetUserId(); long loginId = CurrentSession.GetLogOnId(); const int verificationStatusId = -3; Transaction.Verify(tranId, officeId, userId, loginId, verificationStatusId, reason); }
public static IEnumerable <Entities.Core.Menu> GetMenuCollection(string path, short level) { string relativePath = path; int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); string culture = CurrentSession.GetCulture().TwoLetterISOLanguageName; return(Factory.Get <Entities.Core.Menu>("SELECT * FROM policy.get_menu(@0, @1, @2) WHERE parent_menu_id=(SELECT menu_id FROM core.menus WHERE url=@3) AND level=@4 ORDER BY menu_id;", userId, officeId, culture, relativePath, level)); }
private long PostTransaction(string partyCode, string currencyCode, decimal amount, decimal debitExchangeRate, decimal creditExchangeRate, string referenceNumber, string statementReference, int costCenterId, int cashRepositoryId, DateTime?postedDate, int bankAccountId, string bankInstrumentCode, string bankTransactionCode) { int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); long loginId = CurrentSession.GetLogOnId(); long transactionMasterID = Data.Transactions.Receipt.PostTransaction(userId, officeId, loginId, partyCode, currencyCode, amount, debitExchangeRate, creditExchangeRate, referenceNumber, statementReference, costCenterId, cashRepositoryId, postedDate, bankAccountId, bankInstrumentCode, bankTransactionCode); return(transactionMasterID); }
private void BindGridView() { DateTime from = Conversion.TryCastDate(this.fromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.toDateTextBox.Text); int userId = CurrentSession.GetUserId(); string accountNumber = this.accountNumberInputText.Value; int officeId = CurrentSession.GetOfficeId(); this.statementGridView.DataSource = Data.Reports.AccountStatement.GetAccountStatement(from, to, userId, accountNumber, officeId); this.statementGridView.DataBound += this.StatementGridViewDataBound; this.statementGridView.DataBind(); }
private void BindGrid() { DateTime from = Conversion.TryCastDate(this.fromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.toDateTextBox.Text); decimal factor = Conversion.TryCastDecimal(this.factorInputText.Value); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); this.cashflowStatementGridView.DataSource = Data.Reports.CashFlow.GetDirectCashFlowStatement(from, to, userId, officeId, factor); this.cashflowStatementGridView.DataBind(); }
public static IEnumerable <Entities.Core.Menu> GetMenuCollection(int parentMenuId, short level) { int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); string culture = CurrentSession.GetCulture().TwoLetterISOLanguageName; if (parentMenuId > 0) { return(Factory.Get <Entities.Core.Menu>("SELECT * FROM policy.get_menu(@0, @1, @2) WHERE parent_menu_id=@3 AND level=@4 ORDER BY menu_id;", userId, officeId, culture, parentMenuId, level)); } return(Factory.Get <Entities.Core.Menu>("SELECT * FROM policy.get_menu(@0, @1, @2) WHERE parent_menu_id is null ORDER BY menu_id;", userId, officeId, culture)); }
public bool Save(Collection <Data.Models.Reorder> details) { if (details == null) { throw new ArgumentNullException("details"); } long loginId = CurrentSession.GetLogOnId(); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); return(Data.Transactions.Reorder.Save(loginId, userId, officeId, details)); }
private void Flag_Updated(object sender, FlagUpdatedEventArgs e) { int flagTypeId = e.FlagId; const string resource = "transactions.transaction_master"; const string resourceKey = "transaction_master_id"; int userId = CurrentSession.GetUserId(); TransactionGovernor.Flags.CreateFlag(userId, flagTypeId, resource, resourceKey, this.GetSelectedValues()); this.BindGrid(); }
private void BindGrid() { DateTime from = Conversion.TryCastDate(this.fromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.toDateTextBox.Text); decimal factor = Conversion.TryCastDecimal(this.factorInputText.Value); bool compact = this.ShowCompact(); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); this.plAccountGridView.DataSource = Data.Reports.ProfitAndLossAccount.GetPLAccount(from, to, userId, officeId, compact, factor); this.plAccountGridView.DataBind(); }
private void Flag_Updated(object sender, FlagUpdatedEventArgs e) { int flagTypeId = e.FlagId; const string resource = "account_statement"; const string resourceKey = "transaction_code"; int userId = CurrentSession.GetUserId(); TransactionGovernor.Flags.CreateFlag(userId, flagTypeId, resource, resourceKey, this.GetSelectedValues()); this.BindGridView(); this.CreateAccountOverviewPanel(this.accountOverviewTab); }
private void BindGrid() { DateTime previousTerm = Conversion.TryCastDate(this.previousPeriodDateTextBox.Text); DateTime currentTerm = Conversion.TryCastDate(this.currentPeriodDateTextBox.Text); int factor = Conversion.TryCastInteger(this.factorInputText.Value); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); using (DataTable table = Data.Reports.BalanceSheet.GetBalanceSheet(previousTerm, currentTerm, userId, officeId, factor)) { this.grid.DataSource = table; this.grid.DataBind(); } }
public bool InitializeEODOperation() { if (!CurrentSession.IsAdmin()) { return(false); } int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); Data.EODOperation.Initialize(userId, officeId); this.ForceLogOff(officeId); return(true); }
private void OkButton_Click(object sender, EventArgs e) { string tranId = this.GetTranId(); if (string.IsNullOrWhiteSpace(tranId)) { return; } if (this.IsNonGlTransaction) { this.messageLabel.Text = Labels.CannotWithdrawNotValidGLTransaction; this.messageLabel.CssClass = "ui block message red vpad12"; return; } DateTime transactionDate = DateTime.Now; long transactionMasterId = Conversion.TryCastLong(tranId); Entities.Models.Transactions.Verification model = Verification.GetVerificationStatus(transactionMasterId); if ( model.VerificationStatusId.Equals(0) //Awaiting verification || model.VerificationStatusId.Equals(2) //Automatically Approved by Workflow ) { //Withdraw this transaction. if (transactionMasterId > 0) { if (Verification.WithdrawTransaction(transactionMasterId, CurrentSession.GetUserId(), this.reasonTextBox.Text)) { this.messageLabel.Text = string.Format(CultureInfo.CurrentCulture, Labels.TransactionWithdrawnMessage, transactionDate.ToShortDateString()); this.messageLabel.CssClass = "ui block message yellow vpad12"; } } } else { this.messageLabel.Text = Labels.CannotWithdrawTransaction; this.messageLabel.CssClass = "ui block message red vpad12"; } this.ShowVerificationStatus(tranId, this.verificationLabel); }
private void BindGrid() { DateTime from = Conversion.TryCastDate(this.fromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.toDateTextBox.Text); decimal factor = Conversion.TryCastDecimal(this.factorInputText.Value); bool compact = this.ShowCompact(); bool changeSide = this.ChangeSideWhenNegative(); bool includeZeroBalanceAccounts = this.IncludeZeroBalanceAccounts(); int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); using (DataTable table = Data.Reports.TrialBalance.GetTrialBalance(from, to, userId, officeId, compact, factor, changeSide, includeZeroBalanceAccounts)) { this.trialBalanceGridView.DataSource = table; this.trialBalanceGridView.DataBind(); } }
private void BindGrid() { int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); DateTime from = Conversion.TryCastDate(this.dateFromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.dateToDateTextBox.Text); long tranId = Conversion.TryCastLong(this.tranIdInputText.Value); string tranCode = this.tranCodeInputText.Value; string book = this.bookInputText.Value; string referenceNumber = this.referenceNumberInputText.Value; string statementReference = this.statementReferenceInputText.Value; string postedBy = this.postedByInputText.Value; string office = this.officeInputText.Value; string status = this.statusInputText.Value; string verifiedBy = this.verifiedByInputText.Value; string reason = this.reasonInputText.Value; this.transactionGridView.DataSource = Data.Journal.GetJournalView(userId, officeId, from, to, tranId, tranCode, book, referenceNumber, statementReference, postedBy, office, status, verifiedBy, reason); this.transactionGridView.DataBind(); }
public SubmitAnswerOutput SubmitAnswer(SubmitAnswerInput input) { var question = _questionRepository.Get(input.QuestionId); var currentUser = _userRepository.Get(CurrentSession.GetUserId()); question.AnswerCount++; var answer = _answerRepository.Insert( new Answer(input.Text) { Question = question, CreatorUser = currentUser }); _unitOfWorkManager.Current.SaveChanges(); return(new SubmitAnswerOutput { Answer = answer.MapTo <AnswerDto>() }); }
public long Save(DateTime valueDate, string referenceNumber, string statementReference, List <StockAdjustmentDetail> models) { foreach (var model in models) { if (model.TransferType == TransactionType.Credit) { decimal existingQuantity = Data.Helpers.Items.CountItemInStock(model.ItemCode, model.UnitName, model.StoreName); if (existingQuantity < model.Quantity) { throw new MixERPException(string.Format(CultureInfo.CurrentCulture, Errors.InsufficientStockWarning, Conversion.TryCastInteger(existingQuantity), model.UnitName, model.ItemName)); } } } int officeId = CurrentSession.GetOfficeId(); int userId = CurrentSession.GetUserId(); long loginId = CurrentSession.GetLogOnId(); return(Data.Transactions.StockAdjustment.Add(officeId, userId, loginId, valueDate, referenceNumber, statementReference, models.ToCollection())); }
private void LoadGridView() { DateTime dateFrom = Conversion.TryCastDate(this.dateFromDateTextBox.Text); DateTime dateTo = Conversion.TryCastDate(this.dateToDateTextBox.Text); string office = this.officeInputText.Value; string party = this.partyInputText.Value; string priceType = string.Empty; string user = this.userInputText.Value; string referenceNumber = this.referenceNumberInputText.Value; string statementReference = this.statementReferenceInputText.Value; string bookName = TransactionBookHelper.GetInvariantTransactionBookName(this.Book, this.SubBook); if (this.priceTypeInputText != null) { priceType = this.priceTypeInputText.Value; } int userId = CurrentSession.GetUserId(); int officeId = CurrentSession.GetOfficeId(); GridViewColumnHelper.AddColumns(this.productViewGridView, this.SubBook); if (this.IsNonGlTransaction) { this.productViewGridView.DataSource = NonGlStockTransaction.GetView(bookName, dateFrom, dateTo, office, party, priceType, user, referenceNumber, statementReference); this.productViewGridView.DataBind(); return; } if (this.SubBook == SubTranBook.Receipt) { this.productViewGridView.DataSource = CustomerReceipts.GetView(userId, officeId, dateFrom, dateTo, office, party, user, referenceNumber, statementReference); this.productViewGridView.DataBind(); return; } this.productViewGridView.DataSource = GLStockTransaction.GetView(bookName, dateFrom, dateTo, office, party, priceType, user, referenceNumber, statementReference); this.productViewGridView.DataBind(); }
public bool Save(string book, long id, string attachmentsJSON) { if (string.IsNullOrWhiteSpace(book)) { throw new ArgumentNullException("book"); } if (id <= 0) { throw new ArgumentNullException("id"); } if (string.IsNullOrWhiteSpace(attachmentsJSON)) { throw new ArgumentNullException("attachmentsJSON"); } Collection <Attachment> attachments = CollectionHelper.GetAttachmentCollection(attachmentsJSON); int userId = CurrentSession.GetUserId(); return(Data.Attachments.Save(userId, book, id, attachments)); }
private void BindGridView() { DateTime from = Conversion.TryCastDate(this.fromDateTextBox.Text); DateTime to = Conversion.TryCastDate(this.toDateTextBox.Text); int userId = CurrentSession.GetUserId(); string itemCode = this.itemCodeInputText.Value; int storeId = Conversion.TryCastInteger(this.storeIdHidden.Value); if (string.IsNullOrWhiteSpace(itemCode)) { return; } if (storeId.Equals(0)) { return; } this.statementGridView.DataSource = Data.Reports.StockItems.GetAccountStatement(from, to, userId, itemCode, storeId); this.statementGridView.DataBound += this.StatementGridViewDataBound; this.statementGridView.DataBind(); }
private void Flag_Updated(object sender, FlagUpdatedEventArgs e) { int flagTypeId = e.FlagId; string resource = this.DbTableName; string resourceKey = this.PrimaryKey; if (string.IsNullOrWhiteSpace(resource)) { throw new MixERPException(Warnings.CannotCreateFlagTransactionTableNull); } if (string.IsNullOrWhiteSpace(resourceKey)) { throw new MixERPException(Warnings.CannotCreateFlagTransactionTablePrimaryKeyNull); } int userId = CurrentSession.GetUserId(); Flags.CreateFlag(userId, flagTypeId, resource, resourceKey, this.GetSelectedValues().Select(t => Conversion.TryCastString(t)).ToList().ToCollection()); this.LoadGridView(); }
public static long Add(DateTime valueDate, int storeId, bool isCredit, string partyCode, Collection <StockDetail> details, int costCenterId, string referenceNumber, string statementReference, Collection <Attachment> attachments) { StockMaster stockMaster = new StockMaster(); stockMaster.PartyCode = partyCode; stockMaster.StoreId = storeId; stockMaster.IsCredit = isCredit; if (!string.IsNullOrWhiteSpace(statementReference)) { statementReference = statementReference.Replace(" ", " ").Trim(); } long transactionMasterId = GlTransaction.Add(valueDate, "Purchase.Direct", CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), costCenterId, referenceNumber, statementReference, stockMaster, details, new Collection <long>(), attachments); return(transactionMasterId); }
public static long Add(DateTime valueDate, string referenceNumber, int costCenterId, Collection <JournalDetail> details, Collection <Attachment> attachments) { long transactionMasterId = Add(valueDate, CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), costCenterId, referenceNumber, details, attachments); return(transactionMasterId); }
public static long Add(DateTime valueDate, int storeId, string partyCode, int priceTypeId, int paymentTermId, Collection <StockDetail> details, int shipperId, string shippingAddressCode, decimal shippingCharge, int costCenterId, string referenceNumber, int agentId, string statementReference, Collection <int> transactionIdCollection, Collection <Attachment> attachments, bool nonTaxable) { StockMaster stockMaster = new StockMaster(); stockMaster.PartyCode = partyCode; stockMaster.IsCredit = true; //Credit stockMaster.PaymentTermId = paymentTermId; stockMaster.PriceTypeId = priceTypeId; stockMaster.ShipperId = shipperId; stockMaster.ShippingAddressCode = shippingAddressCode; stockMaster.ShippingCharge = shippingCharge; stockMaster.SalespersonId = agentId; stockMaster.StoreId = storeId; long transactionMasterId = GlTransaction.Add("Sales.Delivery", valueDate, CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), costCenterId, referenceNumber, statementReference, stockMaster, details, attachments, nonTaxable); return(transactionMasterId); }
public static long Add(DateTime valueDate, string partyCode, int priceTypeId, Collection <StockDetail> details, string referenceNumber, string statementReference, Collection <long> transactionIdCollection, Collection <Attachment> attachments, bool nonTaxable, int salesPersonId, int shipperId, string shippingAddressCode, int storeId) { StockMaster stockMaster = new StockMaster(); stockMaster.PartyCode = partyCode; stockMaster.PriceTypeId = priceTypeId; stockMaster.SalespersonId = salesPersonId; stockMaster.ShipperId = shipperId; stockMaster.ShippingAddressCode = shippingAddressCode; stockMaster.StoreId = storeId; long nonGlStockMasterId = NonGlStockTransaction.Add("Sales.Order", valueDate, CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), referenceNumber, statementReference, stockMaster, details, transactionIdCollection, attachments, nonTaxable); return(nonGlStockMasterId); }