コード例 #1
0
ファイル: MainForm.cs プロジェクト: okamiiiiiiii/DoAn
        public MainForm()
        {
            InitializeComponent();
            DataController.Execute("exec khoitao");
            random = new Random();
            Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
            btnCloseChildForm.Visible = false;

            this.Text       = string.Empty;
            this.ControlBox = false;

            labelName.Text = LoginUser.UserData()["tennv"].ToString();
            labelRole.Text = LoginUser.UserData()["tenchucvu"].ToString();


            string phanquyen = LoginUser.UserData()["machucvu"].ToString();

            if (phanquyen == "1")
            {
                btnBaoCaoThongKe.Visible = false;
                btnQuanLyChi.Visible     = false;
                btnCaiDatThamSo.Visible  = false;
                btnQuanLyHeThong.Visible = false;
                btnQuanLyHocSinh.Visible = false;
                btnQuanLyThu.Visible     = false;
            }

            if (phanquyen == "2")
            {
                btnQuanLyVeAn.Visible = false;
                button2.Visible       = false;
            }

            if (phanquyen == "3")
            {
                btnBaoCaoThongKe.Visible = false;
                btnQuanLyChi.Visible     = false;
                btnCaiDatThamSo.Visible  = false;
                btnQuanLyHeThong.Visible = false;
                btnQuanLyHocSinh.Visible = false;
                btnQuanLyThu.Visible     = false;
                button2.Visible          = false;
                btnQuanLyVeAn.Visible    = false;
            }
            else
            {
                foreach (Control btns in this.Controls)
                {
                    if (btns.GetType() == typeof(Button))
                    {
                        Button btn = (Button)btns;
                        btn.Visible = false;
                    }
                }
            }
        }
