Example #1
0
        private bool DoAdd()
        {
            try
            {
                Model.wx_product_type model = new Model.wx_product_type();
                BLL.wx_product_type   bll   = new BLL.wx_product_type();

                model.tName = txtTitle.Text.Trim();

                model.sort_id = int.Parse(txtSortId.Text.Trim());

                model.tUrl = txtLinkUrl.Text.Trim();
                int parentid = int.Parse(ddlParentId.SelectedValue);
                model.parentId = parentid;
                if (parentid > 0)
                {
                    Model.wx_product_type parentModel = bll.GetModel(parentid);
                    model.class_layer = parentModel.class_layer + 1;
                }
                else
                {
                    model.class_layer = 1;
                }
                model.store_id = int.Parse(ddlPStore.SelectedValue);
                model.remark   = txtContent.Value;
                model.icoPic   = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                Model.wx_userweixin weixin = GetWeiXinCode();
                model.wid         = weixin.id;
                model.creatDate   = DateTime.Now;
                model.tel         = txttel.Text;
                model.daohangurl  = txtdaohangurl.Text;
                model.showDefault = rblshowDefault.SelectedItem.Value == "1"?true:false;

                if (bll.Add(model) > 0)
                {
                    AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加产品库分类:" + model.tName); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
        private bool DoAdd()
        {
            try
            {
                Model.wx_product_type model = new Model.wx_product_type();
                BLL.wx_product_type bll = new BLL.wx_product_type();

                model.tName = txtTitle.Text.Trim();

                model.sort_id = int.Parse(txtSortId.Text.Trim());

                model.tUrl = txtLinkUrl.Text.Trim();
               int parentid=int.Parse(ddlParentId.SelectedValue);
                model.parentId = parentid;
                if (parentid > 0)
                {
                    Model.wx_product_type parentModel = bll.GetModel(parentid);
                    model.class_layer = parentModel.class_layer + 1;
                }
                else
                {
                    model.class_layer = 1;
                }
                model.store_id = int.Parse(ddlPStore.SelectedValue) ;
                model.remark = txtContent.Value;
                model.icoPic = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                Model.wx_userweixin weixin = GetWeiXinCode();
                model.wid = weixin.id;
                model.creatDate = DateTime.Now;
                model.tel = txttel.Text;
                model.daohangurl = txtdaohangurl.Text;
                model.showDefault = rblshowDefault.SelectedItem.Value=="1"?true:false;

                if (bll.Add(model) > 0)
                {
                    AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加产品库分类:" + model.tName); //记录日志
                    return true;
                }
            }
            catch
            {
                return false;
            }
            return false;
        }