/// <summary>
        /// 插入文档信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
       public static bool InsertThreeCodeInfo(CodeReasonFeeModel model, string TableName)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            if (model == null)
                return false;
            //登陆日志
            try
            {
                bool succ = false;
                LogInfoModel logModel = InitLogInfo(model.CodeName,TableName);
                logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
                succ = CodeReasonFeeDBHelper.InsertThreeCodeInfo(model, TableName);
                if (!succ)
                    logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
                else
                    logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
                LogDBHelper.InsertLog(logModel);
                return succ;
            }
            catch (Exception ex)
            {
                WriteSystemLog(userInfo, ex,TableName);
                return false;
            }

        }
        /// <summary>
        /// 插入原因分类|费用分类|计量单位代码信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool InsertThreeCodeInfo(CodeReasonFeeModel model, string TabelName)
        {
            SqlParameter[] param = null;
            //SQL拼写
            string sql = "";

            if (TabelName == "officedba.CodeReasonType")
            {
                sql = "Insert into " + TabelName + "(CompanyCD,CodeName,Flag,Description,UsedStatus,ModifiedDate,ModifiedUserID)" +
                                   "values(@CompanyCD,@CodeName,@Flag,@Description,@UsedStatus,@ModifiedDate,@ModifiedUserID)";
                param = new SqlParameter[7];
            }
            if (TabelName == "officedba.CodeFeeType")
            {
                sql = "Insert into " + TabelName + "(CompanyCD,CodeName,FeeSubjectsNo,Flag,Description,UsedStatus,ModifiedDate,ModifiedUserID)" +
                                   "values(@CompanyCD,@CodeName,@FeeSubjectsNo,@Flag,@Description,@UsedStatus,@ModifiedDate,@ModifiedUserID)";
                param = new SqlParameter[8];
            }
            else if (TabelName == "officedba.CodeUnitType")
            {
                param = new SqlParameter[8];
                sql = "Insert into officedba.CodeUnitType(CompanyCD,CodeName,Flag,Description,UsedStatus,CodeSymbol,ModifiedDate,ModifiedUserID)" +
                                                 "values(@CompanyCD,@CodeName,@Flag,@Description,@UsedStatus,@CodeSymbol,@ModifiedDate,@ModifiedUserID)";
            }
            param[0] = SqlHelper.GetParameter("@CompanyCD", model.CompanyCD);
            param[1] = SqlHelper.GetParameter("@CodeName", model.CodeName);
            param[2] = SqlHelper.GetParameter("@Flag", model.Flag);
            param[3] = SqlHelper.GetParameter("@Description", model.Description);
            param[4] = SqlHelper.GetParameter("@UsedStatus", model.UsedStatus);
            param[5] = SqlHelper.GetParameter("@ModifiedDate", model.ModifiedDate);
            param[6] = SqlHelper.GetParameter("@ModifiedUserID", model.ModifiedUserID);
            if (TabelName == "officedba.CodeFeeType")
            {
                param[7] = SqlHelper.GetParameter("@FeeSubjectsNo", model.FeeSubjectsNo);
            }
            if (TabelName == "officedba.CodeUnitType")
            {
                param[7] = SqlHelper.GetParameter("@CodeSymbol", model.CodeSymbol);
            }
            //创建命令
            SqlHelper.ExecuteTransSql(sql.ToString(), param);
            return SqlHelper.Result.OprateCount > 0 ? true : false;
        }
        /// <summary>
        /// 根据ID获取信息
        /// </summary>
        /// <returns></returns>
        public static CodeReasonFeeModel GetThreeCodeById(int id, string TableName)
        {
            CodeReasonFeeModel model = new CodeReasonFeeModel();
            string sql = "select * from " + TableName + " where id=@id ";
            SqlParameter[] param = new SqlParameter[1];
            param[0] = SqlHelper.GetParameter("@id", id);
            DataTable dt = SqlHelper.ExecuteSql(sql, param);

            DataRow data = dt.Rows[0];
            if (dt.Rows.Count > 0)
            {
                model.CodeName = GetSafeData.ValidateDataRow_String(data, "CodeName");
                model.ModifiedDate = GetSafeData.ValidateDataRow_DateTime(data, "ModifiedDate");
                model.UsedStatus = GetSafeData.ValidateDataRow_String(data, "UsedStatus");
                model.ModifiedUserID = GetSafeData.ValidateDataRow_String(data, "ModifiedUserID");
                model.Flag = GetSafeData.ValidateDataRow_Int(data, "Flag");
                model.CompanyCD = GetSafeData.ValidateDataRow_String(data, "CompanyCD");
                model.Description = GetSafeData.ValidateDataRow_String(data, "Description");
                if (TableName == "officedba.CodeUnitType")// 往来单位
                    model.CodeSymbol = GetSafeData.ValidateDataRow_String(data, "CodeSymbol");
                return model;
            }
            else
            {
                return null;
            }
        }
        /// <summary>
        /// 修改原因分类|费用分类|计量单位代码信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool UpdateThreeCodeInfo(CodeReasonFeeModel model, string TableName)
        {
            StringBuilder sql = new StringBuilder();
            SqlParameter[] param = null;
            if (TableName == "officedba.CodeReasonType")// 往来单位
            {
                sql.AppendLine("uPDATE  " + TableName + "");
                sql.AppendLine("  SET CompanyCD =@CompanyCD                      ");
                sql.AppendLine("     ,CodeName =@CodeName                      ");
                sql.AppendLine("     ,Flag =@Flag                      ");
                sql.AppendLine("     ,Description =@Description                      ");
                sql.AppendLine("     ,UsedStatus =@UsedStatus                   ");
                sql.AppendLine("     ,ModifiedDate =@ModifiedDate                  ");
                sql.AppendLine("     ,ModifiedUserID =@ModifiedUserID                ");
                sql.AppendLine("WHERE  ID=@ID                               ");
                param = new SqlParameter[8];
                //设置参数

            }
            if (TableName == "officedba.CodeFeeType")// 往来单位
            {
                sql.AppendLine("uPDATE  " + TableName + "");
                sql.AppendLine("  SET CompanyCD =@CompanyCD                      ");
                sql.AppendLine("     ,CodeName =@CodeName                      ");
                sql.AppendLine("     ,FeeSubjectsNo =@FeeSubjectsNo                      ");
                sql.AppendLine("     ,Flag =@Flag                      ");
                sql.AppendLine("     ,Description =@Description                      ");
                sql.AppendLine("     ,UsedStatus =@UsedStatus                   ");
                sql.AppendLine("     ,ModifiedDate =@ModifiedDate                  ");
                sql.AppendLine("     ,ModifiedUserID =@ModifiedUserID                ");
                sql.AppendLine("WHERE  ID=@ID                               ");
                param = new SqlParameter[9];
                //设置参数

            }
            else if (TableName == "officedba.CodeUnitType")
            {
                sql.AppendLine("uPDATE  officedba.CodeUnitType");
                sql.AppendLine("  SET CompanyCD =@CompanyCD                      ");
                sql.AppendLine("     ,CodeName =@CodeName                      ");
                sql.AppendLine("     ,Flag =@Flag                      ");
                sql.AppendLine("     ,Description =@Description                      ");
                sql.AppendLine("     ,UsedStatus =@UsedStatus                   ");
                sql.AppendLine("     ,CodeSymbol =@CodeSymbol                   ");
                sql.AppendLine("     ,ModifiedDate =@ModifiedDate                  ");
                sql.AppendLine("     ,ModifiedUserID =@ModifiedUserID                ");
                sql.AppendLine("WHERE  ID=@ID                               ");
                param = new SqlParameter[9];
                //设置参数
            }
            param[0] = SqlHelper.GetParameter("@CompanyCD", model.CompanyCD);
            param[1] = SqlHelper.GetParameter("@CodeName", model.CodeName);
            param[2] = SqlHelper.GetParameter("@Flag", model.Flag);
            param[3] = SqlHelper.GetParameter("@Description", model.Description);
            param[4] = SqlHelper.GetParameter("@UsedStatus", model.UsedStatus);
            param[5] = SqlHelper.GetParameter("@ModifiedDate", model.ModifiedDate);
            param[6] = SqlHelper.GetParameter("@ModifiedUserID", model.ModifiedUserID);
            param[7] = SqlHelper.GetParameter("@ID", model.ID);
            if (TableName == "officedba.CodeUnitType")
            {
                param[8] = SqlHelper.GetParameter("@CodeSymbol", model.CodeSymbol);
            }
            if (TableName == "officedba.CodeFeeType")
            {
                param[8] = SqlHelper.GetParameter("@FeeSubjectsNo", model.FeeSubjectsNo);
            }
            SqlHelper.ExecuteTransSql(sql.ToString(), param);
            return SqlHelper.Result.OprateCount > 0 ? true : false;

        }