Budget Analysis (Asp.Net)




1. INTRODUCTION

            Budget analysis is a useful web application that helps all sorts of business firms. The main strategy of the project is to automate the excel data and calculations into RDBMS to make data retrieval and manipulations easier. The application is done using ASP.Net and we have used SQL Server as the back end to make it more powerful. The main features of budget analysis are:
1.      Fast excel file parsing
2.      Project wise summary report
3.      Date range summary report
4.      Month wise summary report
5.      Year wise summary report
The application is build kept in mind that any users will find to use it friendlier.  We just need to upload the excel file into the application through the friendly user interface provided and the application, will parse the excel file into the database for calculations and manipulations. The users are also given the facility to create a new project by themselves which helps them to handle the excel applications into the database more friendly.

2. SYSTEM SPECIFICATIONS
2.1. HARDWARE DESCRIPTION
            The selection of hardware is very important in the existence and proper working of any software. When selecting hardware, the size and requirements are also important.

Minimum Requirements:
            Processor                     :           Pentium II class, 450MHz
            RAM                           :           128MB
            Hard Disk Drive         :           3GB
            Video                          :           800X600, 256 colors
            CD-ROM                    :           Required

The proposed System is developed on:
            Processor                     :           INTEL Pentium 4
            RAM                           :           512MB
            Hard Disk Drive         :           40GB
            Key Board                  :           Standard 101/102 or Digi Sync Family
            Monitor                       :           Display Panel (1024 X 764)
            Display Adapter          :           Trident Super VGA
            Network Adapter        :           SMC Ethernet Card Elite 16 Ultra
            Mouse                         :           Logitech Serial Mouse

2.2. SOFTWARE DESCRIPTION
            Operating System       :           Windows XP
            Front- End                  :           C#. NET with ASP. NET
            Back- End                   :           MS SQL SERVER 2005 EXPRESS

            Project will be done in ASP. NET with C# 2.0 as front end and SQL Server 2005 as back end. Microsoft .NET is software that connects information, people, systems and devices. It spans clients, servers and developer tools and consists of:
Ø  The .NET Framework programming model that enables developers to build Web-based applications which expose their functionality programmatically over a network using standard protocols such as SOAP and HTTP.
Ø  Developer tools such as Microsoft Visual Studio .NET, which provide a rapid application integrated development environment for programming with the .NET Framework.
Ø  A set of servers including Microsoft Windows 2000, Microsoft SQL, Server and Microsoft BizTalk Server that integrates, runs, operates and manages XML Web services and applications.
Ø  Client software such as Windows XP, Windows CE and Microsoft Office XP that helps developers deliver a deep and compelling user experience across a family of devices and existing products.

            The .NET Framework is the programming model of the .NET environment for building, deploying and running Web- based applications, smart client applications and XML Web services. It manages much of the plumbing, enabling developers to focus on writing the business logic code for their applications. The .NET Framework includes the common language runtime and class libraries.







3. ORGANIZATIONAL PROFILE

            Sristhi Systems is a Software and Web Development Company which provides technology solutions and professional software for clients worldwide. Srishti focus on quality, innovations and leverage deep industry and functional expertise to help customers to transform their highest value business processes. 

Our in-depth technical knowledge coupled with industry experience and the unique methodology enables us to successfully deliver the services to the clients worldwide.  We are driven to attain our customer’s highest satisfaction by providing business experts with underlying delivery expertise in Enterprise Technology, Methodologies and Implementations.  Our core competencies are designed to effectively deliver results to our customers. 

            Sristhi Training Center provides premier instructor-led IT training through a carefully balanced blend of hands-on lab exercises and lecture.

Training is conducted in the comfortable classrooms at our training facility and client locations.  Experienced instructors make training productive and enjoyable.  Customizable courses and computer lab offer additional options fro your training needs.  We also provide project guidance for all academic students which help them to build a successful portfolio and start their IT journey successfully.    








4. OVERVIEW OF THE LANGUAGE USED
4.1. MICROSOFT VISUAL STUDIO

                  Microsoft Visual Studio is Microsoft’s flagship software development product for computer programmers. It centers on an integrated distribution environment which has programmers create stand alone, and web services that run on any platforms supported by Microsoft’s .Net Framework (for all versions after 6). Supported platforms include Microsoft windows, servers and workstations, Pocket PC, Smart Phones and World Wide Web browsers not the Java Virtual Machine that all other java tools target.

VISUAL STUDIO 2005

                  The most important language added in this version was the introduction of generics, which are similar in many aspects to C++ templates. This potentially increases the number of bugs caught at compile- time instead of run- time by encouraging the use of strict type checking in areas where it was not possible before, C++ also got a similar upgrade with the addition of C++/CLI which is slated to replace the use of Managed C++. Other new features of Visual Studio 2005 include the “Development Designer” which allows application designs to be validated before deployments, an improved environment for web publishing when combined with ASP.NET 2.0 and load testing to see application performance under various sorts of user loads. Visual Studio 2005 also added extensive 64- bit support. While the development environment itself only available as a 32- bit application, visual C++ 2005 supports compiling for (x64AMD64 and EM64T) as well as IA- 64 (Itanium). The platforms SDK include 64- bit and 64-bit versions of the libraries.

4.2. .NET FRAMEWORK SDK

                  The .NET framework is an integral windows component that supports building and running the next generation of applications and XML web services. The key component of the .NET frame work are the common language run time and the. NET frame work class library, which includes ADO.NET, ASP.NET and windows forms. The .NET framework provides a managed execution environment simplified development and deployment and integration with a wide variety of programming languages.

This framework is made up of the following parts:
·         The common language runtime(CLR)
·         The base class libraries.
·         Object oriented internet development with ASP.NET
·         Rich client user interface using windows forms
·         RAD for the internet using web forms

4.3. OVERVIEW OF THE .NET FRAME WORK

                  The .NET framework is a new computing platform that simplifies application development in the highly distributed environment of the internet. The .NET framework is designed to fulfill following objectives:

