Пример #1
0
        /// <summary>
        /// 进行单据锁定
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="col1name"></param>
        /// <param name="col1"></param>
        /// <param name="col2name"></param>
        /// <param name="col2"></param>
        /// <param name="idname"></param>
        /// <param name="ID"></param>
        /// <returns></returns>
        public static bool setAudiorApprover(string tableName, string col1name, string col1, string col2name, string col2, string idname, int ID)
        {
            string sql = "UPDATE " + tableName + " set " + col1name + "='" + col1 + "'," + col2name + "='" + col2 + "' where " + idname + "=" + ID;

            if (YKDataClass.SqlCommand(sql) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 锁定与解锁
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="pkName">主键名</param>
        /// <param name="pkValue">主键值</param>
        /// <param name="Auditor">锁定人</param>
        /// <param name="AorU">1为锁定,-1为解锁</param>
        /// <returns></returns>
        public static int AuditAndUnAudit(string tableName, string pkName, int pkValue, string Auditor, int AorU)
        {
            string sql = "";

            if (AorU == 1)
            {
                sql = "UPDATE " + tableName + " SET Locker =  '" + Auditor + "' ,LockDate = GETDATE()  WHERE " + pkName + " = " + pkValue.ToString();
            }
            else if (AorU == -1)
            {
                sql = "UPDATE " + tableName + " SET Locker =  '' ,LockDate = '1900-1-1'  WHERE " + pkName + " = " + pkValue.ToString();
            }
            return(YKDataClass.SqlCommand(sql));
        }
Пример #3
0
        /// <summary>
        /// 设置某行数据无效
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="validFieldName">是否有效的字段名</param>
        /// <param name="fieldName">主键字段名</param>
        /// <param name="fieldValue">主键值</param>
        /// <returns></returns>
        public static int SetRowUnValid(string tableName, string validFieldName, bool ifTrueOrFalse, string fieldName, string fieldValue)
        {
            string sql = " update " + tableName + " set " + validFieldName + "=" + ifTrueOrFalse.CompareTo(false) + " where " + fieldName + "='" + fieldValue + "'";

            return(YKDataClass.SqlCommand(sql));
        }
Пример #4
0
        /// <summary>
        /// 删除某张表某行
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="fieldName">主键字段名</param>
        /// <param name="fieldValue">主键值</param>
        /// <returns></returns>
        public static int DeleteTableRow(string tableName, string fieldName, string fieldValue)
        {
            string sql = " delete from " + tableName + " where " + fieldName + "='" + fieldValue + "'";

            return(YKDataClass.SqlCommand(sql));
        }