/// <summary>
    /// 获取查询公告信息
    /// huangjinjun add 20160223
    /// </summary>
    /// <returns></returns>
    private string getNoticeList()
    {
        int       intTotalCount = 0;
        DataTable dt            = new DataTable();
        string    strSortname   = Request.Params["sortname"];
        string    strSortorder  = Request.Params["sortorder"];
        //当前页面
        int intPageIndex = Convert.ToInt32(Request.Params["page"]);
        //每页记录数
        int intPageSize = Convert.ToInt32(Request.Params["pagesize"]);

        TOaNoticeVo notice = new TOaNoticeVo();

        notice.SORT_FIELD = strSortname;
        notice.SORT_TYPE  = strSortorder;

        //自定义查询使用
        if (!String.IsNullOrEmpty(strTitle))
        {
            notice.TITLE  = strTitle;
            dt            = new TOaNoticeLogic().SelectByTable(notice, intPageIndex, intPageSize);
            intTotalCount = dt.Rows.Count;
        }
        //无条件首次加载用
        else
        {
            dt            = new TOaNoticeLogic().SelectByTable(notice, intPageIndex, intPageSize);
            intTotalCount = dt.Rows.Count;
        }
        string strJson = CreateToJson(dt, intTotalCount);

        return(strJson);
    }
    public static string getNoticeInfo()
    {
        string    serverPath = "..\\Channels\\OA\\Notice\\Image";
        DataTable dt         = new TOaNoticeLogic().getTopTenData();

        dt.Columns.Add("Path", System.Type.GetType("System.String"));
        foreach (DataRow row in dt.Rows)
        {
            if (row["CONTENT"].ToString().Length > 140)
            {
                row["CONTENT"] = row["CONTENT"].ToString().Substring(0, 140) + "...";
            }

            TOaAttVo TOaAttVo = new TOaAttVo();
            TOaAttVo.BUSINESS_ID   = row["ID"].ToString();
            TOaAttVo.BUSINESS_TYPE = "OA_NOTICE";
            TOaAttVo TOaAttVoTemp = new TOaAttLogic().Details(TOaAttVo);
            string   strExtent    = TOaAttVoTemp.ATTACH_TYPE;
            string   path         = serverPath + "\\" + row["ID"].ToString() + strExtent;
            if (strExtent != "")
            {
                row["Path"] = path;
            }
            else
            {
                row["Path"] = "..\\Channels\\OA\\Notice\\default.gif";
            }
        }
        string strJson = DataTableToJson(dt);

        return(strJson);
    }
    public static string deleteDataInfo(string strValue)
    {
        TOaNoticeVo TOaNoticeVo = new TOaNoticeVo();

        TOaNoticeVo.ID = strValue;
        bool isSuccess = new TOaNoticeLogic().Delete(TOaNoticeVo);

        if (isSuccess)
        {
            new PageBase().WriteLog("删除公告信息", "", new UserLogInfo().UserInfo.USER_NAME + "删除公告信息" + TOaNoticeVo.ID);
        }
        return(isSuccess == true ? "1" : "0");
    }
    /// <summary>
    /// 增加数据
    /// </summary>
    /// <returns></returns>
    public string frmAdd()
    {
        TOaNoticeVo TOaNoticeVo = autoBindRequest(Request, new TOaNoticeVo());

        TOaNoticeVo.ID = GetSerialNumber("oa_notice_id");
        bool isSuccess = new TOaNoticeLogic().Create(TOaNoticeVo);

        if (isSuccess)
        {
            WriteLog("新增公告信息", "", LogInfo.UserInfo.USER_NAME + "增加公告信息" + TOaNoticeVo.ID + "成功");
        }
        return(isSuccess == true ? "1" : "0");
    }
    /// <summary>
    /// 修改数据
    /// </summary>
    /// <returns></returns>
    public string frmUpdate()
    {
        TOaNoticeVo TOaNoticeVo = autoBindRequest(Request, new TOaNoticeVo());

        TOaNoticeVo.ID = Request["id"].ToString();
        bool isSuccess = new TOaNoticeLogic().Edit(TOaNoticeVo);

        if (isSuccess)
        {
            loadPicToTemp();
            WriteLog("修改公告信息", "", LogInfo.UserInfo.USER_NAME + "修改公告信息" + TOaNoticeVo.ID + "成功");
        }
        return(isSuccess == true ? "1" : "0");
    }
    /// <summary>
    /// 加载数据
    /// </summary>
    /// <returns></returns>
    public string frmLoadData()
    {
        TOaAttVo TOaAttVo = new TOaAttVo();

        TOaAttVo.BUSINESS_ID   = this.Request["id"].ToString();
        TOaAttVo.BUSINESS_TYPE = "OA_NOTICE";
        TOaAttVo TOaAttVoTemp = new TOaAttLogic().Details(TOaAttVo);
        string   strUrl       = TOaAttVoTemp.UPLOAD_PATH;
        string   mastPath     = System.Configuration.ConfigurationManager.AppSettings["AttPath"].ToString();
        string   filePath     = mastPath + '\\' + strUrl;

        TOaNoticeVo TOaNoticeVo = new TOaNoticeVo();

        TOaNoticeVo.ID = Request["id"].ToString();
        TOaNoticeVo TOaNoticeVoTemp = new TOaNoticeLogic().Details(TOaNoticeVo);

        return(ToJson(TOaNoticeVoTemp));
    }
