public GridViewSection() { var layout = new DynamicLayout(); layout.AddRow(new Label { Text = "Default" }, Default()); layout.AddRow(new Label { Text = "No Header,\nNon-Editable" }, NoHeader()); #if DESKTOP layout.BeginHorizontal(); layout.Add(new Label { Text = "Context Menu\n&& Multi-Select\n&& Filter" }); layout.BeginVertical(); layout.Add(filterText = new SearchBox { PlaceholderText = "Filter" }); var withContextMenuAndFilter = WithContextMenuAndFilter(); layout.Add(withContextMenuAndFilter); layout.EndVertical(); layout.EndHorizontal(); var selectionGridView = Default(addItems: false); layout.AddRow(new Label { Text = "Selected Items" }, selectionGridView); // hook up selection of main grid to the selection grid withContextMenuAndFilter.SelectionChanged += (s, e) => { var items = new GridItemCollection(); items.AddRange(withContextMenuAndFilter.SelectedItems); selectionGridView.DataStore = items; }; #endif Content = layout; }
GridView Default() { var control = new GridView { Size = new Size (300, 100) }; LogEvents (control); var dropDown = MyDropDown (); control.Columns.Add (new GridColumn{ DataCell = new CheckBoxCell (), Editable = true, AutoSize = true, Resizable = false}); control.Columns.Add (new GridColumn{ HeaderText = "Image", DataCell = new ImageCell () }); control.Columns.Add (new GridColumn{ HeaderText = "Text", Editable = true}); control.Columns.Add (new GridColumn{ HeaderText = "Drop Down", DataCell = dropDown, Editable = true }); var image1 = Bitmap.FromResource ("Eto.Test.TestImage.png"); var image2 = Icon.FromResource ("Eto.Test.TestIcon.ico"); var items = new GridItemCollection (); var rand = new Random (); for (int i = 0; i < 10000; i++) { var val = rand.Next (3); var boolVal = val == 0 ? (bool?)false : val == 1 ? (bool?)true : null; val = rand.Next (3); var image = val == 0 ? (Image)image1 : val == 1 ? (Image)image2 : null; var txt = string.Format ("Col 1 Row {0}", i); val = rand.Next (dropDown.DataStore.Count + 1); var combo = val == 0 ? null : dropDown.DataStore [val - 1].Key; items.Add (new LogGridItem (boolVal, image, txt, combo){ Row = i }); } control.DataStore = items; return control; }
void EditProperty(string label) { MainPropertyGrid.Focus(); GridItemCollection gridItems = Helper.GetAllGridEntries(MainPropertyGrid); foreach (GridItem gridItem in gridItems) { if (gridItem.Label.Replace("\t", "") == label) { gridItem.Select(); Application.DoEvents(); break; } } MainPropertyGrid.Focus(); Application.DoEvents(); SendKeys.Send("{F4}"); Application.DoEvents(); }
// Calculates the sum of the heights of all items before the one // private bool CalculateItemY(GridEntry entry, GridItemCollection items, ref int y) { foreach (GridItem item in items) { if (item == entry) { return(true); } y += row_height; if (item.Expandable && item.Expanded) { if (CalculateItemY(entry, item.GridItems, ref y)) { return(true); } } } return(false); }
protected void btnAdd_Click(object sender, EventArgs e) { TrainPlanCourseBLL objBll = new TrainPlanCourseBLL(); ArrayList objList = objBll.GetCourseList(Convert.ToInt32(ViewState["PlanID"].ToString())); GridItemCollection activeItems = Grid1.GetCheckedItems(Grid1.Levels[0].Columns[0]); foreach (GridItem activeItem in activeItems) { if (objList.IndexOf(activeItem[1]) == -1) { RailExam.Model.TrainPlanCourse obj = new RailExam.Model.TrainPlanCourse(); obj.TrainPlanID = Convert.ToInt32(ViewState["PlanID"].ToString()); obj.TrainCourseID = Convert.ToInt32(activeItem[1]); objBll.AddTrainPlanCourse(obj); } } Grid2.DataBind(); }
private GridItem GetSelectedGridItem(GridItemCollection grid_items, int y, ref int current) { foreach (GridItem child_grid_item in grid_items) { if (y > current && y < current + row_height) { return(child_grid_item); } current += row_height; if (child_grid_item.Expanded) { GridItem foundItem = GetSelectedGridItem(child_grid_item.GridItems, y, ref current); if (foundItem != null) { return(foundItem); } } } return(null); }
protected void btnAdd_Click(object sender, EventArgs e) { TrainPlanEmployeeBLL trainPlanEmployeeBLL = new TrainPlanEmployeeBLL(); ArrayList objList = trainPlanEmployeeBLL.GetEmployeeList(Convert.ToInt32(ViewState["PlanID"].ToString())); GridItemCollection activeItems = Grid1.GetCheckedItems(Grid1.Levels[0].Columns[0]); foreach (GridItem activeItem in activeItems) { if (objList.IndexOf(activeItem[1]) == -1) { RailExam.Model.TrainPlanEmployee trainPlanEmployee = new RailExam.Model.TrainPlanEmployee(); trainPlanEmployee.TrainPlanID = Convert.ToInt32(ViewState["PlanID"].ToString()); trainPlanEmployee.TrainPlanEmployeeID = Convert.ToInt32(activeItem[1]); trainPlanEmployeeBLL.AddTrainPlanEmployee(trainPlanEmployee); } } Grid2.DataBind(); }
void propertyGrid1_Paint(object sender, PaintEventArgs e) { PropertyGrid propertyGrid = (PropertyGrid)sender; if (propertyGrid.SelectedObject == null) { return; } if (propertyGrid.SelectedObject.GetType().GetInterface(typeof(IPropertyGridCategoryOrder).FullName) == null) { return; } IPropertyGridCategoryOrder propertyGridCategoryOrder = (IPropertyGridCategoryOrder)propertyGrid.SelectedObject; List <string> propertyGridCategoryNames = propertyGridCategoryOrder.PropertyGridCategoryNames; switch (propertyGridCategoryOrder.OrderType) { case PropertyGridOrderType.Ascending: propertyGridCategoryNames = (from tmpItem in propertyGridCategoryNames orderby tmpItem ascending select tmpItem).ToList(); break; case PropertyGridOrderType.Descending: propertyGridCategoryNames = (from tmpItem in propertyGridCategoryNames orderby tmpItem descending select tmpItem).ToList(); break; case PropertyGridOrderType.Custom: break; } GridItemCollection currentPropEntries = propertyGrid.GetType().GetField("currentPropEntries", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(propertyGrid1) as GridItemCollection; propertyGrid.CollapseAllGridItems(); var newarray = currentPropEntries.Cast <GridItem>().OrderBy((t) => propertyGridCategoryNames.IndexOf(t.Label)).ToArray(); currentPropEntries.GetType().GetField("entries", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(currentPropEntries, newarray); propertyGrid.ExpandAllGridItems(); propertyGrid.PropertySort = (PropertySort)propertyGrid.Tag; propertyGrid.Paint -= new PaintEventHandler(propertyGrid1_Paint); }
private void ToLog() { // Create a new property grid and expand it, to access all items // This beats implementing the property logic to fetch all of item. PropertyGrid grid = new PropertyGrid(); grid.SelectedObject = Properties.SelectedObject; grid.ExpandAllGridItems(); object view = grid.GetType().GetField("gridView", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(grid); // Log each category recursively GridItemCollection items = (GridItemCollection)view.GetType().InvokeMember("GetAllGridEntries", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, view, null); foreach (GridItem item in items) { if (item.GridItemType == GridItemType.Category) { LogItem(item, string.Empty); } } }
protected void btnAdd_Click(object sender, EventArgs e) { TrainTypeExerciseBLL objBll = new TrainTypeExerciseBLL(); ArrayList objList = GetPaperList(); GridItemCollection activeItems = Grid1.GetCheckedItems(Grid1.Levels[0].Columns[0]); foreach (GridItem activeItem in activeItems) { if (objList.IndexOf(activeItem[1]) == -1) { TrainTypeExercise obj = new TrainTypeExercise(); obj.TrainTypeID = Convert.ToInt32(ViewState["TrainTypeID"].ToString()); obj.PaperID = Convert.ToInt32(activeItem[1]); objBll.AddTrainTypeExercise(obj); } } BindGrid(); BindGridSelect(); }
void propertyGrid1_DragDrop(object sender, DragEventArgs e) { ControlDDData data = e.Data.GetData(typeof(ControlDDData)) as ControlDDData; object propertyGridView = GetPropertyGridView(this.propGrid); GridItemCollection allGridEntries = GetAllGridEntries(propertyGridView); int top = GetTop(propertyGridView); int itemHeight = GetCachedRowHeight(propertyGridView); VScrollBar scrollBar = GetVScrollBar(propertyGridView); GridItem item = GetItemAtPoint(allGridEntries, top, itemHeight, scrollBar.Value, this.propGrid.PointToClient(new Point(e.X, e.Y))); if (item != null && item.PropertyDescriptor != null && this.propGrid.SelectedObject is CustomProperty) { Attribute attr = item.PropertyDescriptor.Attributes[typeof(ImageAttribute)]; if (attr != null) { item.PropertyDescriptor.SetValue((this.propGrid.SelectedObject as CustomProperty).GetPropertyOwner(null), UIProject.Instance().GetRelativePath(data.controlData as String)); } } this.propGrid.Refresh(); }
private void VerificarMinimos() { GridItemCollection oListaPuestosNiveles = new GridItemCollection(); oListaPuestosNiveles = grdMercadoSalarial.Items; bool vFgMinCero = false; foreach (GridDataItem item in oListaPuestosNiveles) { var vValorMin = (item.FindControl("txnMinimo") as RadNumericTextBox); string vValor = vValorMin.Value.ToString(); if (vValor == "0") { (item.FindControl("txnMinimo") as RadNumericTextBox).EnabledStyle.BorderColor = System.Drawing.Color.Red; vFgMinCero = true; } } if (vFgMinCero) { UtilMensajes.MensajeResultadoDB(rwmMensaje, "No fue posible generar un mercado mínimo para algunos puestos, favor de ingresar esta información.", E_TIPO_RESPUESTA_DB.WARNING, 400, 200, pCallBackFunction: ""); } }
public void ShowPropertyGridItem(string category, string label) { RefreshPropertyGrid(); GridItem gi = propertyGrid1.SelectedGridItem; while (gi != null && gi.GridItemType != GridItemType.Root) { gi = gi.Parent; } if (gi != null) { // Categories GridItemCollection categories = gi.GridItems; GridItem sliderCategory = categories[category]; if (sliderCategory != null) { GridItemCollection items = sliderCategory.GridItems; GridItem item; if (label == "") { item = items[Math.Min(10, items.Count - 1)]; } else { item = items[label]; } item.Select(); if (item.Expandable) { propertyGrid1.ExpandAllGridItems(); items = item.GridItems; items[Math.Min(10, items.Count - 1)].Select(); } } } RefreshPropertyGrid(); }
private List <String> GetCertificateLinks() { List <String> certificateLinks = new List <String>(); if (RadGridCertificate.SelectedItems.Count == 0) // no check boxes selected { return(certificateLinks); } else { if (radGridCheckBoxSellectAllChecked) // sellect all check box selected { IQueryable <vw_businessPartnerDocument> data = GetData(); certificateLinks = data.Where(c => c.DOPLink != null).Select(c => c.DOPLink).Distinct().ToList(); for (int i = 0; i < certificateLinks.Count; i++) { certificateLinks[i] = HttpContext.Current.Server.MapPath(certificateLinks[i]); } } else // some check boxes selected { GridItemCollection gridItemCollection = RadGridCertificate.SelectedItems; foreach (GridDataItem data in gridItemCollection) { if (data.GetDataKeyValue("DOPLink") != null) { certificateLinks.Add(HttpContext.Current.Server.MapPath(data.GetDataKeyValue("DOPLink").ToString())); } } } // certificateLinks = GetExistingCertificateLinks(certificateLinks); } return(certificateLinks); }
protected void AutoSizeSplitter(int RightMargin = 32) { GridItemCollection gridItemCollection = (GridItemCollection)this.oPropertyGridEntries.GetValue(RuntimeHelpers.GetObjectValue(this.oPropertyGridView)); if (gridItemCollection == null) { return; } Graphics graphics = Graphics.FromHwnd(this.Handle); int num = 0; IEnumerator enumerator = null; try { enumerator = gridItemCollection.GetEnumerator(); while (enumerator.MoveNext()) { GridItem gridItem = (GridItem)enumerator.Current; if (gridItem.GridItemType == GridItemType.Property) { int num2 = checked ((int)Math.Round((double)(unchecked (graphics.MeasureString(gridItem.Label, this.Font).Width + (float)RightMargin)))); if (num2 > num) { num = num2; } } } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } this.MoveSplitterTo(num); }
protected void PopulateChildGridItems() { grid_items = GetChildGridItemsCached(); }
private void EnviarCorreo(bool pFgEnviarTodos) { ProcesoExterno pe = new ProcesoExterno(); bool vEstatusCorreo = false; bool vAlertaBaja = false; int vNoCorreosEnviados = 0; int vNoTotalCorreos = 0; int vIdEvaluador; string vClCorreo; string vNbEvaluador; string myUrl = ResolveUrl("~/Logon.aspx?ClProceso=DESEMPENO"); string vUrl = ContextoUsuario.nbHost + myUrl; GridItemCollection oListaEvaluadores = new GridItemCollection(); XElement vXmlEvaluados = new XElement("EVALUADORES"); List <int> ListaBaja = new List <int>(); if (vFgMasiva) { PeriodoDesempenoNegocio nPeriodo = new PeriodoDesempenoNegocio(); var vPeriododDesempeno = nPeriodo.ObtienePeriodosDesempeno(pIdPeriodo: vIdPeriodo).FirstOrDefault(); var resultado = nPeriodo.InsertaActualiza_PERIODO(vPeriododDesempeno.ID_PERIODO_DESEMPENO, vPeriododDesempeno.CL_PERIODO, vPeriododDesempeno.NB_PERIODO, vPeriododDesempeno.DS_PERIODO, vPeriododDesempeno.CL_ESTADO_PERIODO, vPeriododDesempeno.DS_NOTAS.ToString(), vPeriododDesempeno.FE_INICIO, (DateTime)vPeriododDesempeno.FE_TERMINO, vPeriododDesempeno.CL_TIPO_CAPTURISTA, vPeriododDesempeno.CL_TIPO_METAS, vClUsuario, vNbPrograma, "A", btnCapturaMasivaYes.Checked); } if (string.IsNullOrEmpty(vDsMensaje)) { UtilMensajes.MensajeResultadoDB(rwmMensaje, "El mensaje para el correo electrónico de las solicitudes no está definido. Por favor, configura el mensaje para poder enviar los correos. Los correos no fueron enviados.", E_TIPO_RESPUESTA_DB.WARNING, pAlto: 200); return; } if (pFgEnviarTodos) { oListaEvaluadores = rgCorreos.Items; } else { oListaEvaluadores = rgCorreos.SelectedItems; } vNoTotalCorreos = oListaEvaluadores.Count; foreach (GridDataItem item in oListaEvaluadores) { string vMensaje = vDsMensaje; vClCorreo = (item.FindControl("txtCorreo") as RadTextBox).Text; vNbEvaluador = item["NB_EVALUADOR"].Text; vIdEvaluador = int.Parse(item.GetDataKeyValue("ID_EVALUADOR").ToString()); if (Utileria.ComprobarFormatoEmail(vClCorreo)) { if (item.GetDataKeyValue("FL_EVALUADOR") != null) { if (item.GetDataKeyValue("CL_TOKEN") != null) { vMensaje = vMensaje.Replace("[NB_EVALUADOR]", vNbEvaluador); vMensaje = vMensaje.Replace("[URL]", vUrl + "&FlProceso=" + item.GetDataKeyValue("FL_EVALUADOR").ToString()); vMensaje = vMensaje.Replace("[CONTRASENA]", item.GetDataKeyValue("CL_TOKEN").ToString()); //Envío de correo PeriodoDesempenoNegocio nPeriodoE = new PeriodoDesempenoNegocio(); var Evaluado_baja = nPeriodoE.ObtenerEvaluadoresPeriodo(vIdPeriodo, vIdRol).Where(w => w.ID_EVALUADOR == vIdEvaluador).FirstOrDefault(); if (Evaluado_baja.CL_ESTADO_EMPLEADO == "BAJA") { if (oListaEvaluadores.Count == 1) { vAlertaBaja = true; vEstatusCorreo = false; UtilMensajes.MensajeResultadoDB(rwmMensaje, "El evaluador es un empelado dado de baja, por lo que no podrá recibir el correo.", E_TIPO_RESPUESTA_DB.WARNING, 400, 200, pCallBackFunction: ""); } else { ListaBaja.Add(vIdEvaluador); vAlertaBaja = false; vEstatusCorreo = false; } } else { vAlertaBaja = false; vEstatusCorreo = pe.EnvioCorreo(vClCorreo, vNbEvaluador, "Solicitud para calificar metas", vMensaje); } if (vEstatusCorreo) { vXmlEvaluados.Add(new XElement("EVALUADOR", new XAttribute("ID_EVALUADOR", vIdEvaluador), new XAttribute("CL_CORREO_ELECTRONICO", vClCorreo))); vNoCorreosEnviados++; (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.White; (item.FindControl("txtCorreo") as RadTextBox).HoveredStyle.BackColor = System.Drawing.Color.White; } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; } } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; } } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; UtilMensajes.MensajeResultadoDB(rwmMensaje, "Las contraseña del evaluador no han sido asignada. Por favor, asígnala para poder enviar el correo.", E_TIPO_RESPUESTA_DB.WARNING, pAlto: 200); return; } } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; UtilMensajes.MensajeResultadoDB(rwmMensaje, "El formato del correo es incorrecto. Por favor, corríjalo para poder enviar el correo.", E_TIPO_RESPUESTA_DB.WARNING, pAlto: 200); return; } } if (vNoTotalCorreos == vNoCorreosEnviados && ListaBaja.Count() == 0) { UtilMensajes.MensajeResultadoDB(rwmMensaje, "Proceso exitoso", E_TIPO_RESPUESTA_DB.SUCCESSFUL); } else { if (vAlertaBaja == false && ListaBaja.Count() > 0) { UtilMensajes.MensajeResultadoDB(rwmMensaje, "Se enviaron " + vNoCorreosEnviados.ToString() + " correos de " + vNoTotalCorreos.ToString() + " en total." + " Los correos en amarrillo no serán enviados por que son empleados dados de baja.", E_TIPO_RESPUESTA_DB.SUCCESSFUL, pAlto: 200, pCallBackFunction: ""); } else if (vAlertaBaja == false) { UtilMensajes.MensajeResultadoDB(rwmMensaje, "Se enviaron " + vNoCorreosEnviados.ToString() + " correos de " + vNoTotalCorreos.ToString() + " en total.", E_TIPO_RESPUESTA_DB.SUCCESSFUL, pCallBackFunction: ""); } } }
private void AddChildProducts() { GridItemCollection collection = grdProducts.Items; int MainProductID = 0; bool validate = true; if (!string.IsNullOrEmpty(QueryStringParamID)) { MainProductID = int.Parse(QueryStringParamID); } else if (ViewStateID != null) { MainProductID = (int)ViewStateID; } ICollection <ProductsChildRelationship> comboItems = new List <ProductsChildRelationship>(); foreach (GridItem item in collection) { GridEditableItem editableItem = item as GridEditableItem; int id = (int)editableItem.GetDataKeyValue("ProductID"); CheckBox chk = item.FindControl("OptionCheckBox") as CheckBox; RadNumericTextBox quantity = item.FindControl("Quantity") as RadNumericTextBox; RadNumericTextBox unitPrice = item.FindControl("UnitPrice") as RadNumericTextBox; RadNumericTextBox FreeTopping = item.FindControl("FreeTopping") as RadNumericTextBox; CheckBox isCustomizable = item.FindControl("AllowCustomization") as CheckBox; if (chk.Checked) { if (!String.IsNullOrEmpty(quantity.Text) && !String.IsNullOrEmpty(unitPrice.Text)) { ProductsChildRelationship childProduct = new ProductsChildRelationship(); childProduct.ParentProductsId = MainProductID; childProduct.ChildProductId = id; childProduct.Quantity = Convert.ToInt16(quantity.Text); childProduct.UnitPrice = Convert.ToDouble(unitPrice.Text); childProduct.IsCustomizable = isCustomizable.Checked; if (!String.IsNullOrEmpty(FreeTopping.Text)) { childProduct.NumberOfFreeTopping = Convert.ToInt16(FreeTopping.Text); } comboItems.Add(childProduct); } else { validate = false; break; } } } if (validate) { if (comboItems.Count > 0) { int result = productManager.AddComboDealProducts(comboItems); ShowMessage("Combo items are saved successfully.", MessageType.Success); GetDealOptionsByProductId(MainProductID); GetOptionsForDeal(); ComboOptions.DataBind(); //GetAdonsForDeal(); //ComboAdons.DataBind(); RadTabStrip1.Tabs[2].Visible = true; RadTabStrip1.Tabs[2].Selected = true; RadMultiPage1.PageViews[2].Selected = true; } else { ShowMessage("You have selected no option for combo deal.", MessageType.Error); } } else { ShowMessage("Error! Missing values. Please fill out Quantity and Unit price when adding as combo deal.", MessageType.Error); } }
public void GridItemCollection_Item_GetEmpty_ReturnsNull(string label) { GridItemCollection collection = GridItemCollection.Empty; Assert.Null(collection[label]); }
protected void SaveBtn_Click(object sender, EventArgs e) { if (checkValues()) { int branchid = int.Parse(txtCbBranch.SelectedValue); int productid = int.Parse(txtCbProduct.SelectedValue); short optiontypeid = short.Parse(txtCbOptionType.SelectedValue); ProductsInBranch productbranch = (from pb in entities.ProductsInBranches where pb.BranchID == branchid && pb.ProductID == productid select pb).FirstOrDefault(); if (productbranch != null) { BusinessEntities.OptionTypesInProduct optiontypeproduct = new BusinessEntities.OptionTypesInProduct(); ICollection <BusinessEntities.ProductOptionsInProducts> ProductOptionList = new List <BusinessEntities.ProductOptionsInProducts>(); optiontypeproduct.BranchID = branchid; optiontypeproduct.ProductID = productid; optiontypeproduct.OptionTypeID = Convert.ToInt16(txtCbOptionType.SelectedValue); GridItemCollection collection = grdOptions.Items; bool flag = true; foreach (GridItem item in collection) { CheckBox chk = item.FindControl("txtSelected") as CheckBox; GridEditableItem editableItem = item as GridEditableItem; int productoptionid = (int)editableItem.GetDataKeyValue("OptionID"); if (chk.Checked) { BusinessEntities.ProductOptionsInProducts productoption = new BusinessEntities.ProductOptionsInProducts(); productoption.ProductOptionID = productoptionid; CheckBox enable = item.FindControl("txtEnabled") as CheckBox; productoption.Enabled = enable.Checked; RadNumericTextBox txtDisplayOrder = item.FindControl("txtDisplayOrder") as RadNumericTextBox; productoption.DisplayOrder = Convert.ToInt16(txtDisplayOrder.Value.ToString()); if (txtNo.Checked) { RadNumericTextBox price = item.FindControl("txtOptionPrice") as RadNumericTextBox; if (price.Value != null) { productoption.Price = Convert.ToDecimal(price.Value); } else { ShowMessage("You have not entered option price in selected row of Available Options Table.", MessageType.Error); item.Selected = true; flag = false; break; } } else if (txtYes.Checked) { productoption.Price = Convert.ToDecimal(txtPrice.Value); } if (txtAdonYes.Checked) { RadNumericTextBox price1 = item.FindControl("txtAdonPrice") as RadNumericTextBox; if (price1.Value != null) { productoption.ToppingPrice = Convert.ToDecimal(price1.Value); } else { ShowMessage("You have not entered Adon price in selected row of Available Options Table.", MessageType.Error); item.Selected = true; flag = false; break; } } else { productoption.ToppingPrice = new Nullable <decimal>(); } ProductOptionList.Add(productoption); } } if (flag && ProductOptionList.Count > 0) { try { if (txtYes.Checked) { optiontypeproduct.IsSamePrice = true; } else { optiontypeproduct.IsSamePrice = false; } if (txtMultiYes.Checked) { optiontypeproduct.IsMultiSelect = true; } else { optiontypeproduct.IsMultiSelect = false; } if (txtAdonYes.Checked) { optiontypeproduct.IsAdonPriceVary = true; } else { optiontypeproduct.IsAdonPriceVary = false; } if (txtPriceChangeYes.Checked) { optiontypeproduct.IsProductPriceChangeType = true; } else { optiontypeproduct.IsProductPriceChangeType = false; } optiontypeproduct.ProductOptionsXml = Utility.CollectionXml <BusinessEntities.ProductOptionsInProducts>(ProductOptionList, "ProductOptionsInProductsDataSet", "ProductOptionsInProductsDataTable"); int result = productOptionManager.AddProductOption(optiontypeproduct); if (result > 0) { ShowMessage("Options have been saved successfully.", MessageType.Success); } } catch (Exception ex) { txtError.Text = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message; } } else if (flag) { ShowMessage("You have selected no option. You must select option to proceed.", MessageType.Error); } } } }
// private bool GetScrollBarVisible () // { // if (this.RootGridItem == null) // return false; // // int visibleRows = GetVisibleRowsCount (); // int openedItems = GetVisibleItemsCount (this.RootGridItem); // if (openedItems > visibleRows) // return true; // return false; // } #region Drawing Code private void DrawGridItems (GridItemCollection grid_items, PaintEventArgs pevent, int depth, ref int yLoc) { foreach (GridItem grid_item in grid_items) { DrawGridItem ((GridEntry)grid_item, pevent, depth, ref yLoc); if (grid_item.Expanded) DrawGridItems (grid_item.GridItems, pevent, (grid_item.GridItemType == GridItemType.Category) ? depth : depth+1, ref yLoc); } }
GridView Default(bool addItems = true) { var control = new GridView { Size = new Size(300, 100) }; LogEvents(control); var dropDown = MyDropDown("DropDownKey"); control.Columns.Add(new GridColumn { DataCell = new CheckBoxCell("Check"), Editable = true, AutoSize = true, Resizable = false }); control.Columns.Add(new GridColumn { HeaderText = "Image", DataCell = new ImageViewCell("Image") }); control.Columns.Add(new GridColumn { HeaderText = "Text", DataCell = new TextBoxCell("Text"), Editable = true, Sortable = true }); control.Columns.Add(new GridColumn { HeaderText = "Drop Down", DataCell = dropDown, Editable = true, Sortable = true }); #if Windows // Drawable cells - need to implement on other platforms. var drawableCell = new DrawableCell { PaintHandler = args => { var m = args.Item as MyGridItem; if (m != null) args.Graphics.FillRectangle(Brushes.Cached(m.Color) as SolidBrush, args.CellBounds); } }; control.Columns.Add(new GridColumn { HeaderText = "Owner drawn", DataCell = drawableCell }); #endif if (addItems) { var items = new GridItemCollection(); var rand = new Random(); for (int i = 0; i < 10000; i++) { items.Add(new MyGridItem(rand, i, dropDown)); } control.DataStore = items; } return control; }
GridView Default () { var control = new GridView { Size = new Size (300, 100) }; LogEvents (control); var dropDown = MyDropDown ("DropDownKey"); control.Columns.Add (new GridColumn{ DataCell = new CheckBoxCell ("Check"), Editable = true, AutoSize = true, Resizable = false}); control.Columns.Add (new GridColumn{ HeaderText = "Image", DataCell = new ImageViewCell ("Image") }); control.Columns.Add (new GridColumn{ HeaderText = "Text", DataCell = new TextBoxCell ("Text"), Editable = true, Sortable = true }); control.Columns.Add (new GridColumn{ HeaderText = "Drop Down", DataCell = dropDown, Editable = true, Sortable = true }); var items = new GridItemCollection (); var rand = new Random (); for (int i = 0; i < 10000; i++) { items.Add (new MyGridItem (rand, i, dropDown)); } control.DataStore = items; return control; }
protected void SaveBtn_Click(object sender, EventArgs e) { if (checkValues()) { int branchid = int.Parse(txtCbBranch.SelectedValue); int productid = int.Parse(txtCbProduct.SelectedValue); short optiontypeid = short.Parse(txtCbAdonType.SelectedValue); short displayFormat = Convert.ToInt16(txtCbDisplayFormat.SelectedValue); ProductsInBranch productbranch = (from pb in entities.ProductsInBranches where pb.BranchID == branchid && pb.ProductID == productid select pb).FirstOrDefault(); if (productbranch != null) { AdOnTypeInProduct adontypeproduct = null; if (atPObj != null) { adontypeproduct = atPObj; } else { adontypeproduct = new AdOnTypeInProduct(); } GridItemCollection collection = grdAdons.Items; bool flag = true; if (atPObj == null) { foreach (GridItem item in collection) { CheckBox chk = item.FindControl("txtSelected") as CheckBox; GridEditableItem editableItem = item as GridEditableItem; short adonid = (short)editableItem.GetDataKeyValue("AdOnID"); if (chk.Checked) { ProductAdon productadon = new ProductAdon(); productadon.AdonID = adonid; CheckBox enable = item.FindControl("txtEnabled") as CheckBox; productadon.Enable = enable.Checked; RadComboBox defaultSeleted = item.FindControl("txtCbDefault") as RadComboBox; productadon.DefaultSelected = short.Parse(defaultSeleted.SelectedValue); adontypeproduct.ProductAdons.Add(productadon); } } } else { foreach (GridItem item in collection) { CheckBox chk = item.FindControl("txtSelected") as CheckBox; GridEditableItem editableItem = item as GridEditableItem; short adonid = (short)editableItem.GetDataKeyValue("AdOnID"); if (chk.Checked) { ProductAdon productadon = null; bool isNew = false; productadon = atPObj.ProductAdons.Where(pa => pa.AdonID == adonid).FirstOrDefault(); if (productadon == null) { productadon = new ProductAdon(); productadon.AdonID = adonid; isNew = true; } CheckBox enable = item.FindControl("txtEnabled") as CheckBox; productadon.Enable = enable.Checked; RadComboBox defaultSeleted = item.FindControl("txtCbDefault") as RadComboBox; productadon.DefaultSelected = short.Parse(defaultSeleted.SelectedValue); if (isNew) { adontypeproduct.ProductAdons.Add(productadon); } else { adontypeproduct.ProductAdons.Remove(productadon); adontypeproduct.ProductAdons.Add(productadon); } } else { ProductAdon padon = atPObj.ProductAdons.Where(pa => pa.AdonID == adonid).FirstOrDefault(); if (padon != null) { atPObj.ProductAdons.Remove(padon); entities.ProductAdons.Remove(padon); } } } } if (adontypeproduct.ProductAdons.Count > 0) { using (TransactionScope transaction = new TransactionScope()) { try { if (txtPrice.Value != null) { adontypeproduct.Price = Convert.ToDecimal(txtPrice.Value); } else { adontypeproduct.Price = new Nullable <decimal>(); } adontypeproduct.DisplayFormat = displayFormat; if (atPObj == null) { adontypeproduct.AdonTypeID = optiontypeid; adontypeproduct.BrachProductID = productbranch.BranchProductID; entities.AdOnTypeInProducts.Add(adontypeproduct); } entities.SaveChanges(); transaction.Complete(); ShowMessage("Product adons have been saved successfully. ", MessageType.Error); } catch (Exception ex) { txtError.Text = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message; } } } else if (flag) { ShowMessage("You have selected no Adon. You must select Adon to proceed.", MessageType.Error); } } } }
protected void btnAnular_Click(object sender, EventArgs e) { if (Session["Usuario"] == null) { Response.Redirect("~/Security/frmCerrar.aspx"); } GridItemCollection itemSel = grdDocumentos.SelectedItems; List <string> listaErrores = new List <string>(); try { //if (itemSel.Count > 0) //{ OrdenCompraWCFClient objWCF = new OrdenCompraWCFClient(); int IdEmpresa = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa; int CodigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario; //foreach (GridItem item in itemSel) //{ // try // { // objWCF.Anular_OC(IdEmpresa, CodigoUsuario, Convert.ToInt32(item.Cells[3].Text)); // } // catch /*(Exception ex)*/ // { // this.lblRegistros.Text = " Anular_OC "; // lblRegistros.CssClass = "mensajeError"; // listaErrores.Add(item.Cells[3].Text); // } //} foreach (GridItem rowitem in grdDocumentos.MasterTableView.Items) { GridDataItem dataitem = (GridDataItem)rowitem; TableCell cell = dataitem["CheckColumn"]; CheckBox checkBox = (CheckBox)cell.Controls[0].FindControl("Check"); if (checkBox.Checked == true && checkBox.Enabled == true) { try { objWCF.Anular_OC(IdEmpresa, CodigoUsuario, Convert.ToInt32(rowitem.Cells[4].Text)); } catch /*(Exception ex)*/ { this.lblRegistros.Text = " Anular_OC "; lblRegistros.CssClass = "mensajeError"; listaErrores.Add(rowitem.Cells[4].Text); } } } //} } catch (Exception ex) { this.lblRegistros.Text = ex.Message + "- btnAnular_Click "; lblRegistros.CssClass = "mensajeError"; if (listaErrores.Count > 0) { string cadenaErrores = string.Join(",", listaErrores); rwmReporte.RadAlert("Las Ops " + cadenaErrores + " presentaron errores, no se efectuaron cambios sobre estas OPs", 500, 100, "Error", ""); } else { rwmReporte.RadAlert(ex.Message, 500, 100, "Error", ""); } } finally { Reporte_Cargar(); } }
private void EnviarCorreo(bool pFgEnviarTodos) { ProcesoExterno pe = new ProcesoExterno(); int vNoCorreosEnviados = 0; int vNoTotalCorreos = 0; int vIdEvaluador; string vClCorreo; string vNbEvaluador; string myUrl = ResolveUrl("~/Logon.aspx?ClProceso=DESEMPENO"); string vUrl = ContextoUsuario.nbHost + myUrl; GridItemCollection oListaEvaluadores = new GridItemCollection(); XElement vXmlEvaluados = new XElement("EVALUADORES"); vIdPeriodoNoEnviado = null; if (pFgEnviarTodos) { oListaEvaluadores = rgCorreos.Items; } else { oListaEvaluadores = rgCorreos.SelectedItems; } //vNoTotalCorreos = oListaEvaluadores.Count; foreach (GridDataItem item in oListaEvaluadores) { int vIdPeriodoMasteTable; // bool vFgNoenviado; string vMensaje = vDsMensaje; vClCorreo = (item.FindControl("txtCorreo") as RadTextBox).Text; vNbEvaluador = item["NB_EVALUADOR"].Text; vIdEvaluador = int.Parse(item.GetDataKeyValue("ID_EVALUADOR").ToString()); vIdPeriodoMasteTable = int.Parse(item.GetDataKeyValue("ID_PERIODO").ToString()); if (vFgMasiva) { PeriodoDesempenoNegocio nPeriodo = new PeriodoDesempenoNegocio(); var vPeriododDesempeno = nPeriodo.ObtienePeriodosDesempeno(pIdPeriodo: int.Parse(item.GetDataKeyValue("ID_PERIODO").ToString())).FirstOrDefault(); var resultado = nPeriodo.InsertaActualiza_PERIODO(vPeriododDesempeno.ID_PERIODO_DESEMPENO, vPeriododDesempeno.CL_PERIODO, vPeriododDesempeno.NB_PERIODO, vPeriododDesempeno.DS_PERIODO, vPeriododDesempeno.CL_ESTADO_PERIODO, vPeriododDesempeno.DS_NOTAS.ToString(), vPeriododDesempeno.FE_INICIO, (DateTime)vPeriododDesempeno.FE_TERMINO, vPeriododDesempeno.CL_TIPO_CAPTURISTA, vPeriododDesempeno.CL_TIPO_METAS, vClUsuario, vNbPrograma, "A", btnCapturaMasivaYes.Checked); } DateTime vFechaEnvio = Convert.ToDateTime(item.GetDataKeyValue("FE_ENVIO_SOLICITUD").ToString()); if (vFechaEnvio.Date == DateTime.Now.Date) { vNoTotalCorreos = vNoTotalCorreos + 1; if (Utileria.ComprobarFormatoEmail(vClCorreo)) { if (item.GetDataKeyValue("FL_EVALUADOR") != null) { if (item.GetDataKeyValue("CL_TOKEN") != null) { vMensaje = vMensaje.Replace("[NB_EVALUADOR]", vNbEvaluador); vMensaje = vMensaje.Replace("[URL]", vUrl + "&FlProceso=" + item.GetDataKeyValue("FL_EVALUADOR").ToString()); vMensaje = vMensaje.Replace("[CONTRASENA]", item.GetDataKeyValue("CL_TOKEN").ToString()); //Envío de correo bool vEstatusCorreo = pe.EnvioCorreo(vClCorreo, vNbEvaluador, "Solicitud para calificar metas", vMensaje); if (vEstatusCorreo) { vXmlEvaluados.Add(new XElement("EVALUADOR", new XAttribute("ID_EVALUADOR", vIdEvaluador), new XAttribute("CL_CORREO_ELECTRONICO", vClCorreo))); vNoCorreosEnviados++; (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.White; (item.FindControl("txtCorreo") as RadTextBox).HoveredStyle.BackColor = System.Drawing.Color.White; if (vIdPeriodoNoEnviado != vIdPeriodoMasteTable) { InsertaEstatusEnvio(true, vIdPeriodoMasteTable); } } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; vIdPeriodoNoEnviado = vIdPeriodoMasteTable; InsertaEstatusEnvio(false, vIdPeriodoMasteTable); } } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; vIdPeriodoNoEnviado = vIdPeriodoMasteTable; InsertaEstatusEnvio(false, vIdPeriodoMasteTable); } } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; vIdPeriodoNoEnviado = vIdPeriodoMasteTable; InsertaEstatusEnvio(false, vIdPeriodoMasteTable); } } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; vIdPeriodoNoEnviado = vIdPeriodoMasteTable; InsertaEstatusEnvio(false, vIdPeriodoMasteTable); } } } if (vNoTotalCorreos == vNoCorreosEnviados) { UtilMensajes.MensajeResultadoDB(rwmMensaje, "Los correos han sido enviados con éxito.", E_TIPO_RESPUESTA_DB.SUCCESSFUL); } else { UtilMensajes.MensajeResultadoDB(rwmMensaje, "Se enviaron " + vNoCorreosEnviados.ToString() + " correos de " + vNoTotalCorreos.ToString() + " en total.", E_TIPO_RESPUESTA_DB.SUCCESSFUL, pCallBackFunction: ""); } }
// Calculates the sum of the heights of all items before the one // private bool CalculateItemY (GridEntry entry, GridItemCollection items, ref int y) { foreach (GridItem item in items) { if (item == entry) return true; y += row_height; if (item.Expandable && item.Expanded) if (CalculateItemY (entry, item.GridItems, ref y)) return true; } return false; }
private void btnAdd_Click(object sender, EventArgs e) { int inventoryID = 0; string newUsed = ""; string jobNumber = ""; BPOrderDetails bpOrderDetails = new BPOrderDetails(); BPOrders bpOrders = new BPOrders(); BPInventory bpInventory = new BPInventory(); DSInventory = new BEInventory(); GridItemCollection CheckedCollection = new GridItemCollection(); CheckedCollection = dgInventory.GetCheckedItems(dgInventory.Levels[0].Columns[1]); if (OrderID > 0 && OrderCompleted == false) { DSOrders = bpOrderDetails.SelectByOrderID(OrderID); DSOrders.Merge(bpOrders.SelectOrdersByID(OrderID)); //for tracking JobNumber with inventory item if(DSOrders.tbl_Orders.Count > 0) { BEOrders.tbl_OrdersRow order = DSOrders.tbl_Orders[0]; jobNumber = order.IsOrderJobNumberNull() ? "" : order.OrderJobNumber; } foreach (GridItem item in CheckedCollection) { inventoryID = Convert.ToInt32(item[0]); newUsed = item[3].ToString(); DSOrders.tbl_OrderDetails.DefaultView.RowFilter = "InventoryID=" + inventoryID; if (DSOrders.tbl_OrderDetails.DefaultView.Count == 0) { BEOrders.tbl_OrderDetailsRow OrderDetails; OrderDetails = DSOrders.tbl_OrderDetails.Newtbl_OrderDetailsRow(); OrderDetails.OrderID = OrderID; OrderDetails.InventoryID = inventoryID; OrderDetails.InventoryItemReturned = false; switch ((InventoryTypes)InventoryType) { case InventoryTypes.Buy: if(newUsed.ToLower() == "new") OrderDetails.BuyRentStatus = "Buy-N"; else OrderDetails.BuyRentStatus = "Buy-U"; break; case InventoryTypes.Rental: OrderDetails.BuyRentStatus = "Rent"; break; default: OrderDetails.SetBuyRentStatusNull(); break; } DSOrders.tbl_OrderDetails.Addtbl_OrderDetailsRow(OrderDetails); BEInventory.tbl_InventoryRow Inventory; DSInventory.Merge(bpInventory.SelectInventoryByID(inventoryID)); Inventory = DSInventory.tbl_Inventory.FindByInventoryID(inventoryID); Inventory.InventoryInStock = 2; //track order's JobNumber with inventory item if(jobNumber != "") Inventory.JobNumber = jobNumber; else Inventory.SetJobNumberNull(); } } bpOrderDetails.Update(DSOrders); bpInventory.Update(DSInventory); } // reset or turn off warning message on submit button // if (CheckedCollection.Count > 0) // { // SetSubmitButtonWarningMessage(OrderID); // } dgInventory.UnCheckAll(); BindDSInventory(); BindDSOrders(); }
private GridItem GetSelectedGridItem (GridItemCollection grid_items, int y, ref int current) { foreach (GridItem child_grid_item in grid_items) { if (y > current && y < current + row_height) { return child_grid_item; } current += row_height; if (child_grid_item.Expanded) { GridItem foundItem = GetSelectedGridItem (child_grid_item.GridItems, y, ref current); if (foundItem != null) return foundItem; } } return null; }
public DnnGridItemSelectedEventArgs(GridItemCollection selectedItems) { _SelectedItems = selectedItems; }
private void btnAdd_Click(object sender, EventArgs e) { int InventoryID = 0; BPOrderDetails bp = new BPOrderDetails(); BPInventory bpInventory = new BPInventory(); DSInventory = new BEInventory(); GridItemCollection CheckedCollection = new GridItemCollection(); CheckedCollection = dgInventory.GetCheckedItems(dgInventory.Levels[0].Columns[1]); // if adding an item turn off '0 item' message from submit button if (CheckedCollection.Count > 0) { btnSubmit.MessageEnabled = false; } if (OrderID > 0 && OrderCompleted == false) { DSOrders = bp.SelectByOrderID(OrderID); foreach (GridItem item in CheckedCollection) { InventoryID = Convert.ToInt32(item[0]); DSOrders.tbl_OrderDetails.DefaultView.RowFilter = "InventoryID=" + InventoryID; if (DSOrders.tbl_OrderDetails.DefaultView.Count == 0) { BEOrders.tbl_OrderDetailsRow OrderDetails; OrderDetails = DSOrders.tbl_OrderDetails.Newtbl_OrderDetailsRow(); OrderDetails.OrderID = OrderID; OrderDetails.InventoryID = InventoryID; OrderDetails.InventoryItemReturned = false; DSOrders.tbl_OrderDetails.Addtbl_OrderDetailsRow(OrderDetails); BEInventory.tbl_InventoryRow Inventory; DSInventory.Merge(bpInventory.SelectInventoryByID(InventoryID)); Inventory = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID); Inventory.InventoryInStock = 2; } } bp.Update(DSOrders); bpInventory.Update(DSInventory); } dgInventory.UnCheckAll(); BindDSInventory(); BindDSOrders(); }
private void EnviarCorreo(bool pFgEnviarTodos) { ProcesoExterno pe = new ProcesoExterno(); int vNoCorreosEnviados = 0; int vNoTotalCorreos = 0; int vIdEvaluador; string vClCorreo; string vNbEvaluador; string myUrl = ResolveUrl("~/Logon.aspx?ClProceso=CUESTIONARIOS"); string vUrl = ContextoUsuario.nbHost + myUrl; GridItemCollection oListaEvaluadores = new GridItemCollection(); XElement vXmlEvaluados = new XElement("EVALUADORES"); if (pFgEnviarTodos) { oListaEvaluadores = rgEvaluadores.Items; } else { oListaEvaluadores = rgEvaluadores.SelectedItems; } vNoTotalCorreos = oListaEvaluadores.Count; foreach (GridDataItem item in oListaEvaluadores) { string vMensaje = vDsMensaje; vClCorreo = (item.FindControl("txtCorreo") as RadTextBox).Text; vNbEvaluador = item["NB_EVALUADOR"].Text; vIdEvaluador = int.Parse(item.GetDataKeyValue("ID_EVALUADOR").ToString()); if (Utileria.ComprobarFormatoEmail(vClCorreo)) { if (item.GetDataKeyValue("FL_EVALUADOR") != null) { vMensaje = vMensaje.Replace("[nombre]", vNbEvaluador); vMensaje = vMensaje.Replace("[URL]", vUrl + "&FlProceso=" + item.GetDataKeyValue("FL_EVALUADOR").ToString()); vMensaje = vMensaje.Replace("[contraseña]", item.GetDataKeyValue("CL_TOKEN").ToString()); //bool vEstatusCorreo = pe.EnvioCorreo("*****@*****.**", item.NB_EVALUADOR, "Cuestionarios para evaluación", vMensaje); bool vEstatusCorreo = pe.EnvioCorreo(vClCorreo, vNbEvaluador, "Cuestionarios para evaluación", vMensaje); if (vEstatusCorreo) { vXmlEvaluados.Add(new XElement("EVALUADOR", new XAttribute("ID_EVALUADOR", vIdEvaluador), new XAttribute("CL_CORREO_ELECTRONICO", vClCorreo))); vNoCorreosEnviados++; (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.White; (item.FindControl("txtCorreo") as RadTextBox).HoveredStyle.BackColor = System.Drawing.Color.White; } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; } } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; } } else { (item.FindControl("txtCorreo") as RadTextBox).EnabledStyle.BackColor = System.Drawing.Color.Gold; } } if (vXmlEvaluados.Elements("EVALUADOR").Count() > 0) { ActualizaCorreoEvaluador(vXmlEvaluados.ToString()); } if (vNoTotalCorreos == vNoCorreosEnviados) { UtilMensajes.MensajeResultadoDB(rwmMensaje, "Los correos han sido enviados con éxito.", E_TIPO_RESPUESTA_DB.SUCCESSFUL); } else { UtilMensajes.MensajeResultadoDB(rwmMensaje, "Se enviaron " + vNoCorreosEnviados.ToString() + " correos de " + vNoTotalCorreos.ToString() + " en total.", E_TIPO_RESPUESTA_DB.SUCCESSFUL, pCallBackFunction: ""); } }
private void btnAdd_Click(object sender, EventArgs e) { int InventoryID = 0; BPOrderDetails bp = new BPOrderDetails(); BPInventory bpInventory = new BPInventory(); DSInventory = new BEInventory(); GridItemCollection CheckedCollection = new GridItemCollection(); CheckedCollection = dgInventory.GetCheckedItems(dgInventory.Levels[0].Columns[1]); if (OrderID > 0 && OrderCompleted == false) { DSOrders = bp.SelectByOrderID(OrderID); foreach (GridItem item in CheckedCollection) { InventoryID = Convert.ToInt32(item[0]); DSOrders.tbl_OrderDetails.DefaultView.RowFilter = "InventoryID=" + InventoryID; if (DSOrders.tbl_OrderDetails.DefaultView.Count == 0) { BEOrders.tbl_OrderDetailsRow OrderDetails; OrderDetails = DSOrders.tbl_OrderDetails.Newtbl_OrderDetailsRow(); OrderDetails.OrderID = OrderID; OrderDetails.InventoryID = InventoryID; OrderDetails.InventoryItemReturned = false; switch ((InventoryTypes)InventoryType) { case InventoryTypes.Buy: OrderDetails.BuyRentStatus = "Buy"; break; case InventoryTypes.Rental: OrderDetails.BuyRentStatus = "Rent"; break; default: OrderDetails.SetBuyRentStatusNull(); break; } DSOrders.tbl_OrderDetails.Addtbl_OrderDetailsRow(OrderDetails); BEInventory.tbl_InventoryRow Inventory; DSInventory.Merge(bpInventory.SelectInventoryByID(InventoryID)); Inventory = DSInventory.tbl_Inventory.FindByInventoryID(InventoryID); Inventory.InventoryInStock = 2; Inventory.SetJobNumberNull(); } } bp.Update(DSOrders); bpInventory.Update(DSInventory); } // reset or turn off warning message on submit button if (CheckedCollection.Count > 0) { if(bp.HasBuyRentItemsByOrderID(OrderID)) { btnSubmit.Message = "ATTENTION: This order includes items for Purchase and/or Rental. Click OK to continue or CANCEL to edit the order."; btnSubmit.MessageEnabled = true; } else btnSubmit.MessageEnabled = false; } dgInventory.UnCheckAll(); BindDSInventory(); BindDSOrders(); }