·         To provide a consistent object oriented programming environment whether object code is stored and executed locally but internet- distributed or executed remotely.
·         To provide a code execution environment that minimizes software deployment and versioning conflicts.
·         To provide a code execution environment that guarantees safe execution of code, including code created by an unknown or semi trusted third party.
·         To provide a code execution environment that eliminates the performance problem of scripted or interpreted environments.
·         To make the developer experience consistent across widely types of application, such as windows based applications and web based applications.
·         To build all communication on industry standards to ensure that code based on the .NET framework can integrate with any other code.

                  The .NET framework has two main components: the common language runtime and the .Net framework class library. The common language runtime is the foundation of the .NET framework. You can think of the runtime as an agent that manages code at execution time, and remoting while also enforcing strict type safely and other forms of code accuracy that ensure security and robustness in fact the concept of code management is a fundamental principle of the runtime.

                  Code that targets the runtime is known as managed code, while code that does not target the runtime is known as unmanaged code.  The class library, the other main component of the .NET frameworks is a comprehensive, object-oriented collection reusable types that you can use to develop applications ranging from traditional command line or graphical user interface (FGUI) applications to application base d on the latest innovations provided by ASP.NET, such as web forms and XML web services.

The .NET framework can be hosted by unmanaged component that load the common language runtime into their processes and initiate the execution of managed code.  ASP.NET works directly with the runtime to enable ASP.NET application and XML web services, both of which are discussed later in this topic,  Internet explorer is an example of unmanaged application that hosts the runtime (in the form of a MIME type extension).  Using internet explorer to the host runtime enables you to embed managed components or windows forms controls in HTML documents.  Hosting the runtime in this way makes mobile code 9similar to Microsoft Active Xr controls) possible, but with significant improvement that only managed code can offer, such as semi-trusted execution and secure isolated file storage.

The following illustration shows the relationship of the common language runtime and the class library to your application and to the over all system.  The illustration also shows how managed code operated with in a larger architecture.

We can use the .NET framework to develop the following types of application and services:
·         Console applications
·         Window GUI application (Windows Forms) ASP.NET applications
·         XML Web services
·         Windows services
4.4. COMMON LANGUAGE RUNTIME (CLR)

The common language runtime (CLR) is responsible for runt-time services such as language integration; security enforcement; and memory, process and thread management.  In addition, it has a roll at development time when features such as life cycle management strong type naming, cross-language exception handling, dynamic binding and so on, reduce the amount of code that a developer must write to turn the business logic the reusable component.  The runtime can be hosted by high performance, server-side applications, such a s Microsoft Internet Information Services (IIS) for building web applications with ASP.NE and the next release of Microsoft SQL Server.  This infrastructure enables you to use code “managed “ by the .NET framework to write your business logic, while still enjoying the superior performance of the industry’s best enterprises servers that support runtime hosting.

4.5. ASP.NET

ASP.NET is a set of Microsoft.NET framework technologies used for building web applications and XML Web services.  ASP.NET page execute on the server and generate mark up such as HTML, WML or XML that is sent to a desktop or mobile browser.  ASP.NET pages use a compiled, event-driven programming model that improves performance and enables the separation of application logic and user interface.  Both ASP.NET pages and ASP.NET web services files contain server-side (as opposed to client side logic) written in Visual basic .NET, C#.NET or any .NET compatible language,  Web applications and XML Web Services take advantage of the features of the common language runtime, such as type safety, inheritance, language, interoperability, versioning, and integrated security.



4.6. IIS

