Exemplo n.º 1
0
        // GET: ProductMaster/Delete/5
        public ActionResult Delete(Int64?Productid)
        {
            if (Productid == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            ProductMasterDetail ProductMasterDetail = new ProductMasterDetail();
            Int64 pProductId = System.Convert.ToInt64(Productid);

            ProductMasterDetail = ProductMasterData.Select_Record_Detail(pProductId);

            if (ProductMasterDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(ProductMasterDetail));
        }
Exemplo n.º 2
0
        public static ProductMasterDetail Select_Record_Detail(Int64 pProductId)
        {
            ProductMasterDetail ProductMasterDetail = new ProductMasterDetail();
            SqlConnection       connection          = plansoni_webstoreData.GetConnection();
            string     selectProcedure = "[sp_ppGetProductInfo]";
            SqlCommand selectCommand   = new SqlCommand(selectProcedure, connection);

            selectCommand.CommandType = CommandType.StoredProcedure;
            selectCommand.Parameters.AddWithValue("@Mode", 8);
            selectCommand.Parameters.AddWithValue("@ProductId", pProductId);
            try
            {
                connection.Open();
                SqlDataReader reader
                    = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    ProductMasterDetail.ProductId        = System.Convert.ToInt64(reader["ProductId"]);
                    ProductMasterDetail.Model            = reader["Model"] is DBNull ? null : reader["Model"].ToString();
                    ProductMasterDetail.Partno           = reader["Partno"] is DBNull ? null : reader["Partno"].ToString();
                    ProductMasterDetail.manufacturerdesc = reader["manufacturerdesc"] is DBNull ? null :reader["manufacturerdesc"].ToString();
                    ProductMasterDetail.ProductType      = reader["ProductType"] is DBNull ? null :reader["ProductType"].ToString();
                    ProductMasterDetail.IsActive         = (Boolean)reader["isActive"];
                }
                else
                {
                    ProductMasterDetail = null;
                }
                reader.Close();
            }
            catch (SqlException)
            {
                return(ProductMasterDetail);
            }
            finally
            {
                connection.Close();
            }
            return(ProductMasterDetail);
        }