Esempio n. 1
0
 public override void DataBind()
 {
     this.Items.Clear();
     if (this.AllowNull)
     {
         base.Items.Add(new ListItem(this.NullToDisplay, string.Empty));
     }
     foreach (DataRow row in DistributorHelper.GetDistributorGrades().Rows)
     {
         this.Items.Add(new ListItem(Globals.HtmlDecode(row["Name"].ToString()), row["GradeId"].ToString()));
     }
 }
        public override void DataBind()
        {
            this.Items.Clear();
            if (this.AllowNull)
            {
                base.Items.Add(new ListItem(this.NullToDisplay, string.Empty));
            }
            base.Items.Add(new ListItem("成本价", "-2"));
            base.Items.Add(new ListItem("采购价", "-4"));
            DataTable distributorGrades = DistributorHelper.GetDistributorGrades();

            foreach (DataRow dataRow in distributorGrades.Rows)
            {
                this.Items.Add(new ListItem(Globals.HtmlDecode(dataRow["Name"].ToString() + "采购价"), dataRow["GradeId"].ToString()));
            }
        }
Esempio n. 3
0
        protected void DoCallback()
        {
            base.Response.Clear();
            base.Response.ContentType = "application/json";
            string text = base.Request.QueryString["action"];

            if (text.Equals("getPrepareData"))
            {
                int typeId = int.Parse(base.Request.QueryString["typeId"]);
                System.Collections.Generic.IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(typeId);
                System.Data.DataTable dataTable = ProductTypeHelper.GetBrandCategoriesByTypeId(typeId);
                if (dataTable.Rows.Count == 0)
                {
                    dataTable = ControlProvider.Instance().GetBrandCategories();
                }
                base.Response.Write(this.GenerateJsonString(attributes, dataTable));
                attributes.Clear();
            }
            else
            {
                if (text.Equals("getMemberGradeList"))
                {
                    System.Collections.Generic.IList <MemberGradeInfo> memberGrades = MemberHelper.GetMemberGrades();
                    if (memberGrades != null && memberGrades.Count != 0)
                    {
                        System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                        stringBuilder.Append("{\"Status\":\"OK\",\"MemberGrades\":[");
                        foreach (MemberGradeInfo current in memberGrades)
                        {
                            stringBuilder.Append("{");
                            stringBuilder.AppendFormat("\"GradeId\":\"{0}\",", current.GradeId);
                            stringBuilder.AppendFormat("\"Name\":\"{0}\",", current.Name);
                            stringBuilder.AppendFormat("\"Discount\":\"{0}\"", current.Discount);
                            stringBuilder.Append("},");
                        }
                        stringBuilder.Remove(stringBuilder.Length - 1, 1);
                        stringBuilder.Append("]}");
                        base.Response.Write(stringBuilder.ToString());
                    }
                    else
                    {
                        base.Response.Write("{\"Status\":\"0\"}");
                    }
                }
                else
                {
                    if (text.Equals("getDistributorGradeList"))
                    {
                        System.Data.DataTable distributorGrades = DistributorHelper.GetDistributorGrades();
                        if (distributorGrades != null && distributorGrades.Rows.Count != 0)
                        {
                            System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                            stringBuilder2.Append("{\"Status\":\"OK\",\"DistributorGrades\":[");
                            foreach (System.Data.DataRow dataRow in distributorGrades.Rows)
                            {
                                stringBuilder2.Append("{");
                                stringBuilder2.AppendFormat("\"GradeId\":\"{0}\",", (int)dataRow["GradeId"]);
                                stringBuilder2.AppendFormat("\"Name\":\"{0}\",", (string)dataRow["Name"]);
                                stringBuilder2.AppendFormat("\"Discount\":\"{0}\"", (int)dataRow["Discount"]);
                                stringBuilder2.Append("},");
                            }
                            stringBuilder2.Remove(stringBuilder2.Length - 1, 1);
                            stringBuilder2.Append("]}");
                            base.Response.Write(stringBuilder2.ToString());
                        }
                        else
                        {
                            base.Response.Write("{\"Status\":\"0\"}");
                        }
                    }
                }
            }
            base.Response.End();
        }
 private void BindDistributorRanks()
 {
     grdDistributorRankList.DataSource = DistributorHelper.GetDistributorGrades();
     grdDistributorRankList.DataBind();
 }
Esempio n. 5
0
        protected void DoCallback()
        {
            base.Response.Clear();
            base.Response.ContentType = "application/json";
            string str = base.Request.QueryString["action"];

            if (str.Equals("getPrepareData"))
            {
                int typeId = int.Parse(base.Request.QueryString["typeId"]);
                IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(typeId);
                DataTable             brandCategoriesByTypeId = ProductTypeHelper.GetBrandCategoriesByTypeId(typeId);
                base.Response.Write(this.GenerateJsonString(attributes, brandCategoriesByTypeId));
                attributes.Clear();
            }
            else if (str.Equals("getMemberGradeList"))
            {
                IList <MemberGradeInfo> memberGrades = MemberHelper.GetMemberGrades();
                if ((memberGrades == null) || (memberGrades.Count == 0))
                {
                    base.Response.Write("{\"Status\":\"0\"}");
                }
                else
                {
                    StringBuilder builder = new StringBuilder();
                    builder.Append("{\"Status\":\"OK\",\"MemberGrades\":[");
                    foreach (MemberGradeInfo info in memberGrades)
                    {
                        builder.Append("{");
                        builder.AppendFormat("\"GradeId\":\"{0}\",", info.GradeId);
                        builder.AppendFormat("\"Name\":\"{0}\",", info.Name);
                        builder.AppendFormat("\"Discount\":\"{0}\"", info.Discount);
                        builder.Append("},");
                    }
                    builder.Remove(builder.Length - 1, 1);
                    builder.Append("]}");
                    base.Response.Write(builder.ToString());
                }
            }
            else if (str.Equals("getDistributorGradeList"))
            {
                DataTable distributorGrades = DistributorHelper.GetDistributorGrades();
                if ((distributorGrades == null) || (distributorGrades.Rows.Count == 0))
                {
                    base.Response.Write("{\"Status\":\"0\"}");
                }
                else
                {
                    StringBuilder builder2 = new StringBuilder();
                    builder2.Append("{\"Status\":\"OK\",\"DistributorGrades\":[");
                    foreach (DataRow row in distributorGrades.Rows)
                    {
                        builder2.Append("{");
                        builder2.AppendFormat("\"GradeId\":\"{0}\",", (int)row["GradeId"]);
                        builder2.AppendFormat("\"Name\":\"{0}\",", (string)row["Name"]);
                        builder2.AppendFormat("\"Discount\":\"{0}\"", (int)row["Discount"]);
                        builder2.Append("},");
                    }
                    builder2.Remove(builder2.Length - 1, 1);
                    builder2.Append("]}");
                    base.Response.Write(builder2.ToString());
                }
            }
            base.Response.End();
        }