Microsoft Internet Information S4ervices (IIS; formerly called Server is a set of Internet-based services for servers using Microsoft Windows.  It is the world’s second most popular web server in terms of overall websites.  As of September 2007 it served 34.94% of all websites and 36.63% of all active websites according to Net craft.  The servers currently include FTP, SMTP, NNTOP, and HTTP/HTTPS.

4.7. ADO.NET

ADO.NET provides consistent access to data sources such a Microsoft SQL Server and XML, as well as to data sources exposed through OLE DB and ODBC.  Data sharing consumer applications can use ADO.NET to connect to these data sources and retrieve, manipulate and update the data that they contain.

ADO.NET separates data access from data manipulation into discrete components that can be used separately or in tandem.  ADO.NET includes .NET Frame work data providers for connecting to a database, executing commands and retrieving results.  Those results are either processed directly, placed in and ADO.NET Dataset objects in order to be exposed to the used in an ad hoc manner, combined with data from multiple sources or remote between tiers.  The ADO.NET Dataset object can also be used independently of a .NET Framework data provider to manage data local to the application or sourced from XML.
The ADO.NET classes are found in System.Data.dll and are integrated with the XML classes found in System.Xml.dll.  When compiling code that uses the System. Data, namespace reference both System.Data.dll and System.Xml.dll.

ADO.NET provided functionality to developers writing managed code similar to the functionality provided to native component object model (COM) developers by ActiveX Data Objects (ADO).

  4.7.1. ADO.NET COMPONENTS

              There are two components of ADO.NET that you can use to access and manipulate data:
·         .NET Framework data providers.
·         The DataSet

 .NET FRAMEWORK DATA PROVIDERS

             The .NET Framework Data providers are components that have been explicitly designed for data manipulation and fast, forward-only, read-only access to data.  The connection object provides connectivity to a data source.  The command object enables access to database commands to return data, modify data, run stored procedures and send or retrieve parameter information.  The Data Adapter provides a high-performance stream of data from the data source. Finally, the Data Adapter provides the bridge between the DataSet object and the data source.  The Data Adapter uses command object to execute SQL commands at the data source to both load the DataSet with data and reconcile changes made to the data in the DataSet back to the data source.


 THE DATASET

            The ADO.NET DataSet is explicitly designed for data access independent of any data source.  As a result, it can be used with multiple and differing data sources used with XML data or used to manage data local to the application.  The DataSet contains a collection n of one or more DataTable objects made up to rows and columns of data as well as primary key, foreign key, constraint and relation information about the data in the DataTable objects.


   
4.7.2. BENEFITS OF ADO.NET

               ADO.NET offers several advantages over previous versions of ADO and over other data access components.  These benefits fall into the following categories:
1.      Interoperability
2.      Maintainability
3.      Programmability
4.      Salability

4.7.3.  MICROSOFT DATA ACCSS COMPONENTS (MDAC)

            Microsoft Data Access Components (MDAC) is a collection of core files provided to help applications by providing a means of accessing data.  MDAC includes core files for Open Database Connectivity (ODBC), ActiveX Data Objects (ADO), OLEDB, Network libraries and client configuration tool for SQL Server.  Depending on your data access strategy, you may need to ensure that MDAC is installed on the client computers, the business servers, the Web servers or the database servers.  MDAC 2.6 or later is required by the .NET Framework and at least MDAC 2.7 SP1 is recommended.








5. SYSTEM ANALYSIS
5.1. DEFINITION

            System Analysis is the detailed study of the various operations performed by the system and their relationships within and outside the system. Analysis is the process of breaking something into its parts so that the whole may be understood. System analysis is concerned with becoming aware of the problem, identifying the relevant and most decisional variables, analyzing and synthesizing the various factors and determining an optimal or at least a satisfactory solution. During this a problem is identified, alternate system solutions are studied and recommendations are made about committing the resources used to design the system

5.2. DESCRIPTION OF PRESENT SYSTEM
          Present system is a windows application, in which users can upload data only to that system. Here the user must enter the rate, quantity and sales result at each time when transaction occurs.
5.2.1 LIMITATIONS OF PRESENT SYSTEM
             The user must always be available with the system to do the process. The user has to enter the details all time. So the process is time consuming.

5.3 PROPOSED SYSTEM
             It is a web application in which users can upload excel file which contains the transaction details. User can store the details under a project category which helps them to identify daily data.
5.3.1 ADVANTAGES
            User can upload the excel file from anywhere at anytime. User can view summary reports of each project between two dates, monthly and yearly report.

           
5.4. FEASIBILTY STUDY

               A feasibility analysis usually involves a through assessment of the operational (need), financial and technical aspects of a proposal. Feasibility study is the test of the system proposal made to identify whether the user needs may be satisfied using the current software and hardware technologies, whether the system will be cost effective from a business point of view and whether it can be developed with the given budgetary constraints. A feasibility study should be relatively cheap and done at the earliest possible time. Depending on the study, the decision is made whether to go ahead with a more detailed analysis.

            When a new project is proposed, it normally goes through feasibility assessment. Feasibility study is carried out to determine whether the proposed system is possible to develop with available resources and what should be the cost consideration. Facts considered in the feasibility analysis were.

·         Technical Feasibility
·         Economic Feasibility
·         Behavioral Feasibility

5.4.1 Technical Feasibility

            Technical feasibility includes whether the technology is available in the market for development and its availability. The assessment of technical feasibility must be based on an outline design of system requirements in terms of input, output, files, programs and procedures. This can be qualified in terms of volumes of data, trends, frequency of updating, cycles of activity etc, in order to give an introduction of technical system. Considering our project if is technically feasible. Internal Management System with its emphasis on a more strategic decision making is fast gaining ground as a popular outsourced function.


5.4.2 Economical Feasibility

            This feasibility study present tangible and intangible benefits from the prefect by comparing the development and operational cost. The technique of cost benefit analysis is often used as a basis for assessing economic feasibility. This system needs some more initial investment than the existing system, but it can be justifiable that it will improve quality of service.

Thus feasibility study should center along the following points:

Ø  Improvement resulting over the existing method in terms of accuracy, timeliness.
Ø  Cost comparison
Ø  Estimate on the life expectancy of the hardware
Ø  Overall objective
Our project is economically feasible. It does not require much cost to be involved in the overall process. The overall objectives are in easing out the requirement processes.

5.4.3 Behavioral/ Operational Feasibility

            This analysis involves how it will work when it is installed and the assessment of political and managerial environment in which it is implemented. People are inherently resistant to change and computers have been known to facilitate change. The new proposed system is very much useful to the useful to the users and there for it will accept broad audience from around the world.






6. SYSTEM DESIGN
6.1. DEFINITION

            The most creative and challenging face of the system development is System Design. It provides the understanding and procedural details necessary for implementing the system recommended in the feasibility study. Design goes through the logical and physical stages of development.

            In designing a new system, the system analyst must have a clear understanding of the objectives, which the design is aiming to fulfill. The first step is to determine how the output is to be produced and in what format. Second, input data and master files have to be designed to meet the requirements of the proposed output. The operational phases are handled through program construction and testing.

            Design of a system can be defined as a process of applying various techniques and principles for the purpose of defining a device, a process or a system in sufficient detail to permit its physical realization. Thus system design is a solution to “how to” approach to the creation of a new system. Thus important phase provides the understanding and the procedural details necessary for implementing the system recommended in the feasibility study. The design step provides a data design, architectural design, and a procedural design.

6.2. OUTPUT DESIGN

            In the output design, the emphasis is on producing a hard copy of the information requested or displaying the output on the CRT screen in a predetermined format. Two of the most output media today are printers and the screen. Most users now access their reports from a hard copy or screen display. Computer’s output is the most important and direct source of information to the user, efficient, logical, output design should improve the systems relations with the user and help in decision-making.

            As the outputs are the most important source of information to the user, better design should improve the system’s relation and also should help in decision-making. The output device’s capability, print capability, print capability, response time requirements etc should also be considered form design elaborates the way output is presented and layout available for capturing information. It’s very helpful to produce the clear, accurate and speedy information for end users.

6.3. INPUT DESIGN

            In the input design, user-oriented inputs are converted into a computer based system format. It also includes determining the record media, method of input, speed of capture and entry on to the screen. Online data entry accepts commands and data through a keyboard. The major approach to input design is the menu and the prompt design. In each alternative, the user’s options are predefined. The data flow diagram indicates logical data flow, data stores, source and destination. Input data are collected and organized into a group of similar data. Once identified input media are selected for processing.

            In this software, importance is given to develop Graphical User Interface (GUI), which is an important factor in developing efficient and user-friendly software. For inputting user data, attractive forms are designed. User can also select desired options from the menu, which provides all possible facilities.

            Also the important input format is designed in such a way that accidental errors are avoided. The user has to input only just the minimum data required, which also helps in avoiding the errors that the users may make. Accurate designing of the input format is very important in developing efficient software. The goal or input design is to make entry as easy, logical and free from errors.





6.4. LOGICAL DESIGN

            Logical data design is about the logically implied data. Each and every data in the form can be designed in such a manner to understand the meaning. Logical data designing should give a clear understanding and idea about the related data used to construct a form.

6.4.1. DATA FLOW DIAGRAM

            A Data Flow Diagram (DFD) is a diagram that describes the flow of data and the processes that change data throughout a system. It’s a structured analysis and design tool that can be used for flowcharting in place of or in association with information. Oriented and process oriented system flowcharts. When analysts prepare the Data Flow Diagram, they specify the user needs at a level of detail that virtually determines the information flow into and out of the system and the required data resources. This network is constructed by using a set of symbols that do not imply physical implementations. The Data Flow Diagram reviews the current physical system, prepares input and output specification, specifies the implementation plan etc.

            Four basic symbols are used to construct data flow diagrams. They are symbols that represent data source, data flows, and data transformations and data storage. The points at which data are transformed are represented by enclosed figures, usually circles, which are called nodes.








DATA FLOW DIAGRAM SYMBOLS:-



           
-            Source or Destination of data


-            Data Flow


 


-            Process



 


-           Storage
 














Steps to Construct Data Flow Diagrams

Four steps are commonly used to construct a DFD
·         Process should be named and numbered for easy reference. Each name should be representative of the process.
·         The destination of flow is from top to bottom and from left to right.
·         When a process is exploded in to lower level details they are numbered.
·         The names of data stores, sources and destinations are written in capital letters.

Rules for constructing a Data Flow Diagram
  • Arrows should not cross each other.
  • Squares, circles and files must bear names.
  • Decomposed data flow squares and circles can have same names.
  • Draw all data flow around the outside of the diagram.






6.4.2 CONTEXT DIAGRAM
 











Level 1 DFDAdministrator

 


Level 1 user



 



Level 2 DFD Administrator
 


























Level 2 DFD User
 






 6.5. TABLE SPECIFICATION

Table Name: - Login
Field Name
Data Type
Size
Key
Username
Varchar
50

Password
Varchar
50
-
Table Name: - projects

Field Name
Data Type
Size
Key
project name
Varchar
250

Description
Varchar
250
-
status
Varchar
250
-



Table Name: - Product Info

Field Name
Data Type
Size
Key
SKU
Varchar
15
-
Packaging cost
int
15
-
Actual shipping cost
int
10
-
Unit cost
int
20
-
EBay fee
int
25
-
Market fee
int
25
-
Date
datetime


           


Table Name: - Inventory
Field Name
Data Type
Size
Key
SKU
Varchar
6
Primary
Sold
int
25
-
Prices
int
6
-
Total
int
15
-

Table Name: - Assumption

Field Name
Data Type
Size
Key
SKU
Varchar
50
primary
EBay final value(0-25)
int
2
-
EBay final value(25-1000)
int
25
-
Buyitnow1
int
25
-
Buyitnow2
int
10
-
Insertion
int
Date
-













7. CODING

First phase of implementation is coding. Coding can be done in two ways. One by automatic program code and other by programmer’s manually written code. A code generator is a suite of programs that matches the input to an appropriate code template and from these produces modules of code. The code is made simple in such a way that another programmer can easily understand and work on that in future. The crucial phase in the system development life cycle is the successful implementation of the new system design. The process of converting as new or revised system into an operational one is known as system implementation. This includes all those activities that take place to convert from an old system to a new system. The system can be implemented only after a through testing is done and if it is found to work according to the specifications. The most crucial stage in achieving a new successful system and giving confident on the new system for the users is that it will work effectively and efficiently. If involves careful planning, investigation of the current system and its constraints on implementation, design of methods to achieve the change over.







8. TESTING
Testing is a process to show the correctness of the program. Testing is needed to show completeness, t improve the quality of the software and to provide the maintenance aid. Some testing standards are therefore necessary reduce the testing costs and operation time. Testing software extends throughout the coding phase and it represents the ultimate review of configurations, design and coding. Based on the way the software reacts to these testing, we can decide whether the configuration that has been built is study or not. All components of an application are tested, as the failure to do so many results in a series of bugs after the software is put to use.

8.1. Blackbox Testing
Black box testing also called behavioral testing, focuses on the functional requirements of software. This testing approach enables the software engineer to derive the input conditions that will fully exercise all requirements for a program. Blackbox testing attempts to find the errors like
  • Incorrect or missing functions
  • Interface errors
  • Errors in datastructures or external database access
  • Behavior or performance errors
  • Initialization and termination errors
In Blackbox testing software is exercised over a full range of inputs and outputs are observed for correctness.







8.2. White box Testing
White box testing is also called Glassbox testing is a test case design control; structure of the procedural design to derive test cases using Whitebox testing method, the software engineer can derive the test cases that guarantee that all independent paths within the module have been exercised at least once. Exercise all logic decisions on their true or false sides. Execute all loops at their boundaries and within their operational bounds. Exercise internal data structure to ensure their validity.


8.3 Software Testing Strategies
Testing involves
·         Unit testing
·         Integration testing
·         Acceptance testing

The first level of test is unit testing. The purpose of unit testing is to ensure that each program is fully tested.
            The second step is integration testing. In this individual program units or programs are integrated and tested as a complete system to ensure that the software requirements are met.
            Acceptance Testing involves planning and the execution of various types of tests in order to demonstrate that the implemented software system satisfies the requirements. Finally our project meets the requirements after going through all the levels of testing.





9. SECURITY
            The system security problem can be divided into four related issues: security, integrity, privacy and confidentiality. They determine the file structure, data structure and access procedures.
            System security refers to the technical innovations and procedures applied to the hardware and operating systems to protect against deliberate or accidental damage from a defined threat. In contrast, data security is the protection of data from loss, disclosure, modifications and destruction.
            System integrity refers to the proper functioning of programs, appropriate physical security and safety against external threats such as eavesdropping and wiretapping. In comparison, data integrity makes sure that do not differ from original from others and how the organization can be protected against unwelcome, unfair or excessive dissemination of information about it.
            The term confidentiality is a special status given to sensitive information in a data base to minimize the possible invasion of privacy. It is an attribute of information that characterizes its need for protection. System security is the technical means of providing such protection. In contrast privacy is largely a procedural matter of how information is used.











10. SOURCE CODE
   Index.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    SqlDataReader dr;
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        String uname = txtUsername.Text;
        String passwd = txtPassword.Text;
        String sql = "SELECT * FROM Login WHERE Username='" + uname + "' AND Password='" + passwd + "'";
        BusinessLayer bl = new BusinessLayer();
        dr = bl.getData(sql);
        if (dr.Read())
        {
            Session["userid"] = uname;
            Response.Redirect("projects.aspx");
        }
        else
            lblMsg.Text = "Invalid username or password";

        dr.Close();
    }
}



 Productlist.aspx.cs   
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class productlist : System.Web.UI.Page
{

    SqlConnection con;
    SqlDataAdapter da;   
    DataSet ds = new DataSet();

    protected void Page_Load(object sender, EventArgs e)
    {
        con  = new SqlConnection(ConfigurationManager.ConnectionStrings["budget"].ConnectionString);
        con.Open();
        if (!IsPostBack)
        {
            String sql = "select * from ProductInfo";
            da = new SqlDataAdapter(sql, con);
            da.Fill(ds, "result");
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
        }
    }

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        String sql = "select * from ProductInfo";
        da = new SqlDataAdapter(sql, con);
        da.Fill(ds, "result");
        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}


