⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productui.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
                return RolePermissions.AccessCheckNodePermission(code, -1);
            }
            string roleNodeId = RolePermissions.GetRoleNodeId(PEContext.Current.Admin.Roles, code);
            string str2 = nodeId.ToString();
            NodeInfo cacheNodeById = PowerEasy.Contents.Nodes.GetCacheNodeById(nodeId);
            if (cacheNodeById.IsNull)
            {
                AdminPage.WriteErrMsg("当前栏目不存在,可能被删除了请返回!");
            }
            if (cacheNodeById.ParentId > 0)
            {
                str2 = str2 + "," + cacheNodeById.ParentPath;
            }
            return RolePermissions.CheckNodePurview(roleNodeId, str2);
        }

        private IList<string> ChildProductList()
        {
            IList<string> attrList = new List<string>();
            foreach (RepeaterItem item in this.RepModel.Items)
            {
                if ((item.ItemType != ListItemType.Item) && (item.ItemType != ListItemType.AlternatingItem))
                {
                    continue;
                }
                FieldControl control = (FieldControl) item.FindControl("Field");
                if (control.ControlType == FieldType.Property)
                {
                    Property property = (Property) control.FindControl("PowerEasy2007");
                    string properties = property.Properties;
                    if (!string.IsNullOrEmpty(properties))
                    {
                        attrList.Add(properties);
                    }
                }
            }
            if (attrList.Count > 0)
            {
                return Product.GetProductPropertiesList(attrList);
            }
            return null;
        }

        protected void ChkEnableWholesale_CheckedChanged(object sender, EventArgs e)
        {
            bool visible = false;
            if (this.ChkEnableWholesale.Checked)
            {
                visible = true;
            }
            this.tbWholesale.Visible = visible;
            this.DisplayColumns("批发数量一", visible);
            this.DisplayColumns("批发价格一", visible);
            this.DisplayColumns("批发数量二", visible);
            this.DisplayColumns("批发价格二", visible);
            this.DisplayColumns("批发数量三", visible);
            this.DisplayColumns("批发价格三", visible);
            this.EgdvChildProductsDataBind();
        }

        private void DisplayColumns(string headerText, bool visible)
        {
            foreach (GridViewTemplateField field in this.EgvChildProducts.Columns)
            {
                if (field.HeaderText == headerText)
                {
                    field.Visible = visible;
                    break;
                }
            }
        }

        protected void EgdvChildProducts_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string dataItem = e.Row.DataItem as string;
                CheckBox box = (CheckBox) e.Row.FindControl("ChkIsValid");
                Label label = (Label) e.Row.FindControl("LblProperty");
                label.Text = dataItem;
                if (((this.m_Action == "modify") && (this.m_ProductInfo != null)) && !this.Page.IsPostBack)
                {
                    int dataItemIndex = e.Row.DataItemIndex;
                    if (this.m_ProductDataInfoList.Count > dataItemIndex)
                    {
                        ProductDataInfo info = this.m_ProductDataInfoList[dataItemIndex];
                        box.Checked = info.IsValid;
                        TextBox box2 = (TextBox) e.Row.FindControl("TxtChildStocks");
                        box2.Text = info.Stocks.ToString();
                        box2.Enabled = false;
                        box2.ToolTip = "修改库存请到“库存管理”进行操作!";
                        TextBox box3 = (TextBox) e.Row.FindControl("TxtChildAlarmNum");
                        box3.Text = info.AlarmNum.ToString();
                        TextBox box4 = (TextBox) e.Row.FindControl("TxtPrice");
                        box4.Text = info.PriceInfo.Price.ToString("0.00");
                        TextBox box5 = (TextBox) e.Row.FindControl("TxtUserPrice");
                        box5.Text = info.PriceInfo.PriceMember.ToString("0.00");
                        TextBox box6 = (TextBox) e.Row.FindControl("TxtAgentPrice");
                        box6.Text = info.PriceInfo.PriceAgent.ToString("0.00");
                        TextBox box7 = (TextBox) e.Row.FindControl("TxtNumber_Wholesale1");
                        box7.Text = info.PriceInfo.NumberWholesale1.ToString();
                        TextBox box8 = (TextBox) e.Row.FindControl("TxtNumber_Wholesale2");
                        box8.Text = info.PriceInfo.NumberWholesale2.ToString();
                        TextBox box9 = (TextBox) e.Row.FindControl("TxtNumber_Wholesale3");
                        box9.Text = info.PriceInfo.NumberWholesale3.ToString();
                        TextBox box10 = (TextBox) e.Row.FindControl("TxtPrice_Wholesale1");
                        box10.Text = info.PriceInfo.PriceWholesale1.ToString("0.00");
                        TextBox box11 = (TextBox) e.Row.FindControl("TxtPrice_Wholesale2");
                        box11.Text = info.PriceInfo.PriceWholesale2.ToString("0.00");
                        TextBox box12 = (TextBox) e.Row.FindControl("TxtPrice_Wholesale3");
                        box12.Text = info.PriceInfo.PriceWholesale3.ToString("0.00");
                        IList<ProductPriceInfo> productPriceInfoList = new List<ProductPriceInfo>();
                        if ((this.m_ProductInfo.PriceInfo.PriceMember == -1M) || (this.m_ProductInfo.PriceInfo.PriceAgent == -1M))
                        {
                            productPriceInfoList = ProductPrice.GetProductPrice(this.m_ProductInfo.ProductId, this.m_ProductInfo.TableName, dataItem);
                        }
                        if (this.m_ProductInfo.PriceInfo.PriceMember == -1M)
                        {
                            foreach (UserGroupsInfo info2 in UserGroups.GetGroupTable(GroupType.Register))
                            {
                                TextBox box13 = (TextBox) e.Row.FindControl("TxtGroupPrice" + info2.GroupId);
                                if (box13 != null)
                                {
                                    box13.Text = this.GetChildGroupPrice(info2.GroupId, productPriceInfoList).ToString("0.00");
                                }
                            }
                        }
                        if (this.m_ProductInfo.PriceInfo.PriceAgent == -1M)
                        {
                            foreach (UserGroupsInfo info3 in UserGroups.GetGroupTable(GroupType.Agent))
                            {
                                TextBox box14 = (TextBox) e.Row.FindControl("TxtAgentGroupPrice" + info3.GroupId);
                                if (box14 != null)
                                {
                                    box14.Text = this.GetChildGroupPrice(info3.GroupId, productPriceInfoList).ToString("0.00");
                                }
                            }
                        }
                    }
                }
            }
        }

        private void EgdvChildProductsDataBind()
        {
            IList<string> list = this.ChildProductList();
            if ((list != null) && (list.Count > 0))
            {
                this.EgvChildProducts.DataSource = list;
                this.EgvChildProducts.DataBind();
                this.TRChildProducts.Visible = true;
            }
            else
            {
                this.TRChildProducts.Visible = false;
            }
        }

        private decimal GetChildGroupPrice(int groupId, IList<ProductPriceInfo> productPriceInfoList)
        {
            foreach (ProductPriceInfo info in productPriceInfoList)
            {
                if (info.GroupId == groupId)
                {
                    return info.Price;
                }
            }
            return 0M;
        }

        private DataTable GetDataTableFromRepeater()
        {
            DataTable dataTable = new DataTable();
            dataTable.Columns.Add("FieldName");
            dataTable.Columns.Add("FieldValue");
            dataTable.Columns.Add("FieldType");
            dataTable.Columns.Add("FieldLevel");
            foreach (RepeaterItem item in this.RepModel.Items)
            {
                FieldControl control = (FieldControl) item.FindControl("Field");
                switch (control.ControlType)
                {
                    case FieldType.TextType:
                    case FieldType.MultipleTextType:
                    case FieldType.KeywordType:
                    case FieldType.OperatingType:
                    case FieldType.Producer:
                    case FieldType.Trademark:
                    {
                        this.AddNewRows(dataTable, control.FieldName, DataSecurity.HtmlEncode(control.Value), control.ControlType, control.FieldLevel);
                        continue;
                    }
                    case FieldType.PictureType:
                    {
                        PictureType type2 = (PictureType) control.FindControl("PowerEasy2007");
                        this.AddNewRows(dataTable, control.FieldName, DataSecurity.HtmlEncode(type2.FieldValue), control.ControlType, control.FieldLevel);
                        if ((control.Settings.Count > 7) && DataConverter.CBool(control.Settings[7]))
                        {
                            this.AddNewRows(dataTable, "UploadFiles", DataSecurity.HtmlEncode(type2.UploadFiles), FieldType.TextType, 0);
                        }
                        continue;
                    }
                    case FieldType.FileType:
                    {
                        FileType type3 = (FileType) control.FindControl("PowerEasy2007");
                        this.AddNewRows(dataTable, control.FieldName, type3.FieldValue, control.ControlType, control.FieldLevel);
                        if (DataConverter.CBool(control.Settings[3]))
                        {
                            this.AddNewRows(dataTable, control.Settings[4], type3.FileSize, control.ControlType, control.FieldLevel);
                        }
                        continue;
                    }
                    case FieldType.ContentType:
                    {
                        ContentType type = (ContentType) control.FindControl("PowerEasy2007");
                        this.AddNewRows(dataTable, control.FieldName, StringHelper.RemoveXss(type.Content), control.ControlType, control.FieldLevel);
                        continue;
                    }
                    case FieldType.MultiplePhotoType:
                    {
                        MultiplePhotoType type4 = (MultiplePhotoType) control.FindControl("PowerEasy2007");
                        this.AddNewRows(dataTable, control.FieldName, DataSecurity.HtmlEncode(type4.FieldValue), control.ControlType, control.FieldLevel);
                        if (DataConverter.CBool(control.Settings[2]))
                        {
                            this.AddNewRows(dataTable, control.Settings[3], DataSecurity.HtmlEncode(type4.ThumbFieldValue), control.ControlType, control.FieldLevel);
                        }
                        continue;
                    }
                    case FieldType.Property:
                    {
                        continue;
                    }
                }
                this.AddNewRows(dataTable, control.FieldName, control.Value, control.ControlType, control.FieldLevel);
            }
            this.AddNewRows(dataTable, "DayHits", this.TxtDayHits.Text, FieldType.NumberType, 0);
            this.AddNewRows(dataTable, "EliteLevel", this.TxtEliteLevel.Text, FieldType.NumberType, 0);
            this.AddNewRows(dataTable, "Hits", this.TxtHits.Text, FieldType.NumberType, 0);
            this.AddNewRows(dataTable, "Priority", this.TxtPriority.Text, FieldType.NumberType, 0);
            this.AddNewRows(dataTable, "WeekHits", this.TxtWeekHits.Text, FieldType.NumberType, 0);
            this.AddNewRows(dataTable, "MonthHits", this.TxtMonthHits.Text, FieldType.NumberType, 0);
            this.AddNewRows(dataTable, "UpdateTime", this.PickDate.Text, FieldType.DateTimeType, 0);
            this.AddNewRows(dataTable, "TemplateFile", this.FscTemplate.Text, FieldType.TemplateType, 0);
            this.AddNewRows(dataTable, "SpecialId", this.SpecialType1.FieldValue, FieldType.SpecialType, 0);
            this.AddNewRows(dataTable, "InfoId", this.NodeType1.InfoNodeId, FieldType.InfoType, 0);
            this.AddNewRows(dataTable, "NodeId", this.NodeType1.FieldValue, FieldType.NodeType, 0);
            this.AddNewRows(dataTable, "Inputer", PEContext.Current.Admin.AdminName, FieldType.TextType, 0);
            this.AddNewRows(dataTable, "Title", DataSecurity.HtmlEncode(this.TxtProductName.Text), FieldType.TitleType, 0);
            if (this.ChkEnableSale.Checked)
            {
                this.AddNewRows(dataTable, "Status", "99", FieldType.StatusType, 0);
                return dataTable;
            }
            this.AddNewRows(dataTable, "Status", "90", FieldType.StatusType, 0);
            return dataTable;
        }

        private static int GetGeneralId(DataTable dataTable)
        {
            return DataConverter.CLng(dataTable.Select("FieldName = 'generalId'")[0]["FieldValue"].ToString());
        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -