Пример #1
0
        /// <summary>
        /// 添加收文信息的方法
        /// </summary>
        /// <param name="DocReceiveM">收文信息</param>
        /// <returns>被添加收文ID</returns>
        public static int DocReceiveAdd(DocReceiveModel DocReceiveM)
        {
            try
            {
                #region 设置参数
                SqlParameter[] param = new SqlParameter[25];
                param[0] = SqlHelper.GetParameter("@CompanyCD       ",DocReceiveM.CompanyCD       ); 
                param[1] = SqlHelper.GetParameter("@ReceiveDocNo    ",DocReceiveM.ReceiveDocNo    );
                param[2] = SqlHelper.GetParameter("@ReceiveDocTypeID",DocReceiveM.ReceiveDocTypeID);
                param[3] = SqlHelper.GetParameter("@SecretLevel     ",DocReceiveM.SecretLevel     );
                param[4] = SqlHelper.GetParameter("@Critical        ",DocReceiveM.Critical        );
                param[5] = SqlHelper.GetParameter("@FileDate", DocReceiveM.FileDate == null
                                       ? SqlDateTime.Null
                                       : SqlDateTime.Parse(DocReceiveM.FileDate.ToString()));
                param[6] = SqlHelper.GetParameter("@FileNo          ",DocReceiveM.FileNo          );
                param[7] = SqlHelper.GetParameter("@FileCompany     ",DocReceiveM.FileCompany     );
                param[8] = SqlHelper.GetParameter("@FileTitle       ",DocReceiveM.FileTitle       );
                param[9] = SqlHelper.GetParameter("@FileReason      ",DocReceiveM.FileReason      );
                param[10] = SqlHelper.GetParameter("@KeyWord         ",DocReceiveM.KeyWord         );
                param[11] = SqlHelper.GetParameter("@Description     ",DocReceiveM.Description     );
                param[12] = SqlHelper.GetParameter("@DeptID          ",DocReceiveM.DeptID          );
                param[13] = SqlHelper.GetParameter("@BackerNo        ",DocReceiveM.BackerNo        );
                param[14] = SqlHelper.GetParameter("@Backer          ",DocReceiveM.Backer          );
                param[15] = SqlHelper.GetParameter("@BackDate", DocReceiveM.BackDate == null
                                       ? SqlDateTime.Null
                                       : SqlDateTime.Parse(DocReceiveM.BackDate.ToString()));
                param[16] = SqlHelper.GetParameter("@BackContent     ",DocReceiveM.BackContent     );
                param[17] = SqlHelper.GetParameter("@Remark          ",DocReceiveM.Remark          );
                param[18] = SqlHelper.GetParameter("@RegisterUserID  ",DocReceiveM.RegisterUserID  );                
                param[19] = SqlHelper.GetParameter("@UploadDate", DocReceiveM.UploadDate == null
                                       ? SqlDateTime.Null
                                       : SqlDateTime.Parse(DocReceiveM.UploadDate.ToString()));
                param[20] = SqlHelper.GetParameter("@DocumentName    ",DocReceiveM.DocumentName    );
                param[21] = SqlHelper.GetParameter("@DocumentURL     ",DocReceiveM.DocumentURL     );                
                param[22] = SqlHelper.GetParameter("@ModifiedDate", DocReceiveM.ModifiedDate == null
                                       ? SqlDateTime.Null
                                       : SqlDateTime.Parse(DocReceiveM.ModifiedDate.ToString()));
                param[23] = SqlHelper.GetParameter("@ModifiedUserID  ",DocReceiveM.ModifiedUserID  );

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

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

                return DocReceiveID;
            }
            catch
            {
                return 0;
            }
        }