Projects.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class PROJECTS : System.Web.UI.Page
{

    SqlConnection con;
    SqlCommand cmd;
    SqlDataReader dr;
    SqlDataAdapter da;
    DataSet ds = new DataSet();
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["budget"].ConnectionString);
        con.Open();
        cmd = new SqlCommand();
        cmd.Connection = con;
        ds.Clear();
        da=new SqlDataAdapter("Select projectname,description from projects",con);
        da.Fill(ds,"projects");
        GridView1.DataSource=ds.Tables["projects"];
        GridView1.DataBind();
      
    }


    protected void btnCreate_Click(object sender, EventArgs e)
    {
        String pname = txtprojectname.Text;
        String desc=  txtdescription.Text;
        string status = txtstatus.Text;
        String sql = "SELECT * FROM projects WHERE projectname='" + pname + "'";
        cmd.CommandText = sql;
        dr = cmd.ExecuteReader();  

        if (dr.Read())
        {
            lblmsg.Text = "Project with this name already exist";
            return;
        }
        dr.Close();
        sql = "INSERT INTO projects values('" + pname + "','" + desc + "','" + status + "')";
        cmd.CommandText = sql;
        int x = cmd.ExecuteNonQuery();
        if (x > 0)
        {
            lblmsg.Text = "Project successfully created!";
            txtprojectname.Text = null;
            txtdescription.Text = null;
            txtstatus.Text = null;
            ds.Clear();
            da = new SqlDataAdapter("Select projectname,description from projects", con);
            da.Fill(ds, "projects");
            GridView1.DataSource = ds.Tables["projects"];
            GridView1.DataBind();
        }
    }

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        da=new SqlDataAdapter("Select projectname,description from projects",con);
        da.Fill(ds,"projects");
        GridView1.DataSource=ds.Tables["projects"];
        GridView1.DataBind();

    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}





