Пример #1
0
        public decimal BrandAdd(BrandInfo brandinfo)
        {
            decimal decReturnValue = 0;
            try
            {
                decReturnValue=SPBrand.BrandAdd(brandinfo);
            }
            catch (Exception ex)
            {

                MessageBox.Show("BD1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return decReturnValue;
        }
Пример #2
0
 /// <summary>
 /// Function to insert values to brand Table
 /// </summary>
 /// <param name="brandinfo"></param>
 /// <returns></returns>
 public decimal BrandAdd(BrandInfo brandinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("BrandAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@brandName", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.BrandName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@manufacturer", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.Manufacturer;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.Extra2;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = brandinfo.ExtraDate;
         decimal inEffectedRow = Convert.ToDecimal(sccmd.ExecuteScalar());
         if (inEffectedRow > 0)
         {
             return inEffectedRow;
         }
         else
         {
             return 0;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         return 0;
     }
     finally
     {
         sqlcon.Close();
     }
 }
Пример #3
0
        /// <summary>
        /// Function to get particular values from brand table based on the parameter
        /// </summary>
        /// <param name="brandId"></param>
        /// <returns></returns>
        public BrandInfo BrandView(decimal brandId)
        {
            BrandInfo brandinfo = new BrandInfo();
            try
            {
               brandinfo= SPBrand.BrandView(brandId);
            }
            catch (Exception ex)
            {

                MessageBox.Show("BD4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return brandinfo;
        }
Пример #4
0
        /// <summary>
        /// Function to Update values in brand Table
        /// </summary>
        /// <param name="brandinfo"></param>
        /// <returns></returns>
        public bool BrandEdit(BrandInfo brandinfo)
        {
            bool isEdit = false;
            try
            {

                isEdit = SPBrand.BrandEdit(brandinfo);
            }
            catch (Exception ex)
            {

                MessageBox.Show("BD2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return isEdit;
        }
Пример #5
0
 /// <summary>
 /// Function to get particular values from brand table based on the parameter
 /// </summary>
 /// <param name="brandId"></param>
 /// <returns></returns>
 public BrandInfo BrandView(decimal brandId)
 {
     BrandInfo brandinfo = new BrandInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("BrandView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@brandId", SqlDbType.Decimal);
         sprmparam.Value = brandId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             brandinfo.BrandName = sdrreader[1].ToString();
             brandinfo.Narration = sdrreader[2].ToString();
             brandinfo.Manufacturer = sdrreader[3].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return brandinfo;
 }