private void splBtnDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = XtraMessageBox.Show("Bạn có chắc chắn muốn xoá nhà cung cấp " + txtEdtName.Text + " hay không?",
                                                      "THÔNG BÁO!",
                                                      MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                if (txtEdtID.Text != "")
                {
                    supplier.ID            = txtEdtID.Text;
                    dgvSupplier.DataSource = supplierBLL.Delete(supplier);
                    ClearData();
                    GetAll();

                    XtraMessageBox.Show("Đã xoá thông tin nhà cung cấp " + supplier.Name, "THÔNG BÁO!",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    XtraMessageBox.Show("Vui lòng chọn thông tin nhà cung cấp cần xoá", "THÔNG BÁO!",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemplo n.º 2
0
        private void dgv_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                string   productID = dgv.Rows[e.RowIndex].Cells[1].Value.ToString();
                Supplier ob        = supBLL.GetSupplierWithID(productID);
                if (ob != null)
                {
                    txtSupplierId.Text = ob.SupplierId;
                    txtName.Text       = ob.SupplierName;
                    txtEmail.Text      = ob.SupplierEmail;
                    txtAddress.Text    = ob.SupplierAddress;
                    txtSite.Text       = ob.SupplierWebsite;
                    txtPhone.Text      = ob.SupplierPhone;
                }

                //// Xóa
                if (e.ColumnIndex == 7)
                {
                    if (CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("KhoaNv"),
                                                                         Common.clsLanguages.GetResource("Information"),
                                                                         Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                         Common.Config.CUSTOM_MESSAGEBOX_BUTTON.YESNO) == DialogResult.Yes)
                    {
                        int Xoa = supBLL.Delete(productID);
                        if (Xoa == 1) // xóa thành côg
                        {
                            CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("KhoaTCong"),
                                                                             Common.clsLanguages.GetResource("Information"),
                                                                             Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                             Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                            dgv.Rows.RemoveAt(e.RowIndex);
                            foreach (Control c in this.pInput.Controls)
                            {
                                if (c is TextBox)
                                {
                                    ((TextBox)c).Text = String.Empty;
                                }
                                if (c is RichTextBox)
                                {
                                    ((RichTextBox)c).Text = String.Empty;
                                }
                                if (c is ComboBox)
                                {
                                    ((ComboBox)c).SelectedIndex = 0;
                                }
                                if (c is CheckBox)
                                {
                                    ((CheckBox)c).Checked = false;
                                }
                                lblTB1.Text = "...";
                                lblTB.Text  = "...";
                            }
                            DanhLaiSTT();
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void button4_Click(object sender, EventArgs e)
        {
            emp.SupplierID = empID;
            emp.Delete();

            MessageBox.Show("Delete Record Successful!");
            ResetControls();
        }
Exemplo n.º 4
0
        private void btnSupplierDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Tem certeza que deseja excluir?", "", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                Supplier supplier = CreateSupplier();
                supplier.ID = Convert.ToInt32(lblID.Text);

                Response response = _supplierBLL.Delete(supplier);
                MessageBox.Show(response.Message);
                if (response.Success)
                {
                    this.ClearForm();
                    UpdateGrid();
                    UpdateComponentsRegister();
                }
            }
        }
Exemplo n.º 5
0
 public void Delete()
 {
     using (var reader = new System.IO.StreamReader(Context.Request.InputStream))
     {
         string data = reader.ReadToEnd();
         if (!ValidateUtil.isBlank(data))
         {
             var mIds = data.DeSerializeFromJson <List <string> >();
             if (mIds != null && mIds.Count > 0)
             {
                 bool rst = bll.Delete(mIds.ToArray());
                 if (rst)
                 {
                     Context.Response.WriteJson(ResultCode.Success, null, null);
                     return;
                 }
             }
         }
     }
     Context.Response.WriteJson(ResultCode.Failure, "删除失败", null);
 }
Exemplo n.º 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (op == Operation.Insert)
                {
                    foreach (Control c in gbInfo.Controls)
                    {
                        if (c is TextBox && c.Text == "")
                        {
                            MessageBox.Show("请输入所有值!");
                            c.Focus();
                            return;
                        }
                    }
                    s              = new Supplier();
                    s.SupplierID   = txtSupplierID.Text.Trim();
                    s.SupplierName = txtSupplierName.Text.Trim();
                    s.SpellingCode = txtSpellingCode.Text.Trim();
                    s.Address      = txtAddress.Text.Trim();
                    s.ZipCode      = txtZipCode.Text.Trim();
                    s.Tel          = txtTel.Text.Trim();
                    s.Fax          = txtFax.Text.Trim();
                    s.BankName     = txtBankName.Text.Trim();
                    s.BankAccount  = txtBankAccount.Text.Trim();
                    s.Contacter    = txtContacter.Text.Trim();
                    s.Email        = txtEmail.Text.Trim();

                    if (sBLL.Insert(s))
                    {
                        MessageBox.Show("新增成功!");
                        BindData();
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (list[i].SupplierID == s.SupplierID)
                            {
                                dgSupplierInfo.Rows[i].Selected = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("新增失败!");
                    }
                }
                else if (op == Operation.Update)
                {
                    if (s == null)
                    {
                        MessageBox.Show("请选择要修改的记录!");
                        return;
                    }
                    s.SupplierName = txtSupplierName.Text.Trim();
                    s.SpellingCode = txtSpellingCode.Text.Trim();
                    s.Address      = txtAddress.Text.Trim();
                    s.ZipCode      = txtZipCode.Text.Trim();
                    s.Tel          = txtTel.Text.Trim();
                    s.Fax          = txtFax.Text.Trim();
                    s.BankName     = txtBankName.Text.Trim();
                    s.BankAccount  = txtBankAccount.Text.Trim();
                    s.Contacter    = txtContacter.Text.Trim();
                    s.Email        = txtEmail.Text.Trim();

                    if (sBLL.Update(s))
                    {
                        MessageBox.Show("修改成功!");
                        BindData();
                        dgSupplierInfo.Rows[currentIndex].Selected = true;
                    }
                    else
                    {
                        MessageBox.Show("修改失败!");
                    }
                }
                else if (op == Operation.Delete)
                {
                    if (s == null)
                    {
                        MessageBox.Show("请选择要删除的记录!");
                        return;
                    }

                    if (sBLL.Delete(s))
                    {
                        MessageBox.Show("删除成功!");
                        BindData();
                        s = null;
                    }
                    else
                    {
                        MessageBox.Show("删除失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     supllierBLL.Delete(suppliers);
 }
Exemplo n.º 8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (op == Operation.INSERT)   //新增按钮被点击
            {
                //判断是否输入了所有的值
                foreach (Control col in gbInfo.Controls)
                {
                    if (col is TextBox && col.Text == "")
                    {
                        MessageBox.Show("请输入所有的值", "提示");
                        return;
                    }
                }

                s.SupplierContact = new ContactInfo();
                //获取参数
                s.SupplierID                   = txtSupplierID.Text.Trim();
                s.SupplierContact.Name         = txtSupplierName.Text.Trim();
                s.SupplierContact.SpellingCode = txtSpellingCode.Text.Trim();
                s.SupplierContact.ZipCode      = txtSupplierZipCode.Text.Trim();
                s.SupplierContact.Address      = txtSupplierAddress.Text.Trim();
                s.SupplierContact.Tel          = txtSupplierTel.Text.Trim();
                s.SupplierContact.Fax          = txtSupplierFax.Text.Trim();
                s.SupplierContact.BankName     = txtSupplierBankName.Text.Trim();
                s.SupplierContact.BankAccount  = txtSupplierBankAccount.Text.Trim();
                s.SupplierContact.Contacter    = txtContacter.Text.Trim();
                s.SupplierContact.Email        = txtSupplierEmail.Text.Trim();

                try
                {
                    //判断执行是否成功(新增)
                    if (supplierBLL.Insert(s))
                    {
                        MessageBox.Show("新增成功!", "提示");

                        //清空控件的文本
                        foreach (Control col in gbInfo.Controls)
                        {
                            if (col is TextBox)
                            {
                                ((TextBox)col).Text = string.Empty;
                            }
                        }

                        BindDateGridView();                         //调用填充方法 重新填充DateGridView的数据(刷新结果)
                        dgSupplierInfo.CurrentRow.Selected = false; //取消行的选中状态(第一行)

                        for (int i = 0; i < list.Count; i++)        //新增的当前行被选中
                        {
                            if (list[i].SupplierID == s.SupplierID)
                            {
                                dgSupplierInfo.Rows[i].Selected = true;
                                //自动跳转到查找到的行
                                dgSupplierInfo.FirstDisplayedScrollingRowIndex = i;
                                break;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("新增失败!", "提示");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else if (op == Operation.UPDATE)   //修改按钮被点击
            {
                if (s == null)
                {
                    MessageBox.Show("请选择要修改的数据!", "提示");
                }

                s.SupplierContact = new ContactInfo();
                //获取参数
                s.SupplierID                   = txtSupplierID.Text.Trim();
                s.SupplierContact.Name         = txtSupplierName.Text.Trim();
                s.SupplierContact.SpellingCode = txtSpellingCode.Text.Trim();
                s.SupplierContact.ZipCode      = txtSupplierZipCode.Text.Trim();
                s.SupplierContact.Address      = txtSupplierAddress.Text.Trim();
                s.SupplierContact.Tel          = txtSupplierTel.Text.Trim();
                s.SupplierContact.Fax          = txtSupplierFax.Text.Trim();
                s.SupplierContact.BankName     = txtSupplierBankName.Text.Trim();
                s.SupplierContact.BankAccount  = txtSupplierBankAccount.Text.Trim();
                s.SupplierContact.Contacter    = txtContacter.Text.Trim();
                s.SupplierContact.Email        = txtSupplierEmail.Text.Trim();

                try
                {
                    //判断执行是否成功(更新)
                    if (supplierBLL.Update(s))
                    {
                        MessageBox.Show("更新成功!", "提示");
                        BindDateGridView();                                     //重新填充ateGridView (刷新结果)
                        dgSupplierInfo.CurrentRow.Selected             = false; //取消行的选中状态(第一行)
                        dgSupplierInfo.Rows[currentRowsIndex].Selected = true;  //将当前被更新的行进行反蓝色显示
                        //自动跳转到查找到的行
                        dgSupplierInfo.FirstDisplayedScrollingRowIndex = currentRowsIndex;
                    }
                    else
                    {
                        MessageBox.Show("更新失败!", "提示");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else if (op == Operation.DELETE)   //删除按钮被点击
            {
                if (s == null)
                {
                    MessageBox.Show("请选择要删除的数据!", "提示");
                }

                //弹出是否确认删除的对话框
                DialogResult result = MessageBox.Show("您是否真的要删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    try
                    {
                        if (supplierBLL.Delete(s))
                        {
                            MessageBox.Show("删除成功", "提示");
                            BindDateGridView();
                            dgSupplierInfo.CurrentRow.Selected = false;   //取消行的选中状态(第一行)

                            //清空控件的文本
                            foreach (Control col in gbInfo.Controls)
                            {
                                if (col is TextBox)
                                {
                                    ((TextBox)col).Text = string.Empty;
                                }
                            }
                            //直接初始化 当前窗口
                            btnNewAdd.Enabled = btnModify.Enabled = btnDelete.Enabled = true;
                            gbInfo.Visible    = false;
                        }
                        else
                        {
                            MessageBox.Show("删除失败!", "提示");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
            }
        }