Product Information upload.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Data.SqlClient;

public partial class upload : System.Web.UI.Page
{    
    SqlConnection con;
    SqlCommand cmd;
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["budget"].ConnectionString);
        con.Open();
        cmd = new SqlCommand();
        cmd.Connection = con;
    }
   
    protected void Button1_Click(object sender, EventArgs e)
    {
        String filename;
        try
        {
            if (!FileUpload1.HasFile)
            {
                lblmsg.Text = "Please select the Product information Excel file";
                return;
            }
            else
            {
                filename = FileUpload1.PostedFile.FileName;
                filename = filename.Substring(filename.LastIndexOf("\\") + 1);
                FileUpload1.PostedFile.SaveAs(Server.MapPath(".") + "/uploads/" + filename);
            }
            cmd.CommandText = "DELETE FROM ProductInfo";
            cmd.ExecuteNonQuery();
            DataSet dsRecords = new DataSet();
            string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + Server.MapPath(".") + "/uploads/" + filename + ";Extended Properties=Excel 8.0;";
            OleDbDataAdapter daGetExcel = new OleDbDataAdapter("SELECT * FROM [Data$]", strConn);
            daGetExcel.Fill(dsRecords, "Data");
            foreach (DataRow myDataRow in dsRecords.Tables["Data"].Rows)
            {
                if (myDataRow[0].ToString() != "")
                {
                    String sku = myDataRow[0].ToString();
                    String pc = myDataRow[1].ToString();
                    String sc = myDataRow[2].ToString();
                    String uc = myDataRow[3].ToString();
                    String ef = myDataRow[4].ToString();
                    String mf = myDataRow[5].ToString();
                    Double packFee = Double.Parse(pc);
                    Double shipcost = Double.Parse(sc);
                    Double unitcost = Double.Parse(uc);
                    Double ebay = Double.Parse(ef);
                    Double marketfee = Double.Parse(mf);
                    String sql = "INSERT INTO ProductInfo values('" + sku + "','" + packFee +
                     "','" + shipcost + "','" + unitcost + "','" + ebay + "','" + marketfee + "')";
                    cmd.CommandText = sql;
                    cmd.ExecuteNonQuery();
                }
                lblmsg.Text = "Product information successfully updated";
               
            }

        }
        catch (Exception ex)
        {
            Response.Write("Error:Inalid file format or Invalid excel file selected ""<br>"+ ex.Message);
            //Thread.Sleep(15000);
        }

    }
}




