/// <summary>
        ///  添加发文信息的方法
        /// </summary>
        /// <param name="DocSendM">发文信息</param>
        /// <returns>发文信息ID</returns>
        public static int DocReceiveAdd(DocSendModel DocSendM)
        {
            try
            {
                #region 设置参数
                SqlParameter[] param = new SqlParameter[27];
                param[0] = SqlHelper.GetParameter("@CompanyCD     ",DocSendM.CompanyCD     ); 
                param[1] = SqlHelper.GetParameter("@DocumentNo    ",DocSendM.DocumentNo    ); 
                param[2] = SqlHelper.GetParameter("@SendDocTypeID ",DocSendM.SendDocTypeID ); 
                param[3] = SqlHelper.GetParameter("@SecretLevel   ",DocSendM.SecretLevel   ); 
                param[4] = SqlHelper.GetParameter("@EmerLevel     ",DocSendM.EmerLevel     ); 
                param[5] = SqlHelper.GetParameter("@SendDeptID    ",DocSendM.SendDeptID    ); 
                param[6] = SqlHelper.GetParameter("@FileNo        ",DocSendM.FileNo        ); 
                param[7] = SqlHelper.GetParameter("@FileTitle     ",DocSendM.FileTitle     );
                param[8] = SqlHelper.GetParameter("@FileDate", DocSendM.FileDate == null
                                      ? SqlDateTime.Null
                                      : SqlDateTime.Parse(DocSendM.FileDate.ToString()));
                param[9] = SqlHelper.GetParameter("@MainSend      ",DocSendM.MainSend      ); 
                param[10] = SqlHelper.GetParameter("@CCSend        ",DocSendM.CCSend        ); 
                param[11] = SqlHelper.GetParameter("@OutCompany    ",DocSendM.OutCompany    ); 
                param[12] = SqlHelper.GetParameter("@KeyWord       ",DocSendM.KeyWord       ); 
                param[13] = SqlHelper.GetParameter("@FileReason    ",DocSendM.FileReason    ); 
                param[14] = SqlHelper.GetParameter("@Description   ",DocSendM.Description   ); 
                param[15] = SqlHelper.GetParameter("@RegisterUserID",DocSendM.RegisterUserID); 
                param[16] = SqlHelper.GetParameter("@Backer        ",DocSendM.Backer        ); 
                param[17] = SqlHelper.GetParameter("@BackerNo      ",DocSendM.BackerNo      ); 
                param[18] = SqlHelper.GetParameter("@BackDate", DocSendM.BackDate == null
                                                     ? SqlDateTime.Null
                                                     : SqlDateTime.Parse(DocSendM.BackDate.ToString()));
                param[19] = SqlHelper.GetParameter("@BackContent   ",DocSendM.BackContent   );
                param[20] = SqlHelper.GetParameter("@UploadDate", DocSendM.UploadDate == null
                                                    ? SqlDateTime.Null
                                                    : SqlDateTime.Parse(DocSendM.UploadDate.ToString()));
                param[21] = SqlHelper.GetParameter("@DocumentName  ",DocSendM.DocumentName  );
                param[22] = SqlHelper.GetParameter("@DocumentURL  ", DocSendM.DocumentURL); 
                param[23] = SqlHelper.GetParameter("@Remark        ",DocSendM.Remark        );
                param[24] = SqlHelper.GetParameter("@ModifiedDate", DocSendM.ModifiedDate == null
                                                    ? SqlDateTime.Null
                                                    : SqlDateTime.Parse(DocSendM.ModifiedDate.ToString()));
                param[25] = SqlHelper.GetParameter("@ModifiedUserID",DocSendM.ModifiedUserID); 


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

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

                return DocReceiveID;
            }
            catch
            {
                return 0;
            }
        }
