예제 #1
0
        public void GetBDAppDetail(int intBDAppID)
        {
            VPDetail _vpdetail = null;

            try
            {
                SqlConnection con = new SqlConnection(Global.ConnectionString);
                SqlCommand    cmd = new SqlCommand("qryVPGetBDAppDetail", con);
                cmd.CommandTimeout = Global.TimeOut;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.Parameters.Clear();
                SqlParameter prmBDAppID = cmd.Parameters.Add("@BDAppID", SqlDbType.Int);
                prmBDAppID.Value = intBDAppID;

                con.Open();

                //OleDbDataReader dr = cmd.ExecuteReader();
                SqlDataReader dr = cmd.ExecuteReader();

                if (dr != null)
                {
                    // Call Read before accessing data.
                    while (dr.Read())
                    {
                        _vpdetail              = new VPDetail();
                        _vpdetail.Directorate  = dr["Directorate"].ToString();
                        _vpdetail.CGroup       = dr["CGroup"].ToString();
                        _vpdetail.BDAppReg     = Convert.ToBoolean(dr["BDAppReg"]);
                        _vpdetail.ProductOwner = dr["ProductOwner"].ToString();
                        _vpdetail.BusSME       = dr["BusinessSME"].ToString();
                        _vpdetail.BusContact   = dr["BusinessContact"].ToString();
                        _vpdetail.LeadDev      = dr["FullName"].ToString();
                        _vpdetail.DataGuardian = dr["DataGuardian"].ToString();
                        _vpdetails.Add(_vpdetail);
                    }
                }
            }
            catch (SqlException ex)
            {
                if (ex.Number == -2) // connection time-out
                {
                    System.Windows.Forms.MessageBox.Show("The application could not connect to the database, and will now close.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    // Close the application
                    Environment.Exit(1);
                }
            }
        }
예제 #2
0
 // Public methods.
 public void Add(VPDetail c)
 {
     _vpdetails.Add(c);
 }