Translate

Pages

Wednesday, 26 June 2013

ASP.NET GridView control demo (CSASPNETGridView)

ASP.NET GridView control demo (CSASPNETGridView)

Introduction

This CSASPNETGridView project describes how to populate ASP.NET GridView control and how to implementInsertEditUpdateDeletePaging and Sorting functions in ASP.NET GridView control. We have received many posts in forums about this popular web control, so this sample provides a complete sample for showing how to implement these basic functions of this control. The sample demonstrates data source from both database and memory.

Friday, 24 May 2013

Part-2 What Type Of UML Diagrams Should you be using

As promised here is Part 2 of our UML post. As mentioned previously, today I will be giving you a short and sweet run through of Behavioural Diagrams, which also forms a vast part of UML diagrams. To put it simply behavioral diagrams capture the dynamic aspect of the system. The word “dynamic” in this context can be described as being the changing parts of the system.
Unlike Structural Diagrams, Behavioural Diagrams can be subdivided into five types of diagrams.

Use case Diagram:

U

Use case diagrams consist of a set of use cases, actors and their respective relationships. These diagrams seek to represent the use case view of a system. A diagram of this type illustrates the functionality of a system. So a use case diagram is utilized to represent the relationships that exist among the functionalities and their controllers (internal/external), which are known as actors.

S

Sequence Diagram:

A sequence diagram is also commonly known as an interaction diagram. A diagram of this type deals with certain sequences, which are messages that flow from a certain object to another. It is important to note that the interaction that is present between the components of a system is significant from an implementation and execution perspective. So a sequence diagram is utilized to visualize the sequence of calls in a system when it comes to performing a functionality that is specific.

collaboration diagram:

Another form of an interaction diagram is known as a collaboration diagram. This type of a diagram illustrates the structural organization of the system and the messages that are sent or received. These structural organizations consists of various objects and links. The specific aim of a collaboration diagram is to visualize the organization of objects and their respective interaction.

state chart diagram:

A state chart diagram is utilized to illustrate the event driven state change of a system. It basically describes the state change of a class and interface amongst other things. A state chart diagram is used to visually represent the reaction of a system through internal or external factors.

activity diagram:

An activity diagram would illustrate the flow of control in the system. This means that such a diagram consists of both activities and links. The flow is usually sequential, concurrent or even branched. The activities are the functions within a system. Ideally, activity diagrams are usually used to illustrate the flow of controls in a given system. Such diagrams are excellent when it comes to have an idea of knowing how a system will work when it is executed.

So that pretty much concludes a basic assessment of the various types of UML diagrams. I hope both posts were useful in enhancing your knowledge when it comes to software design and communication. As always, I encourage you to get in touch with us with any issues you may have with diagramming (general or specific). While I think we have substantially covered UML as a subject in this space, expect to see some interesting and thought-provoking posts starting Monday fromIndu. Till then – Happy Diagramming!

The Complete Guide To UML Diagram Types With Examples

UML stands for Unified Modeling Language which is used in object oriented software engineering. Although typically used in software engineering it is a rich language that can be used to model an application structures, behavior and even business processes. There are 14 UML diagram types to help you model these behavior. They can be divided into two main categories structure diagrams and behavioral diagrams. All 14 UML diagram types are listed below with examples, brief introduction to them and also how they are used when modeling applications.
You can draw UML diagrams online using our software, or check out some UML diagram examples at our diagramming community.

Types of UML diagrams with structure diagrams coming first and behavioral diagrams starting from position 8. Click on any diagram type to visit that specific diagram types description.
  1. Class Diagram
  2. Component Diagram
  3. Deployment Diagram
  4. Object Diagram
  5. Package Diagram
  6. Profile Diagram
  7. Composite Structure Diagram
  8. Use Case Diagram
  9. Activity Diagram
  10. State Machine Diagram
  11. Sequence Diagram
  12. Communication Diagram
  13. Interaction Overview Diagram
  14. Timing Diagram
UML Diagram Types
UML Diagram Types

Structure diagrams show the things in a system being modeled. In a more technical term they show different objects in a system. Behavioral diagrams shows what should happen in a system. They describe how the objects interact with each other to create a functioning system.

Class diagrams are arguably the most used UML diagram type. It is the main building block of any object oriented solution. It shows the classes in a system, attributes and operations of each class and the relationship between each class. In most modeling tools a class has three parts, name at the top, attributes in the middle and operations or methods at the bottom. In large systems with many classes related classes are grouped together to to create class diagrams. Different relationships between diagrams are show by different types of Arrows. Below is a image of a class diagram. Follow the link for more class diagram examples.
UML Class Diagram Example
UML Class Diagram with Relationships

