protected void btn_Finish_Click(object sender, EventArgs e) { if (Page.IsValid) { ProductMgr myProductMgr = new ProductMgr(); if (rbtn_Product_Index_Method.SelectedValue == "CreateNew") { #region Create New Product Index and Product // Get update time and user string nowTime = DateTime.Now.ToString(); string UserID = Security.Users.UserStatus.Current_UserID(this.Page); // Product Index string Product_IndexID = Nexus.Core.Tools.IDGenerator.Get_New_GUID(); e2Data[] UpdateData_Index = { new e2Data("Product_IndexID", Product_IndexID), new e2Data("Title", tbx_Index_Title.Text), new e2Data("Short_Description", tbx_Index_Short_Description.Text), new e2Data("Admin_Comment", tbx_Index_Admin_Comment.Text), new e2Data("IsActive", chkbox_Index_IsActive.Checked.ToString()), new e2Data("Create_Date", nowTime), new e2Data("LastUpdate_Date", nowTime), new e2Data("LastUpdate_UserID", UserID) }; myProductMgr.Add_ProductIndex(UpdateData_Index); // Product Basic Infomation string ProductID = Nexus.Core.Tools.IDGenerator.Get_New_GUID_PlainText(); e2Data[] UpdateData_Product = { new e2Data("ProductID", ProductID), new e2Data("Product_IndexID", Product_IndexID), new e2Data("Product_Title", tbx_Product_Title.Text), new e2Data("Title_Type", rbtn_Product_Title_Type.SelectedValue), new e2Data("Product_SKU", tbx_Product_SKU.Text), new e2Data("ManufacturerID", droplist_Product_ManufacturerID.SelectedValue), new e2Data("Manufacturer_SKU", tbx_Product_Manufacturer_SKU.Text), new e2Data("Product_VariantID", droplist_Product_VariantID.SelectedValue), new e2Data("CurrencyID", droplist_Product_CurrencyID.SelectedValue), new e2Data("RRP_Price", RadNumericTextBox_Product_RRP.Text), new e2Data("SortOrder", (myProductMgr.Count_Product_ByProductIndex(Product_IndexID) + 1).ToString()), new e2Data("IsActive", chkbox_Product_IsActive.Checked.ToString()), new e2Data("Create_Date", nowTime), new e2Data("LastUpdate_Date", nowTime), new e2Data("LastUpdate_UserID", UserID) }; myProductMgr.Add_Product(UpdateData_Product); // Product Specification ProductVariantMgr myProductVariantMgr = new ProductVariantMgr(); myProductVariantMgr.Add_Product_Properties(PlaceHolder_Product_Spec, droplist_Product_VariantID.SelectedValue, ProductID); // Add to Product Mapping e2Data[] UpdateData_Mapping = { new e2Data("ProductID", ProductID), new e2Data("CategoryID", _categoryid), new e2Data("IsFeatured", false.ToString()), new e2Data("SortOrder", "1") }; myProductMgr.Add_Product_Mapping(UpdateData_Mapping); // Add Item to Category CategoryMgr myCategoryMgr = new CategoryMgr(); myCategoryMgr.Add_ComponentInCategory_Item( _categoryid, "B131F545-F494-447E-8B55-9F24AFADC417"); // Add Item Web Content string WebPageID = Nexus.Core.Tools.IDGenerator.Get_New_GUID_PlainText(); e2Data[] UpdateData_Webpage = { new e2Data("WebPageID", WebPageID), new e2Data("ProductID", ProductID), new e2Data("Meta_Title", tbx_Product_Title.Text), new e2Data("Page_Title", tbx_Product_Title.Text), new e2Data("SortOrder", "1") }; myProductMgr.Add_WebPage(UpdateData_Webpage); // Finish all update MultiView_CreateProduct.SetActiveView(View_Product_Complete); #endregion } else if (rbtn_Product_Index_Method.SelectedValue == "AddtoExist") { #region Create Product to existed Product Index // Get update time and user string nowTime = DateTime.Now.ToString(); string UserID = Security.Users.UserStatus.Current_UserID(this.Page); // Product Basic Infomation string ProductID = Nexus.Core.Tools.IDGenerator.Get_New_GUID_PlainText(); e2Data[] UpdateData_Product = { new e2Data("ProductID", ProductID), new e2Data("Product_IndexID", _product_indexid), new e2Data("Product_Title", tbx_Product_Title.Text), new e2Data("Title_Type", rbtn_Product_Title_Type.SelectedValue), new e2Data("Product_SKU", tbx_Product_SKU.Text), new e2Data("ManufacturerID", droplist_Product_ManufacturerID.SelectedValue), new e2Data("Manufacturer_SKU", tbx_Product_Manufacturer_SKU.Text), new e2Data("Product_VariantID", droplist_Product_VariantID.SelectedValue), new e2Data("CurrencyID", droplist_Product_CurrencyID.SelectedValue), new e2Data("RRP_Price", RadNumericTextBox_Product_RRP.Text), new e2Data("SortOrder", (myProductMgr.Count_Product_ByProductIndex(Product_IndexID) + 1).ToString()), new e2Data("IsActive", chkbox_Product_IsActive.Checked.ToString()), new e2Data("Create_Date", nowTime), new e2Data("LastUpdate_Date", nowTime), new e2Data("LastUpdate_UserID", UserID) }; myProductMgr.Add_Product(UpdateData_Product); // Product Specification ProductVariantMgr myProductVariantMgr = new ProductVariantMgr(); myProductVariantMgr.Add_Product_Properties(PlaceHolder_Product_Spec, droplist_Product_VariantID.SelectedValue, ProductID); // Add to Product Mapping e2Data[] UpdateData_Mapping = { new e2Data("ProductID", ProductID), new e2Data("CategoryID", _categoryid), new e2Data("IsFeatured", false.ToString()), new e2Data("SortOrder", "1") }; myProductMgr.Add_Product_Mapping(UpdateData_Mapping); // Add Item to Category CategoryMgr myCategoryMgr = new CategoryMgr(); myCategoryMgr.Add_ComponentInCategory_Item( _categoryid, "B131F545-F494-447E-8B55-9F24AFADC417"); // Finish all update MultiView_CreateProduct.SetActiveView(View_Product_Complete); #endregion } // Trigger Refresh Event OnCategoryRefreshed(sender, e); } }