Esempio n. 1
0
    //批量删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        int sucCount   = 0; //成功数量
        int errorCount = 0; //失败数量

        Cms.BLL.C_article_attribute_field bll = new Cms.BLL.C_article_attribute_field();
        for (int i = 0; i < rptList.Items.Count; i++)
        {
            int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
            CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
            if (cb.Checked)
            {
                if (bll.Delete(id))
                {
                    sucCount++;
                }
                else
                {
                    errorCount++;
                }
            }
        }
        adminUser.AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除扩展字段成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
        JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("attribute_field_list.aspx", "control_type={0}&keywords={1}", this.control_type, this.keywords), "Success");
    }
    private bool DoEdit(int _id)
    {
        bool result = false;

        Cms.BLL.C_article_attribute_field   bll   = new Cms.BLL.C_article_attribute_field();
        Cms.Model.C_article_attribute_field model = bll.GetModel(_id);

        if (model.is_sys == 0)
        {
            model.control_type = ddlControlType.SelectedValue;
            model.data_length  = Utils.StrToInt(txtDataLength.Text.Trim(), 0);
            model.data_place   = Utils.StrToInt(ddlDataPlace.SelectedValue, 0);
            model.data_type    = rblDataType.SelectedValue;
        }
        model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);
        model.title   = txtTitle.Text;
        if (cbIsRequired.Checked == true)
        {
            model.is_required = 1;
        }
        else
        {
            model.is_required = 0;
        }
        if (cbIsPassword.Checked == true)
        {
            model.is_password = 1;
        }
        else
        {
            model.is_password = 0;
        }
        if (cbIsHtml.Checked == true)
        {
            model.is_html = 1;
        }
        else
        {
            model.is_html = 0;
        }
        model.editor_type     = Utils.StrToInt(rblEditorType.SelectedValue, 0);
        model.item_option     = txtItemOption.Text.Trim();
        model.default_value   = txtDefaultValue.Text.Trim();
        model.valid_pattern   = txtValidPattern.Text.Trim();
        model.valid_tip_msg   = txtValidTipMsg.Text.Trim();
        model.valid_error_msg = txtValidErrorMsg.Text.Trim();

        if (bll.Update(model))
        {
            adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改扩展字段:" + model.title); //记录日志
            result = true;
        }

        return(result);
    }
Esempio n. 3
0
    private void FieldBind()
    {
        Cms.BLL.C_article_attribute_field bll = new Cms.BLL.C_article_attribute_field();
        DataTable dt = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

        this.cblAttributeField.Items.Clear();
        foreach (DataRow dr in dt.Rows)
        {
            this.cblAttributeField.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
        }
    }
    private void ShowInfo(int _id)
    {
        Cms.BLL.C_article_attribute_field   bll   = new Cms.BLL.C_article_attribute_field();
        Cms.Model.C_article_attribute_field model = bll.GetModel(_id);

        txtName.Enabled = false;
        txtName.Attributes.Remove("ajaxurl");
        txtName.Attributes.Remove("datatype");
        ddlControlType.SelectedValue = model.control_type;
        showControlHtml(model.control_type); //显示对应的HTML
        txtSortId.Text = model.sort_id.ToString();
        txtName.Text   = model.name;
        txtTitle.Text  = model.title;
        if (model.is_required == 1)
        {
            cbIsRequired.Checked = true;
        }
        else
        {
            cbIsRequired.Checked = false;
        }
        if (model.is_password == 1)
        {
            cbIsPassword.Checked = true;
        }
        else
        {
            cbIsPassword.Checked = false;
        }
        if (model.is_html == 1)
        {
            cbIsHtml.Checked = true;
        }
        else
        {
            cbIsHtml.Checked = false;
        }
        rblEditorType.SelectedValue = model.editor_type.ToString();
        rblDataType.SelectedValue   = model.data_type;
        txtDataLength.Text          = model.data_length.ToString();
        ddlDataPlace.SelectedValue  = model.data_place.ToString();
        txtItemOption.Text          = model.item_option;
        txtDefaultValue.Text        = model.default_value;
        txtValidPattern.Text        = model.valid_pattern;
        txtValidTipMsg.Text         = model.valid_tip_msg;
        txtValidErrorMsg.Text       = model.valid_error_msg;
        if (model.is_sys == 1)
        {
            ddlControlType.Enabled = false;
        }
    }
Esempio n. 5
0
    //保存排序
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Cms.BLL.C_article_attribute_field bll = new Cms.BLL.C_article_attribute_field();
        for (int i = 0; i < rptList.Items.Count; i++)
        {
            int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
            int sortId;
            if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
            {
                sortId = 99;
            }

            int counts = Cms.DBUtility.DbHelperSQL.ExecuteSql("update C_article_attribute_field set sort_id=" + sortId + " where id='" + id + "'"); //修改
        }
        adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存扩展字段排序");                                                                      //记录日志
        JscriptMsg("保存排序成功!", Utils.CombUrlTxt("attribute_field_list.aspx", "control_type={0}&keywords={1}", this.control_type, this.keywords), "Success");
    }