Пример #2
0
        /// <summary>
        /// 根据收文ID修改收文信息
        /// </summary>
        /// <param name="DocReceiveM">收文信息</param>
        /// <returns>bool值</returns>
        public static bool UpdateDocReceive(DocReceiveModel DocReceiveM)
        {
            try
            {
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("UPDATE officedba.DocReceiveInfo set ");
                sql.AppendLine("CompanyCD       =@CompanyCD       ,");
                //sql.AppendLine("ReceiveDocNo    =@ReceiveDocNo    ,");
                sql.AppendLine("ReceiveDocTypeID=@ReceiveDocTypeID,");
                sql.AppendLine("SecretLevel     =@SecretLevel     ,");
                sql.AppendLine("Critical        =@Critical        ,");
                sql.AppendLine("FileDate        =@FileDate        ,");
                sql.AppendLine("FileNo          =@FileNo          ,");
                sql.AppendLine("FileCompany     =@FileCompany     ,");
                sql.AppendLine("FileTitle       =@FileTitle       ,");
                sql.AppendLine("FileReason      =@FileReason      ,");
                sql.AppendLine("KeyWord         =@KeyWord         ,");
                sql.AppendLine("Description     =@Description     ,");
                sql.AppendLine("DeptID          =@DeptID          ,");
                sql.AppendLine("BackerNo        =@BackerNo        ,");
                sql.AppendLine("Backer          =@Backer          ,");
                sql.AppendLine("BackDate        =@BackDate        ,");
                sql.AppendLine("BackContent     =@BackContent     ,");
                sql.AppendLine("Remark          =@Remark          ,");
                sql.AppendLine("RegisterUserID  =@RegisterUserID  ,");
                sql.AppendLine("UploadDate      =@UploadDate      ,");
                sql.AppendLine("DocumentName    =@DocumentName    ,");
                sql.AppendLine("DocumentURL     =@DocumentURL     ,");
                sql.AppendLine("ModifiedDate    =@ModifiedDate    ,");
                sql.AppendLine("ModifiedUserID  =@ModifiedUserID   ");
                sql.AppendLine(" WHERE ");
                sql.AppendLine("ID = @ID ");

                SqlParameter[] param = new SqlParameter[24];
                param[0] = SqlHelper.GetParameter("@ID      ", DocReceiveM.ID);
                param[1] = SqlHelper.GetParameter("@CompanyCD       ",DocReceiveM.CompanyCD       );
                param[2] = SqlHelper.GetParameter("@ReceiveDocTypeID",DocReceiveM.ReceiveDocTypeID);
                param[3] = SqlHelper.GetParameter("@SecretLevel     ",DocReceiveM.SecretLevel     );
                param[4] = SqlHelper.GetParameter("@Critical        ",DocReceiveM.Critical        );

                //param[5] = SqlHelper.GetParameter("@FileDate        ",DocReceiveM.FileDate        );
                param[5] = SqlHelper.GetParameter("@FileDate", DocReceiveM.FileDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(DocReceiveM.FileDate.ToString()));
                param[6] = SqlHelper.GetParameter("@FileNo          ",DocReceiveM.FileNo          );
                param[7] = SqlHelper.GetParameter("@FileCompany     ",DocReceiveM.FileCompany     );
                param[8] = SqlHelper.GetParameter("@FileTitle       ",DocReceiveM.FileTitle       );
                param[9] = SqlHelper.GetParameter("@FileReason      ",DocReceiveM.FileReason      );
                param[10] = SqlHelper.GetParameter("@KeyWord         ",DocReceiveM.KeyWord         );
                param[11] = SqlHelper.GetParameter("@Description     ",DocReceiveM.Description     );
                param[12] = SqlHelper.GetParameter("@DeptID          ",DocReceiveM.DeptID          );
                param[13] = SqlHelper.GetParameter("@BackerNo        ",DocReceiveM.BackerNo        );
                param[14] = SqlHelper.GetParameter("@Backer          ",DocReceiveM.Backer          );

                //param[15] = SqlHelper.GetParameter("@BackDate        ",DocReceiveM.BackDate        );
                param[15] = SqlHelper.GetParameter("@BackDate", DocReceiveM.BackDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(DocReceiveM.BackDate.ToString()));

                param[16] = SqlHelper.GetParameter("@BackContent     ",DocReceiveM.BackContent     );
                param[17] = SqlHelper.GetParameter("@Remark          ",DocReceiveM.Remark          );
                param[18] = SqlHelper.GetParameter("@RegisterUserID  ",DocReceiveM.RegisterUserID  );
                //param[19] = SqlHelper.GetParameter("@UploadDate      ",DocReceiveM.UploadDate      );
                param[19] = SqlHelper.GetParameter("@UploadDate", DocReceiveM.UploadDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(DocReceiveM.UploadDate.ToString()));

                param[20] = SqlHelper.GetParameter("@DocumentName    ",DocReceiveM.DocumentName    );
                param[21] = SqlHelper.GetParameter("@DocumentURL     ",DocReceiveM.DocumentURL     );
                //param[22] = SqlHelper.GetParameter("@ModifiedDate    ",DocReceiveM.ModifiedDate    );
                param[22] = SqlHelper.GetParameter("@ModifiedDate", DocReceiveM.ModifiedDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(DocReceiveM.ModifiedDate.ToString()));
                param[23] = SqlHelper.GetParameter("@ModifiedUserID  ",DocReceiveM.ModifiedUserID  );

                SqlHelper.ExecuteTransSql(sql.ToString(), param);
                return SqlHelper.Result.OprateCount > 0 ? true : false;
            }
            catch
            {
                return false;
            }
        }
