示例#1
0
 protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
 {
     if (!e.IsFromDetailTable)
     {
         StoreDelivGrpDAO storeDelivGrp = new StoreDelivGrpDAO();
         StoreDelivGroupsRadGrid.DataSource = storeDelivGrp.GetStoreDelivGroups().Tables[0];
     }
 }
示例#2
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);
                }
            }
        }
示例#3
0
        protected void StoreDelivGroupsRadGrid_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;

            Int64            storeDeliveryGroupId   = Int64.Parse(editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["group_id"].ToString());
            string           storeDeliveryGroupName = editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["group_name"].ToString();
            StoreDelivGrpDAO storeDelivGrp          = new StoreDelivGrpDAO();

            try
            {
                storeDelivGrp.RemoveStoreDeliveryGroupType(storeDeliveryGroupId);
                DisplayMessage(false, "Group " + storeDeliveryGroupName + " removed");
            }
            catch (Exception ex)
            {
                string messageline = ex.Message.Split('\n')[0].Substring(10);
                DisplayMessage(true, messageline);
            }
        }