示例#1
0
 protected void dlNotify_ItemCommand(object source, DataListCommandEventArgs e)
 {
     DalOperationAboutAdminNotify doan = new DalOperationAboutAdminNotify();
     if (e.CommandName == "delete")
     {
         string adminNotifyInfoId = dlNotify.DataKeys[e.Item.ItemIndex].ToString();//取选中行公告编号
         doan.DeleteNotifyById(int.Parse(adminNotifyInfoId));
         Javascript.AlertAndRedirect("删除成功!", "/Administrator/NotifyInfoManage.aspx?page="+pageIndex, Page);
     }
     else if (e.CommandName == "update")
     {
         string adminNotifyInfoId = dlNotify.DataKeys[e.Item.ItemIndex].ToString();//取选中行公告编号
         Javascript.JavaScriptLocationHref("/Administrator/EditNotifyInfo.aspx?adminNotifyInfoId=" + adminNotifyInfoId, Page);
     }
     else if(e.CommandName == "editIstop")
     {
         string adminNotifyInfoId = dlNotify.DataKeys[e.Item.ItemIndex].ToString();
         AdminNotifyInfo adminNotify = doan.FindNotifyByNo(int.Parse(adminNotifyInfoId));
         if (adminNotify.isTop > 0)
             doan.Canceltop(int.Parse(adminNotifyInfoId));
         else
             doan.Addtop(int.Parse(adminNotifyInfoId));
         Javascript.JavaScriptLocationHref("/Administrator/NotifyInfoManage.aspx", Page);
     }
 }
示例#2
0
    //初始化编辑页面
    public void InitialNotifyEdit(int notifyId)
    {
        DalOperationAboutAdminNotify doan = new DalOperationAboutAdminNotify();
        AdminNotifyInfo notify = doan.FindNotifyByNo(notifyId);
        if (notify == null)
        {
            Javascript.AlertAndRedirect("要修改的信息不存在,请检查!", "/Administrator/NotifyInfoManage.aspx", Page);
        }
        else
        {
            //通知或办事流程
            ddlNotifyType.SelectedValue = notify.notifyTypeId.ToString().Trim();

            txtTitle.Text = notify.notifyTitle;

            this.Textarea1.Value = notify.notifyContent;

            hidAttachmentId.Value = notify.attachmentIds;

            if (notify.attachmentIds.Length > 0)
            {
                DalOperationAttachments dalOperationAttachments = new DalOperationAttachments();
                ltlAttachment.Text = dalOperationAttachments.GetAttachmentsList(notify.attachmentIds, ref iframeCount, true,string.Empty);
            }
        }

        DalOperationAboutAdminNotifyType dalNotifyType = new DalOperationAboutAdminNotifyType();
        DataTable dt = dalNotifyType.FindAllParentAdminNotifyType().Tables[0];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            ListItem _item = new ListItem(dt.Rows[i]["notifyTypeName"].ToString().Trim(), dt.Rows[i]["notifyTypeId"].ToString().Trim());
            ddlNotifyType.Items.Add(_item);
        }

        if (dalNotifyType.FindParentIdById(notify.notifyTypeId).Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ddlNotifyType.Items.Count; i++)
            {

                if (ddlNotifyType.Items[i].Value.ToString().Trim() == dalNotifyType.FindParentIdById(notify.notifyTypeId).Tables[0].Rows[0]["parentId"].ToString().Trim())
                {
                    ddlNotifyType.SelectedIndex = i;
                }
            }

            DataTable _dt = dalNotifyType.FindAllAdminNotifyTypeByParentId(int.Parse(ddlNotifyType.SelectedValue)).Tables[0];

            for (int j = 0; j < _dt.Rows.Count; j++)
            {
                ddlNotifyTypeChild.Items.Add(new ListItem(_dt.Rows[j]["notifyTypeName"].ToString().Trim(), _dt.Rows[j]["notifyTypeId"].ToString().Trim()));
            }
        }

        for (int i = 0; i < ddlNotifyTypeChild.Items.Count; i++)
        {
            if (ddlNotifyTypeChild.Items[i].Value.ToString().Trim() == notify.notifyTypeId.ToString().Trim())
            {
                ddlNotifyTypeChild.SelectedIndex = i;
            }
        }
    }