private void SaveButton_Click(object sender, System.EventArgs e) { Models.DataBaseContext dataBaseContext = null; try { dataBaseContext = new Models.DataBaseContext(); string errorMessage = string.Empty; #region Validation //----- if (string.IsNullOrWhiteSpace(drinkNameTextBox.Text) || string.Compare(drinkNameTextBox.Text, "نام نوشیدنی") == 0) { errorMessage = "فیلد نام نوشیدنی تکمیل گردد!"; } if (string.IsNullOrWhiteSpace(drinkPriceTextBox.Text) || string.Compare(drinkPriceTextBox.Text, "مبلغ نوشیدنی") == 0) { if (errorMessage != string.Empty) { errorMessage += System.Environment.NewLine + " "; } errorMessage += "فیلد مبلغ نوشیدنی تکمیل گردد!"; } if (string.IsNullOrWhiteSpace(descriptionTextBox.Text) || string.Compare(descriptionTextBox.Text, "توضیحات") == 0) { if (errorMessage != string.Empty) { errorMessage += System.Environment.NewLine + " "; } errorMessage += "فیلد توضیحات تکمیل گردد!"; } if (errorMessage != string.Empty) { if (string.IsNullOrWhiteSpace(drinkNameTextBox.Text) || string.Compare(drinkNameTextBox.Text, "نام غذا") == 0) { drinkNameTextBox.Focus(); drinkNameTextBox.Clear(); } else if (string.IsNullOrWhiteSpace(drinkPriceTextBox.Text) || string.Compare(drinkPriceTextBox.Text, "مبلغ غذا") == 0) { drinkPriceTextBox.Focus(); drinkPriceTextBox.Clear(); } else if (string.IsNullOrWhiteSpace(descriptionTextBox.Text) || string.Compare(descriptionTextBox.Text, "توضیحات") == 0) { descriptionTextBox.Focus(); descriptionTextBox.Clear(); } ErrorMessage(errorMessage); } if (string.IsNullOrEmpty(DrinkImage)) { System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog { Filter = "JPEP (*.jpg)|*.jpg|" + "PNG (*.png)|*.png|" + "BMP (*.bmp)|*.bmp", Title = "Load user picture ", }; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DrinkImage = openFileDialog.FileName; drinkImagePicturBox.Image = System.Drawing.Image.FromFile(DrinkImage); } } //----- #endregion /Validation errorMessageLabel.Visible = false; errorMessage = string.Empty; System.Windows.Forms.DialogResult dialogResult; dialogResult = Mbb.Windows.Forms.MessageBox.QuestionMessage (text: $"{DrinkName} ثبت گردد؟", captiopn: "ثبت نوشیدنی", buttons: System.Windows.Forms.MessageBoxButtons.YesNo, defaultButton: System.Windows.Forms.MessageBoxDefaultButton.Button2, icon: System.Windows.Forms.MessageBoxIcon.Question, options: System.Windows.Forms.MessageBoxOptions.RightAlign | System.Windows.Forms.MessageBoxOptions.RtlReading); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { RegisterDate = Infrastructure.Utility.PersianCalendar(System.DateTime.Now); RegisterTime = Infrastructure.Utility.ShowTime(); Models.Drink drink = dataBaseContext.Drinks .Where(current => string.Compare(current.DrinkName, DrinkName, false) == 0) .FirstOrDefault(); if (drink != null) { //errorMessage = // System.Environment.NewLine; errorMessage = $"{DrinkName} در سیستم موجود است!"; ErrorMessage(errorMessage); drinkNameTextBox.Focus(); drinkNameTextBox.SelectAll(); return; } else { drink = new Models.Drink { DrinkName = DrinkName, DrinkPrice = $"{DrinkPrice.ToString("#,0")} تومان", Description = Description, DrinkImage = System.IO.File.ReadAllBytes(DrinkImage), RegisterTime = RegisterDate + " " + RegisterTime, UpdateTime = UpdateTime, NumberUpdate = int.Parse(NumberUpdate), }; dataBaseContext.Drinks.Add(drink); dataBaseContext.SaveChanges(); //-----جهت بارگذاری اطلاعات غذا در جدول داده if (Resturant.MainForm.MenuListForm != null) { Resturant.MainForm.MenuListForm.DrinkLoader(); } string message = $"{DrinkName} ثبت گردید."; Infrastructure.Utility.WindowsNotification (message: message, caption: Infrastructure.PopupNotificationForm.Caption.موفقیت, picture: DrinkImage); AllClear(); } } else { return; } } catch (System.Exception ex) { Infrastructure.Utility.PopupNotification(ex); } finally { if (dataBaseContext != null) { dataBaseContext.Dispose(); dataBaseContext = null; } } }
//-----End of coding line #region Founctions //----- #region FormLoad private void FormLoad() { Models.DataBaseContext dataBaseContext = null; try { dataBaseContext = new Models.DataBaseContext(); Models.Drink drink = dataBaseContext.Drinks .Where(current => string.Compare(current.DrinkName, DrinkName_FirstLoad, true) == 0) .FirstOrDefault(); DrinkName = null; DrinkDescription_New = null; drinkNameTextBox.Text = drink.DrinkName; DrinkPrice = null; DrinkPrice_New = null; DrinkPrice_Int = 0; drinkPriceTextBox.Text = drink.DrinkPrice; DrinkPrice_FirstLoad = drink.DrinkPrice; drinkPriceTextBox.ForeColor = Infrastructure.Utility.DarkDimGary(); drinkPricePanel.BackColor = Infrastructure.Utility.DarkDimGary(); DrinkDescription = null; DrinkDescription_New = null; drinkDescriptionTextBox.Text = drink.DrinkDescription; DrinkDescription_FirstLoad = drink.DrinkDescription; drinkDescriptionTextBox.ForeColor = Infrastructure.Utility.DarkDimGary(); drinkDescriptionPanel.BackColor = Infrastructure.Utility.DarkDimGary(); DrinkImage = null; DrinkDescription_New = null; DrinkImage_FirstLoad = drink.DrinkImage; var byteImage = drink.DrinkImage; if (byteImage == null) { deleteDrinkImageButton.Visible = false; } else { deleteDrinkImageButton.Visible = true; using (System.IO.MemoryStream ms = new System.IO.MemoryStream(byteImage)) { drinkImagePicturBox.Image = System.Drawing.Image.FromStream(ms); } } } catch (System.Exception ex) { Infrastructure.Utility.ExceptionShow(ex); } finally { if (dataBaseContext != null) { dataBaseContext.Dispose(); dataBaseContext = null; } } }
private void DeleteRecordButton_Click(object sender, System.EventArgs e) { if (drinkStoreDataGridView.Rows.Count >= 1) { System.Windows.Forms.DialogResult dialogResult = Mbb.Windows.Forms.MessageBox.Show (text: $"{drinkStoreDataGridView.CurrentRow.Cells[0].Value} حذف گردد؟!", caption: "هشدار", icon: Mbb.Windows.Forms.MessageBoxIcon.Warning, button: Mbb.Windows.Forms.MessageBoxButtons.YesNo); if (dialogResult == System.Windows.Forms.DialogResult.Yes) //----جهت حذف مشترک { string drinkName = drinkStoreDataGridView.CurrentRow.Cells[0].Value.ToString(); using (Models.DataBaseContext dataBaseContext = new Models.DataBaseContext()) { Models.Drink drink = dataBaseContext.Drinks .Where(current => string.Compare(current.DrinkName, drinkName) == 0) .FirstOrDefault(); if (drink != null) { var entry = dataBaseContext.Entry(drink); if (entry.State == EntityState.Detached) { dataBaseContext.Drinks.Attach(drink); } } #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"{drinkName} حذف گردید."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog dataBaseContext.Drinks.Remove(drink); dataBaseContext.SaveChanges(); DrinkLoader(); } Infrastructure.Utility.WindowsNotification (message: "کد مورد نظر حذف گردید!", caption: Infrastructure.PopupNotificationForm.Caption.موفقیت); } } else { Mbb.Windows.Forms.MessageBox.Show (text: $"موردی برای حذف وجود ندارد!", caption: "اطلاع", icon: Mbb.Windows.Forms.MessageBoxIcon.Information, button: Mbb.Windows.Forms.MessageBoxButtons.Ok); return; } }
private void UpdateDataDrinkButton_Click(object sender, System.EventArgs e) { Models.DataBaseContext dataBaseContext = null; try { dataBaseContext = new Models.DataBaseContext(); string drinkName = null; if (string.IsNullOrEmpty(DrinkName_New)) { drinkName = DrinkName_FirstLoad; DrinkName = DrinkName_FirstLoad; } else { drinkName = DrinkName_New; DrinkName = DrinkName_New; } if (string.IsNullOrEmpty(DrinkPrice_New)) { DrinkPrice = DrinkPrice_FirstLoad; } else { DrinkPrice = DrinkPrice_New; } if (string.IsNullOrEmpty(DrinkDescription_New)) { DrinkDescription = DrinkDescription_FirstLoad; } else { DrinkDescription = DrinkDescription_New; } if (string.IsNullOrEmpty(Select_DrinkImage)) { DrinkImage = DrinkImage_FirstLoad; } else { DrinkImage = DrinkImage_New; } System.Windows.Forms.DialogResult dialogResult; dialogResult = Mbb.Windows.Forms.MessageBox.Show (text: $"{DrinkName} به روز گردد؟", caption: "به روز رسانی کالا", icon: Mbb.Windows.Forms.MessageBoxIcon.Question, button: Mbb.Windows.Forms.MessageBoxButtons.YesNo); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { Models.Drink drink = dataBaseContext.Drinks .Where(current => string.Compare(current.DrinkName, DrinkName_FirstLoad) == 0) .FirstOrDefault(); DrinkNumberUpdate = drink.NumberUpdate; DrinkUpdateTime = $"{Infrastructure.Utility.ShowTime()} - {Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; DrinkNumberUpdate++; drink.DrinkName = DrinkName; drink.DrinkPrice = DrinkPrice; drink.DrinkDescription = DrinkDescription; drink.UpdateTime = DrinkUpdateTime; drink.NumberUpdate = DrinkNumberUpdate; drink.DrinkImage = DrinkImage; dataBaseContext.SaveChanges(); //-----جهت بارگذاری اطلاعات قلیان در جدول داده if (HOOKAH_SALON.MainForm.DrinkStoreForm != null) { HOOKAH_SALON.MainForm.DrinkStoreForm.DrinkLoader(); } //-----این بخش مربوط به ثبت رخداد می باشد! #region EventLogForFood if (string.IsNullOrEmpty(DrinkName_New) && string.IsNullOrEmpty(DrinkPrice_New) && string.IsNullOrEmpty(DrinkDescription_New) && string.IsNullOrEmpty(Select_DrinkImage)) { return; } else if (string.IsNullOrEmpty(DrinkName_New) == false && string.IsNullOrEmpty(DrinkPrice_New) && string.IsNullOrEmpty(DrinkDescription_New) && string.IsNullOrEmpty(Select_DrinkImage)) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"نام {DrinkName_FirstLoad} به {DrinkName_New} تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) == false && string.IsNullOrEmpty(DrinkPrice_New) == false && string.IsNullOrEmpty(DrinkDescription_New) && string.IsNullOrEmpty(Select_DrinkImage)) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"نام {DrinkName_FirstLoad} به {DrinkName_New} و مبلغ آن از {DrinkPrice_FirstLoad} به {DrinkPrice_New} تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) == false && string.IsNullOrEmpty(DrinkPrice_New) && string.IsNullOrEmpty(DrinkDescription_New) == false && string.IsNullOrEmpty(Select_DrinkImage)) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"نام {DrinkName_FirstLoad} به {DrinkName_New}و توضیحات آن از {DrinkDescription_FirstLoad} به {DrinkDescription} تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) == false && string.IsNullOrEmpty(DrinkPrice_New) && string.IsNullOrEmpty(DrinkDescription_New) && string.IsNullOrEmpty(Select_DrinkImage) == false) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"نام {DrinkName_FirstLoad} به {DrinkName_New} و عکس آن تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) == false && string.IsNullOrEmpty(DrinkPrice_New) == false && string.IsNullOrEmpty(DrinkDescription_New) == false && string.IsNullOrEmpty(Select_DrinkImage)) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"نام {DrinkName_FirstLoad} به {DrinkName_New} و قیمت آن از {DrinkPrice_FirstLoad} به {DrinkPrice_New} و توضیحات آن از {DrinkDescription_FirstLoad} به {DrinkDescription_New} تغییر یافت."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) == false && string.IsNullOrEmpty(DrinkPrice_New) == false && string.IsNullOrEmpty(DrinkDescription_New) && string.IsNullOrEmpty(Select_DrinkImage) == false) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"نام {DrinkName_FirstLoad} به {DrinkName_New} و قیمت آن از {DrinkPrice_FirstLoad} به {DrinkPrice_New} و عکس آن تغییر یافت."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) == false && string.IsNullOrEmpty(DrinkPrice_New) && string.IsNullOrEmpty(DrinkDescription_New) == false && string.IsNullOrEmpty(Select_DrinkImage) == false) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"نام {DrinkName_FirstLoad} به {DrinkName_New} و توضیحات آن از {DrinkDescription_FirstLoad} به {DrinkDescription_New} و عکس آن تغییر یافت."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) == false && string.IsNullOrEmpty(DrinkPrice_New) == false && string.IsNullOrEmpty(DrinkDescription_New) == false && string.IsNullOrEmpty(Select_DrinkImage) == false) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"نام {DrinkName_FirstLoad} به {DrinkName_New} و قیمت از {DrinkPrice_FirstLoad} به {DrinkPrice_New} و توضیحات از {DrinkDescription_FirstLoad} به {DrinkDescription_New} و عکس آن تغییر یافت."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) && string.IsNullOrEmpty(DrinkPrice_New) == false && string.IsNullOrEmpty(DrinkDescription_New) && string.IsNullOrEmpty(Select_DrinkImage)) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"قیمت {DrinkName_FirstLoad} از {DrinkPrice_FirstLoad} به {DrinkPrice_New} تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) && string.IsNullOrEmpty(DrinkPrice_New) == false && string.IsNullOrEmpty(DrinkDescription_New) == false && string.IsNullOrEmpty(Select_DrinkImage)) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"قیمت {DrinkName_FirstLoad} از {DrinkPrice_FirstLoad} به {DrinkPrice_New} و توضیحات آن از {DrinkDescription_FirstLoad} به {DrinkDescription_New} تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) && string.IsNullOrEmpty(DrinkPrice_New) == false && string.IsNullOrEmpty(DrinkDescription_New) && string.IsNullOrEmpty(Select_DrinkImage) == false) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"قیمت {DrinkName_FirstLoad} از {DrinkPrice_FirstLoad} به {DrinkPrice_New} و عکس آن تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) && string.IsNullOrEmpty(DrinkPrice_New) == false && string.IsNullOrEmpty(DrinkDescription_New) == false && string.IsNullOrEmpty(Select_DrinkImage) == false) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"قیمت {DrinkName_FirstLoad} از {DrinkPrice_FirstLoad} به {DrinkPrice_New} و توضیحات آن از {DrinkDescription_FirstLoad} به {DrinkDescription_New} و عکس آن تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) && string.IsNullOrEmpty(DrinkPrice_New) && string.IsNullOrEmpty(DrinkDescription_New) == false && string.IsNullOrEmpty(Select_DrinkImage)) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"توضیحات {DrinkName_FirstLoad} از {DrinkDescription_FirstLoad} به {DrinkDescription_New} تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) && string.IsNullOrEmpty(DrinkPrice_New) && string.IsNullOrEmpty(DrinkDescription_New) == false && string.IsNullOrEmpty(Select_DrinkImage) == false) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"توضیحات {DrinkName_FirstLoad} از {DrinkDescription_FirstLoad} به {DrinkDescription_New} و عکس آن تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } else if (string.IsNullOrEmpty(DrinkName_New) && string.IsNullOrEmpty(DrinkPrice_New) && string.IsNullOrEmpty(DrinkDescription_New) && string.IsNullOrEmpty(Select_DrinkImage) == false) { #region EventLog Username = Program.AuthenticatedUser.Username; FullName = $"{Program.AuthenticatedUser.First_Name} {Program.AuthenticatedUser.Last_Name}"; EventDate = $"{Infrastructure.Utility.PersianCalendar(System.DateTime.Now)}"; EventTime = $"{Infrastructure.Utility.ShowTime()}"; EventTitle = $"عکس {DrinkName_FirstLoad} تغییر کرد."; Infrastructure.Utility.EventLog (username: Username, fullName: FullName, eventDate: EventDate, eventTime: EventTime, eventTitle: EventTitle); #endregion /EventLog } #endregion /EventLogForFood string message = $"{DrinkName} بروز رسانی گردید."; Infrastructure.Utility.WindowsNotification (message: message, caption: Infrastructure.PopupNotificationForm.Caption.موفقیت, picture: DrinkImage); } else { return; } } catch (System.Exception ex) { Infrastructure.Utility.ExceptionShow(ex); } finally { if (dataBaseContext != null) { dataBaseContext.Dispose(); dataBaseContext = null; } } }