Tuesday, September 25, 2012

f

 web
----------------
xml version="1.0"?>

configuration>
    system.web>
       
        compilation debug="true"/>
       
        authentication mode="Windows"/>
       
    system.web>
    connectionStrings>
        add name="myconn" connectionString="Server='10.0.0.15';Integrated Security=false;uid='sa';pwd='123456';Database=Asian_Test;Min Pool Size=10" providerName="System.Data.SqlClient"/>
    connectionStrings>
    appSettings>
    add key="DBSERVER" value="10.0.0.15"/>
        add key="DBNAME" value="Asian_Test"/>
    add key="USENAME" value="sa"/>
    add key="password" value="123456"/>
    appSettings>
configuration>

   
----------------------
data access
using System;
using System.Collections.Generic;
using System.Text;

using sits.@in.db.conect;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;



namespace sits.@in.db.conect.IMPL
{
    public class DataAccessImpl : sits.@in.db.conect.DataAccess
    {

        private string fConectingString = string.Empty;
        public string ConectingString
        {
            get { return this.fConectingString; }
            set { this.fConectingString = value; }
        }
       
        public DataAccessImpl()
        {
            fConectingString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
        }
           
       

            //string UserID = ConfigurationManager.AppSettings["USENAME"].ToString();
            //string Password = ConfigurationManager.AppSettings["password"].ToString();
            //string Host = ConfigurationManager.AppSettings["DBNAME"].ToString();
            //string ServiceName = ConfigurationManager.AppSettings["DBSERVER"].ToString();





        #region DataAccess Members

        public DataSet readtodataset(string sql)
        {
            DataSet ds = null;
            try
            {
                ds = SqlHelper.ExecuteDataset(ConectingString, CommandType.Text, sql);
               
               
            }
            catch (Exception ex)
            {
               
                throw;
            }
            return ds;
        }


        public bool updatesql(string sql)
        {
            bool success = false;
            try
            {
               
                SqlHelper.ExecuteNonQuery(ConectingString, CommandType.Text, sql);
                success = true;

            }
            catch (Exception ex)
            {

                throw ex;
            }
            return success;
        }

        public bool updatesSP(string sSP, SqlParameter[] param)
        {
            bool success = false;
            try
            {
                SqlHelper.ExecuteNonQuery(ConectingString, CommandType.StoredProcedure, sSP, param);
                success = true;
            }
            catch (Exception ex)
            {

                throw ex;
            }

            return success;
        }

        #endregion
    }
}
----------------------------

public ItemCategory[] getActiveCategories()
        {
            logger.Debug("start retriviewing all item category details");
            ItemCategory[] tempCat = null;
            string sSql = "SELECT * FROM IMS_TBL_ADMIN_ITEMCATEGORY WHERE CATEGORY_STATUS=" + 1 + " ORDER BY CATEGORY_NAME";

            try
            {
                DataSet ds = dataAccess.ReadToDataSet(sSql);

                int rowCount = ds.Tables[0].Rows.Count;
                int row = 0;

                if (rowCount > 0)
                {
                    tempCat = new ItemCategory[rowCount];

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        ItemCategory temp = new ItemCategory();
                        temp.categoryCode = dr["CATEGORY_CODE"].ToString().Trim();
                        temp.categoryName = dr["CATEGORY_NAME"].ToString().Trim();
                        temp.userDefineCode = dr["DEFINE_CAT_CODE"].ToString().Trim();

                        if (!string.IsNullOrEmpty(dr["CATEGORY_STATUS"].ToString()))
                        {
                            temp.categoryStatus = Convert.ToInt32(dr["CATEGORY_STATUS"]);
                        }
                        else
                        {
                            temp.categoryStatus = 0;
                        }

                        tempCat[row++] = temp;
                    }
                }
                logger.Debug("Successfully retrived all item category details");
            }
            catch (DbException db)
            {
                logger.Error("Item category information retrieval failed due to the exception : " + db.Message);
                throw new DbException("DB error when retriving the item category details");
            }
            catch (Exception ex)
            {
                logger.Error("Item category information retrieval failed due to the exception : " + ex.Message);
                throw ex;
            }

            return tempCat;

