public FrmBookmarkList() { try { bookMan = new BookmarkManager(); exportMan = new ExportManager(); InitializeComponent(); rdbtnCreationtime.Checked = true; rdbtnStartsWith.Checked = true; IsDateFilteringChecked(false); grdVwBookmarks.ColumnHeaderTextList = "ID[i]-Name-Description-Url-Creation Time-Update Time-Table[i]-ChangeSetCount[i]"; cmbxSearchType.SetItemSource("Name*Name-Url*Url-Description*Description", '-', '*'); if (cmbxSearchType.Items.Count > 0) { cmbxSearchType.SelectedIndex = 0; } } catch (Exception ex) { LightLogger.LogMethod(ex, this.Name, "Ctor"); MessageUtil.Error("Bookmark List could not be opened."); } }
private void openInFileExplorer(object sender, EventArgs e) { try { if (lstShortCuts.SelectedItems.Count == 0) { MessageUtil.Warn("Please Select A Shortcut!.."); return; } string path = string.Format("{0}", lstShortCuts.SelectedItems[0].SubItems[1].Text); if (path.Replace(" ", "").Length == 0) { MessageUtil.Warn("Invalid Shortcut Path!.."); return; } string arg = string.Format("/Select, \"{0}\"", path); ProcessStartInfo pfi = new ProcessStartInfo("Explorer.exe", arg); System.Diagnostics.Process.Start(pfi); pfi = null; } catch (Exception ex) { MessageUtil.Error("Open In File Explorer Operation Failed."); Logger.WriteException(ex, "OpenInFileExplorer", "Open In File Explorer Operation Failed."); } }
private void LoadForm() { try { _isFormLoaded = false; if (_bookmarkId != -1) { bookmark = bookMan.GetById(_bookmarkId); if (bookmark != null) { txtName.Text = bookmark.Name; txtDescription.Text = bookmark.Description; txtUrl.Text = bookmark.Url; } } _isFormLoaded = true; } catch (Exception ex) { FreeLogger.LogMethod(ex, this.Name, "FormLoad"); MessageUtil.Error("Bookmark could not be loaded."); } finally { bookmark = new Bookmark(); if (_bookmarkId != -1) { bookmark.ID = _bookmarkId; } } }
void DeleteObj() { try { if (grdBrowsers.SelectedRows.Count > 0) { DialogResult dr = MessageUtil.Confirm("External Browser will be deleted. are you sure?"); if (dr == System.Windows.Forms.DialogResult.Yes) { int browserId = grdBrowsers.SelectedRows[0].Cells["Id"].Value.ToInt(); Browser br = new Browser { Id = browserId }; br.Delete(); UpdateForm(); } return; } return; } catch (Exception ex) { FreeLogger.LogMethod(ex, this.Name, "DeleteObj"); MessageUtil.Error("Object could not be deleted."); } }
public FrmRunWith(string url, bool isRegistered) { try { InitializeComponent(); bookMan = new BookmarkManager(); _isRegistered = isRegistered; _url = url; List <Browser> browsers = new List <Browser>(); if (_isRegistered) { browsers = GetBrowsers(); } else { browsers = bookMan.GetExternalBrowsers(); } cmbxBrowsers.DataSource = browsers; cmbxBrowsers.DisplayMember = "Name"; cmbxBrowsers.ValueMember = "Path"; cmbxBrowsers.SelectedIndex = -1; cmbxBrowsers.Refresh(); } catch (Exception ex) { FreeLogger.LogMethod(ex, this.Name, "Ctor"); MessageUtil.Error("Run With Form could not be opened."); } }
public List <ImportProductModel> Read(string path) { var results = new List <ImportProductModel>(); var inputFile = new ExcelPackage(new FileInfo(path)); var sheet = inputFile.Workbook.Worksheets[1]; var maxRow = sheet.Dimension.End.Row; var units = _db.Units.Select(x => new KeyValueInt() { Key = x.Id, Value = x.Name }).ToList(); var suppliers = _db.Suppliers.Select(x => new KeyValueInt() { Key = x.Id, Value = x.Name }).ToList(); var products = _db.Products.ToList(); for (var row = 2; row <= maxRow; row++) { if (sheet.Row(row) == null) { continue; } var elm = new ImportProductModel() { Barcode = sheet.Cells["A" + row].Value.ToString(), ProductName = sheet.Cells["B" + row].Value.ToString(), Total = sheet.Cells["C" + row].Value.ToString().IsNumberic() ? int.Parse(sheet.Cells["C" + row].Value.ToString()) : 0, Quantity = sheet.Cells["D" + row].Value.ToString().IsNumberic() ? int.Parse(sheet.Cells["D" + row].Value.ToString()) : 0, PriceBuy = sheet.Cells["E" + row].Value.ToString().IsNumberic() ? int.Parse(sheet.Cells["E" + row].Value.ToString()) : 0, Unit = units.Where(x => x.Value.Equals(sheet.Cells["F" + row].Value.ToString())).Select(x => x.Key).First(), Price = (sheet.Cells["G" + row].Value != null && sheet.Cells["G" + row].Value.ToString().IsNumberic()) ? int.Parse(sheet.Cells["G" + row].Value.ToString()) : 0, Ex = DateTime.Parse(sheet.Cells["H" + row].Value.ToString()), Supplier = suppliers.Where(x => x.Value.Equals(sheet.Cells["I" + row].Value.ToString())).Select(x => x.Key).First(), Discount = (sheet.Cells["K" + row].Value != null && sheet.Cells["K" + row].Value.ToString().IsNumberic()) ? double.Parse(sheet.Cells["K" + row].Value.ToString()) : 0, DiscountBarcode1 = sheet.Cells["L" + row].Value != null ? sheet.Cells["L" + row].Value.ToString() : string.Empty, DiscountQuantity1 = (sheet.Cells["M" + row].Value != null && sheet.Cells["M" + row].Value.ToString().IsNumberic()) ? int.Parse(sheet.Cells["M" + row].Value.ToString()) : 0, DiscountBarcode2 = sheet.Cells["N" + row].Value != null ? sheet.Cells["N" + row].Value.ToString() : string.Empty, DiscountQuantity2 = (sheet.Cells["O" + row].Value != null && sheet.Cells["O" + row].Value.ToString().IsNumberic()) ? int.Parse(sheet.Cells["O" + row].Value.ToString()) : 0, DiscountBarcode3 = sheet.Cells["P" + row].Value != null ? sheet.Cells["P" + row].Value.ToString() : string.Empty, DiscountQuantity3 = (sheet.Cells["Q" + row].Value != null && sheet.Cells["Q" + row].Value.ToString().IsNumberic()) ? int.Parse(sheet.Cells["Q" + row].Value.ToString()) : 0, DiscountBarcode4 = sheet.Cells["R" + row].Value != null ? sheet.Cells["R" + row].Value.ToString() : string.Empty, DiscountQuantity4 = (sheet.Cells["S" + row].Value != null && sheet.Cells["S" + row].Value.ToString().IsNumberic()) ? int.Parse(sheet.Cells["S" + row].Value.ToString()) : 0, }; FillNameDiscount(ref elm, products); CalcDiscount(ref elm, products); elm.Cal(); results.Add(elm); } var validMess = Valid(results, products); if (validMess.Length > 0) { MessageUtil.Error(validMess); } return(results); }
private static void exportToExcel() { try { } catch (Exception ex) { MessageUtil.Error("Export Operation Failed."); Logger.WriteException(ex, "ShortCut Export", "Export Operation Failed."); } }
void UpdateForm() { try { RefreshSource(); } catch (Exception ex) { FreeLogger.LogMethod(ex, this.Name, "UpdateForm"); MessageUtil.Error("List could not be refreshed."); } }
public FrmShortCutList() { try { InitializeComponent(); CheckForIllegalCrossThreadCalls = false; } catch (Exception ex) { MessageUtil.Error("Program could not be started."); Logger.WriteException(ex, "ListFormInitiliaze", "Program could not be started."); } }
private void RunProgram() { try { thrdRun = new Thread(new ThreadStart(this.RunThread)); thrdRun.Start(); } catch (Exception ex) { MessageUtil.Error("Program could not be started."); Logger.WriteException(ex, "RunProgram", "Program could not be started."); } }
public ActionResult Create(EventoView evento, string equipe01, string equipe02) { DesafioView desafioView = new DesafioView(); //validando if (equipe01 == null || equipe02 == null) { ViewBag.MsgRetorno += MessageUtil.ErrorDesafioEquipeSelecionar(); return(View(_eventoUtil.ConversaoParaEventoViewPorId(evento.Id, _context))); } desafioView.IdEvento = evento.Id; desafioView.Nome = evento.Nome; desafioView.IdTime01 = Convert.ToInt32(equipe01); desafioView.IdTime02 = Convert.ToInt32(equipe02); //validaçao var listaValidacao = _desafioUtil.Validate(desafioView, _context); if (listaValidacao.Where(x => x.Resultado == false).Any()) { foreach (ResultadoValidacao item in listaValidacao) { ViewBag.MsgRetorno += item.Mensagem + " | "; } } else { try { if (desafioView != null) { _desafioInfra.Insert( _desafioUtil.ConvertDesafioViewInDesafio(desafioView) , _context ); } ViewBag.MsgRetorno = MessageUtil.Sucess(); } catch (System.Exception ex) { ViewBag.MsgRetorno = MessageUtil.Error() + " - " + ex.Message; } } GerarViewBagListaEquipes(evento.Id); return(View(_eventoUtil.ConversaoParaEventoViewPorId(evento.Id, _context))); }
public FrmBookmark(int bookmarkId) { try { InitializeComponent(); bookmark = new Bookmark(); bookMan = new BookmarkManager(); _bookmarkId = bookmarkId; } catch (Exception ex) { FreeLogger.LogMethod(ex, this.Name, "FrmBookmark Ctor"); MessageUtil.Error("Bookmark could not be opened."); } }
void RunThread() { try { if (lstShortCuts.SelectedItems.Count > 0) { string exeString = lstShortCuts.SelectedItems[0].SubItems[1].Text; Process.Start(exeString); } } catch (Exception ex) { MessageUtil.Error("Program could not be started."); Logger.WriteException(ex, "RunThread", "Program could not be started."); } }
public IActionResult Delete(EquipeView equipeView) { try { _equipeInfra.Delete( _contexto, _equipeUtil.ConversaoEquipeView(equipeView) ); ViewBag.MsgRetorno = MessageUtil.Sucess(); } catch (System.Exception ex) { ViewBag.MsgRetorno = MessageUtil.Error() + " - " + ex.Message; } return(View("Index", _equipeUtil.ConsultarEquipe(_contexto))); }
public IActionResult Delete(EventoView eventoView) { try { _eventoInfra.Delete( _contexto, _eventoUtil.ConversaoParaEvento(eventoView) ); ViewBag.MsgRetorno = MessageUtil.Sucess(); } catch (System.Exception ex) { ViewBag.MsgRetorno = MessageUtil.Error() + " - " + ex.Message; } return(View("Index", _eventoUtil.ConsultarEventos(_contexto))); }
public IActionResult Edit(EquipeView equipeView) { try { _equipeInfra.Update( _contexto, _equipeUtil.ConversaoEquipeView(equipeView) ); ViewBag.MsgRetorno = MessageUtil.Sucess(); } catch (System.Exception ex) { ViewBag.MsgRetorno = MessageUtil.Error() + " - " + ex.Message; } return(View()); }
public IActionResult Delete(DesafioView desafioView) { try { _desafioInfra.Delete( _context, _desafioUtil.ConvertDesafioViewInDesafio(desafioView) ); ViewBag.MsgRetorno = MessageUtil.Sucess(); } catch (System.Exception ex) { ViewBag.MsgRetorno = MessageUtil.Error() + " - " + ex.Message; } return(View("Index", _desafioUtil.GetDesafios(_context))); }
void Save() { try { if (browser.Name.Replace(" ", "").Length == 0) { MessageUtil.Message("Browser name can not be empty."); return; } if (browser.Path.Replace(" ", "").Length == 0) { MessageUtil.Message("Browser path can not be empty."); return; } if (_browserId == -1) { browser.Insert(); if (ExternalBrowserChanged != null) { ExternalBrowserChanged(); } } else { if (browser.ChangeSetCount > 1) { browser.Update(); if (ExternalBrowserChanged != null) { ExternalBrowserChanged(); } } } this.Close(); } catch (Exception ex) { FreeLogger.LogMethod(ex, this.Name, "Save"); MessageUtil.Error("Browser could not be saved."); } }
private void ExportToExcel() { try { DataTable dt2Export = new DataTable(); using (BookmarksDL bkmrkDL = new BookmarksDL()) { dt2Export = bkmrkDL.GetTable(new Bookmark { }); } exportMan.Export2Excel(dt2Export, "Bookmarks", "D:/Bookmarks.xls"); } catch (Exception ex) { LightLogger.LogMethod(ex, this.Name, "ExportToExcel"); MessageUtil.Error("Export Operation failed"); } }
public FrmAbout() { try { InitializeComponent(); this.Text = String.Format("About {0}", AssemblyTitle); this.labelProductName.Text = AssemblyTitle; this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); this.labelCopyright.Text = AssemblyCopyright; this.labelCompanyName.Text = AssemblyCompany; this.textBoxDescription.Text = AssemblyDescription; } catch (Exception ex) { MessageUtil.Error("An Error occured at opening About Form!.."); Logger.WriteException(ex, "An Error occured at opening About Form!..", "ERR_ABOUT_INIT");; } }
private void FormLoad(object sender, EventArgs e) { try { using (BookmarksDL bookmrksDL = new BookmarksDL()) { bookmarkList = bookmrksDL.GetTableAsList <Bookmark>(); SetDataSourceOfGRid(); } } catch (Exception ex) { LightLogger.LogMethod(ex, this.Name, "FormLoad"); MessageUtil.Error("Bookmark List could not be loaded."); } }
private void CreateShortCut(Environment.SpecialFolder flder, string DosyaYolu) { try { IWshRuntimeLibrary.IWshShortcut kisayol; WshShell ws = new WshShell(); kisayol = (IWshShortcut)ws.CreateShortcut(Environment.GetFolderPath(flder) + DosyaYolu); kisayol.TargetPath = Application.ExecutablePath; kisayol.Description = "This software has been made for decreasing shortcuts on the desktop. Use for good days.\nMade By : Nusty\nPath : " + Application.ExecutablePath; kisayol.IconLocation = Application.StartupPath + @"\monitor.ico"; kisayol.Save(); } catch (Exception ex) { MessageUtil.Error("Shortcut could not be created."); Logger.WriteException(ex, "Shortcut could not be created.", "ERR_SHORT_CREATE");; } }
private void CreateShortCut(Environment.SpecialFolder flder, string filePath) { try { IWshRuntimeLibrary.IWshShortcut shortCut; WshShell ws = new WshShell(); shortCut = (IWshShortcut)ws.CreateShortcut(Environment.GetFolderPath(flder) + filePath); shortCut.TargetPath = Application.ExecutablePath; shortCut.Description = "This software has been made for managing all bookmarks in one program. Use for good days.\nMade By : Nusty\nPath : " + Application.ExecutablePath; shortCut.IconLocation = Application.StartupPath + @"\monitor.ico"; shortCut.Save(); } catch (Exception ex) { MessageUtil.Error("Shortcut could not be created."); LightLogger.LogMethod(ex, this.Name, "CreateShortCut"); } }
private void UpdateObj() { try { if (grdVwBookmarks.SelectedRows.Count > 0) { int bkmrkId = grdVwBookmarks.SelectedRows[0].Cells["ID"].Value.ToInt(); FrmBookmark bkrmrk = new FrmBookmark(bkmrkId); bkrmrk.BookmarkChanged += new FrmBookmark.BookmarkChange(this.BkmrkChanged); bkrmrk.ShowDialog(); } } catch (Exception ex) { LightLogger.LogMethod(ex, this.Name, "Update"); MessageUtil.Error("Object could not be updated"); } }
private void Add(Object sender, EventArgs e) { try { FrmShortCut kseg = new FrmShortCut(); kseg.ShowDialog(); if (kseg.DialogResult == DialogResult.OK) { shortCutList = AppVariables.AllList; Utility.List2ListView(lstShortCuts, shortCutList); } return; } catch (Exception ex) { MessageUtil.Error("Shortcuts could not be loaded."); Logger.WriteException(ex, "ShortCut DoubleClick", "Program could not be started."); } }
private void Delete() { try { if (lstShortCuts.Items.Count > 0 && lstShortCuts.SelectedItems.Count > 0) { System.Windows.Forms.DialogResult dr = MessageBox.Show(string.Format("This shortcut will be deleted, Are you sure?\nName : {0}\nPath : {1}", lstShortCuts.SelectedItems[0].SubItems[0].Text, lstShortCuts.SelectedItems[0].SubItems[1].Text), "Warning", MessageBoxButtons.YesNo); if (dr != System.Windows.Forms.DialogResult.Yes) { return; } Kisayol ks = new Kisayol(shortCutList[lstShortCuts.SelectedIndices[0]].Id); int ix = SQLiteManager.Delete(ks); //ks.Delete(); AppVariables.Delete(ks); string s = string.Empty; switch (ix) { case 1: s = "Delete Process is succesfull."; break; default: s = "Delete Process is not succesfull."; break; } MessageBox.Show(s, "Result"); } shortCutList = AppVariables.AllList; Utility.List2ListView(lstShortCuts, shortCutList); return; } catch (Exception ex) { MessageUtil.Error("An Error occured at Deleting shortcut!.."); Logger.WriteException(ex, "An error occured at deleting shortcut.", "ERR_DELETE"); } }
private void allListToolStripMenuItem_Click(object sender, EventArgs e) { try { bool result = ExportToFile(shortCutList); if (result) { MessageUtil.Info("Export Operation successed."); } else { MessageUtil.Error("Export Operation failed."); } } catch (Exception ex) { MessageUtil.Error("Export Operation Failed."); Logger.WriteException(ex, "All ShortCut Export", "Export Operation Failed."); } }
private void ExportToExcelSearch() { try { DataTable dt2Export = new DataTable(); int rowCount = grdVwBookmarks.Rows.Count; if (rowCount > 0) { int colCount = grdVwBookmarks.ColumnCount; for (int colCounter = 0; colCounter < colCount; colCounter++) { if (object.ReferenceEquals(typeof(Bookmark).GetProperty(grdVwBookmarks.Columns[colCounter].Name).PropertyType, typeof(DateTime)) == false && grdVwBookmarks.Columns[colCounter].Visible == true) { dt2Export.Columns.Add(grdVwBookmarks.Columns[colCounter].Name, typeof(string)); } } colCount = dt2Export.Columns.Count; DataRow row; for (int rowCounter = 0; rowCounter < rowCount; rowCounter++) { row = null; row = dt2Export.NewRow(); for (int colcounter = 0; colcounter < colCount; colcounter++) { row[dt2Export.Columns[colcounter].ColumnName] = grdVwBookmarks.Rows[rowCounter].Cells[dt2Export.Columns[colcounter].ColumnName].Value.ToStr(); } dt2Export.Rows.Add(row); } } exportMan.Export2Excel(dt2Export, "Bookmarks", "D:/Bookmarks.xls"); } catch (Exception ex) { LightLogger.LogMethod(ex, this.Name, "ExportToExcel"); MessageUtil.Error("Export Operation failed"); } }
void FormLoad() { try { double w = (double)this.Width / 12; this.lstShortCuts.Columns[0].Width = (int)(2 * w - 9); this.lstShortCuts.Columns[1].Width = (int)(7 * w - 9); this.lstShortCuts.Columns[2].Width = (int)(3 * w - 9); SQLiteManager.Execute(Crud.CreateTableQuery(), null); AppVariables.AllList = SQLiteManager.AllList(); shortCutList = AppVariables.AllList; Utility.List2ListView(lstShortCuts, shortCutList); cmbxTur.SelectedIndex = 0; this.lstShortCuts.AutoResizeColumns(ColumnHeaderAutoResizeStyle.None); } catch (Exception ex) { MessageUtil.Error("Program could not be started."); Logger.WriteException(ex, "ListFormLoad", "Program could not be loadaed."); } }
private void elementsAtListToolStripMenuItem_Click(object sender, EventArgs e) { try { if (lstShortCuts.Items.Count == 0) { MessageUtil.Warn("Shortcut List must contain one item at leats."); return; } List <Kisayol> list = new List <Kisayol>(); Kisayol ks = null; for (int counter = 0; counter < lstShortCuts.Items.Count; counter++) { ks = null; ks = new Kisayol() { KisayolAdi = lstShortCuts.Items[counter].SubItems[0].Text, Yol = lstShortCuts.Items[counter].SubItems[1].Text }; list.Add(ks); } bool result = ExportToFile(list); if (result) { MessageUtil.Info("Export Operation successed."); } else { MessageUtil.Error("Export Operation failed."); } } catch (Exception ex) { MessageUtil.Error("Export Operation Failed."); Logger.WriteException(ex, "Selected ShortCut Export", "Export Operation Failed."); } }