Daily Inventory Upload.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Data.SqlClient;

public partial class inv_upload : System.Web.UI.Page
{
    SqlConnection con;
    SqlCommand cmd;
    SqlDataAdapter da;
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["budget"].ConnectionString);
        con.Open();
        cmd = new SqlCommand();
        cmd.Connection = con;
        if (!IsPostBack)
        {
            da = new SqlDataAdapter("select projectname from projects", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            ddlpjcts.Items.Add("--Select--");
            foreach (DataRow drow in ds.Tables[0].Rows)
            {
                ddlpjcts.Items.Add(drow["projectname"].ToString());
            }
        }
    }


    protected void Btn1_Click(object sender, EventArgs e)
    {
        if (ddlpjcts.SelectedValue =="--Select--")
        {
            lblmsg.Text = "Please select a project name";
            return;
        }
    
  
            String filename;
            try
            {
                if (!FileUpload1.HasFile)
                {
                    lblmsg.Text = "Please select an excel file";
                    return;
                }
                else
                {
                    filename = FileUpload1.PostedFile.FileName;
                    filename = filename.Substring(filename.LastIndexOf("\\") + 1);
                    FileUpload1.PostedFile.SaveAs(Server.MapPath(".") + "/uploads/" + filename);
                }
                DataSet dsRecords = new DataSet();
                string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + Server.MapPath(".") + "/uploads/" + filename + ";Extended Properties=Excel 8.0;";
                OleDbDataAdapter daGetExcel = new OleDbDataAdapter("SELECT * FROM [Inventory$]", strConn);
                daGetExcel.Fill(dsRecords, "Inventory");
                String ProjectName = ddlpjcts.SelectedValue;
                foreach (DataRow myDataRow in dsRecords.Tables["Inventory"].Rows)
                {
                    if (myDataRow[0].ToString() != "")
                    {
                       
                        String SKU = myDataRow[0].ToString();
                        String sd = myDataRow[1].ToString();
                        String pr = myDataRow[2].ToString();
                        String tot = myDataRow[3].ToString();
                        Double Sold = Double.Parse(sd);
                        Double Prices = Double.Parse(pr);
                        Double Total = Double.Parse(tot);
                        String sql = "INSERT INTO Inventory values('"+ ProjectName + "','" + SKU + "','" + Sold +
                         "','" + Prices + "','" + Total + "','" + DateTime.Now +  "')";
                        cmd.CommandText = sql;
                        cmd.ExecuteNonQuery();
                    }
                    lblmsg.Text = "Inventory details successfully inserted";

                }
            }

            catch (Exception ex)
            {
                Response.Write("Error:" + ex.Message);
                //Thread.Sleep(15000);
            }  }}

Projectwise summary.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Data.SqlClient;


public partial class summary : System.Web.UI.Page
{
    SqlConnection con;
    DataSet ds;
    SqlDataAdapter da;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null)
        {
            Response.Redirect("index.aspx");
        }
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["budget"].ConnectionString);
        con.Open();
        if (!IsPostBack)
        {
            da = new SqlDataAdapter("select projectname from projects", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            drop.Items.Add("--Select--");
            foreach (DataRow drow in ds.Tables[0].Rows)
            {
                drop.Items.Add(drow["projectname"].ToString());
            }
            
           
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (drop.SelectedValue == "--Select--")
        {
            lblMsg.Text = "Please, select a project name.";
            return;
        }
        lblMsg.Text = "";
        String pjtname = drop.SelectedValue;
        String sql = "SELECT A.SKU, A.Sold, A.Prices, A.Total, B.PackagingCost, B.ActualShippingCost, B.UnitCost, B.EbayFee, B.MarketFee," +
            "B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee AS TotalUnitCost, " +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee AS TotalCost," +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee - A.Total AS TotalEarning " +
            "FROM Inventory AS A INNER JOIN ProductInfo AS B ON A.SKU = B.SKU WHERE (A.ProjectName = '" + pjtname + "')";
        da = new SqlDataAdapter(sql, con);
        ds = new DataSet();
        da.Fill(ds);
        gvSummary.DataSource = ds.Tables[0];
        gvSummary.DataBind();
    }
    protected void gvSummary_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvSummary.PageIndex = e.NewPageIndex;
        String pjtname = drop.SelectedValue;
        String sql = "SELECT A.SKU, A.Sold, A.Prices, A.Total, B.PackagingCost, B.ActualShippingCost, B.UnitCost, B.EbayFee, B.MarketFee," +
            "B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee AS TotalUnitCost, " +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee AS TotalCost," +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee - A.Total AS TotalEarning " +
            "FROM Inventory AS A INNER JOIN ProductInfo AS B ON A.SKU = B.SKU WHERE (A.ProjectName = '" + pjtname + "')";
        da = new SqlDataAdapter(sql, con);
        ds = new DataSet();
        da.Fill(ds);
        gvSummary.DataSource = ds.Tables[0];
        gvSummary.DataBind();
    }
    protected void gvSummary_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}













