Ejemplo n.º 1
0
        private void addKhoHang1_SubmitClickOK()
        {
            Control.UpdateData updata             = new Control.UpdateData();
            ResultsData <List <tbl_kho_hang> > rs = updata.AddKho(Share.Constant.khohang);

            switch (rs.err_code)     // lấy giá trị từ control. updatedata đổ về view
            {
            case QLKhoHang.Model.ErrorCode.fail:
                MessageBox.Show(rs.err_desc, Share.Constant.Error_msg_cap, MessageBoxButtons.OK);
                break;

            case QLKhoHang.Model.ErrorCode.success:
                MessageBox.Show(rs.err_desc, Share.Constant.Info_msg_cap, MessageBoxButtons.OK);
                dgv_all_kho.DataSource = rs.data;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        private void btn_sua_kh_Click(object sender, EventArgs e)
        {
            Model.tbl_kho_hang khohang = new Model.tbl_kho_hang();
            khohang = Share.Constant.khohang;
            if (txt_kh_diachi.Text == "" || txt_kh_quanly.Text == "" || txt_kh_id.Text == "")
            {
                throw new Exception(Share.Constant.notValue_msg);
            }
            else
            {
                khohang.kh_dia_chi = txt_kh_diachi.Text;
                khohang.kh_quan_ly = txt_kh_quanly.Text;
                khohang.kh_id      = txt_kh_id.Text;
                try
                {
                    Share.Constant.khohang.kh_suc_chua = Int16.Parse(txt_kh_succhua.Text);
                    Control.UpdateData update = new Control.UpdateData();
                    Model.ResultsData <List <Model.tbl_kho_hang> > key = update.Update(khohang);
                    switch (key.err_code)
                    {
                    case QLKhoHang.Model.ErrorCode.fail:
                        MessageBox.Show(key.err_desc, Share.Constant.Error_msg_cap, MessageBoxButtons.OK);
                        break;

                    case QLKhoHang.Model.ErrorCode.success:
                        MessageBox.Show(key.err_desc, Share.Constant.Info_msg_cap, MessageBoxButtons.OK);
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    khohang.kh_suc_chua = 0;

                    throw ex;
                }
            }
        }