Example #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (Code > -1)
            {
                NCCPTien   nc         = cbbSupplier.SelectedItem as NCCPTien;
                PhuongTien exited     = PhuongTien.Single(Code);
                PhuongTien newVehicle = controls_Load();
                if (txtName.Text != exited.TenPT)
                {
                    if (PhuongTien.FindByTen_NCC(txtName.Text, nc.ID).Count > 0)
                    {
                        MessageBox.Show("This vehicle had been exited!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        btnAdd.Enabled = false;
                        return;
                    }
                }

                int affected = PhuongTien.Update(newVehicle);
                if (affected > 0)
                {
                    MessageBox.Show("Updating is sucessful!", "Kim Nguyễn say:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Updating had been failse!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            NCCPTien exited = NCCPTien.Single(Code);
            NCCPTien newAdd = controls_Load();

            if (exited.TenNCC != newAdd.TenNCC)
            {
                if (NCCPTien.FindByTenNCC(newAdd.TenNCC) != null)
                {
                    MessageBox.Show("This supplier had been exited!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    btnAdd.Enabled = false;
                    return;
                }
            }

            int affected = NCCPTien.Update(newAdd);

            if (affected > 0)
            {
                MessageBox.Show("Updating is successfull!", "Kim Nguyễn say:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("Updating had been failse!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
 private void tvSupplier_Load(NCCPTien supplier)
 {
     tvSupplier.Nodes.Clear();
     tvSupplier.Nodes.Add("Code: " + supplier.ID);
     tvSupplier.Nodes.Add("Company Name: " + supplier.TenNCC);
     tvSupplier.Nodes.Add("Phone Numbers: " + supplier.DienThoai);
     tvSupplier.Nodes.Add("Address: " + supplier.DiaChi);
 }
Example #4
0
        private void controls_LoadUp()
        {
            NCCPTien nc = NCCPTien.Single(Code);

            txtName.Text    = nc.TenNCC;
            txtAddress.Text = nc.DiaChi;
            txtPhone.Text   = nc.DienThoai;
        }
Example #5
0
        private void itemAdd_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e)
        {
            Supplierform frm = new Supplierform();

            frm.ShowDialog();
            if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                lvSuppliers_Load(NCCPTien.All());
            }
        }
Example #6
0
        private void btnNewSupplier_Click(object sender, EventArgs e)
        {
            Supplierform frm = new Supplierform();

            frm.ShowDialog();
            if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                cbbSupplier_Load(NCCPTien.All());
            }
        }
Example #7
0
        private NCCPTien controls_Load()
        {
            NCCPTien result = new NCCPTien();

            result.ID        = Code;
            result.TenNCC    = txtName.Text;
            result.DiaChi    = txtAddress.Text;
            result.DienThoai = txtPhone.Text;
            return(result);
        }
Example #8
0
        private void btnView_Click(object sender, EventArgs e)
        {
            Supplierform frm = new Supplierform();
            NCCPTien     nc  = cbbSupplier.SelectedItem as NCCPTien;

            frm.Code = NCCPTien.Single(nc.ID).ID;
            frm.ShowDialog();
            if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                cbbSupplier_Load();
            }
        }
Example #9
0
 private void Suppliersfrm_Load(object sender, EventArgs e)
 {
     if (Powers == PowersLog.Administrator || Powers == PowersLog.Designer)
     {
         grbManager.Visible = true;
     }
     else
     {
         grbManager.Visible = false;
     }
     cbbFields_Load();
     lvSuppliers_Load(NCCPTien.All());
 }
Example #10
0
 private void itemUpdate_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e)
 {
     if (lvSuppliers.SelectedItems.Count > 0)
     {
         Supplierform frm = new Supplierform();
         frm.Code = MyConvert.ToInt32(lvSuppliers.SelectedItems[0].SubItems[0].Text);
         frm.ShowDialog();
         if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
         {
             lvSuppliers_Load(NCCPTien.All());
         }
     }
 }
Example #11
0
        private PhuongTien controls_Load()
        {
            PhuongTien result = new PhuongTien();

            result.ID            = Code;
            result.TenPT         = txtName.Text;
            result.TienNghi      = txtFacitities.Text;
            result.SoChoToiDa    = MyConvert.ToInt32(txtMxNbr.Text);
            result.SoChoToiThieu = MyConvert.ToInt32(txtMinNbr.Text);
            NCCPTien nc = (NCCPTien)cbbSupplier.SelectedItem;

            result.NhaCungCap = nc.ID;
            return(result);
        }
Example #12
0
 private void Tourfrm_Load(object sender, EventArgs e)
 {
     tvtours_Load(Tour.All());
     listDes    = new List <DiemDen>();
     listScenic = new List <DiemDL>();
     cbbLocal_Load(DiaDiemDL.All());
     cbbSupplier_Load(NCCPTien.All());
     cbbStatus.SelectedIndex = 0;
     if (_ID != 0)
     {
         btnUpdateTour.Enabled = true;
         Controls_LoadUp();
     }
 }
Example #13
0
 private void cbbSupplier_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbbSupplier.SelectedIndex > 0)
     {
         NCCPTien ncc = cbbSupplier.SelectedItem as NCCPTien;
         cbbPhuongTien_Load(PhuongTien.FindByMaNCC(ncc.ID));
     }
     else
     {
         cbbPhuongTien_Load(PhuongTien.All());
     }
     cbbVehical.Text = "";
     tvVehical.Nodes.Clear();
     btnAddDes.Enabled = false;
 }
Example #14
0
 private void lvVehicles_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lvVehicles.SelectedItems.Count > 0)
     {
         lvTours_Load(Tour.FindByVehicleCode(MyConvert.ToInt32(lvVehicles.SelectedItems[0].SubItems[0].Text)));
         trvDestination_Load(DiemDen.FindByMaPT(MyConvert.ToInt32(lvVehicles.SelectedItems[0].SubItems[0].Text)));
         tvSupplier_Load(NCCPTien.FindByVehicleCode(MyConvert.ToInt32(lvVehicles.SelectedItems[0].SubItems[0].Text)));
     }
     else
     {
         lvTours.Items.Clear();
         trvDestination.Nodes.Clear();
         tvSupplier.Nodes.Clear();
     }
 }
Example #15
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            NCCPTien nc = NCCPTien.FindByTenNCC(txtName.Text);

            if (nc != null)
            {
                MessageBox.Show("This supplier had been exited!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                btnAdd.Enabled = false;
                return;
            }
            int affected = NCCPTien.Add(controls_Load());

            if (affected > 0)
            {
                MessageBox.Show("Adding is successful!", "Kim Nguyễn say:", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("Adding had been failse!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #16
0
 private void cbbFields_Load()
 {
     object[] bjs = NCCPTien.ColumnNames();
     cbbFields.Items.AddRange(bjs);
 }
Example #17
0
 private void btnAll_Click(object sender, EventArgs e)
 {
     lvSuppliers_Load(NCCPTien.All());
 }
Example #18
0
 private void txtSearchKey_EditValueChanged(object sender, EventArgs e)
 {
     lvSuppliers_Load(NCCPTien.SearchKeyWords(txtSearchKey.Text));
 }
Example #19
0
 private void cbbFields_SelectedIndexChanged(object sender, EventArgs e)
 {
     lvSuppliers_Load(NCCPTien.SearchFields(cbbFields.SelectedItem.ToString(), txtValueField.Text));
 }
Example #20
0
 private void cbbSupplier_Load()
 {
     cbbSupplier.DataSource    = NCCPTien.All();
     cbbSupplier.DisplayMember = "TenNCC";
     cbbSupplier.ValueMember   = "ID";
 }