Datewise Summary.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class datewisesummary : System.Web.UI.Page
{
    SqlConnection con;
    DataSet ds;
    SqlDataAdapter da;
    String startDate, endDate;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null)
        {
            Response.Redirect("index.aspx");
        }
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["budget"].ConnectionString);
        con.Open();
    }

    protected void btnShow_Click(object sender, EventArgs e)
    {
        startDate = Request.Form.Get("txtStartDate");
        endDate = Request.Form.Get("txtEndDate");
        if (startDate == "" || endDate == "")
        {
            lblMSg.Text = "Missing fields,Select a start date and end date.";
        }
        String sql = "SELECT CONVERT(CHAR(11), A.PDate, 106) as PDate, A.ProjectName,A.SKU, A.Sold, A.Prices, A.Total, B.PackagingCost, B.ActualShippingCost, B.UnitCost, B.EbayFee, B.MarketFee," +
            "B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee AS TotalUnitCost, " +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee AS TotalCost," +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee - A.Total AS TotalEarning " +
            "FROM Inventory AS A INNER JOIN ProductInfo AS B ON A.SKU = B.SKU WHERE ( (A.PDate >= '" + startDate + "') AND (A.PDate < '" + endDate + "'))" +
            " ORDER BY A.PDate";
        //Response.Write(sql);
        da = new SqlDataAdapter(sql, con);
        ds = new DataSet();
        da.Fill(ds);
        gvSummary.DataSource = ds.Tables[0];
        gvSummary.DataBind();
    }
    protected void gvSummary_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvSummary.PageIndex = e.NewPageIndex;
        String sql = "SELECT CONVERT(CHAR(11), A.PDate, 106) as PDate, A.ProjectName,A.SKU, A.Sold, A.Prices, A.Total, B.PackagingCost, B.ActualShippingCost, B.UnitCost, B.EbayFee, B.MarketFee," +
            "B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee AS TotalUnitCost, " +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee AS TotalCost," +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee - A.Total AS TotalEarning " +
            "FROM Inventory AS A INNER JOIN ProductInfo AS B ON A.SKU = B.SKU WHERE ( (A.PDate >= '" + startDate + "') AND (A.PDate < '" + endDate + "'))" +
            " ORDER BY A.PDate";
        //Response.Write(sql);
        da = new SqlDataAdapter(sql, con);
        ds = new DataSet();
        da.Fill(ds);
        gvSummary.DataSource = ds.Tables[0];
        gvSummary.DataBind();
    }
}


Monthwise Summary.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class monthwisesummary : System.Web.UI.Page
{
    SqlConnection con;
    DataSet ds;
    SqlDataAdapter da;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null)
        {
            Response.Redirect("index.aspx");
        }
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["budget"].ConnectionString);
        con.Open();
        if (!IsPostBack)
        {          
            for (int i = DateTime.Now.Year; i > 1990; i--)
            {
                cmbYear.Items.Add(i.ToString());
            }
            cmbYear.SelectedIndex = 0;
        }
    }
    protected void btnShow_Click(object sender, EventArgs e)
    {
        if (cmbMonth.Text == "--Select--")
        {
            lblMSg.Text = "Missing fields,Select a month";
            return;
        }
        lblMSg.Text = "";
        String sql = "SELECT CONVERT(CHAR(11), A.PDate, 106) as PDate, A.ProjectName,A.SKU, A.Sold, A.Prices, A.Total, B.PackagingCost, B.ActualShippingCost, B.UnitCost, B.EbayFee, B.MarketFee," +
            "B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee AS TotalUnitCost, " +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee AS TotalCost," +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee - A.Total AS TotalEarning " +
            "FROM Inventory AS A INNER JOIN ProductInfo AS B ON A.SKU = B.SKU WHERE ( Year(A.PDate)=" + cmbYear.SelectedValue + " and Month(A.PDate)=" +cmbMonth.SelectedValue+ ")ORDER BY A.PDate";
        //Response.Write(sql);
        da = new SqlDataAdapter(sql, con);
        ds = new DataSet();
        da.Fill(ds);
        mthSummary.DataSource = ds.Tables[0];
        mthSummary.DataBind();
    }

    protected void mthSummary_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        mthSummary.PageIndex = e.NewPageIndex;
        String sql = "SELECT CONVERT(CHAR(11), A.PDate, 106) as PDate, A.ProjectName,A.SKU, A.Sold, A.Prices, A.Total, B.PackagingCost, B.ActualShippingCost, B.UnitCost, B.EbayFee, B.MarketFee," +
            "B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee AS TotalUnitCost, " +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee AS TotalCost," +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee - A.Total AS TotalEarning " +
            "FROM Inventory AS A INNER JOIN ProductInfo AS B ON A.SKU = B.SKU WHERE ( Year(A.PDate)=" + cmbYear.SelectedValue + " and Month(A.PDate)=" + cmbMonth.SelectedValue + ")ORDER BY A.PDate";
        //Response.Write(sql);
        da = new SqlDataAdapter(sql, con);
        ds = new DataSet();
        da.Fill(ds);
        mthSummary.DataSource = ds.Tables[0];
        mthSummary.DataBind();
    }
}



