Beispiel #1
0
        /// <summary>
        /// 根据文档ID修改文档信息
        /// </summary>
        /// <param name="DocM">文档信息</param>
        /// <returns>bool值</returns>
        public static bool UpdateDoc(DocModel DocM)
        {
            try
            {
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("UPDATE officedba.DocInfo set ");
                sql.AppendLine("CompanyCD     =@CompanyCD     ,");
                sql.AppendLine("DocType       =@DocType       ,");
                sql.AppendLine("DocTitle      =@DocTitle      ,");
                sql.AppendLine("UploadUserID  =@UploadUserID  ,");
                sql.AppendLine("DeptID        =@DeptID        ,");
                sql.AppendLine("UploadDate    =@UploadDate    ,");
                sql.AppendLine("DocumentName  =@DocumentName  ,");
                //sql.AppendLine("DocumentType  =@DocumentType  ,");
                sql.AppendLine("DocumentURL   =@DocumentURL   ,");
                sql.AppendLine("ModifiedDate  =@ModifiedDate  ,");
                sql.AppendLine("ModifiedUserID=@ModifiedUserID");
                sql.AppendLine(" WHERE ");
                sql.AppendLine("ID = @ID ");

                SqlParameter[] param = new SqlParameter[11];
                param[0] = SqlHelper.GetParameter("@ID      ", DocM.ID);
                param[1] = SqlHelper.GetParameter("@CompanyCD     ",DocM.CompanyCD     );                
                param[2] = SqlHelper.GetParameter("@DocType       ",DocM.DocType       );
                param[3] = SqlHelper.GetParameter("@DocTitle      ",DocM.DocTitle      );
                param[4] = SqlHelper.GetParameter("@UploadUserID  ",DocM.UploadUserID  );
                param[5] = SqlHelper.GetParameter("@DeptID        ",DocM.DeptID        );               
                param[6] = SqlHelper.GetParameter("@UploadDate", DocM.UploadDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(DocM.UploadDate.ToString()));
                param[7] = SqlHelper.GetParameter("@DocumentName  ",DocM.DocumentName  );
                //param[8] = SqlHelper.GetParameter("@DocumentType  ",DocM.DocumentType  );
                param[8] = SqlHelper.GetParameter("@DocumentURL   ",DocM.DocumentURL   );                
                param[9] = SqlHelper.GetParameter("@ModifiedDate", DocM.ModifiedDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(DocM.ModifiedDate.ToString()));
                param[10] = SqlHelper.GetParameter("@ModifiedUserID",DocM.ModifiedUserID);


                SqlHelper.ExecuteTransSql(sql.ToString(), param);
                return SqlHelper.Result.OprateCount > 0 ? true : false;
            }
            catch
            {
                return false;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 添加文档信息的方法
        /// </summary>
        /// <param name="DocM">文档信息</param>
        /// <returns>被添加文档ID</returns>
        public static int DocAdd(DocModel DocM)
        {
            try
            {
                #region 设置参数
                SqlParameter[] param = new SqlParameter[12];
                param[0] = SqlHelper.GetParameter("@CompanyCD     ",DocM.CompanyCD     );
                param[1] = SqlHelper.GetParameter("@DocumentNo    ",DocM.DocumentNo    );
                param[2] = SqlHelper.GetParameter("@DocType       ",DocM.DocType       );
                param[3] = SqlHelper.GetParameter("@DocTitle      ",DocM.DocTitle      );
                param[4] = SqlHelper.GetParameter("@UploadUserID  ",DocM.UploadUserID  );
                param[5] = SqlHelper.GetParameter("@DeptID        ",DocM.DeptID        );                
                param[6] = SqlHelper.GetParameter("@UploadDate", DocM.UploadDate == null
                                       ? SqlDateTime.Null
                                       : SqlDateTime.Parse(DocM.UploadDate.ToString()));
                param[7] = SqlHelper.GetParameter("@DocumentName  ",DocM.DocumentName  );
                //param[8] = SqlHelper.GetParameter("@DocumentType  ",DocM.DocumentType  );
                param[8] = SqlHelper.GetParameter("@DocumentURL   ",DocM.DocumentURL   );                
                param[9] = SqlHelper.GetParameter("@ModifiedDate", DocM.ModifiedDate == null
                                       ? SqlDateTime.Null
                                       : SqlDateTime.Parse(DocM.ModifiedDate.ToString()));
                param[10] = SqlHelper.GetParameter("@ModifiedUserID",DocM.ModifiedUserID);


                SqlParameter paramid = new SqlParameter("@id", SqlDbType.Int);
                paramid.Direction = ParameterDirection.Output;
                param[11] = paramid;
                #endregion

                //创建命令
                SqlCommand comm = new SqlCommand();
                SqlHelper.ExecuteTransStoredProcedure("officedba.insertDoc", comm, param);
                int DocID = Convert.ToInt32(comm.Parameters["@id"].Value);

                return DocID;
            }
            catch
            {
                return 0;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 根据文档ID修改文档信息
        /// </summary>
        /// <param name="DocM">文档信息</param>
        /// <returns>bool值</returns>
        public static bool UpdateDoc(DocModel DocM)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            LogInfoModel logModel = new LogInfoModel(); //操作日志
            bool isSucc = false;//定义返回变量

            #region 设置操作日志内容
            //设置公司代码
            logModel.CompanyCD = userInfo.CompanyCD;
            //设置登陆用户ID
            logModel.UserID = userInfo.UserID;
            //设置模块ID 模块ID在ConstUtil中定义,以便维护
            logModel.ModuleID = ConstUtil.MODULE_ID_DOC_LIST;
            //操作单据编号  编号
            logModel.ObjectID = DocM.DocumentNo;
            //操作对象 操作的表信息
            logModel.ObjectName = ConstUtil.TABLE_NAME_DOC;
            //涉及关键元素 涉及其他业务、表关系
            logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
            //备注 操作类型
            logModel.Remark = ConstUtil.LOG_PROCESS_UPDATE;
            #endregion

            try
            {
                isSucc = DocDBHelper.UpdateDoc(DocM);
            }
            catch (System.Exception ex)
            {
                #region  操作失败时记录日志到文件
                //定义变量
                LogInfo logSys = new LogInfo();
                //设置日志类型 需要指定为系统日志
                logSys.Type = LogInfo.LogType.SYSTEM;
                //指定系统日志类型 出错信息
                logSys.SystemKind = LogInfo.SystemLogKind.SYSTEM_ERROR;
                //指定登陆用户信息
                logSys.UserInfo = userInfo;
                //设定模块ID
                logSys.ModuleID = ConstUtil.MODULE_ID_DOC_LIST;
                //描述
                logSys.Description = ex.ToString();
                //输出日志
                LogUtil.WriteLog(logSys);
                #endregion
            }

            if (isSucc)//操作成功
            {
                logModel.Remark += "成功";
            }
            else//操作失败
            {
                logModel.Remark += "失败";
            }

            //记录日志
            LogDBHelper.InsertLog(logModel);

            return isSucc;
        }
Beispiel #4
0
 /// <summary>
 /// 导出文档列表
 /// </summary>
 /// <param name="DocM"></param>
 /// <param name="FileDateBegin"></param>
 /// <param name="FileDateEnd"></param>
 /// <param name="ord"></param>
 /// <returns></returns>
 public static DataTable ExportDoc(DocModel DocM, string FileDateBegin, string FileDateEnd, string ord)
 {
     return DocDBHelper.ExportDoc(DocM, FileDateBegin, FileDateEnd, ord);
 }
Beispiel #5
0
 /// <summary>
 /// 根据条件检索文档信息
 /// </summary>
 /// <param name="DocM">文档信息</param>
 /// <param name="FileDateBegin">开始时间</param>
 /// <param name="FileDateEnd">结束时间</param>       
 /// <returns>文档列表信息</returns>
 public static DataTable GetDocBycondition(DocModel DocM, string FileDateBegin, string FileDateEnd, int pageIndex, int pageCount, string ord, ref int totalCount)
 {
     return DocDBHelper.GetDocBycondition(DocM, FileDateBegin, FileDateEnd, pageIndex, pageCount, ord, ref totalCount);
 }
Beispiel #6
0
        /// <summary>
        /// 导出文档列表
        /// </summary>
        /// <param name="DocM"></param>
        /// <param name="FileDateBegin"></param>
        /// <param name="FileDateEnd"></param>
        /// <param name="ord"></param>
        /// <returns></returns>
        public static DataTable ExportDoc(DocModel DocM, string FileDateBegin, string FileDateEnd, string ord)
        {
            try
            {
                #region sql语句
                string sql = "select" +
                       " di.ID,di.DocumentNo,di.DocumentName,cd.CodeName,isnull(ei.EmployeeName,'') EmployeeName," +
                       " isnull(CONVERT(varchar(100), di.UploadDate, 23),'') UploadDate," +
                       " di.DocumentURL" +
                   " from " +
                       " officedba.DocInfo di" +
                   " left join officedba.CodeDocType cd" +
                   " on cd.id = di.DocType" +
                   " left join officedba.EmployeeInfo ei" +
                   " on ei.id = di.UploadUserID" +
                   " where" +
                   " di.CompanyCD = '" + DocM.CompanyCD + "'";

                if (DocM.DocTitle != "")
                    sql += " and di.DocTitle like '%" + DocM.DocTitle + "%'";
                if (DocM.UploadUserID != 0)
                    sql += " and di.UploadUserID = " + DocM.UploadUserID + "";
                if (DocM.DocType != 0)
                    sql += " and di.DocType = " + DocM.DocType + "";
                if (FileDateBegin != "")
                    sql += " and di.UploadDate >= '" + FileDateBegin + "'";
                if (FileDateEnd != "")
                    sql += " and di.UploadDate <= '" + FileDateEnd + "'";

                #endregion

                return SqlHelper.ExecuteSql(sql);
            }
            catch
            {
                return null;
            }
        }
Beispiel #7
0
        /// <summary>
        /// 根据条件检索文档信息
        /// </summary>
        /// <param name="DocM">文档信息</param>
        /// <param name="FileDateBegin">开始时间</param>
        /// <param name="FileDateEnd">结束时间</param>       
        /// <returns>文档列表信息</returns>
        public static DataTable GetDocBycondition(DocModel DocM, string FileDateBegin, string FileDateEnd, int pageIndex, int pageCount, string ord, ref int TotalCount)
        {
            try
            {
                #region sql语句
                string sql = "select" +
                       " di.ID,di.DocumentNo,di.DocumentName,cd.CodeName,isnull(ei.EmployeeName,'') EmployeeName," +
                       " isnull(CONVERT(varchar(100), di.UploadDate, 23),'') UploadDate," +
                       " di.DocumentURL" +
                   " from " +
                       " officedba.DocInfo di" +
                   " left join officedba.CodeDocType cd" +
                   " on cd.id = di.DocType" +
                   " left join officedba.EmployeeInfo ei" +
                   " on ei.id = di.UploadUserID" +
                   " where" +
                   " di.CompanyCD = '" + DocM.CompanyCD + "'";   
                            
                if (DocM.DocTitle != "")
                    sql += " and di.DocTitle like '%" + DocM.DocTitle + "%'";
                if (DocM.UploadUserID != 0)
                    sql += " and di.UploadUserID = " + DocM.UploadUserID + "";
                if (DocM.DocType != 0)
                    sql += " and di.DocType = " + DocM.DocType + "";
                if (FileDateBegin != "")
                    sql += " and di.UploadDate >= '" + FileDateBegin + "'";
                if (FileDateEnd != "")
                    sql += " and di.UploadDate <= '" + FileDateEnd + "'";

                #endregion

                //return SqlHelper.ExecuteSql(sql);
                return SqlHelper.CreateSqlByPageExcuteSql(sql.ToString(), pageIndex, pageCount, ord, null, ref TotalCount);
            }
            catch
            {
                return null;
            }
        }