コード例 #1
0
    /// <summary>
    /// 获取签名信息
    /// </summary>
    protected void getSignInfo()
    {
        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"]);
        //部门ID
        string strDept = !string.IsNullOrEmpty(Request.QueryString["deptId"]) ? Request.QueryString["deptId"].ToString() : "";

        TRptSignatureVo objSign = new TRptSignatureVo();

        objSign.SORT_FIELD = !string.IsNullOrEmpty(strSortname) ? strSortname : TRptSignatureVo.ID_FIELD;
        objSign.SORT_TYPE  = strSortorder;
        //自定义查询使用
        intTotalCount = new TRptSignatureLogic().GetSelectResultCountByDept(objSign, strDept);
        dt            = new TRptSignatureLogic().SelectByTableByDept(objSign, strDept, intPageIndex, intPageSize);

        string strJson = LigerGridDataToJson(dt, intTotalCount);

        Response.Write(strJson);
        Response.End();
    }
コード例 #2
0
    /// <summary>
    /// 获得印章信息
    /// </summary>
    protected void showDetail()
    {
        TRptSignatureVo objSign = new TRptSignatureLogic().Details(this.Request["id"].ToString());

        this.MARK_NAME.Text = Request["real_name"].ToString();
        this.fileId.Value   = objSign.ID;
        this.fileType.Value = objSign.MARK_TYPE;
    }
コード例 #3
0
    /// <summary>
    /// 数据存在 性
    /// </summary>
    /// <param name="strUser">用户名</param>
    /// <returns>数据ID</returns>
    protected string Exist(string strUser)
    {
        TRptSignatureVo objSign = new TRptSignatureVo();

        objSign.USER_NAME = strUser;
        objSign           = new TRptSignatureLogic().Details(objSign);
        return(objSign.ID);
    }
コード例 #4
0
    protected void UploadAtt(string strResultPath)
    {
        //获取主文件路径
        string mastPath      = System.Configuration.ConfigurationManager.AppSettings["AttPath"].ToString();
        string strfolderPath = mastPath + "\\SignImg\\";
        //删除原来文件
        //判断原来是否已经上传过文件,如果有的话则获取原来已经上传的文件路径
        TRptSignatureVo objSign = new TRptSignatureVo();

        objSign.USER_NAME = LogInfo.UserInfo.USER_NAME;
        DataTable objTable = new TRptSignatureLogic().SelectByTable(objSign);

        if (objTable.Rows.Count > 0)
        {
            //如果存在记录
            //获取该记录的ID
            string strId = objTable.Rows[0]["ID"].ToString();
            //获取原来文件的路径
            string strOldFilePath = objTable.Rows[0]["MARK_PATH"].ToString();
            //如果存在的话,删除原来的文件
            if (File.Exists(strOldFilePath))
            {
                File.Delete(strOldFilePath);
            }
        }
        //开始上传附件
        try
        {
            //判断文件夹是否存在,如果不存在则创建
            if (Directory.Exists(strfolderPath) == false)
            {
                Directory.CreateDirectory(strfolderPath);
            }
            this.fileUpload.SaveAs(strResultPath);
        }
        catch (Exception ex)
        {
            LigerDialogAlert(ex.Message, "error");
        }
    }
コード例 #5
0
    /// <summary>
    /// 附件添加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        if (this.MARK_NAME.Text.Trim() == "")
        {
            LigerDialogAlert("请输入印章名称", "error"); return;
        }
        if (this.fileUpload.PostedFile.ContentLength >= 20971520)
        {
            LigerDialogAlert("上传的文件不能大于20M", "error"); return;
        }
        if (Path.GetExtension(this.fileUpload.PostedFile.FileName).ToLower() != ".jpg")
        {
            LigerDialogAlert("请上传.jpg类型图片文件", "error"); return;
        }
        if (this.fileUpload.PostedFile.ContentLength <= 0)
        {
            LigerDialogAlert("请选择文件", "error"); return;
        }

        TRptSignatureVo objSign = new TRptSignatureLogic().Details(Request["id"]);

        //读取文件流
        byte[] UploadFile = new byte[fileUpload.PostedFile.ContentLength];
        fileUpload.PostedFile.InputStream.Read(UploadFile, 0, fileUpload.PostedFile.ContentLength);
        objSign.MARK_BODY = UploadFile;
        objSign.MARK_SIZE = fileUpload.PostedFile.ContentLength.ToString();
        objSign.MARK_TYPE = System.IO.Path.GetExtension(fileUpload.PostedFile.FileName);

        //获取主文件路径
        string mastPath = System.Configuration.ConfigurationManager.AppSettings["AttPath"].ToString();
        //完整路径
        string strResultPath = mastPath + "\\SignImg\\" + Request["user_id"].ToString() + ".jpg";

        objSign.MARK_PATH = strResultPath;

        string strid = Exist(Request["user_id"]);

        if (strid.Length > 0)
        {
            //设置ID
            //umuv.ID = strid;
            objSign.ID = strid;

            if (new TRptSignatureLogic().Edit(objSign))
            {
                WriteLog("编辑印章", "", LogInfo.UserInfo.USER_NAME + "编辑印章" + objSign.ID);
                LigerDialogAlert("印章编辑成功", "success");
                UploadAtt(strResultPath);
            }
            else
            {
                LigerDialogAlert("印章编辑失败", "error");
            }
        }
        else
        {
            //umuv.USER_ID = this.user_id.Value;
            objSign.USER_NAME = Request["user_id"];
            objSign.MARK_NAME = this.MARK_NAME.Text.Trim();
            objSign.ADD_TIME  = DateTime.Now.ToString("yyyy-MM-dd");
            objSign.ADD_USER  = LogInfo.UserInfo.REAL_NAME;
            objSign.ID        = GetSerialNumber("Sign_Id");

            if (new TRptSignatureLogic().Create(objSign))
            {
                WriteLog("添加印章", "", LogInfo.UserInfo.USER_NAME + "添加印章" + objSign.ID);
                LigerDialogAlert("印章新增成功", "success");
            }
            else
            {
                LigerDialogAlert("印章新增失败", "error");
            }
        }
    }