private void btnDel_Click(object sender, EventArgs e)
        {
            List <int> list_Dell = new List <int>();

            int[] selectedRows = dgv_Item.GetSelectedRows();

            foreach (int rowHandle in selectedRows)
            {
                if (rowHandle >= 0)
                {
                    object cellValue = dgv_Item.GetRowCellValue(rowHandle, grdcol_IdItem);
                    list_Dell.Add((int)cellValue);
                }
            }
            FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn xóa?");

            formYesNoBox.ShowDialog();
            if (formYesNoBox.GetValue() == 1)
            {
                for (int i = 0; i < list_Dell.Count; ++i)
                {
                    if (BUS_Bill.Instance.DelBill(list_Dell[i]))
                    {
                        LoadBillDetail();
                        FormMessageBox formMessageBox = new FormMessageBox("Xóa thành công!");
                    }
                    else
                    {
                        FormMessageBox form = new FormMessageBox("Xóa thất bại! Vui lòng kiểm tra lại dữ liệu");
                        form.ShowDialog();
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void LoadBinding()
        {
            string Name_Category = cbb_Category.SelectedItem.ToString();
            int    Id_Category   = 0;

            foreach (CBBItem i in cbb_Category.Items)
            {
                if (i.Text == Name_Category)
                {
                    Id_Category = i.Value;
                    break;
                }
            }
            if (BUS_Item.Instance.Show_DAL(Id_Category) != null)
            {
                DeleteBinding();
                //   txt_Id.DataBindings.Add(new Binding("Text", dgv_Item.DataSource, "Id"));
                txt_Name.DataBindings.Add(new Binding("Text", dgv_Item.DataSource, "Name"));
                cbb_CategoryDetail.DataBindings.Add(new Binding("Text", dgv_Item.DataSource, "Name_Category"));
                txt_Price.DataBindings.Add(new Binding("Text", dgv_Item.DataSource, "Price"));
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Lỗi! Nạp dữ liệu thất bại!");
                form.ShowDialog();
                DeleteBinding();
            }
        }
Exemplo n.º 3
0
        private int ShowMessage(int type, string msg, string title = "产品测试")
        {
            if (currentChannel == int.MinValue)
            {
                currentChannel = 1;
            }

            if (currentWavelength == double.MinValue)
            {
                currentWavelength = MeasurementJob.SpecData.WorkInfoSpecItems.FirstOrDefault().TestSetting.CastTo(1550D);
            }

            testInfoCallback?.Invoke(currentWavelength, currentChannel, currentUnit);

            FormMessageBox.SetShow(null, title, msg, type);

            while (FormMessageBox.MessageBoxResult == 0)
            {
                if (IsStop)
                {
                    FormMessageBox.SetClose(2);
                    break;
                }
                GetPower();
                System.Threading.Thread.Sleep(50);
            }
            readingCallback?.Invoke("-", "-", "-");
            if (FormMessageBox.MessageBoxResult == 2)
            {
                IsStop = true;
            }
            return(FormMessageBox.MessageBoxResult);
        }
Exemplo n.º 4
0
        private void btn_Update_Click(object sender, EventArgs e)
        {
            String name_update = txt_Name.Text;
            String Id          = txt_Id.Text;

            if (Id != "")
            {
                FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?");
                formYesNoBox.ShowDialog();
                if (formYesNoBox.GetValue() == 1)
                {
                    if (BUS_Category.Instance.Update_DAL(Convert.ToInt32(Id), name_update))
                    {
                        DeleteBinding();
                        SetView();
                        FormMessageBox form = new FormMessageBox("Cập nhật thành công!");
                        form.ShowDialog();
                    }
                    else
                    {
                        FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu");
                        form.ShowDialog();
                    }
                }
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Vui lòng chọn loại món muốn cập nhật");
                form.ShowDialog();
            }
        }
        private void btn_Update_Click(object sender, EventArgs e)
        {
            String name_update = txt_Name.Text;
            //String Id = txt_Id.Text;
            int Id = (int)dgv_Table.GetRowCellValue(dgv_Table.FocusedRowHandle, grdcol_Id);            // bool status_update = ckb_Status.Checked ? true : false;

            if (Id != -1)
            {
                FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?");
                formYesNoBox.ShowDialog();
                if (formYesNoBox.GetValue() == 1)
                {
                    if (BUS_Table.Instance.UpdateTable(Id, name_update))
                    {
                        DeleteBinding();
                        SetView();
                        FormMessageBox form = new FormMessageBox("Cập nhật thành công!");
                        form.ShowDialog();
                    }
                    else
                    {
                        FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu");
                        form.ShowDialog();
                    }
                }
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Vui lòng chọn bàn ăn muốn cập nhật");
                form.ShowDialog();
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 弹框
        /// </summary>
        /// <param name="type"></param>
        /// <param name="msg"></param>
        /// <param name="title"></param>
        /// <returns></returns>
        private int ShowMessage(int type, string msg, string title = "归零测试")
        {
            if (currentChannel == int.MinValue)
            {
                currentChannel = Channels.FirstOrDefault();
            }
            if (currentWavelength == double.MinValue)
            {
                currentWavelength = Wavelengths.FirstOrDefault();
            }

            testInfoCallback?.Invoke(currentWavelength, currentChannel);

            FormMessageBox.SetShow(refForm, title, msg, type);

            while (FormMessageBox.MessageBoxResult == 0)
            {
                if (IsStop)
                {
                    FormMessageBox.SetClose(2);
                    break;
                }
                var p = MeasurementController.GetMeterAllChannelPower(1, 1);
                readingCallback?.Invoke(string.Join(", ", p.Values.Select(q => q == double.MinValue ? "-" : q.ToString("F2")).ToArray()));
                System.Threading.Thread.Sleep(50);
            }
            readingCallback?.Invoke("-");
            if (FormMessageBox.MessageBoxResult == 2)
            {
                IsStop = true;
            }
            return(FormMessageBox.MessageBoxResult);
        }
Exemplo n.º 7
0
        private void btn_Update_Click(object sender, EventArgs e)
        {
            int      Id              = Id_Employee;
            string   name_Update     = txt_Name.Text;
            DateTime birthday_Update = de_Birthday.DateTime.Date;
            bool     gender_Update   = rbtn_Male.Checked ? true : false;
            string   address_Update  = txt_Address.Text;
            string   phone_Update    = txt_Phone.Text;


            if (name_Update != "")
            {
                FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?");
                formYesNoBox.ShowDialog();
                if (formYesNoBox.GetValue() == 1)
                {
                    if (BUS_Employee.Instance.Update_DAL(Convert.ToInt32(Id), name_Update, birthday_Update, gender_Update, address_Update, phone_Update))
                    {
                        FormMessageBox form = new FormMessageBox("Cập nhật thành công!");
                        form.ShowDialog();
                    }
                    else
                    {
                        FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu");
                        form.ShowDialog();
                    }
                }
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Không thể tải dữ liệu của bạn! Không thể cập nhật");
                form.ShowDialog();
            }
        }
Exemplo n.º 8
0
        private void btn_Search_Click(object sender, EventArgs e)
        {
            string Name_Category = cbb_Category.SelectedItem.ToString();
            string str_Search    = txt_Search.Text.Trim();
            int    Id_Category   = 0;

            foreach (CBBItem i in cbb_Category.Items)
            {
                if (i.Text == Name_Category)
                {
                    Id_Category = i.Value;
                    break;
                }
            }
            if (BUS_Item.Instance.Search_DAL(Id_Category, str_Search) != null)
            {
                DeleteBinding();
                grd_Item.DataSource = BUS_Item.Instance.Search_DAL(Id_Category, str_Search);
            }
            else
            {
                DeleteBinding();
                FormMessageBox form = new FormMessageBox("Dữ liệu tìm kiếm không tồn tại!");
                form.ShowDialog();
            }
        }
Exemplo n.º 9
0
        public void SetCBB()
        {
            if (cbb_Category.Items != null)
            {
                cbb_Category.Items.Clear();
            }
            cbb_Category.Items.Add(new CBBItem {
                Value = 0, Text = "Tất cả"
            });
            List <dynamic> list_Category = BUS_Category.Instance.GetCategory_DAL().ToList();

            if (list_Category != null)
            {
                for (int i = 0; i < list_Category.Count; i++)
                {
                    cbb_Category.Items.Add(new CBBItem
                    {
                        Value = list_Category[i].Id,
                        Text  = list_Category[i].Name
                    });
                    cbb_CategoryDetail.Items.Add(new CBBItem
                    {
                        Value = list_Category[i].Id,
                        Text  = list_Category[i].Name
                    });
                }
                cbb_Category.SelectedIndex = 0;
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Lỗi! Tải dữ liệu loại món thất bại!");
                form.ShowDialog();
            }
        }
Exemplo n.º 10
0
        private void LoadBinding()
        {
            string Name_Type = cbb_TypeAccount.SelectedItem.ToString();
            int    Id_Type   = 0;

            foreach (CBBItem i in cbb_TypeAccount.Items)
            {
                if (i.Text == Name_Type)
                {
                    Id_Type = i.Value;
                    break;
                }
            }
            if (BUS_Account.Instance.Show_DAL(Id_Type) != null)
            {
                DeleteBinding();
                txt_Name.DataBindings.Add(new Binding("Text", dgv_Account.DataSource, "Name"));
                txt_Phone.DataBindings.Add(new Binding("Text", dgv_Account.DataSource, "Phone"));
                txt_Username.DataBindings.Add(new Binding("Text", dgv_Account.DataSource, "Username"));
                cbb_TypeAccountDe.DataBindings.Add(new Binding("Text", dgv_Account.DataSource, "NameType"));
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Lỗi! Nạp dữ liệu tài khoản thất bại!");
                form.ShowDialog();
                DeleteBinding();
            }
        }
Exemplo n.º 11
0
        private void btn_Update_Click(object sender, EventArgs e)
        {
            string  oldpass   = txt_OldPass.Text;
            string  newpass   = txt_NewPass.Text;
            string  againpass = txt_AgainPass.Text;
            Account acc       = new Account();

            acc = BUS_Account.Instance.GetAccountByIdEmployee(Id_Employee);
            byte[]        temp     = ASCIIEncoding.ASCII.GetBytes(oldpass);
            byte[]        hashData = new MD5CryptoServiceProvider().ComputeHash(temp);
            StringBuilder sb       = new StringBuilder();

            for (int i = 0; i < hashData.Length; i++)
            {
                sb.Append(hashData[i].ToString("x2"));
            }
            if (acc != null)
            {
                if (oldpass != "" && newpass != "" && againpass != "")
                {
                    if (sb.ToString() == acc.Password)
                    {
                        if (newpass == againpass)
                        {
                            if (BUS_Account.Instance.ChangePassword(newpass, Id_Employee))
                            {
                                this.Close();
                                FormMessageBox mess = new FormMessageBox("Đổi mật khẩu thành công!");
                                lbl_ChangePass.ResetText();
                                mess.ShowDialog();
                                this.Close();
                            }
                            else
                            {
                                FormMessageBox mess = new FormMessageBox("Lỗi! Thay đổi thất bại!");
                                mess.ShowDialog();
                            }
                        }
                        else
                        {
                            lbl_ChangePass.Text = "Lỗi! Mật khẩu nhập lại khác mật khẩu mới!";
                        }
                    }
                    else
                    {
                        lbl_ChangePass.Text = "Lỗi! Vui lòng kiểm tra lại thông tin bạn nhập!";
                    }
                }
                else
                {
                    lbl_ChangePass.Text = "Lỗi! Bạn phải điền đầy đủ thông tin!";
                }
            }
            else
            {
                FormMessageBox mess = new FormMessageBox("Lỗi! Không thể lấy dữ liệu mật khẩu!");
                mess.ShowDialog();
            }
        }
Exemplo n.º 12
0
        private void btn_Update_Click(object sender, EventArgs e)
        {
            string username = txt_Username.Text;
            // Lôi không có giá, nó tự load lại giá cũ
            int focusedRow = 0;

            try
            {
                focusedRow = dgv_Account.FocusedRowHandle;
            }
            catch { }
            int          IDAccount    = (int)dgv_Account.GetRowCellValue(dgv_Account.FocusedRowHandle, grdcol_Id);
            FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?");

            formYesNoBox.ShowDialog();
            if (formYesNoBox.GetValue() == 1)
            {
                if (BUS_Account.Instance.CheckExistUserName(username))
                {
                    new FormMessageBox("Tên đăng nhập đã tồn tại, vui lòng thử tên khác").ShowDialog();
                }
                else
                {
                    string name      = txt_Name.Text;
                    string phone     = txt_Phone.Text;
                    string name_Type = "";
                    int    Id_Type   = 0;
                    if (cbb_TypeAccountDe.SelectedItem != null)
                    {
                        name_Type = cbb_TypeAccountDe.SelectedItem.ToString();
                    }
                    foreach (CBBItem i in cbb_TypeAccountDe.Items)
                    {
                        if (i.Text == name_Type)
                        {
                            Id_Type = i.Value;
                            break;
                        }
                    }
                    if (BUS_Account.Instance.UpdateAccount(IDAccount, name, phone, username, Id_Type))
                    {
                        DeleteBinding();
                        SetView();
                        FormMessageBox form = new FormMessageBox("Cập nhật thành công!");
                        form.ShowDialog();
                        LoadBinding();
                        dgv_Account.FocusedRowHandle = focusedRow;
                        dgv_Account.SelectRow(focusedRow);
                        dgv_Account.Focus();
                    }
                    else
                    {
                        FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu");
                        form.ShowDialog();
                    }
                }
            }
        }
Exemplo n.º 13
0
        private void ConnectAction()
        {
            if (MeasurementTasks.Count < 1)
            {
                FormMessageBox.SetShow(null, "测试错误", "请至少选择一个产品测试", 4);
                while (!IsStop && FormMessageBox.MessageBoxResult == 0)
                {
                    System.Threading.Thread.Sleep(500);
                }

                IsStop = true;
                return;
            }

            if (Framework.MeasurementSystemSetting.SystemData.Setting.Profile.DuplicationCheckType > 0)
            {
                var c = new ModifyTestInfo();
                foreach (var task in MeasurementTasks)
                {
                    var temp = c.GetLastTestInfo(MeasurementJob.ProductInfo.ProductID, MeasurementJob.StationInfo.StationID, task.TestSN, true);
                    if (temp.Status)
                    {
                        if (temp.Data != null && temp.Data != Guid.Empty)
                        {
                            tipCallback?.Invoke(task.TestOrderID, 2, $"{task.TestSN}重复测试", 0);
                            FormMessageBox.SetShow(null, "重复测试", $"系统检查到 {task.TestSN} 已经测试\r\n请确认SN号码是否重号或者产品多次测试。", 3);
                            while (!IsStop && FormMessageBox.MessageBoxResult == 0)
                            {
                                System.Threading.Thread.Sleep(500);
                            }
                            if (FormMessageBox.MessageBoxResult != 1)
                            {
                                IsStop = true;
                                return;
                            }
                        }
                    }
                }
            }

            if (!MeasurementController.Connect())
            {
                FormMessageBox.SetShow(null, "仪器错误", $"连接仪器失败\r\n{MeasurementController.ErrorString}", 4);
                while (!IsStop && FormMessageBox.MessageBoxResult == 0)
                {
                    System.Threading.Thread.Sleep(500);
                }

                IsStop = true;
                return;
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string str_Search = txtSearch.Text;

            if (BUS_Bill.Instance.Search_DAL(str_Search) != null)
            {
                grd_Item.DataSource = BUS_Bill.Instance.Search_DAL(str_Search);
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Dữ liệu tìm kiếm không tồn tại!");
                form.ShowDialog();
            }
        }
 public void SetView()
 {
     txt_Id.Enabled = false;
     if (BUS_Table.Instance.Show_DAL() != null)
     {
         grd_Table.DataSource = BUS_Table.Instance.Show_DAL();
         LoadBinding();
     }
     else
     {
         FormMessageBox form = new FormMessageBox("Lỗi! Tải dữ liệu bàn ăn thất bại!");
         form.ShowDialog();
     }
 }
Exemplo n.º 16
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            string name_Category = txt_Name.Text;

            if (BUS_Category.Instance.Add_DAL(name_Category))
            {
                SetView();
                FormMessageBox form = new FormMessageBox("Thêm thành công!");
                form.ShowDialog();
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Thêm thất bại! Vui lòng kiểm tra lại dữ liệu");
                form.ShowDialog();
            }
        }
Exemplo n.º 17
0
 public void SetView(int Id_Em)
 {
     if (BUS_Employee.Instance.GetEmployee(Id_Em) != null)
     {
         Employee em = BUS_Employee.Instance.GetEmployee(Id_Em);
         txt_Name.Text         = em.Name;
         rbtn_Female.Checked   = (rbtn_Male.Checked = (em.Gender == true ? true : false)) ? false : true;
         de_Birthday.EditValue = em.Birthday.Date;
         txt_Address.Text      = em.Address;
         txt_Phone.Text        = em.Phone;
     }
     else
     {
         FormMessageBox mess = new FormMessageBox("Lỗi! Không thể tải dữ liệu của bạn");
     }
 }
        private void btn_Search_Click(object sender, EventArgs e)
        {
            string str_Search = txt_Search.Text;

            if (BUS_Table.Instance.Search_DAL(str_Search) != null)
            {
                DeleteBinding();
                grd_Table.DataSource = BUS_Table.Instance.Search_DAL(str_Search);
            }
            else
            {
                DeleteBinding();
                FormMessageBox form = new FormMessageBox("Dữ liệu tìm kiếm không tồn tại!");
                form.ShowDialog();
            }
        }
 public void LoadBinding()
 {
     if (BUS_Table.Instance.Show_DAL() != null)
     {
         DeleteBinding();
         txt_Id.DataBindings.Add(new Binding("Text", dgv_Table.DataSource, "Id"));
         txt_Name.DataBindings.Add(new Binding("Text", dgv_Table.DataSource, "Name"));
         //  ckb_Status.DataBindings.Add(new Binding("Checked", dgv_Table.DataSource, "Status"));
     }
     else
     {
         FormMessageBox form = new FormMessageBox("Lỗi! Nạp dữ liệu thất bại!");
         form.ShowDialog();
         DeleteBinding();
     }
 }
Exemplo n.º 20
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            List <int> list_Dell = new List <int>();

            int[] selectedRows = dgv_Item.GetSelectedRows();
            int   id           = -1;

            try
            {
                id = (int)dgv_Item.GetRowCellValue(dgv_Item.FocusedRowHandle, grdcol_IdItem);
            }
            catch { id = -1; }
            if (id != -1)
            {
                foreach (int rowHandle in selectedRows)
                {
                    if (rowHandle >= 0)
                    {
                        object cellValue = dgv_Item.GetRowCellValue(rowHandle, grdcol_IdItem);
                        list_Dell.Add((int)cellValue);
                    }
                }
                FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn xóa?");
                formYesNoBox.ShowDialog();
                if (formYesNoBox.GetValue() == 1)
                {
                    if (BUS_Item.Instance.Delete_DAL(list_Dell))
                    {
                        FormMessageBox formMessageBox = new FormMessageBox("Xóa thành công!");
                        DeleteBinding();
                        SetView();
                        formMessageBox.ShowDialog();
                    }
                    else
                    {
                        FormMessageBox formMessageBox = new FormMessageBox("Xóa thất bại! Vui lòng kiểm tra lại dữ liệu!");
                        formMessageBox.ShowDialog();
                    }
                }
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Vui lòng chọn món muốn xóa!");
                form.ShowDialog();
            }
        }
        private void btn_Add_Click(object sender, EventArgs e)
        {
            string name_Table = txt_Name.Text;

            // bool status = ckb_Status.Checked == true ? true : false;
            if (BUS_Table.Instance.AddTable(name_Table))
            {
                SetView();
                FormMessageBox form = new FormMessageBox("Thêm thành công!");
                form.ShowDialog();
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Thêm thất bại! Vui lòng kiểm tra lại dữ liệu");
                form.ShowDialog();
            }
        }
        private void btn_Update_Click(object sender, EventArgs e)
        {
            int focusedRow = dgv_Employee.FocusedRowHandle;
            //    String Id = txt_Id.Text;
            string   name_Update     = txt_Name.Text;
            DateTime birthday_Update = de_Birthday.DateTime.Date;
            bool     gender_Update   = rbtn_Male.Checked ? true : false;
            string   address_Update  = txt_Address.Text;
            string   phone_Update    = txt_Phone.Text;
            int      id = -1;

            try
            {
                id = (int)dgv_Employee.GetRowCellValue(dgv_Employee.FocusedRowHandle, grdcol_IdEmployee);
            }
            catch { id = -1; }
            if (id != -1)
            {
                FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?");
                formYesNoBox.ShowDialog();
                if (formYesNoBox.GetValue() == 1)
                {
                    if (BUS_Employee.Instance.Update_DAL(id, name_Update, birthday_Update, gender_Update, address_Update, phone_Update))
                    {
                        DeleteBinding();
                        SetView();
                        LoadBinding();
                        dgv_Employee.FocusedRowHandle = focusedRow;
                        dgv_Employee.SelectRow(focusedRow);
                        dgv_Employee.Focus();
                        FormMessageBox form = new FormMessageBox("Cập nhật thành công!");
                        form.ShowDialog();
                    }
                    else
                    {
                        FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu");
                        form.ShowDialog();
                    }
                }
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Vui lòng chọn nhân viên muốn cập nhật");
                form.ShowDialog();
            }
        }
Exemplo n.º 23
0
        public bool DisplayMsg(string strMsg)
        {
            FormMessageBox Msg = new FormMessageBox();

            Msg.SetText(strMsg);
            Msg.ShowDialog();

            if (Msg.DialogResult == DialogResult.OK)
            {
                Msg.Dispose();
                return(true);
            }
            else
            {
                Msg.Dispose();
                return(false);
            }
        }
Exemplo n.º 24
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            string name_Item     = txt_Name.Text;
            string name_Category = "";
            int    price_Item    = 0;
            int    Id_Category   = 0;

            if (cbb_CategoryDetail.SelectedItem != null)
            {
                name_Category = cbb_CategoryDetail.SelectedItem.ToString();
            }
            if (txt_Price.Text.ToString() != "")
            {
                price_Item = Convert.ToInt32(txt_Price.Text);
            }
            foreach (CBBItem i in cbb_Category.Items)
            {
                if (i.Text == name_Category)
                {
                    Id_Category = i.Value;
                    break;
                }
            }
            if (price_Item != 0)
            {
                if (BUS_Item.Instance.Add_DAL(name_Item, Id_Category, price_Item))
                {
                    SetView();
                    FormMessageBox form = new FormMessageBox("Thêm thành công!");
                    form.ShowDialog();
                }
                else
                {
                    FormMessageBox form = new FormMessageBox("Thêm thất bại! Vui lòng kiểm tra lại dữ liệu");
                    form.ShowDialog();
                }
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Thêm thất bại! Vui lòng kiểm tra lại dữ liệu");
                form.ShowDialog();
            }
        }
        private void btn_Add_Click(object sender, EventArgs e)
        {
            string   name     = txt_Name.Text;
            DateTime birthday = de_Birthday.DateTime.Date;
            bool     gender   = rbtn_Male.Checked ? true : false;
            string   address  = txt_Address.Text;
            string   phone    = txt_Phone.Text;

            if (BUS_Employee.Instance.Add_DAL(name, birthday, gender, address, phone))
            {
                SetView();
                FormMessageBox form = new FormMessageBox("Thêm thành công!");
                form.ShowDialog();
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Thêm thất bại! Vui lòng kiểm tra lại dữ liệu");
                form.ShowDialog();
            }
        }
Exemplo n.º 26
0
        public void SetView()
        {
            //txt_Id.Enabled = false;
            string category = cbb_Category.SelectedItem.ToString();

            foreach (CBBItem i in cbb_Category.Items)
            {
                if (i.Text == category)
                {
                    if (BUS_Item.Instance.Show_DAL(i.Value) != null)
                    {
                        grd_Item.DataSource = BUS_Item.Instance.Show_DAL(i.Value);
                    }
                    else
                    {
                        FormMessageBox form = new FormMessageBox("Tải dữ liệu món thất bại!");
                        form.ShowDialog();
                    }
                    break;
                }
            }
        }
Exemplo n.º 27
0
        public void SetView()
        {
            if (ID_Type == 3)
            {
                openChildForm(new fSale(this.Id_Employee));
            }
            else
            {
                openChildForm(new TabSystem(this.ID_Type));
            }


            if (BUS_Employee.Instance.GetEmployee(Id_Employee) != null)
            {
                Employee em = BUS_Employee.Instance.GetEmployee(Id_Employee);
                ddbtn_Menu.Text = em.Name;
            }
            else
            {
                FormMessageBox mess = new FormMessageBox("Lỗi tải dữ liệu tài khoản! Vui lòng kiểm tra lại!");
            }
        }
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            List <int> list_Dell = new List <int>();

            int[] selectedRows = dgv_Table.GetSelectedRows();
            if (txt_Id.Text != "")
            {
                foreach (int rowHandle in selectedRows)
                {
                    if (rowHandle >= 0)
                    {
                        object cellValue = dgv_Table.GetRowCellValue(rowHandle, grdcol_Id);
                        list_Dell.Add((int)cellValue);
                    }
                }
                FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn xóa?");
                formYesNoBox.ShowDialog();
                if (formYesNoBox.GetValue() == 1)
                {
                    if (BUS_Table.Instance.Delete_DAL(list_Dell))
                    {
                        FormMessageBox form = new FormMessageBox("Xóa thành công!");
                        form.ShowDialog();
                        DeleteBinding();
                        SetView();
                    }
                    else
                    {
                        FormMessageBox form = new FormMessageBox("Xóa thất bại! Vui lòng kiểm tra lại!");
                        form.ShowDialog();
                    }
                }
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Vui lòng chọn bàn ăn muốn xóa!");
                form.ShowDialog();
            }
        }
Exemplo n.º 29
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            int          IDAccount    = (int)dgv_Account.GetRowCellValue(dgv_Account.FocusedRowHandle, grdcol_Id);
            FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn xóa?");

            formYesNoBox.ShowDialog();
            if (formYesNoBox.GetValue() == 1)
            {
                if (BUS_Account.Instance.DeleteAccount(IDAccount))
                {
                    FormMessageBox formMessageBox = new FormMessageBox("Xóa thành công!");
                    DeleteBinding();
                    SetView();
                    formMessageBox.ShowDialog();
                }
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Vui lòng chọn tài khoản muốn xóa!");
                form.ShowDialog();
            }
        }
        public void LoadBinding()
        {
            object q;

            if ((q = BUS_Employee.Instance.Show_DAL()) != null)
            {
                DeleteBinding();
                //txt_Id.DataBindings.Add(new Binding("Text", dgv_Employee.DataSource, "Id"));
                txt_Name.DataBindings.Add(new Binding("Text", dgv_Employee.DataSource, "Name"));
                var maleBinding = new Binding("Checked", dgv_Employee.DataSource, "Gender");
                rbtn_Male.DataBindings.Add(maleBinding);
                rbtn_Female.Checked = !rbtn_Male.Checked;
                de_Birthday.DataBindings.Add(new Binding("DateTime", dgv_Employee.DataSource, "Birthday"));
                txt_Address.DataBindings.Add(new Binding("Text", dgv_Employee.DataSource, "Address"));
                txt_Phone.DataBindings.Add(new Binding("Text", dgv_Employee.DataSource, "Phone"));
            }
            else
            {
                FormMessageBox form = new FormMessageBox("Lỗi! Nạp dữ liệu thất bại!");
                form.ShowDialog();
                DeleteBinding();
            }
        }