private void InvokeReminderAdded(PropertyReminder Reminder) { if (ReminderAdded != null) { ReminderAdded(Reminder); } }
private void Delete_Button_Click(object sender, EventArgs e) { if (this.Reminding_List.SelectedItems.Count > 0) { if (MessageBox.Show("Seçili nesne(leri) silmek istediğinizden emin misiniz?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { MuhasebeEntities m_Context = new MuhasebeEntities(); ListViewItem m_Select = this.Reminding_List.SelectedItems[0]; int m_ItemID = Convert.ToInt32(m_Select.Tag); if (m_Select.Tag != null && m_ItemID > 0) { PropertyReminder m_Item = m_Context.PropertyReminders.Where(q => q.ID == m_ItemID).FirstOrDefault(); if (m_Item != null) { m_Context.PropertyReminders.Remove(m_Item); m_Context.SaveChanges(); PopulateListView(); } else { MessageBox.Show("Silme işlemi sırasında bir hata oluştu.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Silme işlemi sırasında bir hata oluştu.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void PropertyReminders(PropertyReminder PropertyReminder) { if (PropertyReminderEdited != null) { PropertyReminderEdited(PropertyReminder); } }
private void Edit_Button_Click(object sender, EventArgs e) { if (this.Reminding_List.SelectedItems.Count > 0) { MuhasebeEntities m_Context = new MuhasebeEntities(); ListViewItem m_Select = this.Reminding_List.SelectedItems[0]; int m_ItemID = Convert.ToInt32(m_Select.Tag); if (m_ItemID > 0) { PropertyReminder m_Item = m_Context.PropertyReminders.Where(q => q.ID == m_ItemID).FirstOrDefault(); Edit_Reminder_Pop m_Pop = new Edit_Reminder_Pop(); m_Pop.PropertyReminder = m_Item; m_Pop.PropertyReminderEdited += Pop_PropertyReminderEdited; m_Pop.ShowDialog(); } else { MessageBox.Show("Düzenleme sırasında bir hata oluştu", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void Save_Btn_Click(object sender, EventArgs e) { if (this.PropertyReminder != null) { MuhasebeEntities m_Context = new MuhasebeEntities(); PropertyReminder m_Actual = m_Context.PropertyReminders.Where(q => q.ItemID == this.PropertyReminder.Item.ID).FirstOrDefault(); if (m_Actual != null) { m_Actual.ItemID = this.PropertyReminder.Item.ID; m_Actual.Minimum = this.Min_Num.Value; m_Actual.Maximum = this.Max_Num.Value; m_Actual.ResponsibleID = Convert.ToInt32(this.Responsible_Combo.SelectedValue); m_Actual.PropertyReminderMethodID = Convert.ToInt32(this.ReminderWidth_Combo.SelectedValue); m_Context.SaveChanges(); PropertyReminders(m_Actual); this.Close(); } } }
private void Save_Btn_Click(object sender, EventArgs e) { using (MuhasebeEntities m_Context = new MuhasebeEntities()) { PropertyReminder m_Existing = m_Context.PropertyReminders.Where(q => q.OwnerID == Program.User.WorksAtID && q.Item.Product.Barcode == this.Product_Barcode_Box.Text).FirstOrDefault(); if (m_Existing == null) { PropertyReminder m_Reminder = new PropertyReminder(); var m_Product = m_Context.Products.Where(q => q.Barcode == this.Product_Barcode_Box.Text).FirstOrDefault(); var m_Item = m_Context.Items.Where(q => q.Inventory.OwnerID == Program.User.WorksAtID && q.Product.Barcode == this.Product_Barcode_Box.Text).FirstOrDefault(); if (m_Item != null) { m_Reminder.ItemID = m_Item.ID; m_Reminder.Maximum = this.Max_Num.Value; m_Reminder.Minimum = this.Min_Num.Value; m_Reminder.OwnerID = Program.User.WorksAtID; m_Reminder.ResponsibleID = Convert.ToInt32(this.Responsible_Combo.SelectedValue); m_Reminder.PropertyReminderMethodID = Convert.ToInt32(this.ReminderWidth_Combo.SelectedValue); m_Context.PropertyReminders.Add(m_Reminder); m_Context.SaveChanges(); InvokeReminderAdded(m_Reminder); this.Close(); } else { MessageBox.Show("Bu ürün envanterinizde bulunmamaktadır.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Bu hatırlatma listede zaten mevcut.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
void Pop_ReminderAdded(PropertyReminder Reminder) { this.PopulateListView(); }
void Pop_PropertyReminderEdited(PropertyReminder PropertyReminder) { this.PopulateListView(); }