// Token: 0x06000055 RID: 85 RVA: 0x000091E0 File Offset: 0x000073E0
        private void btnThem_Click(object sender, EventArgs e)
        {
            foreach (object obj in Application.OpenForms)
            {
                Form form = (Form)obj;
                bool flag = form is frmLoaiSanPham;
                if (flag)
                {
                    form.Show();
                    return;
                }
            }
            frmLoaiSanPham frmLoaiSanPham = new frmLoaiSanPham(string.Empty, string.Empty, 1, 0);

            frmLoaiSanPham.Show();
        }
示例#2
0
        // Token: 0x060000BF RID: 191 RVA: 0x00011FC8 File Offset: 0x000101C8
        private void btnThemMoi_Click(object sender, EventArgs e)
        {
            foreach (object obj in Application.OpenForms)
            {
                Form form = (Form)obj;
                bool flag = form is frmLoaiSanPham;
                if (flag)
                {
                    form.ShowDialog();
                    bool flag2 = File.Exists(CMConstant.strFilePathLoaiSanPham) && !string.IsNullOrEmpty(CMConstant.strFilePathLoaiSanPham);
                    if (flag2)
                    {
                        this.lstLoaiSanPham = this.readwriteData2CSV.ReadLoaiSanPhamFromCSV(CMConstant.strFilePathLoaiSanPham);
                    }
                    bool flag3 = this.lstViewDanhMuc.Items.Count > 0;
                    if (flag3)
                    {
                        this.lstViewDanhMuc.Items.Clear();
                    }
                    foreach (LoaiSanPham loaiSanPham in this.lstLoaiSanPham)
                    {
                        this.lstViewDanhMuc.Items.Add(loaiSanPham.strTenLoaiSanPham, 0);
                    }
                    return;
                }
            }
            frmLoaiSanPham frmLoaiSanPham = new frmLoaiSanPham(string.Empty, string.Empty, 1, 0);

            frmLoaiSanPham.ShowDialog();
            bool flag4 = File.Exists(CMConstant.strFilePathLoaiSanPham) && !string.IsNullOrEmpty(CMConstant.strFilePathLoaiSanPham);

            if (flag4)
            {
                this.lstLoaiSanPham = this.readwriteData2CSV.ReadLoaiSanPhamFromCSV(CMConstant.strFilePathLoaiSanPham);
            }
            bool flag5 = this.lstViewDanhMuc.Items.Count > 0;

            if (flag5)
            {
                this.lstViewDanhMuc.Items.Clear();
            }
            foreach (LoaiSanPham loaiSanPham2 in this.lstLoaiSanPham)
            {
                this.lstViewDanhMuc.Items.Add(loaiSanPham2.strTenLoaiSanPham, 0);
            }
        }
示例#3
0
        // Token: 0x060000C5 RID: 197 RVA: 0x000123D0 File Offset: 0x000105D0
        private bool SuaLoaiSanPham()
        {
            foreach (object obj in Application.OpenForms)
            {
                Form form = (Form)obj;
                bool flag = form is frmLoaiSanPham;
                if (flag)
                {
                    form.ShowDialog();
                    bool flag2 = File.Exists(CMConstant.strFilePathLoaiSanPham) && !string.IsNullOrEmpty(CMConstant.strFilePathLoaiSanPham);
                    if (flag2)
                    {
                        this.lstLoaiSanPham = this.readwriteData2CSV.ReadLoaiSanPhamFromCSV(CMConstant.strFilePathLoaiSanPham);
                    }
                    bool flag3 = this.lstViewDanhMuc.Items.Count > 0;
                    if (flag3)
                    {
                        this.lstViewDanhMuc.Items.Clear();
                    }
                    foreach (LoaiSanPham loaiSanPham in this.lstLoaiSanPham)
                    {
                        this.lstViewDanhMuc.Items.Add(loaiSanPham.strTenLoaiSanPham, 0);
                    }
                    return(false);
                }
            }
            ListViewItem listViewItem = new ListViewItem();
            bool         flag4        = this.lstViewDanhMuc.SelectedItems.Count > 0;
            bool         result;

            if (flag4)
            {
                listViewItem = this.lstViewDanhMuc.SelectedItems[0];
                bool flag5 = File.Exists(CMConstant.strFilePathLoaiSanPham) && !string.IsNullOrEmpty(CMConstant.strFilePathLoaiSanPham);
                if (flag5)
                {
                    this.lstLoaiSanPham = this.readwriteData2CSV.ReadLoaiSanPhamFromCSV(CMConstant.strFilePathLoaiSanPham);
                }
                string strloaisanpham = string.Empty;
                string strghichu      = string.Empty;
                foreach (LoaiSanPham loaiSanPham2 in this.lstLoaiSanPham)
                {
                    bool flag6 = listViewItem.Text.Equals(loaiSanPham2.strTenLoaiSanPham);
                    if (flag6)
                    {
                        strloaisanpham = loaiSanPham2.strTenLoaiSanPham;
                        strghichu      = loaiSanPham2.strGhiChu;
                        break;
                    }
                }
                frmLoaiSanPham frmLoaiSanPham = new frmLoaiSanPham(strloaisanpham, strghichu, 2, listViewItem.Index);
                frmLoaiSanPham.ShowDialog();
                bool flag7 = File.Exists(CMConstant.strFilePathLoaiSanPham) && !string.IsNullOrEmpty(CMConstant.strFilePathLoaiSanPham);
                if (flag7)
                {
                    this.lstLoaiSanPham = this.readwriteData2CSV.ReadLoaiSanPhamFromCSV(CMConstant.strFilePathLoaiSanPham);
                }
                bool flag8 = this.lstViewDanhMuc.Items.Count > 0;
                if (flag8)
                {
                    this.lstViewDanhMuc.Items.Clear();
                }
                foreach (LoaiSanPham loaiSanPham3 in this.lstLoaiSanPham)
                {
                    this.lstViewDanhMuc.Items.Add(loaiSanPham3.strTenLoaiSanPham, 0);
                }
                bool flag9 = this.lstViewDanhMuc.SelectedItems.Count == 0;
                if (flag9)
                {
                    this.btnSua.Enabled = false;
                    this.btnXoa.Enabled = false;
                }
                result = true;
            }
            else
            {
                this.funCommon.Msg("Vui lòng chọn loại sản phẩm để chỉnh sửa.", "Lỗi");
                result = false;
            }
            return(result);
        }