Пример #3
0
        /// <summary>
        /// 导出收文列表
        /// </summary>
        /// <param name="DocReceiveM"></param>
        /// <param name="FileDateBegin"></param>
        /// <param name="FileDateEnd"></param>
        /// <param name="FileCompany"></param>
        /// <param name="ord"></param>
        /// <returns></returns>
        public static DataTable ExportDocReceive(DocReceiveModel DocReceiveM, string FileDateBegin, string FileDateEnd, string FileCompany, string ord)
        {
            try
            {
                #region sql语句
                string sql = "select " +
                                   " dr.id,dr.ReceiveDocNo,cp.TypeName,CONVERT(varchar(100), dr.FileDate, 23) FileDate," +
                                   " dr.FileNo,dr.FileCompany DeptName,dr.FileTitle,"+
                                   " (case dr.SecretLevel when '1' then '一般' when '2' then '不公开' when '3' then '秘密' when '4' then '机密' when '5' then '绝密' end)SecretLevel,"+
                                   "(case dr.Critical when '1' then '特提' when '2' then '特急' when '3' then '加急' when '4' then '平急' end) Critical" +
                               " from " +
                                   " officedba.DocReceiveInfo dr,officedba.CodePublicType cp" +
                               " where" +
                                   " dr.CompanyCD = '" + DocReceiveM.CompanyCD + "'" +
                               " and cp.id = dr.ReceiveDocTypeID";
                if (DocReceiveM.FileNo != "")
                    sql += " and dr.FileNo like '%" + DocReceiveM.FileNo + "%'";
                if (DocReceiveM.ReceiveDocTypeID != 0)
                    sql += " and dr.ReceiveDocTypeID = " + DocReceiveM.ReceiveDocTypeID + "";
                if (DocReceiveM.Critical != "0")
                    sql += " and dr.Critical = '" + DocReceiveM.Critical + "'";
                if (FileDateBegin.ToString() != "")
                    sql += " and dr.FileDate >= '" + FileDateBegin.ToString() + "'";
                if (FileDateEnd.ToString() != "")
                    sql += " and dr.FileDate <= '" + FileDateEnd.ToString() + "'";
                if (FileCompany != "")
                    sql += " and dr.FileCompany like '%" + FileCompany + "%'";
                if (DocReceiveM.SecretLevel != "0")
                    sql += " and dr.SecretLevel = '" + DocReceiveM.SecretLevel + "'";

                #endregion

                return SqlHelper.ExecuteSql(sql);
            }
            catch
            {
                return null;
            }
        }
Пример #4
0
        /// <summary>
        /// 根据条件检索收文信息
        /// </summary>
        /// <param name="DocReceiveM">收文信息</param>
        /// <param name="FileDateBegin">开始时间</param>
        /// <param name="FileDateEnd">结束时间</param>
        /// <param name="FileCompany">来文单位</param>
        /// <returns>收文列表信息</returns>
        public static DataTable GetDocReceiveBycondition(DocReceiveModel DocReceiveM, string FileDateBegin, string FileDateEnd, string FileCompany, int pageIndex, int pageCount, string ord, ref int TotalCount)
        {
            try
            {
                #region sql语句
                string sql = "select " +
                                   " dr.id,dr.ReceiveDocNo,cp.TypeName,CONVERT(varchar(100), dr.FileDate, 23) FileDate," +
                                   " dr.FileNo,dr.FileCompany DeptName,dr.FileTitle,dr.SecretLevel,dr.Critical" +
                               " from " +
                                   " officedba.DocReceiveInfo dr,officedba.CodePublicType cp" +
                               " where" +
                                   " dr.CompanyCD = '" + DocReceiveM.CompanyCD + "'" +
                               " and cp.id = dr.ReceiveDocTypeID";                              
                if (DocReceiveM.FileNo != "")
                    sql += " and dr.FileNo like '%" + DocReceiveM.FileNo + "%'";
                if (DocReceiveM.ReceiveDocTypeID != 0)
                    sql += " and dr.ReceiveDocTypeID = " + DocReceiveM.ReceiveDocTypeID + "";
                if (DocReceiveM.Critical != "0")
                    sql += " and dr.Critical = '" + DocReceiveM.Critical + "'";
                if (FileDateBegin.ToString() != "")
                    sql += " and dr.FileDate >= '" + FileDateBegin.ToString() + "'";
                if (FileDateEnd.ToString() != "")
                    sql += " and dr.FileDate <= '" + FileDateEnd.ToString() + "'";
                if (FileCompany != "")
                    sql += " and dr.FileCompany like '%" + FileCompany + "%'";
                if (DocReceiveM.SecretLevel != "0")
                    sql += " and dr.SecretLevel = '" + DocReceiveM.SecretLevel + "'";

                #endregion

                //return SqlHelper.ExecuteSql(sql);
                return SqlHelper.CreateSqlByPageExcuteSql(sql.ToString(), pageIndex, pageCount, ord, null, ref TotalCount);
            }
            catch
            {
                return null;
            }
        }
Пример #5
0
        /// <summary>
        /// 根据收文ID修改收文信息
        /// </summary>
        /// <param name="DocReceiveM">收文信息</param>
        /// <returns>bool值</returns>
        public static bool UpdateDocReceive(DocReceiveModel DocReceiveM)
        {
            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_DOCRECEIVE_LIST;
            //操作单据编号  编号
            logModel.ObjectID = DocReceiveM.ReceiveDocNo;
            //操作对象 操作的表信息
            logModel.ObjectName = ConstUtil.TABLE_NAME_DOCRECEIVE;
            //涉及关键元素 涉及其他业务、表关系
            logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
            //备注 操作类型
            logModel.Remark = ConstUtil.LOG_PROCESS_UPDATE;
            #endregion

            try
            {
                isSucc = DocReceiveDBHelper.UpdateDocReceive(DocReceiveM);
            }
            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_DOCRECEIVE_LIST;
                //描述
                logSys.Description = ex.ToString();
                //输出日志
                LogUtil.WriteLog(logSys);
                #endregion
            }

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

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

            return isSucc;
        }
Пример #6
0
 /// <summary>
 /// 导出收文列表
 /// </summary>
 /// <param name="DocReceiveM"></param>
 /// <param name="FileDateBegin"></param>
 /// <param name="FileDateEnd"></param>
 /// <param name="FileCompany"></param>
 /// <param name="ord"></param>
 /// <returns></returns>
 public static DataTable ExportDocReceive(DocReceiveModel DocReceiveM, string FileDateBegin, string FileDateEnd, string FileCompany, string ord)
 {
     return DocReceiveDBHelper.ExportDocReceive(DocReceiveM, FileDateBegin, FileDateEnd, FileCompany, ord);
 }
Пример #7
0
 /// <summary>
 /// 根据条件检索收文信息
 /// </summary>
 /// <param name="DocReceiveM">收文信息</param>
 /// <param name="FileDateBegin">开始时间</param>
 /// <param name="FileDateEnd">结束时间</param>
 /// <param name="FileCompany">来文单位</param>
 /// <returns>收文列表信息</returns>
 public static DataTable GetDocReceiveBycondition(DocReceiveModel DocReceiveM, string FileDateBegin, string FileDateEnd, string FileCompany, int pageIndex, int pageCount, string ord, ref int totalCount)
 {
     return DocReceiveDBHelper.GetDocReceiveBycondition(DocReceiveM, FileDateBegin, FileDateEnd, FileCompany, pageIndex, pageCount, ord, ref totalCount);
 }