Example #2
0
        /// <summary>
        /// 根据发文ID修改发文信息
        /// </summary>
        /// <param name="DocSendM">发文信息</param>
        /// <returns>bool值</returns>
        public static bool UpdateDocSend(DocSendModel DocSendM)
        {
            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_DOCSEND_LIST;
            //操作单据编号  编号
            logModel.ObjectID = DocSendM.DocumentNo;
            //操作对象 操作的表信息
            logModel.ObjectName = ConstUtil.TABLE_NAME_DOCSEND;
            //涉及关键元素 涉及其他业务、表关系
            logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
            //备注 操作类型
            logModel.Remark = ConstUtil.LOG_PROCESS_UPDATE;
            #endregion

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

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

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

            return isSucc;
        }
Example #3
0
 /// <summary>
 /// 导出发文列表
 /// </summary>
 /// <param name="DocSendM"></param>
 /// <param name="FileDateBegin"></param>
 /// <param name="FileDateEnd"></param>
 /// <param name="ord"></param>
 /// <returns></returns>
 public static DataTable ExportDocSend(DocSendModel DocSendM, string FileDateBegin, string FileDateEnd, string ord)
 {
     return DocSendDBHelper.ExportDocSend(DocSendM, FileDateBegin, FileDateEnd, ord);
 }
