protected void btnSaveCustomer_ServerClick(object sender, EventArgs e)
        {
            ImprovementObject obj = new ImprovementObject();

            obj.SP_ID = Convert.ToInt32(lstServiceProvider.Value);
            obj.Improvement_Name = txtImprovementName.Value;
            obj.Stock_Code = int.Parse(lstVehicle.Value);
            obj.Improvement_Description = txtImprovementDescription.Value;
            obj.Improvement_price = decimal.Parse(txtImprovementPrice.Value);
            obj.Disable = chkBoxImprovementDisable.Checked;

            ManageImprovement manageImprovements = new ManageImprovement();

            bool success = manageImprovements.insert(obj, ConfigurationManager.ConnectionStrings["MVSSqlDev2008ConnectionString"].ConnectionString);

            if (success)
            {
                divSuccess.Visible = true;
            }
            else
                divFailure.Visible = true;
        }
        public Boolean updateAnImprovement(string connectionString, ImprovementObject improvementObj, int rowIndex)
        {
            try
            {
                conn = DBUtility.createConnection(connectionString);
                SqlCommand cmdIns = DBUtility.PrepareSPCommand("sp_UpdateImprovement", insertParameters(improvementObj), conn);
                cmdIns.Parameters.Add(new SqlParameter("@Improvement_ID", rowIndex));

                int rowsUpdated = cmdIns.ExecuteNonQuery();

                cmdIns.Dispose();
                DBUtility.Close(conn);
                conn.Dispose();

                if (rowsUpdated > 0)
                {
                    return true;
                }
                else return false;

            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString(), ex);
            }
            finally
            {
                DBUtility.Close(conn);
                conn.Dispose();
            }
        }
        public bool insert(ImprovementObject ImprovementObj, string connectionString)
        {
            try
            {
                conn = DBUtility.createConnection(connectionString);
                SqlCommand cmdIns = DBUtility.PrepareSPCommand("sp_InsertImprovement", insertParameters(ImprovementObj), conn);

                int rowsUpdated = cmdIns.ExecuteNonQuery();

                //    cmdIns.Parameters.Clear();
                //    cmdIns.CommandText = "SELECT @@IDENTITY";

                //    // Get the last inserted id.
                //    int insertID = Convert.ToInt32(cmdIns.ExecuteScalar());

                cmdIns.Dispose();
                DBUtility.Close(conn);
                conn.Dispose();
                if (rowsUpdated > 0)
                {
                    return true;
                }
                else return false;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString(), ex);
            }
            finally
            {
                DBUtility.Close(conn);
                conn.Dispose();
            }
        }
        public List<SqlParameter> insertParameters(ImprovementObject improvementObj)
        {
            List<SqlParameter> insertParamsArray = new List<SqlParameter>();

            insertParamsArray.Add(new SqlParameter("@Improvement_Name", improvementObj.Improvement_Name));
            insertParamsArray.Add(new SqlParameter("@Improvement_Description", improvementObj.Improvement_Description));
            insertParamsArray.Add(new SqlParameter("@Improvement_Price", improvementObj.Improvement_price));
            insertParamsArray.Add(new SqlParameter("@SP_ID", improvementObj.SP_ID));
            insertParamsArray.Add(new SqlParameter("@Stock_Code", improvementObj.Stock_Code));
            insertParamsArray.Add(new SqlParameter("@Disable", improvementObj.Disable));

            return insertParamsArray;
        }