//------------------------------------------------------------------------------------------- private void PopulateTree(WeavverEntityContainer data, TreeNode parentNode, IOrderedQueryable <Weavver.Data.KnowledgeBase> items) { foreach (var article in items.ToList()) { TreeNode node = new TreeNode(article.Title, article.Id.ToString()); if (parentNode == null) { Navigation.Nodes.Add(node); } else { parentNode.ChildNodes.Add(node); } //if (article.KnowledgeBase2Reference.HasValue) //{ var childItems = from childArticles in data.KnowledgeBase where childArticles.ParentId == article.Id && article.OrganizationId == SelectedOrganization.Id orderby childArticles.Position, childArticles.Title select childArticles; PopulateTree(data, node, childItems); //} } }
//------------------------------------------------------------------------------------------- public string GetName(Guid nameId) { using (WeavverEntityContainer data = new WeavverEntityContainer()) { return(data.GetName(nameId)); } }
//------------------------------------------------------------------------------------------- public void UpdatePage() { using (WeavverEntityContainer data = new WeavverEntityContainer()) { decimal balance = data.Total_ForLedger(SelectedOrganization.Id, LoggedInUser.OrganizationId, LedgerType.Receivable.ToString(), true, true, false, null, null); // data.Total_ForLedger(LoggedInUser.OrganizationId); var cards = (from items in data.Accounting_CreditCards where items.OrganizationId == SelectedOrganization.Id select items); CreditCards.DataSource = cards; CreditCards.DataTextField = "CensoredAccountNumber"; CreditCards.DataValueField = "Id"; CreditCards.DataBind(); if (balance < 0) { decimal amount = balance * -1; MinimumPaymentDue.Text = "$" + amount.ToString(); Balance.Text = "$" + amount.ToString(); PayBalanceAmount.Text = "$" + amount.ToString(); } } }
//------------------------------------------------------------------------------------------- protected void Submit_Click(object sender, EventArgs e) { if (SearchBox.Text == "") { return; } using (WeavverEntityContainer data = new WeavverEntityContainer()) { var results = data.SearchAllTables(SearchBox.Text); var foundTypes = (results.GroupBy(l => l.TableName) .Select(g => new { Type = CleanUp(g.Key), Count = g.Distinct().Count() })).OrderByDescending(g => g.Count); FoundTypes.DataSource = foundTypes; FoundTypes.DataBind(); var results2 = data.SearchAllTables(SearchBox.Text); var searchResults = (results2 .Select(g => new { TableName = CleanUp(g.TableName), ColumnName = CleanUp(g.ColumnName), ColumnValue = Trim(g.ColumnValue) })); List.DataSource = searchResults; List.DataBind(); } }
//------------------------------------------------------------------------------------------- private void UpdatePage() { using (WeavverEntityContainer data = new WeavverEntityContainer()) { //Guid fromGuid = new Guid(FromAccount.SelectedValue); var fAccounts = (from orgs in data.Logistics_Organizations where orgs.OrganizationId == SelectedOrganization.Id orderby orgs.Name select orgs); FromAccount.DataSource = fAccounts; FromAccount.DataTextField = "Name"; FromAccount.DataValueField = "Id"; FromAccount.DataBind(); var cAccounts = (from accounts in data.Accounting_Accounts where accounts.OrganizationId == SelectedOrganization.Id select accounts); ToAccount.DataSource = cAccounts; ToAccount.DataTextField = "Name"; ToAccount.DataValueField = "Id"; ToAccount.DataBind(); } }
//------------------------------------------------------------------------------------------- public void UpdateTotals() { using (WeavverEntityContainer data = new WeavverEntityContainer()) { foreach (DataGridItem dataitem in List.Items) { Guid key = (Guid)List.DataKeys[dataitem.ItemIndex]; foreach (Sales_ShoppingCartItems item in ShoppingCart.Items) { if (item.Id == key) { int quantity = item.Quantity; TextBox tbQuantity = (TextBox)dataitem.Cells[1].Controls[0]; Int32.TryParse(tbQuantity.Text, out quantity); bool changed = false; if (quantity == 0) { data.Sales_ShoppingCartItems.Attach(item); ShoppingCart.Items.Remove(item); data.Sales_ShoppingCartItems.DeleteObject(item); continue; } else if (quantity != item.Quantity) { data.Sales_ShoppingCartItems.Attach(item); item.Quantity = quantity; } } } } data.SaveChanges(); } }
//------------------------------------------------------------------------------------------- protected override void OnPreInit(EventArgs e) { if (SelectedOrganization == null && ConfigurationManager.AppSettings["install_mode"] == "false") { if (Session["SelectedOrganizationId"] == null) { string vanityurl = (Request["org"] == null) ? "default" : Request["org"]; vanityurl = vanityurl.Replace("default,default", "default"); using (WeavverEntityContainer data = new WeavverEntityContainer()) { var orgs = (from x in data.Logistics_Organizations where x.VanityURL == vanityurl select x); if (orgs.Count() > 0) { SelectedOrganization = orgs.First(); data.Logistics_Organizations.Detach(_selectedOrganization); } } } else { using (WeavverEntityContainer data = new WeavverEntityContainer()) { Guid selectedOrgId = new Guid(Session["SelectedOrganizationId"].ToString()); var orgs = (from x in data.Logistics_Organizations where x.Id == selectedOrgId select x); if (orgs.Count() > 0) { SelectedOrganization = orgs.First(); data.Logistics_Organizations.Detach(_selectedOrganization); } } } } base.OnPreInit(e); }
//------------------------------------------------------------------------------------------- protected void LedgerItemAdd_Click(object sender, EventArgs e) { //List.ShowFooter = true; //List.EditItemIndex = List.Items.Count; LedgerType ledgerType = (LedgerType)Enum.Parse(typeof(LedgerType), Request["ledgertype"], true); using (WeavverEntityContainer data = new WeavverEntityContainer()) { Accounting_LedgerItems item = new Accounting_LedgerItems(); item.Id = Guid.NewGuid(); item.OrganizationId = BasePage.SelectedOrganization.Id; item.LedgerType = ledgerType.ToString(); item.Code = ((CodeType)Enum.Parse(typeof(CodeType), CodeTypeList.SelectedValue, true)).ToString(); item.PostAt = DateTime.Parse(LedgerItemPostAt.Text).ToUniversalTime(); item.AccountId = new Guid(Request["AccountId"]); item.Memo = LedgerItemName.Text; item.Amount = Decimal.Parse(LedgerItemAmount.Text); data.Accounting_LedgerItems.AddObject(item); try { data.SaveChanges(); ErrorMsg.Text = ""; OnDataSaved(this, EventArgs.Empty); } catch (IValidatorException ex) { ErrorMsg.Text = ex.Message; } } }
//------------------------------------------------------------------------------------------- public decimal CalculateMonthlyTotal() { decimal cost = 0; foreach (Control ctrl in UpdatePanel1.ContentTemplateContainer.FindControl("OrderFormControls").Controls) { if (ctrl.GetType() == typeof(DropDownList)) { DropDownList ddl = (DropDownList)ctrl; //DropDownList ddl = (DropDownList) UpdatePanel1.ContentTemplateContainer.FindControl("OrderForm").FindControl("feature-" + i.ToString()); if (ddl != null) { Guid featureOptionId; Guid.TryParse(ddl.SelectedValue, out featureOptionId); using (WeavverEntityContainer data = new WeavverEntityContainer()) { Logistics_FeatureOptions option = (from x in data.Logistics_FeatureOptions where x.Id == featureOptionId select x).First(); if (option != null && option.BillingType == FeatureBillingType.Monthly.ToString()) { cost += option.Cost; } } } } } return(cost + item.UnitMonthly); }
//------------------------------------------------------------------------------------------- void TransactionsDetected_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem) { Accounting_LedgerItems item = (Accounting_LedgerItems)e.Item.DataItem; if (item.Amount.Value < 0) { e.Item.Style["background-color"] = "#FFE9E8"; } else if (item.Amount.Value > 0) { e.Item.Style["background-color"] = "#C1FFC1"; } using (WeavverEntityContainer data = new WeavverEntityContainer()) { var row = (from x in data.Accounting_LedgerItems where x.ExternalId == item.ExternalId select x).FirstOrDefault(); if (row != null) { e.Item.Style["background-color"] = "#d4eaf1"; } else { ((CheckBox)FindControlRecursive(e.Item.Cells[1], "ImportRow")).Checked = true; } e.Item.ToolTip = item.ExternalId; } } }
//------------------------------------------------------------------------------------------- public string AgreementText() { using (WeavverEntityContainer data = new WeavverEntityContainer()) { Legal_Agreements agreement = (from x in data.Legal_Agreements where x.Id == new Guid("a618950e-db72-46ac-afd9-47693caabb96") select x).First(); return(agreement.Body); } }
//------------------------------------------------------------------------------------------- private void AddOrganizationListChoice(Guid orgId) { using (WeavverEntityContainer data = new WeavverEntityContainer()) { var org = (from x in data.Logistics_Organizations where x.Id == orgId select x).First(); OrganizationsList.Items.Add(new ListItem(org.Name, org.Id.ToString())); } }
//------------------------------------------------------------------------------------------- protected void Page_Load(object sender, EventArgs e) { IsPublic = false; // Request // do dns check to see if www.weavver.internal resolves to this server... // http://192.168.5.31/weavverweb if (!IsPostBack) { UpdatePage(null); // Get host name string strHostName = Dns.GetHostName(); Console.WriteLine("Host Name: " + strHostName); // Find host by name IPHostEntry iphostentry = Dns.GetHostByName(strHostName); // Enumerate IP addresses int nIP = 0; Self_URL.Text = ""; foreach (IPAddress ipaddress in iphostentry.AddressList) { Self_URL.Text += "http://" + ipaddress.ToString() + ", "; } char[] charsToTrim = { ',', ' ' }; Self_URL.Text = Self_URL.Text.TrimEnd(charsToTrim); } ReceivablesLink.HRef = String.Format("~/Accounting_LedgerItems/List.aspx?AccountId={0}&LedgerType={1}", LoggedInUser.OrganizationId.ToString(), LedgerType.Receivable.ToString()); PayablesLink.HRef = String.Format("~/Accounting_LedgerItems/List.aspx?AccountId={0}&LedgerType={1}", LoggedInUser.OrganizationId.ToString(), LedgerType.Payable.ToString()); TasksLink.HRef = String.Format("~/HR_Tasks/List.aspx?AssignedTo={0}", LoggedInUser.Id.ToString()); using (WeavverEntityContainer data = new WeavverEntityContainer()) { var accountContent = (from x in data.CMS_Pages where x.Title == "Account/Default" && x.OrganizationId == SelectedOrganization.Id select x).FirstOrDefault(); if (accountContent != null) { AccountContent.Text = accountContent.Page; } } //Response.Write(HttpContext.Current.Items["rawurl"]); //DebugOut("Vanity URL: " + HttpContext.Current.Items["rawurl"]); }
//------------------------------------------------------------------------------------------- protected void TransferFunds_Click(object sender, EventArgs e) { using (WeavverEntityContainer data = new WeavverEntityContainer()) { DateTime postAtDate = DateTime.UtcNow; if (DateTime.TryParse(PostAt.Text, out postAtDate)) { postAtDate = postAtDate.ToUniversalTime(); } Accounting_Accounts accountFrom = (from accounts in data.Accounting_Accounts where accounts.Id == new Guid(FromAccount.SelectedValue) select accounts).FirstOrDefault(); Accounting_Accounts accountTo = (from toAccounts in data.Accounting_Accounts where toAccounts.Id == new Guid(ToAccount.SelectedValue) select toAccounts).FirstOrDefault(); Guid transactionId = Guid.NewGuid(); Accounting_LedgerItems debitAccount1 = new Accounting_LedgerItems(); debitAccount1.OrganizationId = BasePage.SelectedOrganization.Id; debitAccount1.TransactionId = transactionId; debitAccount1.PostAt = postAtDate; debitAccount1.AccountId = accountFrom.Id; debitAccount1.LedgerType = accountFrom.LedgerType; debitAccount1.Code = CodeType.Withdrawal.ToString(); debitAccount1.Memo = String.Format("Transfer to {0}", accountTo.Name); debitAccount1.Amount = Decimal.Parse(Amount.Text) * -1.0m; data.Accounting_LedgerItems.AddObject(debitAccount1); Accounting_LedgerItems creditAccount2 = new Accounting_LedgerItems(); creditAccount2.OrganizationId = BasePage.SelectedOrganization.Id; creditAccount2.TransactionId = transactionId; creditAccount2.PostAt = postAtDate; creditAccount2.AccountId = new Guid(ToAccount.SelectedValue); creditAccount2.LedgerType = accountTo.LedgerType; creditAccount2.Code = CodeType.Deposit.ToString(); creditAccount2.Memo = String.Format("Transfer from {0}", accountFrom.Name); creditAccount2.Amount = Decimal.Parse(Amount.Text); data.Accounting_LedgerItems.AddObject(creditAccount2); data.SaveChanges(); // Response.Redirect("~/Accounting_LedgerItems/List.aspx?TransactionId=" + transactionId.ToString()); } OnDataSaved(this, EventArgs.Empty); }
//------------------------------------------------------------------------------------------- public string GetPageContent(string contentId) { using (WeavverEntityContainer data = new WeavverEntityContainer()) { var content = (from x in data.CMS_Pages where x.Title == contentId && x.OrganizationId == SelectedOrganization.Id select x).FirstOrDefault(); if (content != null) { return(content.Page); } } return(""); }
//------------------------------------------------------------------------------------------- protected void Page_Load(object sender, EventArgs e) { IsPublic = false; Master.FormTitle = "Account Payment"; Master.FormDescription = "Use this tool to make payments or add funds to your account."; Master.FixedWidth = true; using (WeavverEntityContainer data = new WeavverEntityContainer()) { } if (!IsPostBack) { UpdatePage(); } }
//------------------------------------------------------------------------------------------- protected void MakePayment_Click(object sender, EventArgs e) { using (WeavverEntityContainer data = new WeavverEntityContainer()) { DateTime postAtDate = DateTime.UtcNow; if (DateTime.TryParse(PostAt.Text, out postAtDate)) { postAtDate = postAtDate.ToUniversalTime(); } Logistics_Organizations accountFrom = (from accounts in data.Logistics_Organizations where accounts.Id == new Guid(FromAccount.SelectedValue) select accounts).FirstOrDefault(); Accounting_Accounts accountTo = (from toAccounts in data.Accounting_Accounts where toAccounts.Id == new Guid(ToAccount.SelectedValue) select toAccounts).FirstOrDefault(); Guid transactionId = Guid.NewGuid(); Accounting_LedgerItems creditFinancialAccount = new Accounting_LedgerItems(); creditFinancialAccount.OrganizationId = SelectedOrganization.Id; creditFinancialAccount.TransactionId = transactionId; creditFinancialAccount.PostAt = postAtDate; creditFinancialAccount.AccountId = accountFrom.Id; creditFinancialAccount.LedgerType = LedgerType.Receivable.ToString(); creditFinancialAccount.Code = CodeType.Deposit.ToString(); creditFinancialAccount.Memo = String.Format("Check {0} to {1}", CheckNum.Text, accountTo.Name); creditFinancialAccount.Amount = Decimal.Parse(Amount.Text); data.Accounting_LedgerItems.AddObject(creditFinancialAccount); Accounting_LedgerItems creditReceivableAccount = new Accounting_LedgerItems(); creditReceivableAccount.OrganizationId = SelectedOrganization.Id; creditReceivableAccount.TransactionId = transactionId; creditReceivableAccount.PostAt = postAtDate; creditReceivableAccount.LedgerType = accountTo.LedgerType; creditReceivableAccount.AccountId = new Guid(ToAccount.SelectedValue); creditReceivableAccount.Code = CodeType.Payment.ToString(); creditReceivableAccount.Memo = String.Format("Check {0} from {1}", CheckNum.Text, accountFrom.Name); creditReceivableAccount.Amount = Decimal.Parse(Amount.Text); data.Accounting_LedgerItems.AddObject(creditReceivableAccount); data.SaveChanges(); Response.Redirect("~/Accounting_LedgerItems/List.aspx?TransactionId=" + transactionId.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { using (WeavverEntityContainer data = new WeavverEntityContainer()) { if (Request["id"] != null) { Projection.Visible = true; Guid itemId = new Guid(Request["Id"]); var billable = (from x in data.Accounting_RecurringBillables where x.Id == itemId select x).FirstOrDefault(); if (billable != null) { var billables = billable.ProjectLedgerItems(24); ProjectionList.ItemDataBound += new DataGridItemEventHandler(ProjectionList_ItemDataBound); ProjectionList.DataSource = billables; ProjectionList.DataBind(); } } else { Totals.Visible = true; var recurringRevenue = data.Accounting_RecurringBillables .Where(x => x.OrganizationId == BasePage.SelectedOrganization.Id) .Where(x => x.AccountTo == BasePage.SelectedOrganization.Id) .Sum(x => (decimal?)x.Amount) ?? 0m; RecurringRevenue.Text = String.Format("{0,10:C}", recurringRevenue); var recurringExpenses = data.Accounting_RecurringBillables .Where(x => x.OrganizationId == BasePage.SelectedOrganization.Id) .Where(x => x.AccountFrom == BasePage.SelectedOrganization.Id) .Sum(x => (decimal?)x.Amount) ?? 0m; RecurringExpenses.Text = String.Format("{0,10:C}", recurringExpenses); Net.Text = String.Format("{0,10:C}", recurringRevenue - recurringExpenses); } } }
//------------------------------------------------------------------------------------------- protected void Next_Click(object sender, EventArgs e) { if (Entry.Text == "") { Directions.ForeColor = System.Drawing.Color.Red; return; } if (Directions.Text.EndsWith(steptwo)) { string userCode = Session["UserCode"].ToString(); string passcode = Entry.Text; WeavverEntityContainer data = new WeavverEntityContainer(); var user = (from x in data.System_Users where x.OrganizationId == SelectedOrganization.Id && x.UserCode == userCode && x.PassCode == passcode select x ).FirstOrDefault(); if (user != null) { //FormsAuthentication.SetAuthCookie(user.Username, true); Response.Redirect("~/kiosk/kiosk2"); Directions.Text = "Invalid password, please start again."; } else { ResetForm(); Directions.Text = "Your usercode or passcode was incorrect. Please try again."; return; } } PhoneNumber.Style.Add("font-size", "14pt"); PhoneNumber.Style.Add("font-weight", "bold"); PhoneNumber.Text = Entry.Text; Directions.Text = steptwo; Session["UserCode"] = Entry.Text; Directions.ForeColor = System.Drawing.Color.Black; Entry.Text = ""; Entry.TextMode = TextBoxMode.Password; Next.Text = "Log In"; }
protected void Page_Load(object sender, EventArgs e) { ScheduledPayments.ItemDataBound += new DataGridItemEventHandler(ScheduledPayments_ItemDataBound); WeavverMaster.FormTitle = "OFX Bill Pay"; Guid accountId = new Guid(Request["id"]); using (WeavverEntityContainer data = new WeavverEntityContainer()) { Accounting_Accounts financialAccount = (from x in data.Accounting_Accounts where x.Id == accountId select x).FirstOrDefault(); if (financialAccount.OrganizationId == LoggedInUser.OrganizationId) { Accounting_OFXSettings ofxBank = financialAccount.GetOFXSettings(); Logistics_Addresses address = null; billPayment.OFXAppId = "QWIN"; billPayment.OFXAppVersion = "1700"; billPayment.FIUrl = ofxBank.Url; billPayment.FIId = ofxBank.FinancialInstitutionId.ToString(); billPayment.FIOrganization = ofxBank.FinancialInstitutionName; billPayment.OFXUser = ofxBank.Username; billPayment.OFXPassword = ofxBank.Password; billPayment.Payment.FromBankId = ofxBank.BankId; billPayment.Payment.FromAccountId = financialAccount.AccountNumber; LedgerType lType = (LedgerType)Enum.Parse(typeof(LedgerType), financialAccount.LedgerType); billPayment.Payment.FromAccountType = Accounting_OFXSettings.ConvertWeavverLedgerTypeToEbankingAccountType(lType); billPayment.SynchronizePayments("REFRESH"); billPayment.SynchronizePayees("REFRESH"); // do these together so we can poll the info in ItemDataBound var items = from x in billPayment.SyncPayments orderby x.DateDue descending select x; ScheduledPayments.DataSource = items; ScheduledPayments.DataBind(); Payees.DataSource = billPayment.SyncPayees; Payees.DataBind(); } } }
//------------------------------------------------------------------------------------------- public void UpdatePage() { using (WeavverEntityContainer data = new WeavverEntityContainer()) { List.DataKeyField = "Id"; List.DataSource = ShoppingCart.Items; List.DataBind(); decimal deposit = ShoppingCart.DepositTotal; decimal monthly = ShoppingCart.MonthlyTotal; decimal setup = ShoppingCart.SetUpTotal; SetUp.Visible = (setup > 0); SetUpTotal.Text = String.Format("{0,10:C}", setup); Monthly.Visible = (monthly > 0); CartMonthly.Text = String.Format("{0,10:C}", monthly); Deposits.Visible = (deposit > 0); DepositTotal.Text = String.Format("{0,10:C}", deposit); CartTotal.Text = String.Format("{0,10:C}", ShoppingCart.Total); if (ShoppingCart.Items.Count == 0) { btnOrder.ImageUrl = "~/images/sales/checkout-disabled.png"; btnOrder.Enabled = false; TotalUpdate.Visible = false; } else { TotalUpdate.Visible = true; btnOrder.ImageUrl = "~/images/sales/checkout.png"; btnOrder.Enabled = true; } var policy = (from x in data.CMS_Pages where x.Title == "Sales/Store Policy" && x.OrganizationId == SelectedOrganization.Id select x).FirstOrDefault(); if (policy != null) { StorePolicy.Text = policy.Page; } } }
//------------------------------------------------------------------------------------------- protected void OFXImport_Click(object sender, EventArgs e) { List <Accounting_OFXLedgerItem> PreviewLedgerItems = (List <Accounting_OFXLedgerItem>)Session["Import_Transactions"]; using (WeavverEntityContainer data = new WeavverEntityContainer()) { for (int i = 0; i < TransactionsDetected.Items.Count; i++) { Guid rowId = new Guid(TransactionsDetected.Items[i].Cells[0].Text); CheckBox importRow = (CheckBox)FindControlRecursive(TransactionsDetected.Items[i].Cells[1], "ImportRow"); if (importRow == null || !importRow.Checked) { continue; } // Load from safe server side dataset var item = (from y in PreviewLedgerItems where y.LedgerItem.Id == rowId select y).First(); TextBox memoField = (TextBox)FindControlRecursive(TransactionsDetected.Items[i].Cells[5], "Memo"); if (memoField != null && item.LedgerItem.Memo != memoField.Text) { item.LedgerItem.Memo = memoField.Text; } data.Accounting_LedgerItems.AddObject(item.LedgerItem); } ClearError(); decimal successCount = data.SaveChanges(); ShowError("Imported " + successCount.ToString() + " row(s)."); } List <Accounting_LedgerItems> LedgerItems = new List <Accounting_LedgerItems>(); foreach (var item in PreviewLedgerItems) { LedgerItems.Add(item.LedgerItem); } var sortedItems = LedgerItems.OrderByDescending(x => x.PostAt); TransactionsDetected.DataSource = sortedItems; TransactionsDetected.DataBind(); }
//------------------------------------------------------------------------------------------- public void OFXPreview_Click(object sender, EventArgs e) { ClearError(); using (WeavverEntityContainer data = new WeavverEntityContainer()) { Accounting_OFXSettings ofxSettings = (from x in data.Accounting_OFXSettings where x.AccountId == new Guid(OFXAccounts.SelectedValue) select x).FirstOrDefault(); if (ofxSettings != null) { Accounting_Accounts acct = (from x in data.Accounting_Accounts where x.Id == new Guid(OFXAccounts.SelectedValue) select x).FirstOrDefault(); List <Accounting_OFXLedgerItem> items = ofxSettings.GetRemoteLedgerItems(DateTime.Parse(OFXStartDate.Text), DateTime.Parse(OFXEndDate.Text)); Session["Import_Transactions"] = items; List <Accounting_LedgerItems> LedgerItemsData = new List <Accounting_LedgerItems>(); foreach (var item in items) { LedgerItemsData.Add(item.LedgerItem); } var sortedItems = LedgerItemsData.OrderByDescending(x => x.PostAt); TransactionsDetected.DataSource = sortedItems; TransactionsDetected.DataBind(); LedgerItems.Visible = true; // totals var credits = items.Where(x => x.LedgerItem.Amount > 0).Sum(x => x.LedgerItem.Amount); var debits = items.Where(x => x.LedgerItem.Amount < 0).Sum(x => x.LedgerItem.Amount); DetectedTotal.Text = items.Count.ToString(); if (credits.HasValue) { TotalCredits.Text = String.Format("{0,10:C}", credits.Value); } if (debits.HasValue) { TotalDebits.Text = String.Format("{0,10:C}", debits.Value); } } } }
//------------------------------------------------------------------------------------------- private void UpdatePage() { BindAR(); BindAP(); BindCashFlow(); BindNet(); using (WeavverEntityContainer data = new WeavverEntityContainer()) { // get cash accounts // remove all receivabls //var avCash = from x in data.Accounting_Accounts // where x.OrganizationId = // select x; // data.Total_ForLedger(null, LoggedInUser.OrganizationId, Guid.Empty, true, true, true); //AvailableCash.Text = String.Format("{0,10:C}", avCash); // Accounting.Balance(LoggedInUser.OrganizationId)); } }
//------------------------------------------------------------------------------------------- void DoDataBind() { Navigation.Nodes.Clear(); using (WeavverEntityContainer data = new WeavverEntityContainer()) { var rootItems = from article in data.KnowledgeBase where article.ParentId.HasValue == false && article.OrganizationId == SelectedOrganization.Id select article; if (Request["ParentId"] != null) { Guid parentId = new Guid(Request["ParentId"]); rootItems = rootItems.Where(x => x.Id == parentId && x.OrganizationId == SelectedOrganization.Id); //rootItems = from x in rootItems // where x.ParentId == parentId // select x; } var rootItems2 = ( from article in rootItems where article.OrganizationId == SelectedOrganization.Id orderby article.Position, article.Title select article); PopulateTree(data, null, rootItems2); //List.DataSource = res.Take(1); //List.DataBind(); //Navigation.ExpandAll(); string selectedNodeId = Request["SelectedNode"]; if (selectedNodeId != null) { SelectNode(Navigation.Nodes, selectedNodeId); } else if (Navigation.Nodes.Count > 0) { Navigation.Nodes[0].Select(); } } }
//------------------------------------------------------------------------------------------- protected void Page_PreInit(object sender, EventArgs e) { Guid pageId = Guid.Empty; if (Guid.TryParse(Request["id"], out pageId)) { using (WeavverEntityContainer data = new WeavverEntityContainer()) { var page = (from x in data.CMS_Pages where x.Id == pageId select x).FirstOrDefault(); if (File.Exists(Server.MapPath(page.MasterPage))) { this.MasterPageFile = page.MasterPage; } } } }
//------------------------------------------------------------------------------------------- protected void Page_Load(object sender, EventArgs e) { using (WeavverEntityContainer data = new WeavverEntityContainer()) { SkeletonPage sPage = (SkeletonPage)Page; if (sPage.SelectedOrganization.BillingAddress.HasValue) { var orgAddress = (from addy in data.Logistics_Addresses where addy.OrganizationId == sPage.SelectedOrganization.Id && addy.Id == sPage.SelectedOrganization.BillingAddress.Value select addy).First(); OrgAddress.Text = orgAddress.ToString().Replace("\r\n", "<br />"); } if (Request["id"] != null) { Guid checkId = new Guid(Request["id"]); var check = (from checks in data.Accounting_Checks where checks.OrganizationId == sPage.SelectedOrganization.Id && checks.Id == checkId select checks).First(); var payeeAccount = (from orgs in data.Logistics_Organizations where orgs.Id == check.Payee select orgs).First(); if (payeeAccount.BillingAddress.HasValue) { var payeeAddress = (from addy in data.Logistics_Addresses where addy.OrganizationId == sPage.SelectedOrganization.Id && addy.Id == payeeAccount.BillingAddress select addy).First(); PayeeAddress.Text = payeeAddress.ToString().Replace("\r\n", "<br />"); } } } }
//------------------------------------------------------------------------------------------- protected void Page_Load(object sender, EventArgs e) { Visible = false; return; if (!Roles.IsUserInRole("Administrators") || !Roles.IsUserInRole("Accountants")) { Visible = false; return; } if (!IsPostBack) { PostAt.Text = DateTime.Now.ToString("MM/dd/yy"); using (WeavverEntityContainer data = new WeavverEntityContainer()) { //Guid fromGuid = new Guid(FromAccount.SelectedValue); var fAccounts = (from orgs in data.Accounting_Accounts where orgs.OrganizationId == BasePage.SelectedOrganization.Id orderby orgs.Name select orgs); FromAccount.DataSource = fAccounts; FromAccount.DataTextField = "Name"; FromAccount.DataValueField = "Id"; FromAccount.DataBind(); var cAccounts = (from accounts in data.Accounting_Accounts where accounts.OrganizationId == BasePage.SelectedOrganization.Id select accounts); ToAccount.DataSource = cAccounts; ToAccount.DataTextField = "Name"; ToAccount.DataValueField = "Id"; ToAccount.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { using (WeavverEntityContainer data = new WeavverEntityContainer()) { var sumQuery = (from balances in data.Accounting_AccountBalances where balances.OrganizationId == BasePage.SelectedOrganization.Id select balances); string receivableLedger = LedgerType.Receivable.ToString(); var receivableTotal = sumQuery.Where(x => x.LedgerType == receivableLedger).Sum(x => x.Balance); receivableTotal = (receivableTotal == null) ? 0m : receivableTotal; ReceivableTotal.Text = String.Format("{0:C}", receivableTotal); string payableLedger = LedgerType.Payable.ToString(); var payableTotal = sumQuery.Where(x => x.LedgerType == payableLedger).Sum(x => x.Balance); payableTotal = (payableTotal == null) ? 0m : payableTotal; PayableTotal.Text = String.Format("{0:C}", payableTotal); Net.Text = String.Format("{0:C}", receivableTotal - payableTotal); } }
//------------------------------------------------------------------------------------------- public void UpdatePage() { using (WeavverEntityContainer data = new WeavverEntityContainer()) { var financialAccounts = from x in data.Accounting_Accounts from y in data.Accounting_OFXSettings where x.OrganizationId == SelectedOrganization.Id && x.Id == y.AccountId orderby x.Name ascending select x; OFXAccounts.Items.Clear(); foreach (Accounting_Accounts account in financialAccounts) { OFXAccounts.Items.Add(new ListItem(account.Name, account.Id.ToString())); } } OFXStartDate.Text = DateTime.Now.Subtract(TimeSpan.FromDays(30)).ToString("MM/dd/yy"); OFXEndDate.Text = DateTime.Now.ToString("MM/dd/yy"); }