Example #4
0
 /// <summary>
 /// 根据条件检索发文信息
 /// </summary>
 /// <param name="DocReceiveM">发文信息</param>
 /// <param name="FileDateBegin">开始时间</param>
 /// <param name="FileDateEnd">结束时间</param>
 /// <returns>发文列表信息</returns>
 public static DataTable GetDocSendBycondition(DocSendModel DocSendM, string FileDateBegin, string FileDateEnd, int pageIndex, int pageCount, string ord, ref int totalCount)
 {
     return DocSendDBHelper.GetDocSendBycondition(DocSendM, FileDateBegin, FileDateEnd, pageIndex, pageCount, ord, ref totalCount);
 }
        /// <summary>
        /// 根据发文ID修改发文信息
        /// </summary>
        /// <param name="DocSendM">发文信息</param>
        /// <returns>bool值</returns>
        public static bool UpdateDocSend(DocSendModel DocSendM)
        {
            try
            {
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("UPDATE officedba.DocSendInfo set ");
                sql.AppendLine("CompanyCD     = @CompanyCD     ,");
                //sql.AppendLine("DocumentNo    = @DocumentNo    ,");
                sql.AppendLine("SendDocTypeID = @SendDocTypeID ,");
                sql.AppendLine("SecretLevel   = @SecretLevel   ,");
                sql.AppendLine("EmerLevel     = @EmerLevel     ,");
                sql.AppendLine("SendDeptID    = @SendDeptID    ,");
                sql.AppendLine("FileNo        = @FileNo        ,");
                sql.AppendLine("FileTitle     = @FileTitle     ,");
                sql.AppendLine("FileDate      = @FileDate      ,");
                sql.AppendLine("MainSend      = @MainSend      ,");
                sql.AppendLine("CCSend        = @CCSend        ,");
                sql.AppendLine("OutCompany    = @OutCompany    ,");
                sql.AppendLine("KeyWord       = @KeyWord       ,");
                sql.AppendLine("FileReason    = @FileReason    ,");
                sql.AppendLine("Description   = @Description   ,");
                sql.AppendLine("RegisterUserID= @RegisterUserID,");
                sql.AppendLine("Backer        = @Backer        ,");
                sql.AppendLine("BackerNo      = @BackerNo      ,");
                sql.AppendLine("BackDate      = @BackDate      ,");
                sql.AppendLine("BackContent   = @BackContent   ,");
                sql.AppendLine("UploadDate    = @UploadDate    ,");
                sql.AppendLine("DocumentName  = @DocumentName  ,");
                sql.AppendLine("DocumentURL   = @DocumentURL  ,");
                sql.AppendLine("Remark        = @Remark        ,");
                sql.AppendLine("ModifiedDate  = @ModifiedDate  ,");
                sql.AppendLine("ModifiedUserID= @ModifiedUserID");
                sql.AppendLine(" WHERE ");
                sql.AppendLine("ID = @ID ");

                SqlParameter[] param = new SqlParameter[26];
                param[0] = SqlHelper.GetParameter("@ID      ", DocSendM.ID);
                param[1] = SqlHelper.GetParameter("@CompanyCD     ",DocSendM.CompanyCD     );                
                param[2] = SqlHelper.GetParameter("@SendDocTypeID ",DocSendM.SendDocTypeID );
                param[3] = SqlHelper.GetParameter("@SecretLevel   ",DocSendM.SecretLevel   );
                param[4] = SqlHelper.GetParameter("@EmerLevel     ",DocSendM.EmerLevel     );
                param[5] = SqlHelper.GetParameter("@SendDeptID    ",DocSendM.SendDeptID    );
                param[6] = SqlHelper.GetParameter("@FileNo        ",DocSendM.FileNo        );
                param[7] = SqlHelper.GetParameter("@FileTitle     ",DocSendM.FileTitle     );
                param[8] = SqlHelper.GetParameter("@FileDate",DocSendM.FileDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(DocSendM.FileDate.ToString()));
                param[9] = SqlHelper.GetParameter("@MainSend      ",DocSendM.MainSend      );
                param[10] = SqlHelper.GetParameter("@CCSend        ",DocSendM.CCSend        );
                param[11] = SqlHelper.GetParameter("@OutCompany    ",DocSendM.OutCompany    );
                param[12] = SqlHelper.GetParameter("@KeyWord       ",DocSendM.KeyWord       );
                param[13] = SqlHelper.GetParameter("@FileReason    ",DocSendM.FileReason    );
                param[14] = SqlHelper.GetParameter("@Description   ",DocSendM.Description   );
                param[15] = SqlHelper.GetParameter("@RegisterUserID",DocSendM.RegisterUserID);
                param[16] = SqlHelper.GetParameter("@Backer        ",DocSendM.Backer        );
                param[17] = SqlHelper.GetParameter("@BackerNo      ",DocSendM.BackerNo      );                
                param[18] = SqlHelper.GetParameter("@BackDate", DocSendM.BackDate == null
                                        ? SqlDateTime.Null
                                        : SqlDateTime.Parse(DocSendM.BackDate.ToString()));
                param[19] = SqlHelper.GetParameter("@BackContent   ",DocSendM.BackContent   );                
                param[20] = SqlHelper.GetParameter("@UploadDate", DocSendM.UploadDate == null
                                       ? SqlDateTime.Null
                                       : SqlDateTime.Parse(DocSendM.UploadDate.ToString()));
                param[21] = SqlHelper.GetParameter("@DocumentName  ",DocSendM.DocumentName  );
                param[22] = SqlHelper.GetParameter("@DocumentURL  ", DocSendM.DocumentURL);
                param[23] = SqlHelper.GetParameter("@Remark        ",DocSendM.Remark        );                
                param[24] = SqlHelper.GetParameter("@ModifiedDate", DocSendM.ModifiedDate == null
                                      ? SqlDateTime.Null
                                      : SqlDateTime.Parse(DocSendM.ModifiedDate.ToString()));
                param[25] = SqlHelper.GetParameter("@ModifiedUserID",DocSendM.ModifiedUserID);


                SqlHelper.ExecuteTransSql(sql.ToString(), param);
                return SqlHelper.Result.OprateCount > 0 ? true : false;
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 导出发文列表
        /// </summary>
        /// <param name="DocSendM"></param>
        /// <param name="FileDateBegin"></param>
        /// <param name="FileDateEnd"></param>
        /// <param name="ord"></param>
        /// <returns></returns>
        public static DataTable ExportDocSend(DocSendModel DocSendM, string FileDateBegin, string FileDateEnd, string ord)
        {
            try
            {
                #region sql语句
                string sql = "select ds.ID,ds.DocumentNo,cp.TypeName,CONVERT(varchar(100), ds.FileDate, 23) FileDate," +
                                       " di.DeptName,ds.FileNo,ds.FileTitle,(case ds.SecretLevel when '1' then '一般' when '2' then '不公开' when '3' then '秘密' when '4' then '机密' when '5' then '绝密' end)SecretLevel,"+
                                       "(case ds.EmerLevel when '1' then '特提' when '2' then '特急' when '3' then '加急' when '4' then '平急' end) EmerLevel " +
                               " from " +
                                    " officedba.DocSendInfo ds,officedba.CodePublicType cp,officedba.DeptInfo di" +
                               " where" +
                                   " di.id = ds.SendDeptID" +
                               " and" +
                                   " cp.id = ds.SendDocTypeID" +
                               " and ds.CompanyCD = '" + DocSendM.CompanyCD + "'";
                if (DocSendM.KeyWord != "")
                    sql += " and ds.KeyWord like '%" + DocSendM.KeyWord + "%'";
                if (DocSendM.FileTitle != "")
                    sql += " and ds.FileTitle like '%" + DocSendM.FileTitle + "%'";
                if (DocSendM.SendDocTypeID != 0)
                    sql += " and ds.SendDocTypeID = " + DocSendM.SendDocTypeID + "";
                if (DocSendM.SecretLevel != "0")
                    sql += " and ds.SecretLevel = '" + DocSendM.SecretLevel + "'";
                if (DocSendM.EmerLevel != "0")
                    sql += " and ds.EmerLevel = '" + DocSendM.EmerLevel + "'";
                if (FileDateBegin.ToString() != "")
                    sql += " and ds.FileDate >= '" + FileDateBegin.ToString() + "'";
                if (FileDateEnd.ToString() != "")
                    sql += " and ds.FileDate <= '" + FileDateEnd.ToString() + "'";
                #endregion

                return SqlHelper.ExecuteSql(sql);
            }
            catch
            {
                return null;
            }
        }
        /// <summary>
        /// 根据条件检索发文信息
        /// </summary>
        /// <param name="DocReceiveM">发文信息</param>
        /// <param name="FileDateBegin">开始时间</param>
        /// <param name="FileDateEnd">结束时间</param>
        /// <returns>发文列表信息</returns>
        public static DataTable GetDocSendBycondition(DocSendModel DocSendM, string FileDateBegin, string FileDateEnd, int pageIndex, int pageCount, string ord, ref int TotalCount)
        {
            try
            {
                #region sql语句
                string sql = "select ds.ID,ds.DocumentNo,cp.TypeName,CONVERT(varchar(100), ds.FileDate, 23) FileDate," +
                                       " di.DeptName,ds.FileNo,ds.FileTitle,ds.SecretLevel,ds.EmerLevel" +
                               " from " +
                                    " officedba.DocSendInfo ds,officedba.CodePublicType cp,officedba.DeptInfo di" +
                               " where" +
                                   " di.id = ds.SendDeptID" +
                               " and" +
                                   " cp.id = ds.SendDocTypeID" +
                               " and ds.CompanyCD = '" + DocSendM.CompanyCD + "'";
                if (DocSendM.KeyWord != "")
                    sql += " and ds.KeyWord like '%" + DocSendM.KeyWord + "%'";
                if (DocSendM.FileTitle != "")
                    sql += " and ds.FileTitle like '%" + DocSendM.FileTitle + "%'";
                if (DocSendM.SendDocTypeID != 0)
                    sql += " and ds.SendDocTypeID = " + DocSendM.SendDocTypeID + "";
                if (DocSendM.SecretLevel != "0")
                    sql += " and ds.SecretLevel = '" + DocSendM.SecretLevel + "'";
                if (DocSendM.EmerLevel != "0")
                    sql += " and ds.EmerLevel = '" + DocSendM.EmerLevel + "'";
                if (FileDateBegin.ToString() != "")
                    sql += " and ds.FileDate >= '" + FileDateBegin.ToString() + "'";
                if (FileDateEnd.ToString() != "")
                    sql += " and ds.FileDate <= '" + FileDateEnd.ToString() + "'";
                #endregion

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