Пример #7
0
    /// <summary>
    /// 获取数据
    /// </summary>
    /// <returns></returns>
    private string getDataInfo()
    {
        string strSortname  = Request.Params["sortname"];
        string strSortorder = Request.Params["sortorder"];
        //当前页面
        int intPageIndex = Convert.ToInt32(Request.Params["page"]);
        //每页记录数
        int intPageSize = Convert.ToInt32(Request.Params["pagesize"]);

        TOaNoticeVo TOaNoticeVo = new TOaNoticeVo();

        TOaNoticeVo.SORT_FIELD = strSortname;
        TOaNoticeVo.SORT_TYPE  = strSortorder;
        DataTable dt            = new TOaNoticeLogic().SelectByTable(TOaNoticeVo, intPageIndex, intPageSize);
        int       intTotalCount = new TOaNoticeLogic().GetSelectResultCount(TOaNoticeVo);
        string    strJson       = CreateToJson(dt, intTotalCount);

        return(strJson);
    }
    /// <summary>
    /// 将显示序号前10条任务存储在临时目录
    /// </summary>
    /// <returns></returns>
    private void loadPicToTemp()
    {
        DataTable dt = new TOaNoticeLogic().getTopTenData();
        //清空Image临时文件夹下所有的临时文件
        string        serverPath = HttpRuntime.AppDomainAppPath + "Channels\\OA\\Notice\\Image";
        DirectoryInfo di         = new DirectoryInfo(serverPath);

        if (di.Exists)
        {
            FileInfo[] files = di.GetFiles();
            foreach (FileInfo fi in files)
            {
                try
                {
                    fi.Delete();
                }
                catch (Exception ex) { }
            }
        }
        //将文件库中的文件复制到临时文件目录下
        //获取主文件路径
        string mastPath = System.Configuration.ConfigurationManager.AppSettings["AttPath"].ToString();

        foreach (DataRow row in dt.Rows)
        {
            string   id       = row["ID"].ToString();
            TOaAttVo TOaAttVo = new TOaAttVo();
            TOaAttVo.BUSINESS_ID   = id;
            TOaAttVo.BUSINESS_TYPE = "OA_NOTICE";
            TOaAttVo TOaAttVoTemp = new TOaAttLogic().Details(TOaAttVo);
            string   strExtent    = TOaAttVoTemp.ATTACH_TYPE;
            string   Path         = TOaAttVoTemp.UPLOAD_PATH;
            string   sumPath      = mastPath + '\\' + Path;
            try
            {
                File.Copy(sumPath, serverPath + "\\" + id + strExtent, true);
            }
            catch (Exception ex) { }
        }
    }