private void ItemsGrid_Delete(object sender, DataGridCommandEventArgs e) { if (_ShippingMethodDto != null) { int id = Int32.Parse(((DataGrid)sender).DataKeys[e.Item.ItemIndex].ToString()); ShippingMethodDto.ShippingMethodCaseRow row = _ShippingMethodDto.ShippingMethodCase.FindByShippingMethodCaseId(id); if (row != null) { row.Delete(); } } BindItemsGrid(); }
private void ItemsGrid_Update(object sender, DataGridCommandEventArgs e) { string selectedJGroup = String.Empty; if (_ShippingMethodDto != null) { int id = Int32.Parse(((DataGrid)sender).DataKeys[e.Item.ItemIndex].ToString()); ShippingMethodDto.ShippingMethodCaseRow row = _ShippingMethodDto.ShippingMethodCase.FindByShippingMethodCaseId(id); if (row != null) { row.Total = Double.Parse(((TextBox)e.Item.Cells[0].FindControl("RowTotal")).Text, _NumberFormat); row.Charge = Double.Parse(((TextBox)e.Item.Cells[1].FindControl("RowPrice")).Text, _NumberFormat); row.StartDate = ((CalendarDatePicker)e.Item.Cells[2].FindControl("StartDate")).Value; row.EndDate = ((CalendarDatePicker)e.Item.Cells[3].FindControl("EndDate")).Value; } } ItemsGrid.EditItemIndex = -1; BindItemsGrid(); }
protected void AddWeightButton_Click(object sender, System.EventArgs e) { if (WeightRange.IsValid && WeightRequired.IsValid && PriceRange.IsValid && PriceRequired.IsValid) { if (_ShippingMethodDto != null && _ShippingMethodDto.ShippingMethod.Count > 0) { ShippingMethodDto.ShippingMethodCaseRow row = _ShippingMethodDto.ShippingMethodCase.NewShippingMethodCaseRow(); row.Total = Double.Parse(Weight.Text, _NumberFormat); row.Charge = Double.Parse(Price.Text, _NumberFormat); row.StartDate = StartDate.Value; row.EndDate = EndDate.Value; row.ShippingMethodId = _ShippingMethodDto.ShippingMethod[0].ShippingMethodId; row.JurisdictionGroupId = Int32.Parse(JurisdictionGroupList.SelectedValue); // add the row to the dto if (row.RowState == DataRowState.Detached) { _ShippingMethodDto.ShippingMethodCase.Rows.Add(row); } } } BindItemsGrid(); }