public bool CreateQuotation(Quotation quotation)
 {
     SqlParameter[] Params = new SqlParameter[]
     {
         new SqlParameter("@User_Id", quotation.userID),
         new SqlParameter("@CompanyID", quotation.companyID),
         new SqlParameter("@DateCreated", quotation.dateCreated),
         new SqlParameter("@CourseID", quotation.courseID),
         new SqlParameter("@ExpiryDate", quotation.expiryDate),
         new SqlParameter("@StartDate", quotation.provStartDate),
         new SqlParameter("@EndDate", quotation.provEndDate),
         new SqlParameter("@CourseID", quotation.courseID),
     };
     return(DBHelper.ExecuteNonQuery("sp_CreateQuotation", CommandType.StoredProcedure,
                                     Params));
 }
 public bool UpdateQuotation(Quotation quotation)
 {
     SqlParameter[] Params = new SqlParameter[]
     {
         new SqlParameter("@QuotationID", quotation.quotationID),
         new SqlParameter("@DateCreated", quotation.dateCreated),
         new SqlParameter("@ExpiryDate", quotation.expiryDate),
         new SqlParameter("@StartDate", quotation.provStartDate),
         new SqlParameter("@EndDate", quotation.provEndDate),
         new SqlParameter("@Course", quotation.courseID),
         new SqlParameter("@Status", quotation.Accepeted),
         new SqlParameter("@Price", quotation.money)
     };
     return(DBHelper.ExecuteNonQuery("sp_UpdateQuotation", CommandType.StoredProcedure,
                                     Params));
 }
        public int Insert(Quotation q)
        {
            SqlConnection con = new SqlConnection("server=SREERAJ-PC;integrated security=true;database=obs");
            SqlCommand    cmd = new SqlCommand("Add_Quotation", con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter p1 = cmd.Parameters.AddWithValue("@CRN", q.Crn);
            SqlParameter p2 = cmd.Parameters.AddWithValue("@v_type", q.VehicleType);
            SqlParameter p3 = cmd.Parameters.AddWithValue("@brand", q.Brand);
            SqlParameter p4 = cmd.Parameters.AddWithValue("@model", q.Model);
            SqlParameter p5 = cmd.Parameters.AddWithValue("@chassiss_no", q.ChassissNo);
            SqlParameter p6 = cmd.Parameters.AddWithValue("@engine_no", q.EngineNo);
            SqlParameter p7 = cmd.Parameters.AddWithValue("@exshowroom_price", q.Price);

            SqlParameter returnParam = new SqlParameter();

            returnParam.Value = ParameterDirection.ReturnValue;
            con.Open();
            cmd.ExecuteNonQuery();
            return(Convert.ToInt32(returnParam.Value));
        }
        public Quotation Insert(Quotation q)
        {
            SqlCommand cmd = dbc.getSqlCommand("AddQuotation");

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter p1 = cmd.Parameters.AddWithValue("@v_type", q.VehicleType);
            SqlParameter p2 = cmd.Parameters.AddWithValue("@brand", q.Brand);
            SqlParameter p3 = cmd.Parameters.AddWithValue("@model", q.Model);
            SqlParameter p4 = cmd.Parameters.AddWithValue("@price", q.Price);

            SqlParameter returnParam = new SqlParameter();

            returnParam.Value = ParameterDirection.ReturnValue;
            dbc.con.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                q.Qid     = Convert.ToInt32(reader.GetValue(0));
                q.Premium = Convert.ToDouble(reader.GetValue(1));
                q.Cover   = Convert.ToDouble(reader.GetValue(2));
            }
            return(q);
        }