A component diagram displays the structural relationship of components of a software system. These are mostly used when working with complex systems that has many components. Components communicate with each other using interfaces. The interfaces are linked using connectors. Below images shows a component diagram.
Component Diagram in UML
Simple Component Diagram with Interfaces

A deployment diagrams shows the hardware of your system and the software in those hardware. Deployment diagrams are useful when your software solution is deployed across multiple machines with each having a unique configuration. Below is an example deployment diagram.
UML Deployment Diagram
UML Deployment Diagram ( Click on the image to use it as a template )

Object Diagrams, sometimes referred as Instance diagrams are very similar to class diagrams. As class diagrams they also show the relationship between objects but they use real world examples. They are used to show how a system will look like at a given time. Because there is data available in the objects they are often used to explain complex relationships between objects.
UML Object Diagram example
UML Object Diagram Example

As the name suggests a package diagrams shows the dependencies between different packages in a system. Check out this wiki article to learn more about the dependencies and elements found in package diagrams.
Package Diagram in UML
Package Diagram in UML

Profile diagram is a new diagram type introduced in UML 2. This is a diagram type that is very rarely used in any specification. For more detailed technical information about this diagram type check this link.
Profile Diagram in UML
Basic UML Profile Diagram structure

Composite structure diagrams are used to show the internal structure of a class. For a detailed explanation of composite structure diagrams click here.
Composite Structure Diagram in UML
A simple Composite Structure Diagram

Most known diagram type of the behavioral UML diagrams, Use case diagrams gives a graphic overview of the actors involved in a system, different functions needed by those actors and how these different functions are interacted. It’s a great starting point for any project discussion because you can easily identify the main actors involved and the main processes of the system. Click through to read more about use case diagram elements and templates.
Use Case Diagram in UML
Use Case diagram showing Actors and main processes

Activity diagrams represent workflows in an graphical way. They can be used to describe business workflow or the operational workflow of any component in a system. Sometimes activity diagrams are used as an alternative to State machine diagrams. Check out this wiki article to learn about symbols and usage of activity diagrams.
Activity Diagrams in UML
Activity Diagrams with start, end, processes and decision points

State machine diagrams are similar to activity diagrams although notations and usage changes a bit. They are sometime known as state diagrams or start chart diagrams as well. These are very useful to describe the behavior of objects that act different according to the state they are at the moment. Below State machine diagram show the basic states and actions.
State Machine Diagram in UML
State Machine diagram in UML, sometime referred to as State or State chart diagram

Sequence diagrams in UML shows how object interact with each other and the order those interactions occur. It’s important to note that they show the interactions for a particular scenario. The processes are represented vertically and interactions are show as arrows. This article explains thepurpose and the basics of Sequence diagrams.
Sequence Diagrams in UML
Sequence Diagrams in UML shows the interaction between two processes

Communication diagram was called collaboration diagram in UML 1. It is similar to sequence diagrams but the focus is on messages passed between objects. The same information can be represented using a sequence diagram and different objects. Click here to understand the differences using an example.
Communication Diagram in UML
Communication Diagram in UML

