Ejemplo n.º 1
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            int id = MyCommFun.Str2Int(hidid.Value);

            #region  //先判断
            string strErr = "";
            if (this.txtaName.Text.Trim().Length == 0)
            {
                strErr += "预订属性名称不能为空!";
            }

            if (strErr != "")
            {
                JscriptMsg(strErr, "back", "Error");
                return;
            }

            #endregion

            #region 赋值
            Model.wx_book_catalog_attribute cataAttr = new Model.wx_book_catalog_attribute();

            if (id > 0)
            {
                cataAttr = caBll.GetModel(id);
            }

            cataAttr.aName     = txtaName.Text.Trim();
            cataAttr.catalogId = MyCommFun.Str2Int(ddlCatalog.SelectedItem.Value);
            cataAttr.aType     = MyCommFun.Str2Int(radType.SelectedItem.Value);
            cataAttr.aValue    = txtaValue.Value.Trim();
            cataAttr.sort_id   = MyCommFun.Str2Int(txtsort_id.Text.Trim());


            #endregion

            if (id <= 0)
            {  //新增
                cataAttr.wid        = weixin.id;
                cataAttr.createDate = DateTime.Now;
                //1新增主表
                id = caBll.Add(cataAttr);

                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加预订属性,主键为" + id); //记录日志
                JscriptMsg("添加预订属性成功!", "attribute_list.aspx?id=" + catalogId, "Success");
            }
            else
            {   //修改
                caBll.Update(cataAttr);

                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改预订属性,主键为" + id); //记录日志
                JscriptMsg("修改预订属性成功!", "attribute_list.aspx?id=" + catalogId, "Success");
            }
        }