Yearwise Summary.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class yearwisesummary : System.Web.UI.Page
{
    SqlConnection con;
    DataSet ds;
    SqlDataAdapter da;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null)
        {
            Response.Redirect("index.aspx");
        }
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["budget"].ConnectionString);
        con.Open();
        if (!IsPostBack)
        {
            for (int i = DateTime.Now.Year; i > 1990; i--)
            {
                cmbYear.Items.Add(i.ToString());
            }
            cmbYear.SelectedIndex = 0;
        }
    }
    protected void btnShow_Click(object sender, EventArgs e)
    {
        if (cmbYear.Text == "--Select--")
        {
            lblMSg.Text = "Missing fields,Select a year";
            return;
        }
        lblMSg.Text = "";
        String sql = "SELECT CONVERT(CHAR(11), A.PDate, 106) as PDate, A.ProjectName,A.SKU, A.Sold, A.Prices, A.Total, B.PackagingCost, B.ActualShippingCost, B.UnitCost, B.EbayFee, B.MarketFee," +
            "B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee AS TotalUnitCost, " +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee AS TotalCost," +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee - A.Total AS TotalEarning " +
            "FROM Inventory AS A INNER JOIN ProductInfo AS B ON A.SKU = B.SKU WHERE (Year(A.PDate)=" + cmbYear.SelectedValue + ")ORDER BY A.PDate";
       
        //Response.Write(sql);
        da = new SqlDataAdapter(sql, con);
        ds = new DataSet();
        da.Fill(ds);
        yrSummary.DataSource = ds.Tables[0];
        yrSummary.DataBind();
    }

    protected void yrSummary_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        yrSummary.PageIndex = e.NewPageIndex;
        String sql = "SELECT CONVERT(CHAR(11), A.PDate, 106) as PDate, A.ProjectName,A.SKU, A.Sold, A.Prices, A.Total, B.PackagingCost, B.ActualShippingCost, B.UnitCost, B.EbayFee, B.MarketFee," +
            "B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee AS TotalUnitCost, " +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee AS TotalCost," +
            "(B.PackagingCost + B.ActualShippingCost + B.UnitCost + B.MarketFee) * A.Sold + B.EbayFee - A.Total AS TotalEarning " +
            "FROM Inventory AS A INNER JOIN ProductInfo AS B ON A.SKU = B.SKU WHERE (Year(A.PDate)=" + cmbYear.SelectedValue + ")ORDER BY A.PDate";

        //Response.Write(sql);
        da = new SqlDataAdapter(sql, con);
        ds = new DataSet();
        da.Fill(ds);
        yrSummary.DataSource = ds.Tables[0];
        yrSummary.DataBind();
    }
}




Assumption.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Data.OleDb;

public partial class assumption : System.Web.UI.Page
{
    SqlConnection con;
    SqlCommand cmd;
    SqlDataAdapter da;
    DataSet ds = new DataSet();
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection(ConfigurationManager.ConnectionStrings["budget"].ConnectionString);
        con.Open();
        cmd = new SqlCommand();
        cmd.Connection = con;
        ds.Clear();
        da = new SqlDataAdapter("Select SKU,EbayFeeFV1,EbayFeeFV2,BuyItNow1,BuyItNow2,BuyItNow3,Insertion from Assumption", con);
        da.Fill(ds, "assum");
        GridView1.DataSource = ds.Tables["assum"];
        GridView1.DataBind();
    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        String filename;
        try
        {
            if (!FileUpload1.HasFile)
            {
                lblmsg.Text = "Please select the Product information Excel file";
                return;
            }
            else
            {
                filename = FileUpload1.PostedFile.FileName;
                filename = filename.Substring(filename.LastIndexOf("\\") + 1);
                FileUpload1.PostedFile.SaveAs(Server.MapPath(".") + "/uploads/" + filename);
            }
            cmd.CommandText = "DELETE FROM Assumption";
            cmd.ExecuteNonQuery();
            DataSet dsRecords = new DataSet();
            string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + Server.MapPath(".") + "/uploads/" + filename + ";Extended Properties=Excel 8.0;";
            OleDbDataAdapter daGetExcel = new OleDbDataAdapter("SELECT * FROM [ASSUMPTION$]", strConn);
            daGetExcel.Fill(dsRecords, "Data");
            foreach (DataRow myDataRow in dsRecords.Tables["Data"].Rows)
            {
                if (myDataRow[0].ToString() != "")
                {
                    String sku = myDataRow[0].ToString();
                    String E1 = myDataRow[1].ToString();
                    String E2 = myDataRow[2].ToString();
                    String B1 = myDataRow[3].ToString();
                    String B2 = myDataRow[4].ToString();
                    String B3 = myDataRow[5].ToString();
                    String In = myDataRow[6].ToString();
                    Double Eb1 = Double.Parse(E1);
                    Double Eb2 = Double.Parse(E2);
                    Double Bu1 = Double.Parse(B1);
                    Double Bu2 = Double.Parse(B2);
                    Double Bu3 = Double.Parse(B3);
                    Double Ins = Double.Parse(In);
                    String sql = "INSERT INTO Assumption values('" + sku + "'," + Eb1 +
                     "," + Eb2 + "," + Bu1 + "," + Bu2 + "," + Bu3 + "," + Ins +  ")";
                    //Response.Write(sql + "<br>");
                    cmd.CommandText = sql;
                    cmd.ExecuteNonQuery();
                }
                lblmsg.Text = "Product information successfully updated";

            }

        }
        catch (Exception ex)
        {
            Response.Write("Error:Invalid file format or Invalid excel file selected " + "<br>" + ex.Message);
            //Thread.Sleep(15000);
        }
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        ds.Clear();
        da = new SqlDataAdapter("Select SKU,EbayFeeFV1,EbayFeeFV2,BuyItNow1,BuyItNow2,BuyItNow3,Insertion from Assumption", con);
        da.Fill(ds, "assum");
        GridView1.DataSource = ds.Tables["assum"];
        GridView1.DataBind();
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
   






11. FUTURE ENHANCEMENTS
Now the users can upload only excel file into the DB for calculating profit and loss of products. In future we can use the facility to upload CSV or XML file into the database for calculation.
12. CONCLUSION

Budget Analysis is an online project that allows the users to calculate profit and loss of products sold and do its analysis. For this, an excel based analyzer is created. If the users are provided with the excel files, they can calculate the profit and loss from anywhere in the world and thus a lot of time can be saved. The users are provided with company’s excel files which are stored in administrator’s database.




13. BIBLIOGRAPHY


  • Windows programming                                            Charles Petzoid
  • ASP. NET Unleashed                                               Stephen Walther
  • Visual Basic .NET Black Book                                Steven Holzer
  • Professional ASP. NET Web services                     Alex Homer, Dave Sussman
  • SQL Server Essential Reference                              Sharon Dooley



0 comments:

Post a Comment