Interaction overview diagrams are very similar to activity diagrams. While activity diagrams shows a sequence of processes Interaction overview diagrams shows a sequence of interaction diagrams. In simple term they can be called a collection of interaction diagrams and the order they happen. As mentioned before there are seven types of interaction diagrams, so any one of them can be a node in an interaction overview diagram. ( img – http://www.sa-depot.com/?page_id=645 )
Interaction Overview Diagram in UML
Interaction overview diagram in UML

Timing diagrams are very similar to sequence diagrams. They represent the behavior of objects in a given time frame. If its only one object the diagram is straight forward but if more then one objects are involved they can be used to show interactions of objects during that time frame as well. ( img –http://blog.tangcs.com/2008/01/10/uml-2-diagrams/ )
Timing Diagram in UML
Timing Diagram in UML
Mentioned above are all the UML diagram types. The links given in each section explains the diagrams in more detail and covers the usage, symbols etc. UML offers many diagram types and sometimes two diagram can explain the same thing using different notations.Check this blog post to learn which UML diagram best suits you.If you have any questions or suggestions feel free to leave a comment.

Wednesday, 15 May 2013

passing multiple parameters in crystal reports


Passing multiple parameters in crystal reports:

hello dears,
i use your code to pass parameter to subreport like code below:

SqlConnection cnn;
            string connectionString = null;
            string sql = null;

            connectionString = "data source=.;initial catalog=Lab2;Integrated Security=yes;";
            cnn = new SqlConnection(connectionString);
            cnn.Open();
            sql = @"EXEC    [dbo].[pro_PrintReceptionReceptionInfo]" +
                            "@ReceptNum = '" + receptionNum + "'" +

                  @"EXEC    [dbo].[pro_PrintReceptionPatientTest]" +
                            "@ReceptionNum = '" + receptionNum + "'" +

                  @"EXEC    [dbo].[pro_PrintReceptionPatientInfo]" +
                            "@PatientNum = '" + patientNum + "'" +

                  @"EXEC    [dbo].[pro_PrintReceptionDepositFund]" +
                            "@ReceptNum = '" + receptionNum + "'";

            SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);
            DataSet ds = new DataSet();
            dscmd.Fill(ds, "ReceptionInfo, PatientTest, PatientInfo, DepositFund");
            cnn.Close();

            ParameterFields pFields = new ParameterFields();

            ParameterField pf = new ParameterField();
            ParameterDiscreteValue pdv = new ParameterDiscreteValue();
            pdv.Value = int.Parse(receptionNum);
            pf.Name = "@ReceptNum";
            pf.CurrentValues.Add(pdv);

            ParameterField pf2 = new ParameterField();
            ParameterDiscreteValue pdv2 = new ParameterDiscreteValue();
            pdv2.Value = int.Parse(receptionNum);
            pf2.Name = "@ReceptionNum";
            pf2.CurrentValues.Add(pdv2);

            ParameterField pf3 = new ParameterField();
            ParameterDiscreteValue pdv3 = new ParameterDiscreteValue();
            pdv3.Value = Int64.Parse(patientNum);
            pf3.Name = "@PatientNum";
            pf3.CurrentValues.Add(pdv3);
            
            ParameterField pf4 = new ParameterField();
            ParameterDiscreteValue pdv4 = new ParameterDiscreteValue();
            pdv4.Value = int.Parse(receptionNum);
            pf4.Name = "@ReceptNum";
            pf4.CurrentValues.Add(pdv4);

            pFields.Add(pf);
            pFields.Add(pf2);
            pFields.Add(pf3);
            pFields.Add(pf4);

            crystalReportViewer1.ParameterFieldInfo = pFields;

            ReceptionPrint objRpt = new ReceptionPrint();
            objRpt.SetDataSource(ds);
            objRpt.SetParameterValue("@ReceptionNum", int.Parse(receptionNum), "ReceptionPrintTest");
            objRpt.SetParameterValue("@ReceptNum", int.Parse(receptionNum), "DepositPrintSubReport");

            crystalReportViewer1.ReportSource = objRpt;
Bottom of Form

Tuesday, 14 May 2013

Crystal Report And Parameter Passing Using Stored Procedure


Here's sample application for how to create Crystal Report using stored procedure and passing parameter to that report. I have experienced this sample project in Visual Studio2005 and SQL Server.
Here, I will create a simple application for how to create Crystal Report using stored procedure and passing parameter to that report. I have experienced this sample project in Visual Studio2005 and SQL Server.

First, let’s assume that we have a database in SQL server –

Step -1:

There I will create a sample table for this project purpose –

drop table [dbo].[USERS]
GO

CREATE TABLE [dbo].[USERS] (
            [OID] [nvarchar] (24) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
            [Name] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [Phone] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [Department] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [Designation] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [LoginName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [PassWord] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [LogQues] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [QuesAns] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [AccessLevel] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [Status] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [Email] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [GroupName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
            [GroupEmail] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

Step -2: Then I will create a simple stored procedure (UserInfo) for using into my report.

CREATE PROCEDURE UserInfo  @Dept VARCHAR(20) AS SELECT * FROM USERS WHERE USERS.Department = @Dept
GO


Step -3:

Now I will design my crystal report. For that I will have to add a crystal report in my project.
a.      Double click on the report to go to the design mode.
b.      In field explorer pan of crystal report. Right click ‘Database Fields’. Then choose ‘Database Expert’
c.       Then from left pane – click on ‘Create New Connection’ node
d.      Choose OLEDB (ADO)
e.      Right Click on ‘Make New Connection’  and select  ‘Make New Connection’  
f.        Then from the list of OLEDB providers select ‘Microsoft OLEDB Provider for SQL Server’ then Next
g.      Provide required information for Database server ex. Server Name (IP Address), User ID, password, database name. Then click next and finished.
h.      Then add stored procedure ‘UserInfo’ from left pane to right pane.


Step -4: Now drag and drop the fields you want to display in report. Just drag the fields and drop into ‘Details section’  of crystal report’s design view.

Step -5: Now I will edit my Web.Config file for database information –

<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
<section name="databaseinformation" type="System.Configuration.SingleTagSectionHandler"/>
</configSections>
<databaseinformation name="data" username="sa" password="pims" servername="192.168.201.69" pvdr="SQLOLEDB.1" databasename="TROUBLETICKET"/>



Step -6: Now I will create a page for report loading-

ReportLoader.aspx

<%@ Page Language="C#" MasterPageFile="~/Pages/MasterPage.master" AutoEventWireup="true" CodeFile="ReportLoader.aspx.cs" Inherits="Pages_ReportLoader" Title="Untitled Page" %>
<%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<asp:Label ID="Label1" runat="server" Text="Insert Department:"></asp:Label>
<asp:TextBox ID="txtParamDept" runat="server"></asp:TextBox>
<asp:Button ID="btnShowReport" runat="server" Text="Show Report" OnClick="btnShowReport_Click" />
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
</asp:Content>


ReportLoader.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 CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

public partial class Pages_ReportLoader : System.Web.UI.Page
{
    ReportDocument reportDocument = new ReportDocument();
    ParameterField paramField = new ParameterField();
    ParameterFields paramFields = new ParameterFields();
    ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

protected void Page_Load(object sender, EventArgs e)
 {
        //Instantiate variables
if (!IsPostBack)
        {
      //Set instances for input parameter 1 -  @Dept
            paramField.Name = "@Dept";
            //*Remember to reconstruct the paramDiscreteValue and paramField objects
            paramDiscreteValue.Value = "CS";
            paramField.CurrentValues.Add(paramDiscreteValue);
            //Add the paramField to paramFields
            paramFields.Add(paramField);
            CrystalReportViewer1.ParameterFieldInfo = paramFields;
reportDocument.Load(Server.MapPath("CrystalReportTest.rpt"));
                       //Load the report by setting the report source
            CrystalReportViewer1.ReportSource = reportDocument;
                       //set the database loggon information.
            reportDocument.SetDatabaseLogon("sa""pims""192.168.201.69""TROUBLETICKET");
        }
    }
    protected void btnShowReport_Click(object sender, EventArgs e)
    {
        paramField.Name = "@Dept";
        paramDiscreteValue.Value = txtParamDept.Text.ToString();
        paramField.CurrentValues.Add(paramDiscreteValue);
        paramFields.Add(paramField);
        CrystalReportViewer1.ParameterFieldInfo = paramFields;
               reportDocument.Load(Server.MapPath("CrystalReportTest.rpt"));
        CrystalReportViewer1.ReportSource = reportDocument;
        reportDocument.SetDatabaseLogon("sa""pims""192.168.201.69""TROUBLETICKET");
    }
}



**Alternative way of Report Loading:

ReportLoader2.aspx

<%@ Page Language="C#" MasterPageFile="~/Pages/MasterPage.master" AutoEventWireup="true" CodeFile="ReportLoader2.aspx.cs" Inherits="Pages_ReportLoader" Title="Untitled Page" %>
<%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Label ID="Label1" runat="server" Text="Insert Department:"></asp:Label>
<asp:TextBox ID="txtParamDept" runat="server"></asp:TextBox>
<asp:Button ID="btnShowReport" runat="server" Text="Show Report" OnClick="btnShowReport_Click" />
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
        <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
            <Report FileName="CrystalReportTest.rpt">
                <Parameters>
                    <CR:ControlParameter ControlID="txtParamDept" ConvertEmptyStringToNull="False" DefaultValue="IT"
                        Name="@Dept" PropertyName="Text" ReportName="" />
                </Parameters>           
            </Report>
        </CR:CrystalReportSource>
</asp:Content>

ReportLoader2.aspx.cs

public partial class Pages_ReportLoader2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        CrystalReportViewer1.Visible = true;
        CrystalReportSource1.ReportDocument.SetDatabaseLogon("sa", "pims", "192.168.201.69", "TROUBLETICKET");
        CrystalReportViewer1.ReportSourceID = "CrystalReportSource1";
    }
    protected void btnShowReport_Click(object sender, EventArgs e)
    {
        CrystalReportViewer1.Visible = true;
        CrystalReportViewer1.ReportSourceID = "CrystalReportSource1";

    }
}









 
Twitter Bird Gadget