-------------------------------------

 public ItemCategory getCategoryByCode(string code)
        {
            logger.Debug("Start retriviewing Item category details by code" + code);
            ItemCategory tempCat = new ItemCategory();
            string sSql = "SELECT * FROM IMS_TBL_ADMIN_ITEMCATEGORY WHERE DEFINE_CAT_CODE='" + code + "'";

            try
            {
                DataSet ds = dataAccess.ReadToDataSet(sSql);
                int aa = ds.Tables[0].Rows.Count;
                DataRow dr = ds.Tables[0].Rows[0];

                tempCat.categoryCode = dr["CATEGORY_CODE"].ToString().Trim();
                tempCat.categoryName = dr["CATEGORY_NAME"].ToString().Trim();
                tempCat.userDefineCode = dr["DEFINE_CAT_CODE"].ToString().Trim();

                if (!string.IsNullOrEmpty(dr["CATEGORY_STATUS"].ToString()))
                {
                    tempCat.categoryStatus = Convert.ToInt32(dr["CATEGORY_STATUS"]);
                }
                else
                {
                    tempCat.categoryStatus = 0;
                }

                logger.Debug("successfully retrived Item category details by code" + code);
            }
            catch (DbException db)
            {
                logger.Error("Item category information retrieval failed due to the exception : " + db.Message);
                throw new DbException("DB error when retriving the item category details");
            }
            catch (Exception ex)
            {
                logger.Error("Item category information retrieval failed due to the exception : " + ex.Message);
                throw ex;
            }

            return tempCat;

____-------------------------------

 public bool InsertAccount(Account Account)
        {
            logger.Debug("Inserting account information for the account : " + Account.accountName);
           
            bool operationSuccess = false;

            try
            {
                SqlParameter[] paramArray = new SqlParameter[14];
                paramArray[0] = new SqlParameter("@AccCode",SqlDbType.Char,10);
                paramArray[0].Value = Account.accountCode;
                paramArray[1] = new SqlParameter("@AccName",SqlDbType.Char,50);
                paramArray[1].Value = Account.accountName;
                paramArray[2] = new SqlParameter("@AccAddress",SqlDbType.Char,80);
                paramArray[2].Value = Account.accountAddress;
                paramArray[3] = new SqlParameter("@AccTel",SqlDbType.Char,30);
                paramArray[3].Value = Account.accountTel;
                paramArray[4] = new SqlParameter("@AccFax",SqlDbType.Char,30);
                paramArray[4].Value = Account.accountFax;
                paramArray[5] = new SqlParameter("@AccEmail",SqlDbType.Char,30);
                paramArray[5].Value = Account.accountEmail;
                paramArray[6] = new SqlParameter("@LastLogOnUser",SqlDbType.Char,20);
                paramArray[6].Value = Account.lastLogOnUser;
                paramArray[7] = new SqlParameter("@AccType",SqlDbType.Int);
                paramArray[7].Value = Account.accountType;
                paramArray[8] = new SqlParameter("@Category",SqlDbType.Int);
                paramArray[8].Value = Account.accountCategory;
                //paramArray[9] = new SqlParameter("@BalanceDate",SqlDbType.DateTime);
                //paramArray[9].Value = Account.balanceDate;
                paramArray[9] = new SqlParameter("@MainAccID",SqlDbType.Int);
                paramArray[9].Value = Account.mainAccountId;
                paramArray[10] = new SqlParameter("@DisplayName", SqlDbType.Char,60);
                paramArray[10].Value = Account.displayName;
                paramArray[11] = new SqlParameter("@Active", SqlDbType.Bit);
                paramArray[11].Value = Account.active;
                paramArray[12] = new SqlParameter("@CostCentre", SqlDbType.Int);
                paramArray[12].Value = Account.costCenter;
                paramArray[13] = new SqlParameter("@Refno", SqlDbType.VarChar,12);
                paramArray[13].Value = Account.referenceNo;
                operationSuccess = fdataAccess.dbUpdateSP("Acc_sp_Insert_Account", paramArray);

                logger.Debug("Account infomation for account : " + Account.accountName + " successfully saved");
            }
            catch (DbException db)
            {
                logger.Error("Inserting account : " + Account.accountName + " failed with the exception : " + db.Message);
                throw new DbException("DB error when Inserting Account");
            }

            return operationSuccess;
        }

Tuesday, July 19, 2011

Wireless Internet Video Cameras



A wireless Internet video camera allows video (and sometimes audio) data to be captured and transmitted across a WiFi computer network. Wireless Internet video cameras are available in both 802.11b and 802.11g varieties. The Linksys WVC54G 802.11g wireless camera is shown above.

Wireless Internet video cameras work by serving up data streams to any computer that connects to them. Cameras like the one above contain a built in Web server. Computers connect to the camera using either a standard Web browser or through a special client user interface provided on CD-ROM with the product. With proper security information, video streams from these cameras can also be viewed across the Internet from authorized computers.

Wi-Fi Internet video cameras can be connected to a wireless router using either an Ethernet cable or wirelessly. These products include setup software on a CD-ROM that must be installed on one computer to complete initial Wi-Fi configuration of the device.

Features that distinguish different wireless Internet video cameras from each other include:

  • resolution of the captured video images (for example, 320x240 pixel, 640x480 pixel, and other image sizes)
  • motion sensors, and the ability to send email alerts when new activity is detected and captured
  • ability to timestamp images
  • built-in microphones and/or jacks for external microphones, for audio support
  • types of WiFi security supported, such as WEP or WAP
How to configure the Wireless Internet Video Camera

Wireless Game Adapters




A wireless game adapter connects a video game console to a Wi-Fi home network to enable Internet or head-to-head LAN gaming. Wireless game adapters for home networks are available in both 802.11b and 802.11g varieties. An example of an 802.11g wireless game adapter appears above, the Linksys WGA54G . Wireless game adapters can be connected either to a wireless router using an Ethernet cable (for best reliability and performance) or over Wi-Fi (for greater reach and convenience). Wireless game adapter products include setup software on a CD-ROM that must be installed on one computer to complete initial configuration of the device. As with generic network adapters, wireless game adapters must be configured with the correct network name (SSID) and encryption settings.

Wireless Print Servers


A wireless print server allows one or two printers to be conveniently shared across a WiFi network. Wireless print servers for home networks generally are available in both 802.11b and 802.11g varieties.

Wireless print servers offer the following advantages:

  • Allows printers to be conveniently located anywhere within wireless network range, not tied to the location of computers
  • Does not require a computer be always turned on in order to print
  • Does not require a computer to manage all print jobs, that can bog down its performance
  • Allows administrators to change computer names and other settings without having to re-configure the network printing settings.

A wireless print server must be connected to printers by a network cable, normally USB 1.1 or USB 2.0. The print server itself can connect to a wireless router over WiFi, or it can be joined using an Ethernet cable.

Most print server products include setup software on a CD-ROM that must be installed on one computer to complete the initial configuration of the device. As with network adapters, wireless print servers must be configured with the correct network name (SSID) and encryption settings. Additionally, a wireless print server requires client software be installed on each computer needing to use a printer.

The Linksys WPS54G (compare prices) 802.11g USB wireless print server is shown. Print servers are very compact devices that include a built-in wireless antenna and LED lights to indicate status.

Wireless Network Adapters


A wireless network adapter allows a computing device to join a wireless LAN. Wireless network adapters contain a built-in radio transmitter and receiver. Each adapter supports one or more of the 802.11a, 802.11b, or 802.11g Wi-Fi standards.

Wireless network adapters also exist in several different form factors. Traditional PCI wireless adapters are add-in cards designed for installation inside a desktop computer having a PCI bus. USB wireless adapters connect to the external USB port of a computer. Finally, so-called PC Card or PCMCIA wireless adapters insert into a narrow open bay on a notebook computer.

One example of a PC Card wireless adapter, the Linksys WPC54G (compare prices) is shown above. Each type of wireless network adapter is small, generally less than 6 inches (0.15 m) long. Each provides equivalent wireless capability according to the Wi-Fi standard it supports.

Some notebook computers are now manufactured with bulit-in wireless networking. Small chips inside the computer provide the equivalent functions of a network adapter. These computers obviously do not require separate installation of a separate wireless network adapter.

Wireless Product Equipment - Network Routers

The centerpiece product of many home computer networks is a wireless router. These routers support all home computers configured with wireless network adapters (see below). They also contain a network switch to allow some computers to be connected with Ethernet cables.

Wireless routers allow cable modem and DSL Internet connections to be shared. Additionally, many wireless router products include a built-in firewall that protects the home network from intruders.

Illustrated above is the Linksys WRT54G (compare prices). This is a popular wireless router product based on the 802.11g Wi-Fi network standard. Wireless routers are small box-like devices generally less than 12 inches (0.3 m) in length, with LED lights on the front and with connection ports on the sides or back. Some wireless routers like the WRT54G feature external antennas that protrude from the top of the device; others contain built-in antennas.

Wireless router products differ in the network protocols they support (802.11g, 802.11a, 802.11b or a combination), in the number of wired device connections they support, in the security options they support, and in many other smaller ways. Generally only one wireless router is required to network an entire household.

Wireless router products differ in the network protocols they support (802.11g, 802.11a, 802.11b or a combination), in the number of wired device connections they support, in the security options they support, and in many other smaller ways. Generally only one wireless router is required to network an entire household.

Access point wireless


Wireless access points (APs or WAPs) are specially configured nodes on wireless local area networks (WLANs). Access points act as a central transmitter and receiver of WLAN radio signals.

Access points used in home or small business networks are generally small, dedicated hardware devices featuring a built-in network adapter, antenna, and radio transmitter. Access points support Wi-Fi wireless communication standards.

Although very small WLANs can function without access points in so-called "ad hoc" or peer-to-peer mode, access points support "infrastructure" mode. This mode bridges WLANs with a wired Ethernet LAN and also scales the network to support more clients. Older and base model access points allowed a maximum of only 10 or 20 clients; many newer access points support up to 255 clients.

A Wireless access points (sometimes called an "AP" or "WAP") serves to join or "bridge" wireless clients to a wired Ethernet network. Access points centralize all WiFi clients on a local network in so-called "infrastructure" mode. An access point in turn may connect to another access point, or to a wired Ethernet router.

Wireless access points are commonly used in large office buildings to create one Wireless Loacal area Network (WLAN) that spans a large area. Each access point typically supports up to 255 client computers. By connecting access points to each other, local networks having thousands of access points can be created. Client computers may move or "roam" between each of these access points as needed.

In home networking, wireless access points can be used to extend an existing home network based on a wired broadband router. The access point connects to the broadband router, allowing wireless clients to join the home network without needing to rewire or re-configure the Ethernet connections.

As illustrated by the Linksys WAP54G shown above, wireless access points appear physically similar to wireless routers. Wireless routers actually contain a wireless access point as part of their overall package. Like wireless routers, access points are available with support for 802.11a, 802.11b, 802.11g or combinations.