protected void btn_AddOption_Click(object sender, EventArgs e) { if (Page.IsValid) { ProductVariantMgr myProductVariantMgr = new ProductVariantMgr(); string OptionID = Nexus.Core.Tools.IDGenerator.Get_New_GUID(); // Product Variant e2Data[] UpdateData = { new e2Data("OptionID", OptionID), new e2Data("Variant_PropertyID", _variant_propertyid), new e2Data("Option_Name", tbx_AddOption_Name.Text), new e2Data("Option_Value", tbx_AddOption_Value.Text), new e2Data("SortOrder", (myProductVariantMgr.Count_Variant_Property_Option(_variant_propertyid) + 1).ToString()), new e2Data("IsActive", chkbox_AddOption_IsActive.Checked.ToString()) }; myProductVariantMgr.Add_Product_Variant_Property_Option(UpdateData); Control_FillData_Option(); RadGrid_Options.Rebind(); } }
private void Display_Input_Options() { Panel_Input_Options.Visible = true; MultiView_InputOption.SetActiveView(View_Add); Control_FillData_Option(); RadGrid_Options.Rebind(); }
private void Display_Input_Options() { ProductAttributeMgr myProductAttributeMgr = new ProductAttributeMgr(); Reset_Form(); btn_CloseWindow.Visible = false; MultiView_OptionForm.SetActiveView(View_Button); Panel_Input_Options.Visible = true; RadGrid_Options.Rebind(); }
protected void lbtn_DeleteOption_Command(object sender, CommandEventArgs e) { if (!DataEval.IsEmptyQuery(e.CommandArgument.ToString())) { ProductVariantMgr myProductVariantMgr = new ProductVariantMgr(); // Need to add code for check option usage later // Remove Option myProductVariantMgr.Remove_Product_Variant_Property_Option(e.CommandArgument.ToString()); RadGrid_Options.Rebind(); } }
protected void RadGrid_Options_RowDrop(object sender, GridDragDropEventArgs e) { if (e.DestDataItem != null && string.IsNullOrEmpty(e.HtmlElement) && e.DestDataItem.OwnerGridID == RadGrid_Options.ClientID) { ProductVariantMgr myProductVariantMgr = new ProductVariantMgr(); Property_Option myProperty_Option = myProductVariantMgr.Get_Product_Variant_Property_Option(e.DestDataItem.GetDataKeyValue("OptionID").ToString()); List <Property_Option> myProperty_Options = myProductVariantMgr.Get_Product_Variant_Property_Options(myProperty_Option.Variant_PropertyID, "SortOrder"); Property_Option draggedProperty_Option = Get_Property_Option_in_List(myProperty_Options, e.DraggedItems[0].GetDataKeyValue("OptionID").ToString()); Property_Option destProperty_Option = Get_Property_Option_in_List(myProperty_Options, e.DestDataItem.GetDataKeyValue("OptionID").ToString()); int destIndex = myProperty_Options.IndexOf(destProperty_Option); if (e.DropPosition == GridItemDropPosition.Above && e.DestDataItem.ItemIndex > e.DraggedItems[0].ItemIndex) { destIndex -= 1; } if (e.DropPosition == GridItemDropPosition.Below && e.DestDataItem.ItemIndex < e.DraggedItems[0].ItemIndex) { destIndex += 1; } myProperty_Options.Remove(draggedProperty_Option); myProperty_Options.Insert(destIndex, draggedProperty_Option); foreach (Property_Option Property_Option in myProperty_Options) { // Product Variant e2Data[] UpdateData = { new e2Data("OptionID", Property_Option.OptionID), new e2Data("SortOrder", (myProperty_Options.IndexOf(Get_Property_Option_in_List(myProperty_Options, Property_Option.OptionID)) + 1).ToString()) }; myProductVariantMgr.Edit_Product_Variant_Property_Option(UpdateData); } RadGrid_Options.Rebind(); } }
protected void RadGrid_Options_RowDrop(object sender, GridDragDropEventArgs e) { if (e.DestDataItem != null && string.IsNullOrEmpty(e.HtmlElement) && e.DestDataItem.OwnerGridID == RadGrid_Options.ClientID) { ProductAttributeMgr myProductAttributeMgr = new ProductAttributeMgr(); List <Product_Attribute> myProduct_Attributes = myProductAttributeMgr.Get_Product_Attributes(_attribute_indexid); Product_Attribute draggedAttribute = Get_Attribute_in_List(myProduct_Attributes, e.DraggedItems[0].GetDataKeyValue("AttributeID").ToString()); Product_Attribute destAttribute = Get_Attribute_in_List(myProduct_Attributes, e.DestDataItem.GetDataKeyValue("AttributeID").ToString()); int destIndex = myProduct_Attributes.IndexOf(destAttribute); if (e.DropPosition == GridItemDropPosition.Above && e.DestDataItem.ItemIndex > e.DraggedItems[0].ItemIndex) { destIndex -= 1; } if (e.DropPosition == GridItemDropPosition.Below && e.DestDataItem.ItemIndex < e.DraggedItems[0].ItemIndex) { destIndex += 1; } myProduct_Attributes.Remove(draggedAttribute); myProduct_Attributes.Insert(destIndex, draggedAttribute); foreach (Product_Attribute myAttribute in myProduct_Attributes) { // Product Variant e2Data[] UpdateData = { new e2Data("AttributeID", myAttribute.AttributeID), new e2Data("SortOrder", (myProduct_Attributes.IndexOf(Get_Attribute_in_List(myProduct_Attributes, myAttribute.AttributeID)) + 1).ToString()) }; myProductAttributeMgr.Edit_Product_Attribute(UpdateData); } RadGrid_Options.Rebind(); } }
protected void btn_EditOption_Command(object sender, CommandEventArgs e) { if (Page.IsValid && !DataEval.IsEmptyQuery(e.CommandArgument.ToString())) { ProductVariantMgr myProductVariantMgr = new ProductVariantMgr(); // Product Variant e2Data[] UpdateData = { new e2Data("OptionID", e.CommandArgument.ToString()), new e2Data("Option_Name", tbx_EditOption_Name.Text), new e2Data("Option_Value", tbx_EditOption_Value.Text), new e2Data("IsActive", chkbox_EditOption_IsActive.Checked.ToString()) }; myProductVariantMgr.Edit_Product_Variant_Property_Option(UpdateData); Control_FillData_Option(); RadGrid_Options.Rebind(); MultiView_InputOption.SetActiveView(View_Add); } }
private void Control_Init() { RadGrid_Options.Rebind(); }