Exemple #1
0
        public static List<ProductGroup> GetAllProductGroups()
        {
            List<ProductGroup> list = new List<ProductGroup>();
            DataTable dt = DAL.GetAllProductGroups();

            foreach (DataRow row in dt.Rows)
            {
                ProductGroup item = new ProductGroup()
                {
                    Id = row.Field<int>("Id"),
                    ProductGroupName = row.Field<string>("Name"),
                    RecordDate = row.Field<DateTime>("RecordDate")

                };
                list.Add(item);
            }

            return list;
        }
Exemple #2
0
        private void btnSaveProductGroup_Click(object sender, EventArgs e)
        {
            if (tbProductGroup.Text.Replace(" ", "") != string.Empty)
            {
                ProductGroup productGrup = new ProductGroup()
                {
                    ProductGroupName = tbProductGroup.Text.Replace(" ", "")
                };
                bool result = productGrup.Save();
                if (result)
                    MessageBox.Show("ürün grubu eklem işleminiz gerçekleştirilmiştir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                else
                    MessageBox.Show("İşlemde hata gerçekleşti.", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error);
                LoadProductGroups();

                tbProductGroup.Text = string.Empty;
            }
            else
            {
                MessageBox.Show("Lütfen ürün grubu giriniz", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
 private void dtProductGroup_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 46)
     {
         DialogResult dialogResult = MessageBox.Show("Silmek istediğinize emin misiniz ? ", "Dikkat", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dialogResult == System.Windows.Forms.DialogResult.Yes)
         {
             int Id = Convert.ToInt32(dtProductGroup.SelectedRows[0].Cells[0].Value);
             ProductGroup t = new ProductGroup()
             {
                 Id = Id
             };
             t.Delete();
         }
         LoadProductGroups();
     }
 }
Exemple #4
0
        private void tbProductGroup_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13)
            {
                if (tbProductGroup.Text.Replace(" ", "") != string.Empty)
                {
                    ProductGroup productGroup = new ProductGroup()
                    {
                        ProductGroupName = tbProductGroup.Text.Replace(" ", "")
                    };
                    bool result = productGroup.Save();
                    if (result)
                        MessageBox.Show("Ürün Grubu ekleme işleminiz gerçekleştirilmiştir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    else
                        MessageBox.Show("İşlemde hata gerçekleşti.", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    LoadProductGroups();

                    tbProductGroup.Text = string.Empty;
                }
                else
                {
                    MessageBox.Show("Lütfen masa adı giriniz", "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #5
0
 private void dtProductGroup_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     var a = dtProductGroup.Rows[e.RowIndex].DataBoundItem as ProductGroup;
     string value = dtProductGroup.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
     int Id = a.Id;
     //int Id = Convert.ToInt32(dtProductGroup.Rows[e.RowIndex].Cells[0].Value);
     DialogResult dialogResult = MessageBox.Show("Güncellemek istediğinize emin misiniz ? ", "Dikkat", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
     if (dialogResult == System.Windows.Forms.DialogResult.Yes)
     {
         ProductGroup t = new ProductGroup()
         {
             Id = Id,
             ProductGroupName = value
         };
         t.Update();
         MessageBox.Show("Ürün grubu güncelleme işleminiz gerçekleştirilmiştir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         LoadProductGroups();
     }
 }