void grdLister_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) { try { GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement; if (cell == null) { return; } else if (cell.GridControl.Name == "grdLister") { if (menu_Job == null) { menu_Job = new RadDropDownMenu(); RadMenuItem viewJobItem1 = new RadMenuItem("View Job"); viewJobItem1.ForeColor = Color.DarkBlue; viewJobItem1.BackColor = Color.Orange; viewJobItem1.Font = new Font("Tahoma", 10, FontStyle.Bold); viewJobItem1.Click += new EventHandler(viewJobItem1_Click); menu_Job.Items.Add(viewJobItem1); } e.ContextMenu = menu_Job; return; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
void grdLister_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) { try { GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement; if (cell == null) { return; } if (statsContextMenu == null) { statsContextMenu = new RadDropDownMenu(); RadMenuItem menu_showJobs = new RadMenuItem("Show Bookings"); menu_showJobs.ForeColor = Color.Blue; menu_showJobs.BackColor = Color.Blue; menu_showJobs.Font = new Font("Tahoma", 10, FontStyle.Bold); menu_showJobs.Click += new EventHandler(menu_showJobs_Click); statsContextMenu.Items.Add(menu_showJobs); } e.ContextMenu = statsContextMenu; } catch (Exception ex) { // ENUtils.ShowMessage(ex.Message); } }
private void radGridView1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e) { GridDataCellElement dataCell = sender as GridDataCellElement; if (dataCell != null) { e.ToolTipText = string.Format("Column: {0}, Row: {1}", dataCell.ColumnIndex, dataCell.RowIndex); } }
private void radTextBoxCellContent_TextChanged(object sender, EventArgs e) { GridDataCellElement cell = gridView.CurrentCell; if (cell != null) { cell.Value = this.radTextBoxCellContent.Text; } }
private void radGridView1_ScreenTipNeeded(object sender, Telerik.WinControls.ScreenTipNeededEventArgs e) { GridDataCellElement cell = e.Item as GridDataCellElement; if (cell != null) { this.ShowScreenTipForCell(cell); } }
void closeButton_Click(object sender, EventArgs e) { ClosePopup(); GridDataCellElement cell = this.Parent as GridDataCellElement; if (cell != null) { cell.GridViewElement.EndEdit(); } }
private void radGridView1_CellMouseMove(object sender, MouseEventArgs e) { GridDataCellElement cell = sender as GridDataCellElement; if (cell == null) { return; } radLabel3.Text = string.Format("CellMouseMove: {0} [{1}, btn: {2}]", cell.Value, e.Location, e.Button); }
private void OnPreviewDragDrop(object sender, Telerik.WinControls.RadDropEventArgs e) { GridDataCellElement dataCell = e.HitTarget as GridDataCellElement; if (dataCell != null) { TreeNodeElement element = e.DragInstance as TreeNodeElement; dataCell.Value = element.Data.Name; e.Handled = true; } }
private void RadExtendedGridViewController_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var element = this.ElementTree.GetElementAtPoint(e.Location); GridDataCellElement cell = element as GridDataCellElement; if (cell?.RowElement is GridDataRowElement) { Rows[cell.RowIndex].IsSelected = true; } } }
private void OnPreviewDragOver(object sender, Telerik.WinControls.RadDragOverEventArgs e) { GridDataCellElement dataCell = e.HitTarget as GridDataCellElement; if (dataCell != null) { TreeNodeElement element = e.DragInstance as TreeNodeElement; object value = null; e.CanDrop = RadDataConverter.Instance.TryParse(dataCell as IDataConversionInfoProvider, element.Data.Name, out value) == null; } }
void grdSelectedPostCodes_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) { try { GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement; if (cell == null) { e.Cancel = true; return; } else if (cell.GridControl.Name == "grdSelectedPostCodes") { if (Update == null) { Update = new RadDropDownMenu(); Update.BackColor = Color.Orange; RadMenuItem UpdateCurrent = new RadMenuItem("Update Coordinates"); UpdateCurrent.ForeColor = Color.DarkBlue; UpdateCurrent.BackColor = Color.Orange; UpdateCurrent.Font = new Font("Tahoma", 10, FontStyle.Bold); UpdateCurrent.Click += new EventHandler(UpdateCurrent_Click); Update.Items.Add(UpdateCurrent); RadMenuItem UpdateUp = new RadMenuItem("Move Up"); UpdateUp.ForeColor = Color.DarkBlue; UpdateUp.BackColor = Color.Orange; UpdateUp.Font = new Font("Tahoma", 10, FontStyle.Bold); UpdateUp.Click += new EventHandler(UpdateUp_Click); Update.Items.Add(UpdateUp); RadMenuItem UpdateDown = new RadMenuItem("Move Down"); UpdateDown.ForeColor = Color.DarkBlue; UpdateDown.BackColor = Color.Orange; UpdateDown.Font = new Font("Tahoma", 10, FontStyle.Bold); UpdateDown.Click += new EventHandler(UpdateDown_Click); Update.Items.Add(UpdateDown); } e.ContextMenu = Update; return; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void gridMyCollection_ScreenTipNeeded(object sender, ScreenTipNeededEventArgs e) { e.Delay = 1; GridDataCellElement cell = e.Item as GridDataCellElement; Card card = (Card)cell?.RowInfo.DataBoundItem; if (card?.Img == null) { return; } cell.ScreenTip = GetScreenTip(card); }
private void gridCardValuation_ScreenTipNeeded(object sender, ScreenTipNeededEventArgs e) { e.Delay = 1; GridDataCellElement cell = e.Item as GridDataCellElement; Valuation valuation = (Valuation)cell?.RowInfo.DataBoundItem; if (valuation?.Card.Img == null) { return; } cell.ScreenTip = GetScreenTip(valuation.Card); }
private void gvDailyMeasures_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e) { GridDataCellElement cell = sender as GridDataCellElement; if (cell != null) { var measure = cell.RowElement.Data.DataBoundItem as DailyStandardMeasure; if (!CanEditMeasure(measure)) { e.ToolTipText = Resources.MeasureNotEditable; } } }
private void radGridView2_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e) { GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement; if ((bool)radGridView2.Rows[cell.RowIndex].Cells["IsCheckOut"].Value) { menu.Items[2].Enabled = true; menu.Items[1].Enabled = false; } else { menu.Items[2].Enabled = false; menu.Items[1].Enabled = true; } e.ContextMenu = menu.DropDown; }
private void grid_CellFormatting(object sender, CellFormattingEventArgs e) { GridDataCellElement dataCell = e.CellElement as GridDataCellElement; if (dataCell != null && dataCell.ColumnInfo.Name == "Name" && dataCell.RowElement is GridDataRowElement) { if (boldFont == null) { boldFont = new Font(dataCell.Font, FontStyle.Bold); } dataCell.Font = boldFont; } else { e.CellElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local); } }
private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) { GridDataCellElement cell = e.CellElement as GridDataCellElement; if (cell != null) { if (cell.ColumnInfo.Name == "Notes") { cell.Font = italicFont; cell.Padding = new Padding(4); } else { cell.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local); cell.ResetValue(LightVisualElement.PaddingProperty, ValueResetFlags.Local); } } }
void grdLister_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) { try { GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement; if (cell == null) { return; } else if (cell.GridControl.Name == "grdLister") { e.ContextMenu = menu; return; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void radGridView1_ScreenTipNeeded(object sender, ScreenTipNeededEventArgs e) { e.Delay = 1; GridDataCellElement cell = e.Item as GridDataCellElement; KeyValuePair <Card, int>?card = (KeyValuePair <Card, int>?)cell?.RowInfo.DataBoundItem; if (card?.Key.Img == null) { return; } byte[] bytes = _wc.DownloadData(card.Value.Key.Img); MemoryStream ms = new MemoryStream(bytes); _screenTip.MainTextLabel.Image = Image.FromStream(ms); _screenTip.MainTextLabel.Text = ""; _screenTip.CaptionVisible = false; _screenTip.FooterVisible = false; _screenTip.MainTextLabel.Margin = new Padding(-5, -35, -15, -20); _screenTip.AutoSize = true; cell.ScreenTip = _screenTip; }
private int GetTargetCellIndex(GridDataCellElement cell, Point dropLocation) { int halfHeight = cell.Size.Height / 2; int index = cell.RowInfo.Index; if (dropLocation.Y > halfHeight) { index++; } return index; }
private void dgvProducts_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e) { GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement; productID = cell.RowInfo.Cells["ProductID"].Value.ToInt(); }
void grdLister_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) { try { GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement; if (cell == null) { return; } else if (cell.GridControl.Name == "grdLister") { if (EditFare == null) { EditFare = new RadDropDownMenu(); EditFare.BackColor = Color.Orange; RadMenuItem EditFareItem1 = new RadMenuItem("Edit Fare"); EditFareItem1.ForeColor = Color.DarkBlue; EditFareItem1.BackColor = Color.Orange; EditFareItem1.Font = new Font("Tahoma", 10, FontStyle.Bold); EditFareItem1.Click += new EventHandler(EditFareItem1_Click); EditFare.Items.Add(EditFareItem1); //RadMenuItem EditFareItem2 = new RadMenuItem("Arrival Text"); //EditFareItem2.ForeColor = Color.DarkBlue; //EditFareItem2.BackColor = Color.Orange; //EditFareItem2.Font = new Font("Tahoma", 10, FontStyle.Bold); //EditFareItem2.Click += new EventHandler(EditFareItem2_Click); //EditFare.Items.Add(EditFareItem2); //EditFareItem2 = new RadMenuItem("SMS Job Details"); //EditFareItem2.ForeColor = Color.DarkBlue; //EditFareItem2.BackColor = Color.Orange; //EditFareItem2.Font = new Font("Tahoma", 10, FontStyle.Bold); //EditFareItem2.Click += new EventHandler(SMSJob_Click); //EditFare.Items.Add(EditFareItem2); //EditFareItem1 = new RadMenuItem("Complete Job"); //EditFareItem1.ForeColor = Color.Black; //EditFareItem1.Font = new Font("Tahoma", 10, FontStyle.Bold); //EditFareItem1.Click += new EventHandler(ForceCompleteJob_Click); //EditFare.Items.Add(EditFareItem1); RadMenuItem EditFareItem3 = new RadMenuItem("View Job"); EditFareItem3.ForeColor = Color.DarkBlue; EditFareItem3.BackColor = Color.Orange; EditFareItem3.Font = new Font("Tahoma", 10, FontStyle.Bold); EditFareItem3.Click += new EventHandler(EditFareItem3_Click); EditFare.Items.Add(EditFareItem3); } e.ContextMenu = EditFare; return; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) { GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement; e.ContextMenu = menuParent.DropDown; }
void grdLister_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e) { try { GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement; if (cell == null) { return; } else if (cell.ColumnInfo.Name == "BackupPlot1" || cell.ColumnInfo.Name == "BackupPlot2") { if (contextMenu == null) { contextMenu = new RadDropDownMenu(); contextMenu.BackColor = Color.Orange; RadMenuItem item1 = new RadMenuItem("High Priority"); item1.ForeColor = Color.DarkBlue; item1.BackColor = Color.Orange; item1.Font = new Font("Tahoma", 10, FontStyle.Bold); item1.Click += new EventHandler(item1_Click); contextMenu.Items.Add(item1); RadMenuItem item2 = new RadMenuItem("Mark All Bidding"); item2.ForeColor = Color.DarkBlue; item2.BackColor = Color.Orange; item2.Font = new Font("Tahoma", 10, FontStyle.Bold); item2.Click += new EventHandler(item2_Click); contextMenu.Items.Add(item2); RadMenuItem item3 = new RadMenuItem("UnMark All Bidding"); item3.ForeColor = Color.DarkBlue; item3.BackColor = Color.Orange; item3.Font = new Font("Tahoma", 10, FontStyle.Bold); item3.Click += new EventHandler(item3_Click); contextMenu.Items.Add(item3); RadMenuItem item4 = new RadMenuItem("Mark All AutoDespatch"); item4.ForeColor = Color.DarkBlue; item4.BackColor = Color.Orange; item4.Font = new Font("Tahoma", 10, FontStyle.Bold); item4.Click += new EventHandler(item4_Click); contextMenu.Items.Add(item4); RadMenuItem item5 = new RadMenuItem("UnMark All AutoDespatch"); item5.ForeColor = Color.DarkBlue; item5.BackColor = Color.Orange; item5.Font = new Font("Tahoma", 10, FontStyle.Bold); item5.Click += new EventHandler(item5_Click); contextMenu.Items.Add(item5); } e.ContextMenu = contextMenu; return; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void ShowScreenTipForCellStats(GridDataCellElement cell) { if (cell == null) { return; } try { GridViewRowInfo row = cell.RowElement.RowInfo; if (row != null && row is GridViewDataRowInfo) { int Id = row.Cells["Id"].Value.ToInt(); int companyId = row.Cells[COLS.CompanyId].Value.ToInt(); List <vu_Invoice> list = null; using (TaxiDataContext db = new TaxiDataContext()) { list = db.vu_Invoices.Where(c => c.Id == Id).ToList(); if (TemplateName == "0") { TemplateName = db.UM_Form_Templates.FirstOrDefault(c => c.UM_Form.FormName == "frmInvoiceReport" && c.IsDefault == true).DefaultIfEmpty().TemplateName.ToStr(); } } if (list.Count > 0) { var data = list.FirstOrDefault().DefaultIfEmpty(); decimal netAmount = 0.00m; decimal invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal(); //NC //Changes Area for VAT start here. decimal invoiceGrandTotal2 = 0.00m;//= (netAmount + data.AdminFees.ToDecimal()); decimal NetCharges = 0.0m; decimal DriverCostNonVAT = 0.0m; decimal BusinessCharge = 0.0m; decimal VatOnBusinessCharge = 0.0m; decimal TotalGPB = 0.0m; // if (TemplateName.ToStr() == "Template13" || TemplateName.ToStr() == "Template14" || TemplateName.ToStr() == "Template24") { if (TemplateName.ToStr() == "Template13" || TemplateName.ToStr() == "Template24") { netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6) .Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal()); // NetCharges = list.Where(c => c.VehicleType != "Saloon" && c.PaymentTypeId.ToInt() != 6).Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal()); } else if (TemplateName.ToStr() == "Template14") { netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6) .Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.ExtraDropCharges.ToDecimal()); // NetCharges = list.Where(c => c.VehicleType != "Saloon" && c.PaymentTypeId.ToInt() != 6).Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.ExtraDropCharges.ToDecimal()); } invoiceGrandTotal = netAmount; } else if (TemplateName.ToStr() == "Template17") { NetCharges = list.Where(c => c.VehicleType != "Coach" && c.PaymentTypeId.ToInt() != 6).Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.ExtraDropCharges.ToDecimal()); netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6) .Sum(c => c.Charges.ToDecimal() + c.ExtraDropCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.MeetAndGreetCharges.ToDecimal() + c.CongtionCharges.ToDecimal()); // NetCharges = list.Where(c => c.VehicleType != "Coach" && c.PaymentTypeId.ToInt() != 6).Sum(c => c.Charges.ToDecimal() + c.ExtraDropCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.MeetAndGreetCharges.ToDecimal() + c.CongtionCharges.ToDecimal()); invoiceGrandTotal = NetCharges + data.AdminFees.ToDecimal(); // invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal(); invoiceGrandTotal2 = netAmount + data.AdminFees.ToDecimal(); } //else if(&& this.ExportFileType.ToStr().ToLower() == "excel") else if (TemplateName.ToStr() == "Template18") { netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6) .Sum(c => c.Charges.ToDecimal() + c.ExtraDropCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal()); invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal(); //NC //valueAddedTax = (invoiceGrandTotal * 20) / 100; DriverCostNonVAT = ((invoiceGrandTotal * 80) / 100); BusinessCharge = ((invoiceGrandTotal * 20) / 100); VatOnBusinessCharge = ((BusinessCharge) * 20 / 100); TotalGPB = (DriverCostNonVAT + BusinessCharge + VatOnBusinessCharge); // valueAddedTax } else if (TemplateName.ToStr() == "Template10" || TemplateName.ToStr() == "Template25" || TemplateName.ToStr() == "Template27") { netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6) .Sum(c => c.Charges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal()); invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal(); } else if (TemplateName.ToStr() == "Template21") { netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6) .Sum(c => c.Charges.ToDecimal()); invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal(); } else { netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6) .Sum(c => c.Charges.ToDecimal() + c.ExtraDropCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal()); invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal(); } string vat = "0"; decimal discountAmount = 0.00m; decimal DiscountPercent = 0.00m; decimal valueAddedTax = 0.0m; decimal AdminFeesPercent = 0.00m; decimal AdminFees = 0.00m; string HasAdminFees = string.Empty; string HasDiscount = "0"; string CompanyAccountNo = string.Empty; if (companyId != 0) { Gen_Company objCompany = General.GetObject <Gen_Company>(c => c.Id == companyId); if (objCompany != null) { if (objCompany.HasVat.ToBool()) { valueAddedTax = (invoiceGrandTotal * 20) / 100; vat = "1"; if (objCompany.VatOnlyOnAdminFees.ToBool()) { valueAddedTax = (data.AdminFees.ToDecimal() * 20) / 100; vat = "1"; } } if (objCompany.DiscountPercentage.ToDecimal() > 0) { discountAmount = (invoiceGrandTotal * objCompany.DiscountPercentage.ToDecimal()) / 100; DiscountPercent = objCompany.DiscountPercentage.ToDecimal(); HasDiscount = "1"; } if (objCompany.AdminFees > 0) { decimal GrandAmount = (invoiceGrandTotal - discountAmount); AdminFees = (invoiceGrandTotal * objCompany.AdminFees.ToDecimal()) / 100; AdminFeesPercent = objCompany.AdminFees.ToDecimal(); HasAdminFees = "1"; } CompanyAccountNo = objCompany.AccountNo.ToStr().Trim(); } } if (TemplateName.ToStr() == "Template17") { invoiceGrandTotal = (invoiceGrandTotal2 + valueAddedTax) - discountAmount; } else { invoiceGrandTotal = (invoiceGrandTotal + valueAddedTax) - discountAmount; } StringBuilder text = new StringBuilder(); text.Append("<html>"); text.Append("<b>" + " Invoice # : " + list[0].InvoiceNo.ToStr() + " @ <color=Red>" + string.Format("{0:dd/MM/yy HH:mm}", list[0].InvoiceDate) + "</b>"); text.Append("<br><br>"); text.Append("<br><b><color=Black>Company : " + list[0].CompanyName.ToStr() + "</b>"); text.Append("<br>Address : " + list[0].CompanyAddress.ToStr()); text.Append("<br><br>"); text.Append("<br><b>Gross Total : </b>" + Math.Round(netAmount.ToDecimal(), 2)); if (valueAddedTax.ToDecimal() > 0) { text.Append("<br><b>Vat : </b>" + Math.Round(valueAddedTax.ToDecimal(), 2)); } if (AdminFees.ToDecimal() > 0) { text.Append("<br><b>Admin Fees : </b>" + Math.Round(AdminFees.ToDecimal(), 2)); } text.Append("<br><b>Total Due : </b>" + Math.Round(invoiceGrandTotal + AdminFees, 2)); text.Append("<br><br>"); RadOffice2007ScreenTipElement screenTip = new RadOffice2007ScreenTipElement(); screenTip.CaptionLabel.Margin = new Padding(3); screenTip.CaptionLabel.Text = text.ToStr(); // screenTip.CaptionLabel.Text = text.ToStr(); screenTip.MainTextLabel.Text = string.Empty; screenTip.EnableCustomSize = false; cell.ScreenTip = screenTip; } } } catch (Exception ex) { } }