Ejemplo n.º 1
0
        /// <summary>
        /// 父级属性名称
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="properName"></param>
        /// <returns></returns>
        protected string GetName(object pid)
        {
            ProperType item = ProperTypeService.GetModel(Convert.ToInt32(pid));

            if (item != null)
            {
                return(item.properName);
            }
            return("");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加类型
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            string properName  = this.txtPropertyName.Text.Trim();
            string productType = ddlProductType.SelectedValue;

            if (productType == "0")
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('请选择产品类型!');", true);
                return;
            }
            if (properName.Length == 0)
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('属性名称不能为空!');", true);
                return;
            }
            string parentId = ddlOne.SelectedValue;

            ProperType item = new ProperType();

            item.infoType    = Convert.ToInt32(productType);
            item.properName  = properName;
            item.properValue = "";
            item.parentId    = Convert.ToInt32(parentId);

            item.status = 0;
            if (cboTj.Checked)
            {
                item.status = 1;
            }
            item.remark = "";

            item.addTime = DateTime.Now;

            if (Session["loginUser"] == null)
            {
                Response.Redirect("/admin/login.aspx");
                return;
            }
            AdminUser admin = Session["loginUser"] as AdminUser;

            item.addUser = admin.id;
            if (ViewState["modId"] != null)
            {
                item.id = Convert.ToInt32(ViewState["modId"]);
                ProperTypeService.Update(item);
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('保存成功!');location.href='propertyInfo.aspx'", true);
            }
            else
            {
                int num = ProperTypeService.Add(item);
            }

            sp.InitBindData(repInfo, pager1, "ProperType", "id", sear());
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('保存成功!');", true);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 控件行命令事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName.Equals("del"))
     {
         int id = Convert.ToInt32(e.CommandArgument);
         ProperValueService.Delete(id);
         sp.InitBindData(repInfo, pager1, "ProperValue", "id", sear());
     }
     if (e.CommandName.Equals("mod"))
     {
         int         id   = Convert.ToInt32(e.CommandArgument);
         ProperValue item = ProperValueService.GetModel(id);
         if (item != null)
         {
             this.ddlProductType.SelectedValue = item.infoType.ToString();
             //产品一级属性下拉框
             DataSet ds = ProperTypeService.GetList("parentId = 0 and infoType = " + item.infoType);
             ddlOne.Items.Clear();
             if (ds.Tables[0].Rows.Count > 0)
             {
                 ddlOne.DataSource     = ds;
                 ddlOne.DataTextField  = "properName";
                 ddlOne.DataValueField = "id";
                 ddlOne.DataBind();
             }
             ddlOne.Items.Insert(0, new ListItem("请选择", "0"));
             if (item.parentId != 0)
             {
                 ddlOne.SelectedValue = item.parentId.ToString();
                 ds = ProperTypeService.GetList("parentId = " + item.parentId);
                 ddlTwo.Items.Clear();
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     ddlTwo.DataSource     = ds;
                     ddlTwo.DataTextField  = "properName";
                     ddlTwo.DataValueField = "id";
                     ddlTwo.DataBind();
                 }
                 ddlTwo.Items.Insert(0, new ListItem("请选择", "0"));
                 if (item.properId != 0)
                 {
                     ddlTwo.SelectedValue  = item.properId.ToString();
                     txtPropertyValue.Text = item.properValue;
                 }
             }
         }
         ViewState["modId"] = id;
         ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "overKeyWordDiv();", true);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 一级属性下拉事件更新二级属性信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlOne_SelectedIndexChanged(object sender, EventArgs e)
        {
            int pid = Convert.ToInt32(ddlOne.SelectedValue);
            //产品一级属性下拉框
            DataSet ds = ProperTypeService.GetList("parentId = " + pid);

            ddlTwo.Items.Clear();
            if (ds.Tables[0].Rows.Count > 0)
            {
                ddlTwo.DataSource     = ds;
                ddlTwo.DataTextField  = "properName";
                ddlTwo.DataValueField = "id";
                ddlTwo.DataBind();
            }
            ddlTwo.Items.Insert(0, new ListItem("请选择", "0"));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 父级属性名称
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="properName"></param>
        /// <returns></returns>
        protected string GetParentName(object pid, object properName)
        {
            int parentId = Convert.ToInt32(pid);

            if (parentId != 0)
            {
                ProperType item = ProperTypeService.GetModel(parentId);
                if (item != null)
                {
                    return(item.properName);
                }
                return("");
            }
            else
            {
                return("顶级");
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 取消推荐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button5_Click(object sender, EventArgs e)
        {
            string ids = selInfo();
            int    num = 0;

            if (ids.Length == 0)
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('请选择要取消推荐的记录!');", true);
                return;
            }
            string[] arr = ids.TrimEnd(',').Split(',');
            for (int i = 0; i < arr.Length; i++)
            {
                if (ProperTypeService.UpdateStatus(Convert.ToInt32(arr[i]), 0) > 0)
                {
                    num++;
                }
            }

            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('成功设置" + num + "条记录!');", true);
            sp.InitBindData(repInfo, pager1, "ProperType", "id", sear());
        }