Exemple #1
0
        /// <summary>
        /// 新增或修改一条语句 参数配置
        /// </summary>
        /// <param name="tmp">1--新增 2--修改</param>
        /// <param name="sql">sql语句</param>
        /// <param name="invoiceInfo"></param>
        /// <returns></returns>
        private int AddAndUpdateInvoiceInfo(int tmp, string sql, InvoiceInfo invoiceInfo)
        {
            SQLiteParameter[] sqLiteParameter =
            {
                new SQLiteParameter("@invoicecode",    invoiceInfo.Invoicecode),
                new SQLiteParameter("@invoicenumber",  invoiceInfo.Invoicenumber),
                new SQLiteParameter("@date",           invoiceInfo.Date),
                new SQLiteParameter("@buyersid",       invoiceInfo.Buyersid),
                new SQLiteParameter("@productname",    invoiceInfo.Productname),
                new SQLiteParameter("@productnumber",  invoiceInfo.Productnumber),
                new SQLiteParameter("@unitprice",      invoiceInfo.Unitprice),
                new SQLiteParameter("@money",          invoiceInfo.Money),
                new SQLiteParameter("@taxrate",        invoiceInfo.Taxrate),
                new SQLiteParameter("@taxamount",      invoiceInfo.Taxamount),
                new SQLiteParameter("@totalamount",    invoiceInfo.Totalamount),
                new SQLiteParameter("@totaltaxamount", invoiceInfo.Totaltaxamount),
                new SQLiteParameter("@moneyupper",     invoiceInfo.Moneyupper),
                new SQLiteParameter("@moneylow",       invoiceInfo.Moneylow),
                new SQLiteParameter("@sellersid",      invoiceInfo.Sellersid),
                new SQLiteParameter("@comment",        invoiceInfo.Comment),
                new SQLiteParameter("@payee",          invoiceInfo.Payee),
                new SQLiteParameter("@check",          invoiceInfo.Check),
                new SQLiteParameter("@drawer",         invoiceInfo.Drawer),
                new SQLiteParameter("@invoicestate",   invoiceInfo.Invoicestate),
                new SQLiteParameter("@returnmoney",    invoiceInfo.Returnmoney),
            };

            List <SQLiteParameter> list = new List <SQLiteParameter>();

            list.AddRange(sqLiteParameter);

            if (tmp == 1)
            {
                list.Add(new SQLiteParameter("@id", "NULL"));
            }
            else if (tmp == 2)
            {
                list.Add(new SQLiteParameter("@id", invoiceInfo.Id));
            }

            return(SqliteConn.ExecuteNonQuery(sql, list.ToArray()));
        }
Exemple #2
0
        /// <summary>
        /// 删除一条发票信息
        /// </summary>
        /// <param name="tableName">数据库表名</param>
        /// <param name="dgvRow">DataGridViewRow</param>
        /// <returns>返回影响行数 </returns>
        public int DeleteSingleInfo(string tableName, DataGridViewRow dgvRow)
        {
            string sql = "UPDATE " + tableName + " SET flag = '1' WHERE invoicenumber = '" + dgvRow.Cells["invoicenumber"].Value.ToString() + "'";

            return(SqliteConn.ExecuteNonQuery(sql));
        }