protected void rcbCriteriaType_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { RadComboBox combobox = (RadComboBox)sender; GridEditFormItem edititem = (GridEditFormItem)combobox.NamingContainer; RadListBox rlbFrom = (RadListBox)edititem.FindControl("RadListBoxFrom"); RadListBox rlbTo = (RadListBox)edititem.FindControl("RadListBoxTo"); Label lblStoreDeliveryGroup = (Label)edititem.FindControl("lblStoreDeliveryGroup"); rlbFrom.Items.Clear(); rlbTo.Items.Clear(); StoreDelivCriteriaDAO storeDelivCriteria = new StoreDelivCriteriaDAO(); DataTable dtAvailableCriteria = storeDelivCriteria.GetAvailableStoreDelivCriteriaByType(lblStoreDeliveryGroup.Text, combobox.Text).Tables[0]; DataTable dtCriteria = storeDelivCriteria.GetStoreDelivCriteriaByType(lblStoreDeliveryGroup.Text, combobox.Text).Tables[0]; foreach (DataRow dr in dtAvailableCriteria.Rows) { rlbFrom.Items.Add(new RadListBoxItem(dr["crit_value"] as string, dr["crit_code"] as string)); } foreach (DataRow dr in dtCriteria.Rows) { rlbTo.Items.Add(new RadListBoxItem(dr["crit_value"] as string, dr["crit_code"] as string)); } }
protected void rcbCarriers_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { RadComboBox combobox = (RadComboBox)sender; GridEditFormItem edititem = (GridEditFormItem)combobox.NamingContainer; RadTextBox rtb = (RadTextBox)edititem.FindControl("txtCageType"); RadListBox rlbFrom = (RadListBox)edititem.FindControl("RadListBoxFrom"); RadListBox rlbTo = (RadListBox)edititem.FindControl("RadListBoxTo"); Label lblCageType = (Label)edititem.FindControl("lblCageType"); RadTextBox txtCageType = (RadTextBox)edititem.FindControl("txtCageType"); rlbFrom.Items.Clear(); if (combobox.SelectedValue == "-1") { rlbFrom.Items.Clear(); } else { StoreDelivCriteriaDAO storeDelivCriteria = new StoreDelivCriteriaDAO(); DataTable dtServices = storeDelivCriteria.GetCarrierServices(combobox.SelectedValue).Tables[0]; foreach (DataRow dr in dtServices.Rows) { rlbFrom.Items.Add(new RadListBoxItem(dr["carrier_service_descr"] as string, dr["carrier_service_id"] as string)); } } }
protected void StoreDelivGroupsRadGrid_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e) { GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; StoreDelivCriteriaDAO storeDelivCriteria = new StoreDelivCriteriaDAO(); string storeDelivGroupId = dataItem.GetDataKeyValue("group_id").ToString(); e.DetailTableView.DataSource = storeDelivCriteria.GetStoreDelivCriteria(storeDelivGroupId).Tables[0]; }
protected void StoreDelivGroupsRadGrid_UpdateCommand(object sender, GridCommandEventArgs e) { Label txtStoreDeliveryGroup = (Label)e.Item.FindControl("lblStoreDeliveryGroup"); RadTextBox txtStoreDeliveryGroupName = (RadTextBox)e.Item.FindControl("txtStoreDeliveryGroupName"); RadTextBox txtStoreDeliveryGroupDescr = (RadTextBox)e.Item.FindControl("txtStoreDeliveryGroupDescr"); RadComboBox txtCriteriaType = (RadComboBox)e.Item.FindControl("rcbCriteriaType"); if (txtStoreDeliveryGroupName.Text.Length > 0 && txtStoreDeliveryGroupDescr.Text.Length > 0) { try { Int64 storeDeliveryGroupId = Int64.Parse(txtStoreDeliveryGroup.Text); string storeDeliveryGroupName = txtStoreDeliveryGroupName.Text; string storeDeliveryGroupDescr = txtStoreDeliveryGroupDescr.Text; string criterionTypeCode = txtCriteriaType.Text; Int64? storeDelivGrpMapId = 0; StoreDelivGrpDAO storeDelivGrp = new StoreDelivGrpDAO(); storeDelivGrp.UpdateStoreDeliveryGroupTypeDetails(storeDeliveryGroupId, storeDeliveryGroupName.ToUpper(), storeDeliveryGroupDescr); RadListBox rlbTo = (RadListBox)e.Item.FindControl("RadListBoxTo"); RadListBox rlbFrom = (RadListBox)e.Item.FindControl("RadListBoxFrom"); StoreDelivCriteriaDAO storeDelivCriteria = new StoreDelivCriteriaDAO(); foreach (RadListBoxItem rlbItem in rlbFrom.Items) { storeDelivCriteria.RemoveCriteriaFromGroup(storeDeliveryGroupId, criterionTypeCode, rlbItem.Value); } foreach (RadListBoxItem rlbItem in rlbTo.Items) { storeDelivCriteria.AddCriteriaToGroup(storeDelivGrpMapId, storeDeliveryGroupId, criterionTypeCode, rlbItem.Value); } DisplayMessage(false, "Store delivery group " + storeDeliveryGroupName + " updated"); StoreDelivGroupsRadGrid.Rebind(); } catch (Exception ex) { string messageline = ex.Message.Split('\n')[0].Substring(10); DisplayMessage(true, messageline); } } }
protected void StoreDelivGroupsRadGrid_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem && !e.Item.Expanded) { GridDataItem dataItem = e.Item as GridDataItem; string sdgroupname = dataItem.GetDataKeyValue("group_name").ToString(); Button button = dataItem["DeleteColumn"].Controls[0] as Button; button.Attributes["onclick"] = "return confirm('Are you sure you want to delete store delivery group " + sdgroupname + "?')"; } if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode) { if (e.Item.ItemIndex < 0) { // Inserting Group GridEditableItem editedItem = e.Item as GridEditableItem; ((Label)(e.Item.FindControl("lblStoreDeliveryGroup"))).Visible = true; ((RadTextBox)(e.Item.FindControl("txtStoreDeliveryGroup"))).Visible = false; RadComboBox rcbCriteriaType = (RadComboBox)e.Item.FindControl("rcbCriteriaType"); StoreDelivCriteriaDAO storeDelivCriteriaType = new StoreDelivCriteriaDAO(); rcbCriteriaType.DataSource = storeDelivCriteriaType.GetStoreDelivCriteriaTypes(); rcbCriteriaType.DataTextField = "sd_crit_type_code"; rcbCriteriaType.DataValueField = "sd_crit_type_value"; rcbCriteriaType.DataBind(); RadComboBoxItem rcbItemStoreDelivCriteriaType = new RadComboBoxItem("None", "-1"); rcbCriteriaType.Items.Add(rcbItemStoreDelivCriteriaType); rcbCriteriaType.SelectedValue = "-1"; } else { // Editing Group GridEditableItem editedItem = e.Item as GridEditableItem; string groupid = editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["group_id"].ToString(); DataRowView row = (DataRowView)e.Item.DataItem; ((Label)(e.Item.FindControl("lblStoreDeliveryGroup"))).Visible = true; ((Label)(e.Item.FindControl("lblStoreDeliveryGroup"))).Text = groupid; ((RadTextBox)(e.Item.FindControl("txtStoreDeliveryGroup"))).Visible = false; ((RadTextBox)e.Item.FindControl("txtStoreDeliveryGroupName")).Text = (string)row.Row["group_name"]; ((RadTextBox)e.Item.FindControl("txtStoreDeliveryGroupDescr")).Text = (string)row.Row["description"]; RadComboBox rcbCriteriaType = (RadComboBox)e.Item.FindControl("rcbCriteriaType"); StoreDelivCriteriaDAO storeDelivCriteriaType = new StoreDelivCriteriaDAO(); rcbCriteriaType.DataSource = storeDelivCriteriaType.GetStoreDelivCriteriaTypes(); rcbCriteriaType.DataTextField = "sd_crit_type_code"; rcbCriteriaType.DataValueField = "sd_crit_type_value"; rcbCriteriaType.DataBind(); RadComboBoxItem rcbItemStoreDelivCriteriaType = new RadComboBoxItem("None", "-1"); rcbCriteriaType.Items.Add(rcbItemStoreDelivCriteriaType); rcbCriteriaType.SelectedValue = "-1"; } } }