예제 #1
0
        /// <summary>
        /// DataTable的行转成发票信息类
        /// </summary>
        /// <param name="dr">DataRow DataTable的一行</param>
        /// <returns>返回发票信息类的对象实例</returns>
        private InvoiceInfo RowToinvoiceInfo(DataRow dr)
        {
            InvoiceInfo invoiceInfo = new InvoiceInfo();

            invoiceInfo.Id             = Convert.ToInt32(dr["id"]);
            invoiceInfo.Invoicecode    = dr["invoicecode"].ToString();
            invoiceInfo.Invoicenumber  = dr["invoicenumber"].ToString();
            invoiceInfo.Date           = dr["date"].ToString();
            invoiceInfo.Buyersid       = Convert.ToInt32(dr["buyersid"]);
            invoiceInfo.Productname    = dr["productname"].ToString();
            invoiceInfo.Productnumber  = Convert.ToInt32(dr["productnumber"]);
            invoiceInfo.Unitprice      = dr["unitprice"].ToString();
            invoiceInfo.Money          = dr["money"].ToString();
            invoiceInfo.Taxrate        = dr["taxrate"].ToString();
            invoiceInfo.Taxamount      = dr["taxamount"].ToString();
            invoiceInfo.Totalamount    = dr["totalamount"].ToString();
            invoiceInfo.Totaltaxamount = dr["totaltaxamount"].ToString();
            invoiceInfo.Moneyupper     = dr["moneyupper"].ToString();
            invoiceInfo.Moneylow       = dr["moneylow"].ToString();
            invoiceInfo.Sellersid      = Convert.ToInt32(dr["sellersid"]);
            invoiceInfo.Comment        = dr["comment"].ToString();
            invoiceInfo.Payee          = dr["payee"].ToString();
            invoiceInfo.Check          = dr["check"].ToString();
            invoiceInfo.Drawer         = dr["drawer"].ToString();
            invoiceInfo.Invoicestate   = dr["invoicestate"].ToString();
            invoiceInfo.Returnmoney    = dr["returnmoney"].ToString();
            return(invoiceInfo);
        }
예제 #2
0
        public int AddInvoiceInfo(InvoiceInfo invoiceInfo)
        {
            String sql = "INSERT INTO invoiceinfo VALUES(@invoicecode, @invoicenumber, @date, @buyersid, @productname,@productnumber, @unitprice, @money, " +
                         "@taxrate, @taxamount, @totalamount, @totaltaxamount, @moneyupper, @moneylow, @sellersid, @comment, @payee, @check, @drawer, " +
                         "@invoicestate, @returnmoney, @flag) ";

            return(AddAndUpdateInvoiceInfo(1, sql, invoiceInfo));
        }
예제 #3
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()));
        }
예제 #4
0
        /// <summary>
        /// 新增或修改多条语句 参数配置
        /// </summary>
        /// <param name="tmp"></param>
        /// <param name="invoiceInfo"></param>
        /// <returns></returns>
        private List <SQLiteParameter> AddAndUpdateParameter(int tmp, 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),
                new SQLiteParameter("@flag",           invoiceInfo.Flag),
            };
            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(list);
        }