Example #1
0
 protected void btndelete_Click(object sender, EventArgs e)
 {
     string ids = "";
     XYECOM.Business.Label le = new XYECOM.Business.Label();
     foreach (GridViewRow row in this.gvList.Rows)
     {
         if (((CheckBox)(row.FindControl("chkExport"))).Checked == true)
             ids += "," + this.gvList.DataKeys[row.DataItemIndex].Value.ToString();
     }
     if (ids.IndexOf(",") == 0)
         ids = ids.Substring(1);
     int err = le.Delete(ids);
     if (err <= 0)
     {
         Alert("标签删除失败!", "List.aspx");
     }
 }
Example #2
0
    protected void btnok_Click(object sender, EventArgs e)
    {
        XYECOM.Model.LabelInfo el = new XYECOM.Model.LabelInfo();

        el.LabelTableName = "";
        el.LabelTypeId = XYECOM.Core.MyConvert.GetInt32(this.hidLT_ID.SelectedValue);
        el.LabelCName = this.tbCName.Text.Trim();
        el.LabelName = this.tbName.Text.Trim();
        el.LabelContent = tbContent.Text;
        el.LabelStyleHead = txtHead.Text;
        el.LabelStyleContent = txtConent.Text;
        el.LabelStyleFooter = txtfooter.Text;
        el.LabelTableName = this.hidTableName.Value;
        el.LabelDescription = this.txtDescription.Text.Trim();

        if (rbtnSystem.Checked)
        {
            el.LabelRange = XYECOM.Model.LabelRange.System;
            el.GroupIdOrUserId = "0";
        }
        if (rbtnUser.Checked)
        {
            el.LabelRange = XYECOM.Model.LabelRange.User;
            el.GroupIdOrUserId = this.hidUserIds.Value;
        }
        if (rbtnUserGroup.Checked)
        {
            el.LabelRange = XYECOM.Model.LabelRange.UserGropu;
            el.GroupIdOrUserId = this.hidGroupIds.Value;
        }

        if (L_ID == 0)
        {
            int err = new XYECOM.Business.Label().Insert(el);
            if (err == -1)
            {
                Alert("该标签已存在", "add.aspx");
            }
            else if (err == -2)
            {
                Alert("数据库错误!请稍后再试!", "List.aspx");
            }
            else
            {
                Response.Redirect("list.aspx");
            }
        }
        else
        {
            el.Id = L_ID;
            int err = new XYECOM.Business.Label().Update(el);

            if (err == -2)
            {
                Alert("数据库错误!请稍后再试!", "List.aspx");
            }
            else
            {
                this.Response.Redirect("List.aspx?" + XYECOM.Core.XYRequest.GetQueryString("backURL"));
            }
        }
    }