コード例 #1
0
ファイル: FrmAddToCart.cs プロジェクト: L10Messi10/APCPOS
        private async Task XGenInvoice()
        {
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql                   = "Select * from tbl_Transaction";
            Sqlcmd.CommandText       = Strsql;
            Sqlcmd.Connection        = Cnn;
            Sqladapter.SelectCommand = Sqlcmd;
            DataTable sqlDt = new DataTable();

            sqlDt.Reset();
            Sqladapter.Fill(sqlDt);
            Sqlreader = Sqlcmd.ExecuteReader();
            if (Sqlreader.Read())
            {
                var count = Convert.ToDouble(sqlDt.Rows.Count.ToString());
                var xRi   = Convert.ToDouble(1 + count);
                inv_num = $"{Now.Year}{xRi}";
            }
            else
            {
                inv_num = $"{Now.Year}{1}";
            }
            Sqlcmd.Dispose();
            Strsql = "";
            Cnn.Close();
        }
コード例 #2
0
ファイル: FrmAddToCart.cs プロジェクト: L10Messi10/APCPOS
        private async Task XTransaction()
        {
            Sqlcmd.Parameters.Clear();
            await Conopen();

            Strsql                   = "Select * from tbl_Transaction where Inv_Num like '" + inv_num + "'";
            Sqlcmd.CommandText       = Strsql;
            Sqlcmd.Connection        = Cnn;
            Sqladapter.SelectCommand = Sqlcmd;
            DataTable sqlDt = new DataTable();

            sqlDt.Reset();
            Sqladapter.Fill(sqlDt);
            Sqlreader = Sqlcmd.ExecuteReader();
            //**************************************************
            if (!Sqlreader.Read())
            {
                await XSaveTransaction();
                await XSaveTransactionDetails();
            }
            else
            {
                await XSaveTransactionDetails();
            }

            var a     = new T_Message();
            var frmok = new Frm_OK();

            a.Show(this);
            frmok.titletxt.Text = @"Success";
            frmok.msgtxt.Text   =
                @"Item successfully added to cart!";
            frmok.OkDescription = "Success";
            frmok.ShowDialog(this);
            a.Hide();
            //popup.TitleText = @"Success";
            //popup.Image = Properties.Resources.check;
            //popup.ContentText = @"The product "+ lblprodname.Text + " has been successfully added to cart!";
            //popup.Popup();
            Sqlcmd.Dispose();
            Strsql = "";
            Cnn.Close();
            TranNum  = inv_num;
            FillCart = true;
            Hide();
        }