Ejemplo n.º 2
0
 private void ShowInfo(int id)
 {
     hidid.Value = id.ToString();
     Model.wx_book_catalog_attribute catalog = caBll.GetModel(id);
     hidid.Value              = catalog.id.ToString();
     txtaName.Text            = catalog.aName.ToString();
     ddlCatalog.SelectedValue = catalog.catalogId.Value.ToString();
     radType.SelectedValue    = catalog.aType.Value.ToString();
     txtaValue.Value          = catalog.aValue;
     txtsort_id.Text          = catalog.sort_id.Value.ToString();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 预订类型选择以后
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlCatalog_SelectedIndexChanged(object sender, EventArgs e)
        {
            int catalogId = MyCommFun.Str2Int(this.ddlCatalog.SelectedItem.Value); //预订类型id

            BLL.wx_book_catalog_attribute           caBll    = new wx_book_catalog_attribute();
            IList <Model.wx_book_catalog_attribute> attrlist = caBll.GetModelList("catalogId=" + catalogId + " order by sort_id asc");

            if (attrlist == null || attrlist.Count <= 0)
            {
                return;
            }
            Model.wx_book_catalog_attribute attr = new Model.wx_book_catalog_attribute();
            StringBuilder attrStr = new StringBuilder();

            for (int i = 0; i < attrlist.Count; i++)
            {
                attr = attrlist[i];
                if (attr.aType.Value == 1)
                {  //供客户查看
                    attrStr.Append("<dl>");
                    attrStr.Append(" <dt>" + attr.aName + "</dt>");
                    attrStr.Append("<dd>");
                    if (attr.aValue == null || attr.aValue.Trim() == "")
                    {
                        attrStr.Append("<input name=\"txtattr\" type=\"text\" id=\"extattr_" + attr.id + "\" attrid=\"" + attr.id + "\" class=\"input normal txt_attr \" datatype=\"*0-200\" sucmsg=\" \" nullmsg=\" \">");
                    }
                    else
                    {
                        //下拉菜单
                        string[] attrvalueArr = Utils.SplitString(attr.aValue, "\r\n");
                        if (attrvalueArr != null && attrvalueArr.Length > 0)
                        {
                            attrStr.Append("<select name=\"ddlattr\" id=\"extattr_" + attr.id + "\" attrid=\"" + attr.id + "\"  class=\"txt_attr\">");
                            attrStr.Append("<option value=\"\">请选择...</option>");
                            for (int j = 0; j < attrvalueArr.Length; j++)
                            {
                                attrStr.Append("<option value=\"" + attrvalueArr[j] + "\">" + attrvalueArr[j] + "</option>");
                            }
                            attrStr.Append("</select>");
                        }
                        attrStr.Append("");
                    }
                    attrStr.Append("</dd>");
                    attrStr.Append("</dl>");
                }
                else if (attr.aType.Value == 2)
                { //客户可选规格,SKU
                    if (attr.aValue == null || attr.aValue.Trim() == "")
                    {
                    }
                    else
                    {
                        attrStr.Append("<dl>");
                        attrStr.Append(" <dt>" + attr.aName + "</dt>");
                        attrStr.Append("<dd>");
                        string[] attrvalueArr = Utils.SplitString(attr.aValue, "\r\n");
                        if (attrvalueArr != null && attrvalueArr.Length > 0)
                        {
                            attrStr.Append(" <table class=\"ltable tb_sku\">  <thead> <tr> <th width=\"80\"> 使用 </th> <th> 名称  </th> <th width=\"120\">  属性加价格 </th> </tr></thead>");
                            attrStr.Append("<tbody class=\"ltbody\">");
                            for (int j = 0; j < attrvalueArr.Length; j++)
                            {
                                attrStr.Append(" <tr class=\"td_c\">");
                                attrStr.Append(" <td><input id=\"chk_skuvalue_" + j + "\" type=\"checkbox\" attrid=\"" + attr.id + "\" class=\"skuchk\"   /></td>");
                                attrStr.Append(" <td> <label for=\"chk_skuvalue_" + j + "\" class=\"skuattrName\">" + attrvalueArr[j] + "</label> </td>");

                                attrStr.Append("<td>");
                                attrStr.Append("<input name=\"txtaddvalue\" type=\"text\"   id=\"txtaddvalue" + attrvalueArr[j] + "\" value=\"0\" class=\"input small skuvaddmenoy\" datatype=\"*0-10\" sucmsg=\" \">");
                                attrStr.Append("</td>");
                                attrStr.Append("</tr>");
                            }

                            attrStr.Append(" </tbody> </table>");
                        }
                        attrStr.Append("</dd>");
                        attrStr.Append("</dl>");
                    }
                }
            }//big for

            litAttr.Text = attrStr.ToString();
        }//end:function
Ejemplo n.º 4
0
        }//end:function

        /// <summary>
        /// 组合预订属性和配件html
        /// </summary>
        /// <param name="catalogId">预订类型</param>
        private void BindAttrHtml(int catalogId)
        {
            IList <Model.wx_book_productAttr_value> oldattrlist = new List <Model.wx_book_productAttr_value>();
            IList <Model.wx_book_sku> oldskulist = new List <Model.wx_book_sku>();
            bool isProductAttr = false; //该预订已经有的属性
            bool isProductSku  = false; //该预订的已有的配件

            int hCatalogId = MyCommFun.Str2Int(hidCatalogId.Value);
            int productId  = MyCommFun.Str2Int(hidid.Value);

            if (catalogId == hCatalogId)
            {
                BLL.wx_book_productAttr_value paBll = new wx_book_productAttr_value();
                BLL.wx_book_sku skuBll = new wx_book_sku();
                oldattrlist = paBll.GetModelList("productId=" + productId);
                if (oldattrlist != null && oldattrlist.Count > 0)
                {
                    isProductAttr = true;
                }
                oldskulist = skuBll.GetModelList("productId=" + productId);
                if (oldskulist != null && oldskulist.Count > 0)
                {
                    isProductSku = true;
                }
            }


            BLL.wx_book_catalog_attribute           caBll    = new wx_book_catalog_attribute();
            IList <Model.wx_book_catalog_attribute> attrlist = caBll.GetModelList("catalogId=" + catalogId + " order by sort_id asc");

            if (attrlist == null || attrlist.Count <= 0)
            {
                return;
            }
            Model.wx_book_catalog_attribute attr = new Model.wx_book_catalog_attribute();
            StringBuilder attrStr  = new StringBuilder();
            string        tmpValue = "";
            string        tmpPrice = "";

            for (int i = 0; i < attrlist.Count; i++)
            {
                attr = attrlist[i];
                if (attr.aType.Value == 1)
                {
                    #region 预订属性
                    //供客户查看
                    attrStr.Append("<dl>");
                    attrStr.Append(" <dt>" + attr.aName + "</dt>");
                    attrStr.Append("<dd>");
                    if (attr.aValue == null || attr.aValue.Trim() == "")
                    {
                        if (isProductAttr)
                        {  //已有值绑定
                            tmpValue = porductAttrValue(attr.id, oldattrlist);
                            attrStr.Append("<input name=\"txtattr\" type=\"text\" id=\"extattr_" + attr.id + "\" value=\"" + tmpValue + "\" attrid=\"" + attr.id + "\" class=\"input normal txt_attr \" datatype=\"*0-200\" sucmsg=\" \" nullmsg=\" \">");
                        }
                        else
                        {
                            attrStr.Append("<input name=\"txtattr\" type=\"text\" id=\"extattr_" + attr.id + "\" attrid=\"" + attr.id + "\" class=\"input normal txt_attr \" datatype=\"*0-200\" sucmsg=\" \" nullmsg=\" \">");
                        }
                    }
                    else
                    {
                        //下拉菜单
                        string[] attrvalueArr = Utils.SplitString(attr.aValue, "\r\n");
                        if (attrvalueArr != null && attrvalueArr.Length > 0)
                        {
                            attrStr.Append("<select name=\"ddlattr\" id=\"extattr_" + attr.id + "\" attrid=\"" + attr.id + "\"  class=\"txt_attr\">");
                            attrStr.Append("<option value=\"\">请选择...</option>");
                            if (isProductAttr)
                            {   //已有值绑定
                                tmpValue = porductAttrValue(attr.id, oldattrlist);
                                for (int j = 0; j < attrvalueArr.Length; j++)
                                {
                                    if (tmpValue == attrvalueArr[j])
                                    {
                                        attrStr.Append("<option value=\"" + attrvalueArr[j] + "\" selected=\"selected\">" + attrvalueArr[j] + "</option>");
                                    }
                                    else
                                    {
                                        attrStr.Append("<option value=\"" + attrvalueArr[j] + "\">" + attrvalueArr[j] + "</option>");
                                    }
                                }
                            }
                            else
                            {
                                for (int j = 0; j < attrvalueArr.Length; j++)
                                {
                                    attrStr.Append("<option value=\"" + attrvalueArr[j] + "\">" + attrvalueArr[j] + "</option>");
                                }
                            }
                            attrStr.Append("</select>");
                        }
                        attrStr.Append("");
                    }
                    attrStr.Append("</dd>");
                    attrStr.Append("</dl>");
                    #endregion
                }
                else if (attr.aType.Value == 2)
                { //客户可选规格,SKU
                    #region 预订配件sku
                    if (attr.aValue == null || attr.aValue.Trim() == "")
                    {
                    }
                    else
                    {
                        attrStr.Append("<dl>");
                        attrStr.Append(" <dt>" + attr.aName + "</dt>");
                        attrStr.Append("<dd>");
                        string[] attrvalueArr = Utils.SplitString(attr.aValue, "\r\n");
                        if (attrvalueArr != null && attrvalueArr.Length > 0)
                        {
                            attrStr.Append(" <table class=\"ltable tb_sku\">  <thead> <tr> <th width=\"80\"> 使用 </th> <th> 名称  </th> <th width=\"120\">  属性加价格 </th> </tr></thead>");
                            attrStr.Append("<tbody class=\"ltbody\">");
                            for (int j = 0; j < attrvalueArr.Length; j++)
                            {
                                attrStr.Append(" <tr class=\"td_c\">");

                                if (isProductSku)
                                {
                                    tmpPrice = porductSkuPrice(attr.id, attrvalueArr[j], oldskulist);
                                    if (tmpPrice != "")
                                    {
                                        attrStr.Append(" <td>");
                                        attrStr.Append("<input id=\"chk_skuvalue_" + j + "\" type=\"checkbox\" attrid=\"" + attr.id + "\" class=\"skuchk\" checked=\"checked\" />");

                                        attrStr.Append("</td>");
                                        attrStr.Append(" <td> <label for=\"chk_skuvalue_" + j + "\" class=\"skuattrName\">" + attrvalueArr[j] + "</label> </td>");

                                        attrStr.Append("<td>");
                                        attrStr.Append("<input name=\"txtaddvalue\" type=\"text\"   id=\"txtaddvalue" + attrvalueArr[j] + "\" value=\"" + tmpPrice + "\" class=\"input small skuvaddmenoy\" datatype=\"*0-10\" sucmsg=\" \">");
                                        attrStr.Append("</td>");
                                    }
                                    else
                                    {
                                        attrStr.Append(" <td>");
                                        attrStr.Append("<input id=\"chk_skuvalue_" + j + "\" type=\"checkbox\" attrid=\"" + attr.id + "\" class=\"skuchk\"   />");
                                        attrStr.Append("</td>");
                                        attrStr.Append(" <td> <label for=\"chk_skuvalue_" + j + "\" class=\"skuattrName\">" + attrvalueArr[j] + "</label> </td>");
                                        attrStr.Append("<td>");
                                        attrStr.Append("<input name=\"txtaddvalue\" type=\"text\"   id=\"txtaddvalue" + attrvalueArr[j] + "\" value=\"0\" class=\"input small skuvaddmenoy\" datatype=\"*0-10\" sucmsg=\" \">");
                                        attrStr.Append("</td>");
                                    }
                                }
                                else
                                {
                                    attrStr.Append(" <td>");
                                    attrStr.Append("<input id=\"chk_skuvalue_" + j + "\" type=\"checkbox\" attrid=\"" + attr.id + "\" class=\"skuchk\"   />");

                                    attrStr.Append("</td>");
                                    attrStr.Append(" <td> <label for=\"chk_skuvalue_" + j + "\" class=\"skuattrName\">" + attrvalueArr[j] + "</label> </td>");

                                    attrStr.Append("<td>");
                                    attrStr.Append("<input name=\"txtaddvalue\" type=\"text\"   id=\"txtaddvalue" + attrvalueArr[j] + "\" value=\"0\" class=\"input small skuvaddmenoy\" datatype=\"*0-10\" sucmsg=\" \">");
                                    attrStr.Append("</td>");
                                }

                                attrStr.Append("</tr>");
                            }

                            attrStr.Append(" </tbody> </table>");
                        }
                        attrStr.Append("</dd>");
                        attrStr.Append("</dl>");
                    }
                    #endregion
                }
            }//big for

            litAttr.Text = attrStr.ToString();
        }