[code] System.TimeSpan sp_start = validation.Subtract(start); double t1 = sp_start.TotalDays; int days = 0; for (int i = 0; i < 13; i++) { if (validation.Month == 12 || validation.Month == 01) { days += 14; } t1 =- days; } [/code] This loop only takes effect on Dec and Jan and returns the same value. I want this loop to add 14 to days each Dec and Jan, and each month following Jan has to be the same number of days as Jan.

Member Avatar
Member Avatar
+0 forum 1

My problem is that the array does not seem to return the correct value, the same value is returned for each data row, but when I display using Response.Write in foreach in Calculation, the correct values are returned. The array values has to be used in a calculation I've got an array function: [code] public int[] NumberOfDays(DateTime startDate, DateTime endDate) { TimeSpan daysCount = endDate - startDate; DateTime currDate; currDate = DateTime.MinValue + daysCount; int monthCount = 0; monthCount = (((currDate.Year - 1) * 12) + currDate.Month) - 1; int[] result = new int[monthCount]; int subtractAmount = 0; for (int …

Member Avatar
Member Avatar
+0 forum 4

Hallo can someone please help me, I've got this table: Valuation Date Construction 30/03/2009 30,625.26 30/04/2009 269,825.04 30/05/2009 850,056.45 30/06/2009 1,922,475.06 30/07/2009 3,500,852.19 30/08/2009 5,757,055.16 30/09/2009 8,699,041.1 30/10/2009 12,232,330.17 30/11/2009 16,612,763.46 30/12/2009 19,166,542.19 30/01/2010 22,098,191.54 28/02/2010 33,539,289.47 30/03/2010 40,518,025 30/04/2010 48,372,377.98 30/05/2010 56,543,248.62 30/06/2010 65,507,314.28 30/07/2010 74,607,415.4 30/08/2010 84,352,063.34 30/09/2010 94,325,187.87 30/10/2010 104,060,459.19 30/11/2010 114,040,884.2 30/12/2010 119,094,482.8 30/01/2011 124,342,210.61 28/02/2011 140,316,539.09 30/03/2011 146,909,564.95 Calculated from this formula: [code] public string Calculation(double b, DateTime validation, DateTime start, DateTime end, double alpha, double beta) { //start date(t1) System.TimeSpan sp_start = validation.Subtract(start); string sp_start_str = sp_start.TotalDays.ToString("#"); double t1 = double.Parse(sp_start_str); // change accordingly …

Member Avatar
Member Avatar
+0 forum 2

