示例#1
0
        private void btnLuuBaoCao_Click(object sender, EventArgs e)
        {
            string MaBaoCao = tbQuy.Text + tbNam.Text;

            if (BaoCao.TimBaoCao(MaBaoCao) != null)
            {
                MessageBox.Show("Đã có báo cáo này");
            }
            else
            {
                if (tbQuy.Text != "" && tbNam.Text != "" && tbTongDoanhThu.Text != "" && tbTongSoTiec.Text != "" && tbTyLeThanhCong.Text != "" && tbTyLeHuy.Text != "")
                {
                    DTO_BaoCao DTO_BaoCao = new DTO_BaoCao(MaBaoCao, int.Parse(tbQuy.Text), int.Parse(tbNam.Text), int.Parse(tbTongDoanhThu.Text), int.Parse(tbTongSoTiec.Text), float.Parse(tbTyLeThanhCong.Text), float.Parse(tbTyLeHuy.Text));
                    if (BaoCao.insertBaoCao(DTO_BaoCao))
                    {
                        MessageBox.Show("Lưu báo cáo thành công.");
                        Reset();
                    }
                    else
                    {
                        MessageBox.Show("Lưu báo cáo không thành công.");
                    }
                }
                else
                {
                    MessageBox.Show("Bạn phải nhấn nút Báo Cáo trước khi lưu.");
                }
            }
        }
示例#2
0
        public bool insertBaoCao(DTO_BaoCao bc)
        {
            SQLiteConnection connect = Db.getConnection();

            connect.Open();

            try
            {
                string        SQL = string.Format("INSERT INTO BaoCao (MaBaoCao, Quy,  Nam, TongThu, TongSoTiecCuoi, TyLeThanhCong, TyLeHuy) VALUES ('{0}', '{1}', {2}, {3}, {4}, {5}, '{6}')", bc.MaBaoCao, bc.Quy, bc.Nam, bc.TongThu, bc.TongSoTiecCuoi, bc.TyLeThanhCong, bc.TyLeHuy);
                SQLiteCommand cmd = new SQLiteCommand(SQL, connect);

                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            catch (Exception e) { }
            finally
            {
                connect.Close();
            }

            return(false);
        }
 public bool insertBaoCao(DTO_BaoCao hd)
 {
     return(BaoCao.insertBaoCao(hd));
 }