Friday, August 17, 2012

Speech Bubble Component in flex:
package {
    import flash.display.Graphics;
    import mx.skins.RectangularBorder;   
    public class CustomContainerBorderSkin extends RectangularBorder {
        private var dropShadow:RectangularDropShadow;
        // Constructor.
        public function CustomContainerBorderSkin() {
        override protected function updateDisplayList(unscaledWidth:Number,
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            var cornerRadius:Number = getStyle("cornerRadius");
            var backgroundColor:int = getStyle("backgroundColor");
            var backgroundAlpha:Number = getStyle("backgroundAlpha");
            // Background
            drawRoundRect(0, 0, unscaledWidth, unscaledHeight,
                {tl: cornerRadius, tr:cornerRadius, bl: cornerRadius, br: cornerRadius},
                backgroundColor, backgroundAlpha);
            // Shadow
            if (!dropShadow)
                dropShadow = new RectangularDropShadow();
            dropShadow.distance = 8;
            dropShadow.angle = 45;
            dropShadow.color = 0;
            dropShadow.alpha = 0.4;
            dropShadow.tlRadius = cornerRadius;
            dropShadow.trRadius = cornerRadius;
            dropShadow.blRadius = cornerRadius;
            dropShadow.brRadius = cornerRadius;
            dropShadow.drawShadow(graphics, 0, 0, unscaledWidth, unscaledHeight);           
            graphics.moveTo(this.x-80, this.height/2+45);
            graphics.lineTo(this.x, this.height/2-20);           
            graphics.lineTo(this.x, this.height/2+20);

Usage of the above component:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx=""
               xmlns:mx="library://" minWidth="955" minHeight="600">
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    <mx:VBox height="100%" width="100%" verticalAlign="middle" horizontalAlign="center">   
    <mx:VBox id="vb1"
             verticalAlign="middle" horizontalAlign="center"
        <mx:Label text="Speech Bubble" fontSize="24" fontWeight="bold"/>
        <mx:Form horizontalCenter="0" verticalCenter="0" verticalGap="5" horizontalGap="5">       

            <mx:FormItem horizontalAlign="center" label="User Name" styleName="loginFormItem">
                <mx:TextInput id="tipUsername" fontWeight="normal" width="180"  height="29" maxChars="15"/>
            <mx:FormItem horizontalAlign="center" label="Password" styleName="loginFormItem">
                <mx:TextInput id="tipPassword" maxChars="8" fontWeight="normal" displayAsPassword="true" height="29" width="180"/>
            <mx:FormItem direction="horizontal" x="71" y="59" horizontalGap="5">
                <mx:Button id="btnLogin" label="Login" />
                <mx:Button id="btnCancel" paddingLeft="5" label="Cancel"/>


Tuesday, January 4, 2011

How to Create a sample ASP.NET Web Service and retrieve values from the database :

Step 1:

Create a database table by name

doctormaster(DoctorID,Doctor_Name,Specialist,Gender,Phone as columns)in MSSQL
Server database with some data.
Open Microsoft Visual Studio 2008--->>>File--->>> New--->>>
Web Site--->>>Select ASP.NET Web Service--->>>
Choose language to "visual c#"

Step 2:

In the Service.cs File--->>>
Copy paste the given code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
[WebService(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX,

uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
    SqlConnection con = new SqlConnection("Data

Source=VIJAYVIGNESH\\SQLEXPRESS2008;Initial Catalog=hospital1;Integrated

    SqlCommand cmd = new SqlCommand();
    SqlDataReader dr;
    public Service () {

        //Uncomment the following line if using designed components

    public string HelloWorld() {
        return "Hello World";
    public List<Doctor> getDoctorDetails()
        var doclist = new List<Doctor>();
        Doctor doc;
        cmd.Connection = con;
        cmd.CommandText = "SELECT * from doctormaster";
        dr = cmd.ExecuteReader();
        while (dr.Read())
            doc = new Doctor
                DoctorID = dr["DoctorID"].ToString(),
                Doctor_Name = dr["Doctor_Name"].ToString(),
                Specialist = dr["Specialist"].ToString(),
                Gender = dr["Gender"].ToString(),
                Phone = dr["Phone"].ToString()
        return doclist;
public class Doctor
    public string DoctorID = string.Empty;
    public string Doctor_Name = string.Empty;
    public string Specialist = string.Empty;
    public string Gender = string.Empty;
    public string Phone = string.Empty;

thats it...!!!!Now you can run the program and click the "getDoctorDetails" Web
Method link in the browser--->>> press invoke.
Output will be in XML Format.Now you can use this web service in any front end

[Note: Make Your Own Connection String Instead Of "Data

Source=VIJAYVIGNESH\\SQLEXPRESS2008;Initial Catalog=hospital1;Integrated