void grdExtraTypes_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { DropDownList cboNominalCodes = (DropDownList)e.Item.FindControl("cboNominalCodes"); HtmlInputControl txtDescription = (HtmlInputControl)e.Item.FindControl("txtDescription"); HtmlInputControl txtShortDescription = (HtmlInputControl)e.Item.FindControl("txtShortDescription"); CheckBox chkFuelSurchargeApplies = (CheckBox)e.Item.FindControl("chkFuelSurchargeApplies"); CheckBox chkIsEnabled = (CheckBox)e.Item.FindControl("chkIsEnabled"); CheckBox chkIsAcceptanceRequired = (CheckBox)e.Item.FindControl("chkIsAcceptanceRequired"); CheckBox chkIsDisplayedOnAddUpdateOrder = (CheckBox)e.Item.FindControl("chkIsDisplayedOnAddUpdateOrder"); CheckBox chkIsTimeBased = (CheckBox)e.Item.FindControl("chkIsTimeBased"); RadTimePicker rdiStartTime = (RadTimePicker)e.Item.FindControl("rdiStartTime"); RadTimePicker rdiEndTime = (RadTimePicker)e.Item.FindControl("rdiEndTime"); CheckBox chkIsDayBased = (CheckBox)e.Item.FindControl("chkIsDayBased"); CheckBox chkMonday = (CheckBox)e.Item.FindControl("chkMonday"); CheckBox chkTuesday = (CheckBox)e.Item.FindControl("chkTuesday"); CheckBox chkWednesday = (CheckBox)e.Item.FindControl("chkWednesday"); CheckBox chkThursday = (CheckBox)e.Item.FindControl("chkThursday"); CheckBox chkFriday = (CheckBox)e.Item.FindControl("chkFriday"); CheckBox chkSaturday = (CheckBox)e.Item.FindControl("chkSaturday"); CheckBox chkSunday = (CheckBox)e.Item.FindControl("chkSunday"); Facade.ExtraType facExtraType = new Facade.ExtraType(); Entities.ExtraType extraType = new Entities.ExtraType(); int?startTime = null; int?endTime = null; if (chkIsTimeBased.Checked) { startTime = (int?)rdiStartTime.SelectedTime.Value.TotalMinutes; endTime = (int?)rdiEndTime.SelectedTime.Value.TotalMinutes; } if (!string.IsNullOrEmpty(cboNominalCodes.SelectedValue) && Convert.ToInt32(cboNominalCodes.SelectedValue) > 0) { Facade.INominalCode facNominal = new Facade.NominalCode(); Entities.NominalCode nominalCode = facNominal.GetForNominalCodeID(Convert.ToInt32(cboNominalCodes.SelectedValue)); extraType.NominalCode = nominalCode; } extraType.Description = txtDescription.Value; extraType.FuelSurchargeApplies = chkFuelSurchargeApplies.Checked; extraType.IsEnabled = chkIsEnabled.Checked; extraType.IsDisplayedOnAddUpdateOrder = chkIsDisplayedOnAddUpdateOrder.Checked; extraType.IsAcceptanceRequired = chkIsAcceptanceRequired.Checked; extraType.IsTimeBased = chkIsTimeBased.Checked; extraType.ExtraTypeStartTime = startTime; extraType.ExtraTypeEndTime = endTime; extraType.IsDayBased = chkIsDayBased.Checked; extraType.Monday = chkMonday.Checked; extraType.Tuesday = chkTuesday.Checked; extraType.Wednesday = chkWednesday.Checked; extraType.Thursday = chkThursday.Checked; extraType.Friday = chkFriday.Checked; extraType.Saturday = chkSaturday.Checked; extraType.Sunday = chkSunday.Checked; extraType.ShortDescription = txtShortDescription.Value; facExtraType.Create(extraType, ((Orchestrator.Entities.CustomPrincipal)Page.User).UserName.ToString()); grdExtraTypes.Rebind(); }