Hi, I've got a date range between a start and end date, which has to be each month on the valuation day, but if end date(2010/07/20) is before the valuation date(2010/07/31), the valuation month for that month must be displayed. if (endDate.Day < validDay) is true, then it works perfect. but if it's false, it duplicates all of the fields. I tried this in my code: [code] public List<DateTime> GetDates(DateTime startDate, DateTime endDate, int validDay) { TimeSpan span; span = endDate - startDate; List<DateTime> result = new List<DateTime>(); DateTime dateToParse = DateTime.MinValue + span; int yearMonths = 0; if (dateToParse.Year …

Member Avatar
Member Avatar
+0 forum 1

hallo can someone please help me my Access Database ConnectionString does not work on the server [code] string strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|calculator.mdb"; [/code]

Member Avatar
Member Avatar
+0 forum 1

I'm creating a cash flow calculator, start and end date is entered, and then dates according to months in between are displayed. If the month is Dec or Jan t1 should change accordingly, [code] if (validation.Month == 12) t1 = t1 - 14; if (validation.Month == 01) t1 = t1 - 28; [/code] after this has happened remaining dates should be t1 = t1 - 28 Can anyone please show me how to do this?

Member Avatar
+0 forum 0

Hallo everyone. I want to set the day to the validDay. e.g if valid day is 25 then the day must be 25 on DateTime. [CODE]string validDay_str = reader["validation"].ToString(); int validDay = Int32.Parse(validDay_str); string start_str = reader["start"].ToString(); DateTime start = DateTime.Parse(start_str); start.Day = validDay;[/CODE] with this code I get an error, "Property or indexer 'System.DateTime.Day' cannot be assigned to -- it is read only" I cannot use [CODE]start = start.AddDays(validdaye);[/CODE] because then it will add 25 to the existing day.

Member Avatar
Member Avatar
+0 forum 2

Hi can anyone please help me, I've got a gridview populated from a database, when the download button is pressed this is exported to excel, what I would like to do is to hide the gridview, it must not show on the aspx page but the database must still export to excel, is this possible. excel.aspx [CODE] private void ExportGridView() { string attachment = "attachment; filename=Enquiry.xls"; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/ms-excel"; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); grid.RenderControl(htw); Response.Write(sw.ToString()); Response.End(); } private void PrepareGridViewForExport(Control gv) { LinkButton lb = new LinkButton(); Literal l = new …

Member Avatar
Member Avatar
+0 forum 1

Hi on my localhost the website works fine, but when I transfer it onto the web I get this error, please someone help. [CODE] Server Error in '/' Application. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file …

Member Avatar
Member Avatar
+0 forum 1

Hi, I've got a DropDownList with a list of colours, when one is selected and the "Add to ShoppingCart" button is pressed, all the colours in the DropDownList are duplicated. Can somebody please help. [CODE] // fill the control with data private void PopulateControls(ProductDetails pd) { // display product recommendations string productId = pd.ProductId.ToString(); recommendations.LoadProductRecommendations(productId); // display the product details titleLabel.Text = pd.Name; descriptionLabel.Text = pd.Description; priceLabel.Text = String.Format("{0:c}", pd.Price); productImage.ImageUrl = "ProductImages/" + pd.Image2FileName; // set the title of the page this.Title = BalloonShopConfiguration.SiteName + pd.Name; // obtain the attributes of the product DataTable attrTable = CatalogAccess.GetProductAttributes(productId); // temp …

Member Avatar
Member Avatar
+0 forum 7

Hi everyone, I've got a shopping cart with a total amount label, this works perfect with the products, if a product quantity is changed the label also changes. I have a shipping type drop down list determined by which region the user is, I would like the total amount label to add this cost to but can't seem to get it to work. I've used a stored procedure, which I have executed and it works. Here is my code; Checkout.aspx.cs [code] public partial class Checkout : System.Web.UI.Page { decimal shippingCost; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) PopulateControls(); …

Member Avatar
Member Avatar
+0 forum 19

Hi everyone, I've got a DepartmenstList and CategoriesList user controls, which works with stored procedures, when the a department is selected, only then is that departments categories listed. What I need help with is, when a department is selected I want the categories to display as a submenu to the selected department. I have no idea how to accomplish this with stored procedures involved. Any help will be appreciated. DepartmentsList.ascx [code] <asp:Repeater ID="Department" runat="server" > <HeaderTemplate> <ul> </HeaderTemplate> <ItemTemplate> <li> <asp:HyperLink ID="HyperLink1" Runat="server" NavigateUrl='<%# Link.ToDepartment(Eval("DepartmentID").ToString())%>' Text='<%# HttpUtility.HtmlEncode(Eval("Name").ToString()) %>' ToolTip='<%# HttpUtility.HtmlEncode(Eval("Description").ToString()) %>' CssClass='<%# Eval("DepartmentID").ToString() == Request.QueryString["DepartmentID"] ? "DepartmentSelected" : "DepartmentUnselected" %>' …

Member Avatar
+0 forum 0

Hi everyone, I've got a DropDownList in Product.aspx when the add to cart button is pressed the value selected is passed onto a stored procedure. What I need help with is in ShoppingCart.aspx I want the selected value on the previous page to be the index on this pages DropDownList. But the DropDownList is in a GridView and therefore I do not know how to do this. Any help will be appreciated. ShoppingCart.aspx [code] <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Label ID="titleLabel" runat="server" Text="Your Shopping Cart" CssClass="ShoppingCartTitle" /> <br /> <asp:Label ID="statusLabel" CssClass="AdminPageText" ForeColor="Red" runat="server" /><br /> <asp:GridView ID="grid" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID" …

Member Avatar
Member Avatar
+0 forum 1

I'm working on the book "Beginning Aspnet E-Commerce with C#", but I have encountered a problem. The tutorial includes a Pager Control, this works fine for all of the products it is just when the a department is selected the pager does not work, only after a Category is selected that it works. Pager.ascx.cs [code] // simple struct that represent a (page number, url) association public struct PageURL { private string page; private string url; // page and url property definitions public string Page { get { return page; } } public string URL { get { return url; } …

Member Avatar
+0 forum 0

The End.