public override void Find() { // To.ID = View.ModelID; To.CurrentModel.ID = View.Model.ID; Bo.Find(); View.Model = To.CurrentModel; }
public override void Save() { try { // Aqui estou salvando um novo registro To.CurrentModel = View.CurrentEditModel; if (View.CurrentEditModel.ID != 0) { // Quando estou editando um registro, devo buscá-lo no BD antes de salvar, senão dá erro? // To.CurrentID = View.CurrentEditModel.ID; To.CurrentModel.ID = View.CurrentEditModel.ID; Bo.Find(); To.CurrentModel.CategoryName = View.CurrentEditModel.CategoryName; To.CurrentModel.Description = View.CurrentEditModel.Description; To.CurrentModel.PictureImage = View.CurrentEditModel.PictureImage; } Bo.Save(); FindAllDataBind(); HelperFactory.MessageHelper.ShowMessage("Success", "Item saved"); } catch (Exception ex) { HelperFactory.MessageHelper.ShowMessageError("Error", "Error trying to save item", ex); } finally { Clear(); } }
public override void DeleteList() { try { // TODO: Verificar se eu preciso mesmo desse if if (View.CurrentList.Count > 0) { if (HelperFactory.MessageHelper.ShowMessageConfirm("Alert", "Do you really want to delete the item(s)?")) { To.CurrentList = View.CurrentList; var position = View.CurrentPosition; Bo.DeleteList(); FindAllDataBind(); View.CurrentPosition = position < View.BindableList.Count ? position : View.BindableList.Count - 1; HelperFactory.MessageHelper.ShowMessage("Success", "Item(s) deleted"); } } else { HelperFactory.MessageHelper.ShowMessageError("Error", "Please select at least one item to delete"); } } catch (Exception ex) { HelperFactory.MessageHelper.ShowMessageError("Error", "Error trying to delete item(s)", ex); } finally { Clear(); } }
public void TOTALUSAGE() { StreamWriter Bk; try { Bk = File.AppendText("C:\\Users\\RON TAYLOR\\Desktop\\Computer Programing\\Company_Charge.txt"); TOTAL_USAGE = WATER_USAGE + SEWAGE_USAGE; Bk.WriteLine(total_usage); Bk.WriteLine("Total usage:{0}", total_usage); Bk.Close(); } catch { Console.WriteLine(" file not writtten "); } Console.ReadLine(); StreamReader Bo; Bo = File.OpenText("C:\\Users\\RON TAYLOR\\Desktop\\Computer Programing\\Company_Charge.txt"); TotalUsagedisplay = Bo.ReadLine(); while (TotalUsagedisplay != null) { Console.WriteLine(TotalUsagedisplay); TotalUsagedisplay = Bo.ReadLine(); } Bo.Close(); }
// I've created this method private void FindAll() { try { Bo.FindAll(); } catch (Exception ex) { HelperFactory.MessageHelper.ShowMessageError("Error", "Could not list items", ex); } }
public override void Delete() { try { // To.CurrentModel = View.CurrentModel; // var position = View.CurrentPosition; // TODO: Verificar se eu preciso mesmo desse if if (View.CurrentList.Count <= 1) { // if (View.CurrentModel != null) // To.CurrentModel = View.CurrentModel; // TODO: Verificar se eu preciso mesmo desse if if (View.CurrentPosition > -1) { var bindableList = View.BindableList ?? new SortableBindingList <Category>(To.List); if (View.SortInfo.SortOrder != PropertySortOrder.None) { bindableList.Sort(View.SortInfo); } To.CurrentModel = bindableList[View.CurrentPosition]; } else { HelperFactory.MessageHelper.ShowMessageError("Error", "No item was selected to delete"); } if (HelperFactory.MessageHelper.ShowMessageConfirm("Alert", "Do you really want to delete the item?")) { Bo.Delete(); FindAllDataBind(); HelperFactory.MessageHelper.ShowMessage("Success", "Item deleted"); } // View.CurrentPosition = position < View.BindableList.Count ? position : View.BindableList.Count - 1; } else { HelperFactory.MessageHelper.ShowMessageError("Error", "Please select only one item to delete"); } } catch (Exception ex) { HelperFactory.MessageHelper.ShowMessageError("Error", "Error trying to delete item", ex); } finally { Clear(); } }
private bool ShowEditDialog() { ICategoryEditView categoryEditView = HelperFactory.RedirectHelper.CreateModalDialogView <ICategoryEditView>(View, To.CurrentModel); if (HelperFactory.RedirectHelper.ShowModalDialogView(categoryEditView, View)) { To.CurrentModel = categoryEditView.Model; Bo.Save(); return(true); } categoryEditView.Model = To.CurrentModel; return(false); }
public override void SaveList() { try { To.CurrentList = View.CurrentList; Bo.SaveList(); FindAllDataBind(); HelperFactory.MessageHelper.ShowMessage("Success", "Item(s) saved"); } catch (Exception ex) { HelperFactory.MessageHelper.ShowMessageError("Error", "Error trying to save item(s)", ex); } finally { Clear(); } }
public bool TryById (int id, out Bo.Download download) { var downloads = _db.Query<Bo.Download> (@" SELECT * FROM Download WHERE Id = ? ; ", id); if (!downloads.Any ()) { download = null; return false; } download = downloads.First (); return true; }
public void DoBackgroundWork() { Bo.SlowWork(); }
private static void WriteBo(Bo bo, string basePath) { WriteFile(basePath + "\\" + bo.Name + "Bo.cs", bo.Content); }
public void CreerCompteRendu(int idCompteRendu, Bo.Client client, DateTime date, DateTime duree, System.Array piecesUtilisees, string commentaire) { throw new NotImplementedException(); }