private void InitComponent() { string productId = NumberRule.NewDataModel(16).GetValue(16); this.txtProductID.Text = productId; DataTable categoryData = XSql.GetDataTable("exec [dbo].[sp_get_tree_table] 'PDT_ProductCategory','ID','Name','ParentID','ID',0,1,5"); this.ddlProductCategory.DataSource = categoryData; this.ddlProductCategory.DataTextField = "name"; this.ddlProductCategory.DataValueField = "id"; this.ddlProductCategory.DataBind(); DataTable unitData = XSql.GetDataTable("SELECT * FROM Ass_Unit"); this.ddlUnits.DataSource = unitData; this.ddlUnits.DataValueField = "ID"; this.ddlUnits.DataTextField = "UnitName"; this.ddlUnits.DataBind(); if (WX.Main.GetConfigItem("Product_ISDept") == "1" && WX.Main.GetConfigItem("Product_OneDept") == "1") { BindDropList(); } if (Request["ProductID"] != null && Request["ProductID"] != "") { MenuBar1.Key = "Sale_Product_Edit"; MenuBar1.Param1 = "{Q:ProductID}"; MenuBar1.CurIndex = 2; WX.PDT.Product.MODEL product = WX.Request.rProduct; this.rIsEnable.SelectedValue = product.IsEnable.ToString(); this.txtProductID.Text = product.ProductID.ToString(); this.txtProductName.Text = product.ProductName.ToString(); this.ddlProductCategory.SelectedValue = product.CategoryID.ToString(); this.txtSpecification.Text = product.Specification.ToString(); this.ddlUnits.SelectedValue = product.Units.ToString(); this.txtSalesPrice.Text = product.SalesPrice.ToString(); this.txtDiscountedPrice.Text = product.DiscountedPrice.ToString(); this.txtCostPrice.Text = product.CostPrice.ToString(); this.txtRemark.Text = product.Remark.ToString(); this.txtServices.Text = product.Services.ToString(); if (WX.Main.GetConfigItem("Product_ISDept") == "1" && WX.Main.GetConfigItem("Product_OneDept") == "1") { WX.PDT.ProductDept.MODEL productdept = WX.PDT.ProductDept.GetModel("select top 1 * from PDT_ProductDept where ProductID=" + WX.Request.rProductId + " order by ID desc"); if (productdept != null) { ProductDeptID.SelectedValue = productdept.DeptID.ToString(); MonthFee.Text = productdept.MonthFee.ToString(); Fee.Text = productdept.Fee.ToString(); Feetype1.SelectedValue = productdept.MonthFeeType.ToString(); Feetype2.SelectedValue = productdept.FeeType.ToString(); txtDeptRemarks.Text = productdept.Remarks.ToString(); } } } if (WX.Main.GetConfigItem("Product_ISDept") == "1" && WX.Main.GetConfigItem("Product_OneDept") == "1") { pdept.Visible = true; } }
private void PageInit() { WX.PDT.ProductDept.MODEL productdept = null; if (Request["ProductDeptID"] != null && Request["ProductDeptID"] != "") { productdept = WX.PDT.ProductDept.NewDataModel(Request["ProductDeptID"]); } else if (WX.Main.GetConfigItem("Product_ISDept") == "1" && WX.Main.GetConfigItem("Product_OneDept") == "1") { productdept = WX.PDT.ProductDept.GetModel("select top 1 * from PDT_ProductDept where ProductID=" + WX.Request.rProductId + " order by ID desc"); } if (productdept != null) { ProductDeptID.SelectedValue = productdept.DeptID.ToString(); MonthFee.Text = productdept.MonthFee.ToString(); Fee.Text = productdept.Fee.ToString(); Feetype1.SelectedValue = productdept.MonthFeeType.ToString(); Feetype2.SelectedValue = productdept.FeeType.ToString(); txtDeptRemarks.Text = productdept.Remarks.ToString(); } }