コード例 #2
0
ファイル: InBaoCaoDiemDanh.cs プロジェクト: okamiiiiiiii/DoAn
        static private DocX CreateInvoiceFromTemplate(DocX template)
        {
            template.AddCustomProperty(new CustomProperty("Ngay", DateTime.Today.ToString("yyyy-MM-dd")));
            template.AddCustomProperty(new CustomProperty("Lop", "khoi A"));
            template.AddCustomProperty(new CustomProperty("GiaoVien", LoginUser.UserData()["tennv"].ToString()));


            //table
            var t = template.Tables[0];

            CreateAndInsertInvoiceTableAfter(t, ref template);
            t.Remove();
            return(template);
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!addMode)
            {
                addMode = true;

                txt_ten.Enabled  = true;
                txt_tien.Enabled = true;
                cbb_hs.Enabled   = true;
                cbb_type.Enabled = true;

                txt_tien.Clear();
                txt_ten.Clear();
                cbb_hs.SelectedIndex   = -1;
                cbb_type.SelectedIndex = -1;
                btn_HuyThem.Visible    = true;
            }
            else
            {
                if (string.IsNullOrWhiteSpace(txt_ten.Text))
                {
                    MessageBox.Show("Chưa nhập tên phụ thu", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (string.IsNullOrWhiteSpace(txt_tien.Text))
                {
                    MessageBox.Show("Chưa nhập thành tiền tiền", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (cbb_hs.SelectedIndex == -1)
                {
                    MessageBox.Show("Chưa chọn học sinh", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (cbb_type.SelectedIndex == -1)
                {
                    MessageBox.Show("Chưa nhập loại phụ thu", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string mhs    = (cbb_hs.SelectedIndex + 1).ToString();
                    string maloai = (cbb_type.SelectedIndex + 1).ToString();
                    DataController.Execute("insertphuthu N'" +
                                           txt_ten.Text + "' ," +
                                           txt_tien.Text + ", N'" +
                                           LoginUser.UserData()["tennv"] + "', " +
                                           maloai + ", " +
                                           mhs);

                    txt_ten.Enabled  = false;
                    txt_tien.Enabled = false;
                    cbb_hs.Enabled   = false;
                    cbb_type.Enabled = false;

                    txt_ten.Text           = guna2DataGridView1.CurrentRow.Cells[2].Value.ToString();
                    txt_tien.Text          = guna2DataGridView1.CurrentRow.Cells[4].Value.ToString();
                    cbb_hs.SelectedIndex   = int.Parse(guna2DataGridView1.CurrentRow.Cells[1].Value.ToString()) - 1;
                    cbb_type.SelectedIndex = int.Parse(guna2DataGridView1.CurrentRow.Cells[5].Value.ToString()) - 1;

                    guna2DataGridView1.DataSource = DataController.ExecTable("select " +
                                                                             "phuthu.maphuthu," +
                                                                             "hocsinh.mahocsinh, " +
                                                                             "hocsinh.tenhocsinh, " +
                                                                             "phuthu.tenphuthu, " +
                                                                             "phuthu.thanhtien, " +
                                                                             "phuthu.maloai, " +
                                                                             "phuthu.nguoilapkhoanthu " +
                                                                             "from phuthu inner join hocsinh on " +
                                                                             "hocsinh.mahocsinh = phuthu.mahocsinh; ");
                }
            }
        }
コード例 #4
0
        private void btn_Sua_Click(object sender, EventArgs e)
        {
            if (!editMode)
            {
                editMode            = true;
                txt_ten.Enabled     = true;
                txt_tien.Enabled    = true;
                txt_SoLuong.Enabled = true;
            }
            else
            {
                if (string.IsNullOrWhiteSpace(txt_ten.Text))
                {
                    MessageBox.Show("Chưa nhập tên khoản chi", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (string.IsNullOrWhiteSpace(txt_tien.Text))
                {
                    MessageBox.Show("Chưa nhập số tiền", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (string.IsNullOrWhiteSpace(txt_SoLuong.Text))
                {
                    MessageBox.Show("Chưa nhập số lượng", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (cbb_loaikhoanchi.SelectedIndex == -1)
                {
                    MessageBox.Show("Chưa chọn loại khoản chi", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (cbb_type.SelectedIndex == -1)
                {
                    MessageBox.Show("Chưa nhập mã khoản chi", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string mathu1     = guna2DataGridView1.CurrentRow.Cells[0].Value.ToString();
                    string loai       = (cbb_loaikhoanchi.SelectedIndex + 1).ToString();
                    string magiaovien = LoginUser.UserData()["manv"].ToString();

                    DataController.Execute("update tttienchi set " +
                                           "soluong = " + txt_SoLuong.Text +
                                           ", thanhtien = " + txt_tien.Text +
                                           ", tentienchi = N'" + txt_ten.Text + "'" +
                                           "where matttc = " + mathu1);

                    guna2DataGridView1.DataSource = DataController.ExecTable("select " +
                                                                             "matttc, " +
                                                                             "tentienchi, " +
                                                                             "soluong, " +
                                                                             "thanhtien, " +
                                                                             "thoigian, " +
                                                                             "tennv " +
                                                                             "from tttienchi " +
                                                                             "inner join nhanvien on tttienchi.manv = nhanvien.manv");


                    editMode            = false;
                    btn_Sua.Enabled     = true;
                    btn_Xoa.Enabled     = true;
                    btn_HuyThem.Visible = false;

                    txt_ten.Enabled          = false;
                    txt_tien.Enabled         = false;
                    txt_SoLuong.Enabled      = false;
                    cbb_loaikhoanchi.Enabled = false;
                    txt_GhiChu.Enabled       = false;
                    cbb_loaikhoanchi.Enabled = false;
                    cbb_type.Enabled         = false;


                    DataTable dt   = DataController.ExecTable("select * from tttienchi where matttc = " + mathu1);
                    DataRow   data = dt.Rows[0];

                    txt_ten.Text     = data["tentienchi"].ToString();
                    txt_tien.Text    = data["thanhtien"].ToString();
                    txt_SoLuong.Text = data["soluong"].ToString();
                    if (!data.IsNull("manguyenlieu"))
                    {
                        cbb_loaikhoanchi.SelectedIndex = 0;
                        cbb_type.SelectedIndex         = int.Parse(data["manguyenlieu"].ToString()) - 1;
                    }
                    else if (!data.IsNull("mahoclieu"))
                    {
                        cbb_loaikhoanchi.SelectedIndex = 1;
                        cbb_type.SelectedIndex         = int.Parse(data["mahoclieu"].ToString()) - 1;
                    }
                    else if (!data.IsNull("mahdnk"))
                    {
                        cbb_loaikhoanchi.SelectedIndex = 2;
                        cbb_type.SelectedIndex         = int.Parse(data["mahdnk"].ToString()) - 1;
                    }
                }
            }
        }