Esempio n. 1
0
    //绑定文章信息
    public void DataListBindAdminNotify(int type)
    {
        DalOperationAboutAdminNotify doan = new DalOperationAboutAdminNotify();
        DataView dv = null;
        if(type==0)
          dv = doan.GetAllNotifys().Tables[0].DefaultView;
        else
         dv=doan.FindNotifyByTypeId(type).Tables[0].DefaultView;

        this.AspNetPager1.RecordCount = dv.Count;
        AspNetPager1.PageSize = CommonUtility.pageSize;

        PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
        pds.DataSource = dv;
        pds.AllowPaging = true;

        pds.CurrentPageIndex = pageIndex - 1;
        pds.PageSize = AspNetPager1.PageSize;

        this.dlNotify.DataSource = pds;
        this.dlNotify.DataBind();

        if (pds.Count > 0)
        {
            this.dlNotify.ShowFooter = false;
        }
    }
Esempio n. 2
0
    //第1个标签:结束
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (ddlNotifyTypeChild.Items.Count == 0)
        {
            Javascript.GoHistory(-1, "请选择“" + ddlNotifyType.SelectedItem.Text + "”下的二级分类\n若无二级分类,请在文章类别管理页面添加相应地的二级分类", Page);
            return;
        }

        if (txtTitle.Text.Trim().Length == 0 || Textarea1.Value.Trim().Length == 0)
        {
            Javascript.GoHistory(-1, "标题和内容不能为空,请输入!", Page);
        }
        else
        {
            DalOperationAboutAdminNotify doan = new DalOperationAboutAdminNotify();
            AdminNotifyInfo notify = new AdminNotifyInfo();
            notify.notifyTitle = txtTitle.Text.Trim();
            notify.notifyContent = Textarea1.Value.Trim();
            notify.notifyTypeId = int.Parse(ddlNotifyTypeChild.SelectedValue);

            //以下提交附件的判断与相关操作
            if (hidAttachmentId.Value.CompareTo(string.Empty) != 0)
            {
                notify.attachmentIds = hidAttachmentId.Value;//保存了附件并且返回了attachmentId(自增长类型主键)
            }

            try
            {
                doan.AddNotifyInfo(notify);//保存通知
                //Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page);
                Javascript.AlertAndRedirect("添加成功!", "/Common/NotifyList.aspx", Page);
            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                //Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page);
                Javascript.GoHistory(-1, "添加失败,请检查格式是否有误!", Page);
            }
        }
    }
Esempio n. 3
0
    //***第3个标签:显示某一类型的文章信息---------------开始
    //绑定文章类型列表
    protected void DataListBindNotifyByTypeId(int type)
    {
        DalOperationAboutAdminNotify DalOperationAboutAdminNotify = new DalOperationAboutAdminNotify();
        DataSet ds = DalOperationAboutAdminNotify.FindNotifyByTypeId(type);

        this.AspNetPager1.RecordCount = ds.Tables[0].DefaultView.Count;
        this.AspNetPager1.PageSize = CommonUtility.pageSize;

        PagedDataSource pds = new PagedDataSource();
        pds.DataSource = ds.Tables[0].DefaultView;
        pds.AllowPaging = true;

        pds.CurrentPageIndex = pageIndex - 1;
        pds.PageSize = this.AspNetPager1.PageSize;

        this.dlistNotifyList.DataSource = pds;
        this.dlistNotifyList.DataBind();

        if (pds.Count > 0) {
            this.dlistNotifyList.ShowFooter = false;
        }
    }
Esempio n. 4
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);
     }
 }
Esempio n. 5
0
    //依据文章类型,绑定第类的文章列表
    protected void dlstNotifyType_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            DataList dataList = (DataList)e.Item.FindControl("dlstNotify");
            DataRowView rowv = (DataRowView)e.Item.DataItem;
            int mainID = Convert.ToInt32(rowv["notifyTypeId"]);
            DalOperationAboutAdminNotify DalOperationAboutAdminNotify = new DalOperationAboutAdminNotify();
            DataSet ds = DalOperationAboutAdminNotify.FindTheTop5NotifyByTypeId(mainID);
            dataList.DataSource = ds.Tables[0].DefaultView;
            dataList.DataBind();

            if (ds.Tables[0].Rows.Count == 0)
            {
                dataList.ShowFooter = true;
            }
            else
            {
                dataList.ShowFooter = false;
            }
        }
    }
Esempio n. 6
0
    protected void ViewAdminNotify()
    {
        int notifyId = -1;
        if (CommonUtility.SafeCheckByParams<string>(Request["adminNotifyInfoId"], ref notifyId))
        {
            DalOperationAboutAdminNotify dal = new DalOperationAboutAdminNotify();

            //浏览次数加1
            dal.AddScanCount(notifyId);

            DataSet adminNotify = dal.FindNotifybyNo(notifyId);
            news.DataSource = adminNotify.Tables[0];
            news.DataBind();

            if (adminNotify.Tables[0].Rows[0]["attachmentIds"].ToString().Length > 0)//有附件则显示
            {
                DalOperationAttachments dalOperationAttachments = new DalOperationAttachments();
            }

        }
        else
        {
            Javascript.GoHistory(-1, Page);
        }
    }
Esempio n. 7
0
    //修改
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (ddlNotifyTypeChild.Items.Count == 0)
        {
            Javascript.GoHistory(-1, "请选择“" + ddlNotifyType.SelectedItem.Text + "”下的二级分类\n若无二级分类,请在文章类别管理页面添加相应地的二级分类", Page);
            return;
        }

        if (txtTitle.Text.Trim().Length == 0 || this.Textarea1.Value.Trim().Length == 0)
        {
            Javascript.GoHistory(-1, "标题和内容不能为空,请输入!", Page);
        }
        else
        {
            DalOperationAboutAdminNotify doan = new DalOperationAboutAdminNotify();
            AdminNotifyInfo notify = new AdminNotifyInfo();
            notify.adminNotifyInfoIds = notifyId.ToString();

            notify.notifyTitle = txtTitle.Text.Trim();
            notify.notifyContent = this.Textarea1.Value.Trim();
            notify.notifyTypeId = int.Parse(ddlNotifyTypeChild.SelectedValue.ToString().Trim());
            notify.attachmentIds = hidAttachmentId.Value;
            notify.updateTime = DateTime.Now;

            try
            {

                doan.UpdateNotifyInfo(notify);//修改
                Javascript.RefreshParentWindow("修改成功!", "/Administrator/NotifyInfoManage.aspx", Page);
            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                Javascript.GoHistory(-1, "修改失败,请检查格式是否有误!", Page);
            }

        }
    }
Esempio n. 8
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;
            }
        }
    }