Beispiel #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (decimal.TryParse(textBox1.Text, out decimal qty))
         {
             PromocionDetail _promocionDetail = new PromocionDetail();
             _promocionDetail.PromocionId  = BasePage.PromoForEdit;
             _promocionDetail.SkuProduct   = lblItemCode.Text;
             _promocionDetail.Descriptions = lblDescription.Text;
             _promocionDetail.QtyProduct   = int.Parse(textBox1.Text);
             int          a            = _CN_Products.CN_NewPromocionDetail(_promocionDetail);
             DialogResult dialogResult = MessageBox.Show("Producto agregado exitosamente", "", MessageBoxButtons.OK);
             if (dialogResult.ToString() == "OK")
             {
                 this.Hide();
             }
             //MessageBox.Show("Producto agregado exitosamente");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     //BasePage.PromoForEdit
 }
Beispiel #2
0
        public List <PromocionDetail> GetPromocionDetailbyPromoId(int PromocionId)
        {
            try
            {
                List <PromocionDetail> _promocionDetails = new List <PromocionDetail>();


                conOrders._SqlConnect.Open();
                string         query = "select * from PromocionDetail where promocionid = " + PromocionId;
                SqlCommand     cmd   = new SqlCommand(query, conOrders._SqlConnect);
                SqlDataAdapter data  = new SqlDataAdapter(cmd);
                DataTable      table = new DataTable();
                data.Fill(table);
                conOrders._SqlConnect.Close();

                foreach (DataRow row in table.Rows)
                {
                    PromocionDetail _promo = new PromocionDetail
                    {
                        PromocionDetailId = Convert.ToInt32(row["PromocionDetailId"].ToString()),
                        PromocionId       = Convert.ToInt32(row["PromocionId"].ToString()),
                        SkuProduct        = row["SkuProduct"].ToString(),
                        QtyProduct        = Convert.ToInt32(row["QtyProduct"].ToString()),
                        IsActive          = Convert.ToBoolean(row["IsActive"].ToString()),
                        Descriptions      = row["Descriptions"].ToString()
                    };
                    _promocionDetails.Add(_promo);
                }
                return(_promocionDetails);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conOrders._SqlConnect.Close();
            }
        }
Beispiel #3
0
 public int CD_NewPromocionDetail(PromocionDetail _PromocionDetail)
 {
     try
     {
         cone._SqlConnect.Open();
         int    ban   = 0;
         string query = "insert into PromocionDetail values (" + _PromocionDetail.PromocionId + ", '" + _PromocionDetail.SkuProduct + "'," + _PromocionDetail.QtyProduct + ", 1 ,'" + _PromocionDetail.Descriptions + "') ";
         query = query.Remove(query.Length - 1);
         SqlCommand     cmd  = new SqlCommand(query, cone._SqlConnect);
         SqlDataAdapter data = new SqlDataAdapter(cmd);
         ban = cmd.ExecuteNonQuery();
         cone._SqlConnect.Close();
         return(ban);
     }
     catch (Exception ex)
     {
         throw;
     }
     finally
     {
         cone._SqlConnect.Close();
     }
 }
Beispiel #4
0
 public int CN_NewPromocionDetail(PromocionDetail PromocionDetailId)
 {
     return(_Cd_Items.CD_NewPromocionDetail(PromocionDetailId));
 }