private void ButtonTypeAddProduct_Click(object sender, EventArgs e) { try { if (TextBoxTypeNameAddProduct.Text != "" && TextBoxTypePriceAddProduct.Text != "") { TypeBO objTypeBO = new TypeBO(); objTypeBO.ProductID = (Int32)ComboBoxProductNameAddProduct.SelectedValue; objTypeBO.TypeName = TextBoxTypeNameAddProduct.Text; objTypeBO.TypePrice = Convert.ToDecimal(TextBoxTypePriceAddProduct.Text); TypeBL objTypeBL = new TypeBL(); objTypeBL.AddTypeBL(objTypeBO); MessageBox.Show("Ürün türü başarıyla eklenmiştir"); } else { MessageBox.Show("Lütfen tür adı ve fiyatını giriniz"); } TextBoxTypeNameAddProduct.Clear(); TextBoxTypePriceAddProduct.Clear(); } catch (Exception ex) { throw ex; } }
private void tlbMenu_DeleteClick() { try { Cursor = Cursors.WaitCursor; if (XtraMessageBox.Show("Be sure to delete the record?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!ValidarIngreso()) { TypeBE objE_Type = new TypeBE(); objE_Type.IdType = int.Parse(gvType.GetFocusedRowCellValue("IdType").ToString()); objE_Type.Login = Parametros.strUsuarioLogin; objE_Type.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objE_Type.IdCompany = Parametros.intEmpresaId; TypeBL objBL_Type = new TypeBL(); objBL_Type.Elimina(objE_Type); XtraMessageBox.Show("The record was successfully deleted.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Cargar(); } } Cursor = Cursors.Default; } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ButtonAddProduct_Click(object sender, EventArgs e) { try { if (TextBoxProductCount.Text != "") { TypeBO objTypeBO = new TypeBO(); objTypeBO.ProductID = (Int32)ComboBoxProductName.SelectedValue; objTypeBO.TypeName = ComboBoxProductType.Text; objTypeBO.TypeCount = Convert.ToInt32(TextBoxProductCount.Text); TypeBL objTypeBL = new TypeBL(); objTypeBL.AddProductToStockBL(objTypeBO); MessageBox.Show("Ürün başarı ile eklenmiştir"); TextBoxProductCount.Clear(); ComboBoxProductName.SelectedIndex = 0; PopulateGridViewStockHistory(); } else { MessageBox.Show("Lütfen ürün adedini giriniz"); } } catch (Exception ex) { throw ex; } }
public void PopulateGridViewProducts() { TypeBL objTypeBL = new TypeBL(); DataSet ds = objTypeBL.PopulateGridViewProductsBL(); ds.Tables[0].Columns[0].ColumnName = "Ürün Adı"; ds.Tables[0].Columns[1].ColumnName = "Ürün Türü"; ds.Tables[0].Columns[2].ColumnName = "Fiyat"; GridViewProducts.DataSource = ds; GridViewProducts.DataMember = ds.Tables[0].ToString(); }
void ExportarExcel(string filename) { Excel._Application xlApp; Excel._Workbook xlLibro; Excel._Worksheet xlHoja; Excel.Sheets xlHojas; xlApp = new Excel.Application(); filename = Path.Combine(Directory.GetCurrentDirectory(), "Excel\\Type.xlsx"); xlLibro = xlApp.Workbooks.Open(filename, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); xlHojas = xlLibro.Sheets; xlHoja = (Excel._Worksheet)xlHojas[1]; Cursor.Current = Cursors.WaitCursor; try { int Row = 6; int Secuencia = 1; List <TypeBE> lstType = null; lstType = new TypeBL().ListaTodosActivo(Parametros.intEmpresaId); if (lstType.Count > 0) { xlHoja.Shapes.AddPicture(Path.Combine(Directory.GetCurrentDirectory(), "Logo.jpg"), Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 1, 1, 100, 60); foreach (var item in lstType) { xlHoja.Cells[Row, 1] = item.IdType; xlHoja.Cells[Row, 2] = item.Abbreviate; xlHoja.Cells[Row, 3] = item.NameType; Row = Row + 1; Secuencia = Secuencia + 1; } } xlLibro.SaveAs("C:\\Excel\\Type.xlsx", Excel.XlFileFormat.xlWorkbookDefault, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlExclusive, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); xlLibro.Close(true, Missing.Value, Missing.Value); xlApp.Quit(); Cursor.Current = Cursors.Default; BSUtils.OpenExcel("C:\\Excel\\Type.xlsx"); //XtraMessageBox.Show("It was imported correctly \n The file was generated C:\\Excel\\Type.xlsx", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public ActionResult Creer() { ViewBag.ListeTypes = TypeBL.GetAllTypes().Select(x => x.ToSelectListItem()); ViewBag.ListeClients = ClientBL.GetAllClients().Select(x => x.ToSelectListItem()); ViewBag.ListeResponsables = ResponsableBL.GetAllResponsables().Select(x => x.ToSelectListItem()); ViewBag.ListeTechnologies = TechnologieBL.GetAllTechnologies().Select(x => x.ToSelectListItem()); //Creating the default environnements var composant = new ComposantModel(); composant.Environnements = EnvironnementBL.GetDefaultEnvironnements().Select(x => x.ToEnvironnementModel()).ToList(); return(View("Creer", composant)); }
public ActionResult Index(BrowseViewModel model) { model.CurrentPage = 1; model.MovieTypes = TypeBL.GetAllDO().OrderBy(q => q.Name).ToList(); var movieList = MovieBL.GetAllAsDO(); //save filter to session Session["BrowseFilters"] = model.Filters; //do the filtering movieList = model.Filters.DoFilter(movieList, UserID); model.MovieList = movieList.OrderBy(q => q.OriginalName).ToList(); return(View(model)); }
private void UpdateProduct_Load(object sender, System.EventArgs e) { TextBoxProductNameUpdateProduct.Text = Constants.ProductNameUpdateProduct; TextBoxTypeNameUpdateProduct.Text = Constants.TypeNameUpdateProduct; TextBoxTypePriceUpdateProduct.Text = Constants.TypePriceUpdateProduct; ProductBL objProductBL = new ProductBL(); objTypeBO.ProductID = objProductBL.GetProductID(Constants.ProductNameUpdateProduct); objTypeBO.TypeName = TextBoxTypeNameUpdateProduct.Text; objTypeBO.TypePrice = Convert.ToDecimal(TextBoxTypePriceUpdateProduct.Text); TypeBL objTypeBL = new TypeBL(); objTypeBO.TypeID = objTypeBL.GetTypeID(objTypeBO); }
private void ButtonUpdateProduct_Click(object sender, EventArgs e) { try { objTypeBO.TypeName = TextBoxTypeNameUpdateProduct.Text; objTypeBO.TypePrice = Convert.ToDecimal(TextBoxTypePriceUpdateProduct.Text); TypeBL objTypeBL = new TypeBL(); objTypeBL.UpdateProduct(objTypeBO); MessageBox.Show("Ürün başarı ile güncellenmiştir"); this.Close(); form.PopulateGridViewProducts(); } catch (Exception ex) { throw ex; } }
public ActionResult Modifier(int id, int idEnvironnement) { var composant = ComposantBL.GetComposant(id); if (composant == null) { return(View("Error")); } else { composant.EnvironnementSelectionne = idEnvironnement; ViewBag.ListeTypes = TypeBL.GetAllTypes().Select(x => x.ToSelectListItem()); ViewBag.ListeClients = ClientBL.GetAllClients().Select(x => x.ToSelectListItem()); ViewBag.ListeResponsables = ResponsableBL.GetAllResponsables().Select(x => x.ToSelectListItem()); ViewBag.ListeTechnologies = TechnologieBL.GetAllTechnologies().Select(x => x.ToSelectListItem()); return(View("Modifier", composant)); } }
private void frmManTypeEdit_Load(object sender, EventArgs e) { if (pOperacion == Operacion.Nuevo) { this.Text = "Type - New"; } else if (pOperacion == Operacion.Modificar) { this.Text = "Type - Update"; TypeBE objE_Type = null; objE_Type = new TypeBL().Selecciona(IdType); if (objE_Type != null) { txtAbbreviate.Text = objE_Type.Abbreviate; txtDescripcion.Text = objE_Type.NameType.Trim(); } } txtAbbreviate.Select(); }
public ActionResult Index(int page = 1) { BrowseViewModel model = new BrowseViewModel(); model.MovieTypes = TypeBL.GetAllDO().OrderBy(q => q.Name).ToList(); model.MovieList = MovieBL.GetAllAsDO().OrderBy(q => q.OriginalName).ToList(); model.CurrentPage = page; if (Session["BrowseFilters"] != null) { model.Filters = (FiltersForPage)Session["BrowseFilters"]; model.MovieList = model.Filters.DoFilter(model.MovieList, UserID).OrderBy(q => q.OriginalName).ToList(); } else { model.Filters = new Filtering.FiltersForPage(); } return(View(model)); }
private void ButtonDeleteProduct_Click(object sender, EventArgs e) { try { int count = 0; if (GridViewProducts.SelectedRows.Count == 1) { DataGridViewRow dr = GridViewProducts.SelectedRows[0]; TypeBL objTypeBL = new TypeBL(); ProductBL objProductBL = new ProductBL(); foreach (DataGridViewRow row in GridViewProducts.Rows) { if (row.Cells[0].Value.ToString() == dr.Cells[0].Value.ToString()) { if (count == 1) { objTypeBL.DeleteTypeBL(dr.Cells[0].Value.ToString(), dr.Cells[1].Value.ToString()); count++; break; } count++; } } if (count == 1) { objProductBL.DeleteProductBL(dr.Cells[0].Value.ToString()); } PopulateGridViewProducts(); } else { MessageBox.Show("Lütfen silmek istediğiniz ürünün satırını seçin"); } } catch (Exception ex) { throw ex; } }
protected void PopulateComboBoxProductTypeSell() { try { ComboBoxProductTypeSell.Text = ""; TypeBL objTypetBL = new TypeBL(); int ProductID = Constants.ProductIDOfFirstItem; DataSet ds = objTypetBL.PopulateComboBoxProductTypeBL(ProductID); DataView dvTypes = new DataView(ds.Tables[0]); dvTypes.Sort = "TypeName"; ComboBoxProductTypeSell.DataSource = dvTypes; ComboBoxProductTypeSell.DisplayMember = "TypeName"; ComboBoxProductTypeSell.ValueMember = "TypeID"; } catch (Exception ex) { throw ex; } }
private void Form1_Load(object sender, EventArgs e) { BLInitializer.Initialize( ); parseStatus.Minimum = 0; parseStatus.Maximum = ActorBL.GetAll( ).Count( ) + DirectorBL.GetAll( ).Count( ) + LanguageBL.GetAll( ).Count( ) + TypeBL.GetAll( ).Count( ) + WriterBL.GetAll( ).Count( ); parseStatus.Value = 0; Thread loadDictionaryThread = new Thread(new ThreadStart(InitializeDictionaries)); loadDictionaryThread.Start( ); //txtImdbId.Text = "tt0243493"; //the closet //txtImdbId.Text = "tt0361748"; //ingl. basterds - multi director //txtSearch.Text = "Ocean's Eleven"; }
private void InitializeDictionaries( ) { allActors = new Dictionary <string, int>( ); foreach (var item in ActorBL.GetAllDO( )) { allActors.Add(item.Name, item.ID); setProgressBarValue(parseStatus, parseStatus.Value + 1); } allDirectors = new Dictionary <string, int>( ); foreach (var item in DirectorBL.GetAllDO( )) { allDirectors.Add(item.Name, item.ID); setProgressBarValue(parseStatus, parseStatus.Value + 1); } allLanguages = new Dictionary <string, int>( ); foreach (var item in LanguageBL.GetAllDO( )) { allLanguages.Add(item.Name, item.ID); setProgressBarValue(parseStatus, parseStatus.Value + 1); } allTypes = new Dictionary <string, int>( ); foreach (var item in TypeBL.GetAllDO( )) { allTypes.Add(item.Name, item.ID); setProgressBarValue(parseStatus, parseStatus.Value + 1); } allWriters = new Dictionary <string, int>( ); foreach (var item in WriterBL.GetAllDO( )) { allWriters.Add(item.Name, item.ID); setProgressBarValue(parseStatus, parseStatus.Value + 1); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { TypeBL objBL_Type = new TypeBL(); TypeBE objType = new TypeBE(); objType.IdType = IdType; objType.Abbreviate = txtAbbreviate.Text; objType.NameType = txtDescripcion.Text; objType.FlagState = true; objType.Login = Parametros.strUsuarioLogin; objType.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objType.IdCompany = Parametros.intEmpresaId; if (pOperacion == Operacion.Nuevo) { objBL_Type.Inserta(objType); } else { objBL_Type.Actualiza(objType); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void getMovieInfoByIdAndSave(string imdbId, MovieDO movie, TextWriter tw, DateTime start) { ImdbModel imdbInfo = new ImdbModel( ); try { imdbInfo = ImdbHelper.getMovieInformation(imdbId, tw, start); logHelper.logLine(tw, "Imdb information parsed successfully. Starting operation 'Basic Info'"); #region Basic Info (not updated in db yet) if (string.IsNullOrEmpty(movie.ImdbID)) { movie.ImdbID = imdbId; } if (string.IsNullOrEmpty(movie.ImdbPoster) && !string.IsNullOrEmpty(imdbInfo.picturePath)) { string savePath = getSavePath( ); string fileName = FileSystemHelper.prepareFileNameForPicture(imdbInfo.picturePath.Substring(imdbInfo.picturePath.LastIndexOf('/')), new MovieNameModel { OriginalName = movie.OriginalName }, savePath); WebRequestHelper.Download(imdbInfo.picturePath, savePath + fileName); movie.ImdbPoster = fileName; } movie.ImdbRating = imdbInfo.imdbRating; if (movie.Year == null || movie.Year == 0) { movie.Year = imdbInfo.year; } #endregion Basic Info logHelper.logLine(tw, "Basic Info inserted"); logHelper.logLine(tw, "Starting operation 'Genres'"); #region types if (MovieTypeBL.GetAllByMovieID(movie.ID).Count() < 1) { try { if (imdbInfo.genres != null) { foreach (string item in imdbInfo.genres) { if (allTypes.ContainsKey(item)) { MovieTypeBL.Save(new MovieTypeDO( ) { MovieID = movie.ID, TypeID = allTypes[item] }, 1); } else { int currentID = TypeBL.Save(new MArchive.Domain.Lookup.TypeDO( ) { Name = item }, 1).ID; //MovieTypeBL.Save( movie.ID, item, 1 ); MovieTypeBL.Save(new MovieTypeDO( ) { MovieID = movie.ID, TypeID = currentID }, 1); allTypes.Add(item, currentID); } } } logHelper.logLine(tw, "Genres inserted"); } catch (Exception ex) { logHelper.logLine(tw, "Genres could not be inserted."); logHelper.logException(tw, ex); logHelper.logLine(tw); } } #endregion types logHelper.logLine(tw, "Starting operation 'Actors'"); #region actors if (MovieActorBL.GetAllByMovieID(movie.ID).Count( ) < 1) { try { if (imdbInfo.cast != null) { foreach (string item in imdbInfo.cast) { if (allActors.ContainsKey(item)) { MovieActorBL.Save(new MovieActorDO( ) { MovieID = movie.ID, ActorID = allActors[item] }, 1); } else { int currentID = ActorBL.Save(new MArchive.Domain.Lookup.ActorDO( ) { Name = item }, 1).ID; MovieActorBL.Save(new MovieActorDO( ) { MovieID = movie.ID, ActorID = currentID }, 1); allActors.Add(item, currentID); } } } logHelper.logLine(tw, "Actors inserted"); } catch (Exception ex) { logHelper.logLine(tw, "Actors could not be inserted."); logHelper.logException(tw, ex); logHelper.logLine(tw); } } #endregion actors logHelper.logLine(tw, "Starting operation 'Languages'"); #region languages if (MovieLanguageBL.GetAllByMovieID(movie.ID).Count( ) < 1) { try { if (imdbInfo.languages != null) { foreach (string item in imdbInfo.languages) { if (allLanguages.ContainsKey(item)) { MovieLanguageBL.Save(new MovieLanguageDO( ) { MovieID = movie.ID, LanguageID = allLanguages[item] }, 1); } else { int currentID = LanguageBL.Save(new MArchive.Domain.Lookup.LanguageDO( ) { Name = item }, 1).ID; MovieLanguageBL.Save(new MovieLanguageDO( ) { MovieID = movie.ID, LanguageID = currentID }, 1); allLanguages.Add(item, currentID); } } } logHelper.logLine(tw, "Languages inserted"); } catch (Exception ex) { logHelper.logLine(tw, "Languages could not be inserted."); logHelper.logException(tw, ex); logHelper.logLine(tw); } } #endregion languages logHelper.logLine(tw, "Starting operation 'Directors'"); #region directors if (MovieDirectorBL.GetAllByMovieID(movie.ID).Count( ) < 1) { try { if (imdbInfo.directors != null) { foreach (string item in imdbInfo.directors) { if (allDirectors.ContainsKey(item)) { MovieDirectorBL.Save(new MovieDirectorDO( ) { MovieID = movie.ID, DirectorID = allDirectors[item] }, 1); } else { int currentID = DirectorBL.Save(new MArchive.Domain.Lookup.DirectorDO( ) { Name = item }, 1).ID; MovieDirectorBL.Save(new MovieDirectorDO( ) { MovieID = movie.ID, DirectorID = currentID }, 1); allDirectors.Add(item, currentID); } } } logHelper.logLine(tw, "Directors inserted"); } catch (Exception ex) { logHelper.logLine(tw, "Directors could not be inserted."); logHelper.logException(tw, ex); logHelper.logLine(tw); } } #endregion directors logHelper.logLine(tw, "Starting operation 'Writers'"); #region writers if (MovieWriterBL.GetAllByMovieID(movie.ID).Count( ) < 1) { try { if (imdbInfo.writers != null) { foreach (string item in imdbInfo.writers) { if (allWriters.ContainsKey(item)) { MovieWriterBL.Save(new MovieWriterDO( ) { MovieID = movie.ID, WriterID = allWriters[item] }, 1); } else { int currentID = WriterBL.Save(new MArchive.Domain.Lookup.WriterDO( ) { Name = item }, 1).ID; MovieWriterBL.Save(new MovieWriterDO( ) { MovieID = movie.ID, WriterID = currentID }, 1); allWriters.Add(item, currentID); } } } logHelper.logLine(tw, "Writers inserted"); } catch (Exception ex) { logHelper.logLine(tw, "Writers could not be inserted."); logHelper.logException(tw, ex); logHelper.logLine(tw); } } #endregion writers logHelper.logLine(tw, "Updating 'movie' table"); movie.ImdbParsed = true; movie.ImdbLastParseDate = movie.UpdateDate = DateTime.Now; MovieBL.Save(movie, 1); logHelper.logLine(tw, "Table update successful"); } catch (Exception ex) { logHelper.logException(tw, ex); } }