private void GenerateBarcodeTag(JewelMaster entity) { var jewelMasterDataSet = new JewelMasterDataSet(); var barcode = new BarcodeUtility(); var jewelImage = barcode.MakeBarcodeImage(entity.JewelNo); var jewelMasterRow = jewelMasterDataSet.Tables["JewelMaster"].NewRow(); jewelMasterRow["JewelId"] = entity.JewelId; jewelMasterRow["JewelNo"] = entity.JewelNo; jewelMasterRow["StyleNo"] = entity.StyleNo; jewelMasterRow["JewelDescription"] = entity.JewelDescription; jewelMasterRow["MetalColor"] = entity.MetalColor; jewelMasterRow["ImagePath"] = ImageExtension.GetImageName(entity.StyleNo); jewelMasterRow["DiamondPcs"] = Convert.ToString(entity.DiamondPcs); jewelMasterRow["DiamondWt"] = Convert.ToString(entity.DiamondWt); jewelMasterRow["GrsWt"] = Convert.ToString(entity.GrsWt); jewelMasterRow["NetWt"] = Convert.ToString(entity.NetWt); jewelMasterRow["JewelImage"] = ImageConverterHelper.ImageToByteArray(jewelImage); jewelMasterDataSet.Tables["JewelMaster"].Rows.Add(jewelMasterRow); if (!File.Exists(Application.StartupPath + @"\" + ReportConstants.JEWELMASTERREPORTPATH)) { return; } var reportDocument = new ReportDocument(); reportDocument.Load(Application.StartupPath + @"\" + ReportConstants.JEWELMASTERREPORTPATH); reportDocument.SetDataSource(jewelMasterDataSet); crystalReportViewer1.ReportSource = reportDocument; crystalReportViewer1.Refresh(); }
public override void BindValues(JewelMaster entity) { if (entity == null) { return; } btnPrintSticker.Enabled = true; txtJewelNo.Text = entity.JewelNo; txtStyleNo.Text = entity.StyleNo; cboJewelDesc.Text = entity.JewelDescription; cboMetalColor.Text = entity.MetalColor; txtDiamondPcs.Text = Convert.ToString(entity.DiamondPcs); txtDiamondWt.Text = Convert.ToString(entity.DiamondWt); txtNetWt.Text = Convert.ToString(entity.NetWt); txtGrsWt.Text = Convert.ToString(entity.GrsWt); var imagePath = Path.Combine(_winSettingProvider.ImageDirectory, ImageExtension.GetImageName(entity.StyleNo)); { if (File.Exists(imagePath)) { HasImage = true; using (var img = Image.FromFile(imagePath)) jewelPictureBox.Image = img.Clone <Image>(); } else { HasImage = false; jewelPictureBox.Image = Image.FromFile(Application.StartupPath + @"\Resource\TirthJewels.JPG"); } } GenerateBarcodeTag(entity); }
private void btnGenerateBarcode_Click(object sender, EventArgs e) { if (!SelectedJewels.Any()) { MessageBox.Show(Resources.frmAllJewelsBarcodePrint_btnGenerateBarcode_Click_No_Jewel_selected_for_report_, "No Jewel selected", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var jewelMasterDataSet = new JewelMasterDataSet(); var barcode = new BarcodeUtility(); foreach (var jewel in SelectedJewels) { //Add data to crystal report. var jewelImage = barcode.MakeBarcodeImage(jewel.JewelNo); var jewelMasterRow = jewelMasterDataSet.Tables["JewelMaster"].NewRow(); jewelMasterRow["JewelId"] = jewel.JewelId; jewelMasterRow["JewelNo"] = jewel.JewelNo; jewelMasterRow["StyleNo"] = jewel.StyleNo; jewelMasterRow["JewelDescription"] = jewel.JewelDescription; jewelMasterRow["MetalColor"] = jewel.MetalColor; jewelMasterRow["ImagePath"] = ImageExtension.GetImageName(jewel.StyleNo); jewelMasterRow["DiamondPcs"] = Convert.ToString(jewel.DiamondPcs); jewelMasterRow["DiamondWt"] = Convert.ToString(jewel.DiamondWt); jewelMasterRow["GrsWt"] = Convert.ToString(jewel.GrsWt); jewelMasterRow["NetWt"] = Convert.ToString(jewel.NetWt); jewelMasterRow["JewelImage"] = ImageConverterHelper.ImageToByteArray(jewelImage); jewelMasterDataSet.Tables["JewelMaster"].Rows.Add(jewelMasterRow); } if (File.Exists(Application.StartupPath + @"\" + ReportConstants.JEWELMASTERREPORTPATH)) { var reportDocument = new ReportDocument(); reportDocument.Load(Application.StartupPath + @"\" + ReportConstants.JEWELMASTERREPORTPATH); crystalReportViewer1.ReportSource = null; crystalReportViewer1.ReportSource = reportDocument; reportDocument.SetDataSource(jewelMasterDataSet); crystalReportViewer1.Refresh(); } }
private void FillGrid(int StartRow) { //var owner = (frmCatalogue)Owner; //var Jewels = _jewelService.GetCatalogueJewels(owner.FromJewel, owner.ToJewel, owner.JewelDescription, owner.SelectedWeight); IList <JewelMaster> Jewels; Jewels = OWNERS.HasFilters ? _jewelService.GetCatalogueJewels(OWNERS.Filters) : _jewelService.GetCatalogueJewels(OWNERS.FromJewel, OWNERS.ToJewel, OWNERS.JewelDescription, OWNERS.SelectedWeight); totalRecords = Jewels.Count; if (totalRecords == 0) { MessageBox.Show(Resources.frmProduct_FillGrid_Records_Not_found__); Close(); return; } var JewelData = Jewels.Skip(StartRow).Take(10).ToList(); dgvJewel.Rows.Clear(); GridRow = 0; foreach (var jewel in JewelData) { dgvJewel.Rows.Add(1); dgvJewel.Rows[GridRow].Height = 100; dgvJewel.Rows[GridRow].Cells[2].Value = jewel.JewelNo; dgvJewel.Rows[GridRow].Cells[3].Value = jewel.StyleNo; dgvJewel.Rows[GridRow].Cells[4].Value = jewel.JewelDescription; dgvJewel.Rows[GridRow].Cells[5].Value = jewel.MetalColor; dgvJewel.Rows[GridRow].Cells[6].Value = ImageExtension.GetImageName(jewel.StyleNo); dgvJewel.Rows[GridRow].Cells[7].Value = jewel.DiamondPcs; dgvJewel.Rows[GridRow].Cells[8].Value = jewel.DiamondWt; dgvJewel.Rows[GridRow].Cells[9].Value = jewel.GrsWt; dgvJewel.Rows[GridRow].Cells[10].Value = jewel.NetWt; dgvJewel[1, GridRow].Value = ImageExtension.ResolveImage(jewel.StyleNo); GridRow = GridRow + 1; } lblTotItems.Text = Resources.frmProduct_FillGrid_ + Convert.ToString(dgvJewel.RowCount); dgvJewel.Focus(); }
public void ShowBarcodeTag(IEnumerable <String> jewelNumbers) { var jewelMasterDataSet = new JewelMasterDataSet(); var barcode = new BarcodeUtility(); foreach (var jewel in jewelNumbers) { var jeweltran = _transactionService.GetJewelStockByJewelNo(jewel); if (jeweltran == null) { continue; } var jewelImage = barcode.MakeBarcodeImage(jeweltran.JewelNumber); var jewelMasterRow = jewelMasterDataSet.Tables["JewelMaster"].NewRow(); jewelMasterRow["JewelNo"] = jeweltran.JewelNumber; jewelMasterRow["StyleNo"] = jeweltran.DesignCode; jewelMasterRow["CertificateNo"] = jeweltran.CertificateNumber; jewelMasterRow["JewelDescription"] = jeweltran.JewelType; jewelMasterRow["MetalColor"] = jeweltran.MetalColor; jewelMasterRow["ImagePath"] = ImageExtension.GetImageName(jeweltran.DesignCode); jewelMasterRow["DiamondPcs"] = Convert.ToString(jeweltran.StonePcs); jewelMasterRow["DiamondWt"] = Convert.ToString(jeweltran.StoneWeight); jewelMasterRow["GrsWt"] = Convert.ToString(jeweltran.TotalWeight); jewelMasterRow["NetWt"] = Convert.ToString(jeweltran.MetalWeight); jewelMasterRow["JewelImage"] = ImageConverterHelper.ImageToByteArray(jewelImage); jewelMasterDataSet.Tables["JewelMaster"].Rows.Add(jewelMasterRow); } var orderReport = new frmReport { ReportPath = ResolveReportPath(ReportConstants.JEWELMASTERREPORTPATH), ReportDataSet = jewelMasterDataSet }; orderReport.Show(); }
private void frmBarcodePrinter_Load(object sender, EventArgs e) { var jewels = FormData as TransactionLookup; var jewelMasterDataSet = new JewelMasterDataSet(); var barcode = new BarcodeUtility(); foreach (var jewel in jewels.JewelTransactions) { var jewelImage = barcode.MakeBarcodeImage(jewel.JewelNumber); var jewelMasterRow = jewelMasterDataSet.Tables["JewelMaster"].NewRow(); jewelMasterRow["JewelNo"] = jewel.JewelNumber; jewelMasterRow["CertificateNo"] = jewel.CertificateNumber; jewelMasterRow["StyleNo"] = jewel.DesignCode; jewelMasterRow["JewelDescription"] = jewel.JewelType; jewelMasterRow["MetalColor"] = jewel.MetalColor; jewelMasterRow["ImagePath"] = ImageExtension.GetImageName(jewel.DesignCode); jewelMasterRow["DiamondPcs"] = Convert.ToString(jewel.StonePcs); jewelMasterRow["DiamondWt"] = Convert.ToString(jewel.StoneWeight); jewelMasterRow["GrsWt"] = Convert.ToString(jewel.TotalWeight); jewelMasterRow["NetWt"] = Convert.ToString(jewel.MetalWeight); jewelMasterRow["JewelImage"] = ImageConverterHelper.ImageToByteArray(jewelImage); jewelMasterDataSet.Tables["JewelMaster"].Rows.Add(jewelMasterRow); } if (File.Exists(ReportUtility.ResolveReportPath(ReportConstants.JEWELMASTERREPORTPATH))) { var reportDocument = new ReportDocument(); reportDocument.Load(ReportUtility.ResolveReportPath(ReportConstants.JEWELMASTERREPORTPATH)); crystalReportViewer.ReportSource = null; crystalReportViewer.ReportSource = reportDocument; reportDocument.SetDataSource(jewelMasterDataSet); crystalReportViewer.Refresh(); } }
private void FillGrid(int StartRow) { totalRecords = Jewels.Count(); if (totalRecords == 0) { MessageBox.Show(Resources.frmAllJewelsBarcodePrint_FillGrid_Records_Not_found__); //Close(); return; } var JewelData = Jewels.OrderBy(x => x.JewelId).Skip(StartRow).Take(10).ToList(); dgvJewel.Rows.Clear(); SelectedJewels.Clear(); GridRow = 0; foreach (var jewel in JewelData) { //Add data to grid. dgvJewel.Rows.Add(1); dgvJewel.Rows[GridRow].Height = 100; dgvJewel.Rows[GridRow].Cells[2].Value = jewel.JewelNo; dgvJewel.Rows[GridRow].Cells[3].Value = jewel.StyleNo; dgvJewel.Rows[GridRow].Cells[4].Value = jewel.JewelDescription; dgvJewel.Rows[GridRow].Cells[5].Value = jewel.MetalColor; dgvJewel.Rows[GridRow].Cells[6].Value = ImageExtension.GetImageName(jewel.StyleNo); dgvJewel.Rows[GridRow].Cells[7].Value = jewel.DiamondPcs; dgvJewel.Rows[GridRow].Cells[8].Value = jewel.DiamondWt; dgvJewel.Rows[GridRow].Cells[9].Value = jewel.GrsWt; dgvJewel.Rows[GridRow].Cells[10].Value = jewel.NetWt; GridRow = GridRow + 1; } dgvJewel.Focus(); }
private void frmAllCatalogueProduct_Load(object sender, EventArgs e) { WindowState = FormWindowState.Normal; lblProductName.Text = ((frmCatalogue)Owner).JewelDescription; var JewelData = _jewelService.GetAllCatalogueJewels(); if (JewelData.Count == 0) { MessageBox.Show(Resources.frmAllCatalogueProduct_frmAllCatalogueProduct_Load_Record_s__Not_found__); Close(); return; } dgvJewel.Rows.Clear(); GridRow = 0; foreach (var jewel in JewelData) { dgvJewel.Rows.Add(1); dgvJewel.Rows[GridRow].Height = 100; dgvJewel.Rows[GridRow].Cells[2].Value = jewel.JewelNo; dgvJewel.Rows[GridRow].Cells[3].Value = jewel.StyleNo; dgvJewel.Rows[GridRow].Cells[4].Value = jewel.JewelDescription; dgvJewel.Rows[GridRow].Cells[5].Value = jewel.MetalColor; dgvJewel.Rows[GridRow].Cells[6].Value = ImageExtension.GetImageName(jewel.StyleNo); dgvJewel.Rows[GridRow].Cells[7].Value = jewel.DiamondPcs; dgvJewel.Rows[GridRow].Cells[8].Value = jewel.DiamondWt; dgvJewel.Rows[GridRow].Cells[9].Value = jewel.GrsWt; dgvJewel.Rows[GridRow].Cells[10].Value = jewel.NetWt; dgvJewel[1, GridRow].Value = ImageExtension.ResolveImage(jewel.StyleNo); GridRow = GridRow + 1; dgvJewel.FirstDisplayedScrollingRowIndex = dgvJewel.RowCount - 1; } lblTotItems.Text = Resources.frmAllCatalogueProduct_frmAllCatalogueProduct_Load_ + Convert.ToString(dgvJewel.RowCount); dgvJewel.Focus(); }
private void FindJewel(FindJewelBy findParam) { foreach (DataGridViewRow dgvr in dgvJewel.Rows) { var findCode = ""; var code = ""; if (findParam == FindJewelBy.JewelNo) { findCode = dgvr.Cells["JewelNo"].Value.ToString(); code = txtBarCode.Text; } else if (findParam == FindJewelBy.StyleNo) { findCode = dgvr.Cells["StyleNo"].Value.ToString(); code = txtStyleNo.Text; } if (String.Compare(findCode, code, StringComparison.OrdinalIgnoreCase) == 0) { MessageBox.Show(findParam + Resources.frmBarCodeOrder_FindJewel__already_exists_Please_search_for_new_record_, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); txtBarCode.Text = String.Empty; txtStyleNo.Text = String.Empty; return; } } JewelMaster JewelData = null; if (findParam == FindJewelBy.JewelNo) { JewelData = _jewelService.GetJewelsByJewelNo(txtBarCode.Text); } else if (findParam == FindJewelBy.StyleNo) { JewelData = _jewelService.GetJewelsByStyleNo(txtStyleNo.Text); } if (JewelData == null) { MessageBox.Show(Resources.frmBarCodeOrder_FindJewel_Records_Not_found__); txtBarCode.Text = String.Empty; txtStyleNo.Text = String.Empty; return; } int _newRow = dgvJewel.RowCount; dgvJewel.Rows.Add(1); dgvJewel.Rows[_newRow].Cells[0].Value = true; dgvJewel.Rows[_newRow].Height = 100; dgvJewel.Rows[_newRow].Cells[2].Value = JewelData.JewelNo; dgvJewel.Rows[_newRow].Cells[3].Value = JewelData.StyleNo; dgvJewel.Rows[_newRow].Cells[4].Value = JewelData.JewelDescription; dgvJewel.Rows[_newRow].Cells[5].Value = JewelData.MetalColor; dgvJewel.Rows[_newRow].Cells[6].Value = ImageExtension.GetImageName(JewelData.StyleNo); dgvJewel.Rows[_newRow].Cells[7].Value = JewelData.DiamondPcs; dgvJewel.Rows[_newRow].Cells[8].Value = JewelData.DiamondWt; dgvJewel.Rows[_newRow].Cells[9].Value = JewelData.GrsWt; dgvJewel.Rows[_newRow].Cells[10].Value = JewelData.NetWt; dgvJewel[1, _newRow].Value = ImageExtension.ResolveImage(JewelData.StyleNo); dgvJewel.FirstDisplayedScrollingRowIndex = dgvJewel.RowCount - 1; CatalogueRequest.Add(new QueryRequest { JewelNo = JewelData.JewelNo, StyleNo = JewelData.StyleNo, }); GetTotal(); }
private void btnSave_Click(object sender, EventArgs e) { if (base.IsValid == false) { MessageBox.Show(AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } if (HasImage == false) { MessageBox.Show(Resources.frmJewelMaster_btnSave_Click_Please_select_file_to_upload_, Constants.ALERTMESSAGEHEADER); return; } var jewelMaster = new JewelMaster(); if (false == string.IsNullOrEmpty(txtJewelNo.Text)) { jewelMaster = _jewelService.GetJewelsByJewelNo(txtJewelNo.Text); } decimal dimWt; if (!Decimal.TryParse(txtDiamondWt.Text, out dimWt)) { MessageBox.Show(Resources.frmJewelMaster_btnSave_Click_Please_select_proper_dia_Wt_, Constants.ALERTMESSAGEHEADER); return; } decimal netWt; if (!Decimal.TryParse(txtNetWt.Text, out netWt)) { MessageBox.Show(Resources.frmJewelMaster_btnSave_Click_Please_select_proper_net_Wt_, Constants.ALERTMESSAGEHEADER); return; } decimal grsWt; if (!Decimal.TryParse(txtGrsWt.Text, out grsWt)) { MessageBox.Show(Resources.frmJewelMaster_btnSave_Click_Please_select_proper_grs_Wt_, Constants.ALERTMESSAGEHEADER); return; } jewelMaster.StyleNo = txtStyleNo.Text; jewelMaster.JewelDescription = cboJewelDesc.Text; jewelMaster.MetalColor = cboMetalColor.Text; jewelMaster.DiamondPcs = Convert.ToInt32(txtDiamondPcs.Text); jewelMaster.DiamondWt = dimWt; jewelMaster.GrsWt = grsWt; jewelMaster.NetWt = netWt; jewelMaster.AccessedBy = 0; jewelMaster.AccessedDate = DateTime.Now; var filePath = Path.Combine(_winSettingProvider.ImageDirectory, ImageExtension.GetImageName(txtStyleNo.Text)); if (File.Exists(fileDialog.FileName)) { File.Copy(fileDialog.FileName, filePath, true); } var jewelRequest = new JewelMasterRequest() { JewelMaster = jewelMaster }; var jewelMasterResponse = _jewelService.CreateJewelMaster(jewelRequest); if (false == jewelMasterResponse.IsValid) { MessageBox.Show(jewelMasterResponse.AllErrors.ErrorMessageString(), Constants.ALERTMESSAGEHEADER); return; } groupBox.Enabled = btnSave.Enabled = false; btnPrintSticker.Enabled = true; GenerateBarcodeTag(jewelMaster); MessageBox.Show("Record saved!"); }