Exemplo n.º 1
0
 public frmSuaTyGia(TyGia kq)
 {
     InitializeComponent();
     txtMa.Text          = kq.Ma;
     txtTen.Text         = kq.Ten;
     txtTyGiaQuyDoi.Text = kq.TyGiaQuyDoi.ToString();
 }
Exemplo n.º 2
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            TyGia kq = ChuyenSangDTO();

            XL_TYGIA.SuaTyGia(kq);
            XtraMessageBox.Show("Lưu thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
Exemplo n.º 3
0
        private void btnSua_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TyGia       nv  = TruyenDuLieu();
            frmSuaTyGia frm = new frmSuaTyGia(nv);

            frm.ShowDialog();
            LoadDuLieu();
        }
Exemplo n.º 4
0
 private void FillTyGia(TyGia tg)
 {
     txtMaTyGia.Text     = tg.MaTyGia;
     txtMaTyGia.ReadOnly = true;
     txtTenTyGia.Text    = tg.TenTyGia;
     ceTyGiaQuyDoi.Value = tg.TyGiaQuyDoi;
     cbConQuanLy.Checked = tg.ConQuanLy;
 }
Exemplo n.º 5
0
 public void infoTygia()
 {
     lb_menh_gia_the.text = "";
     for (int i = 0; i < BaseInfo.gI().list_tygia.Count; i++)
     {
         TyGia tg = (TyGia)BaseInfo.gI().list_tygia[i];
         lb_menh_gia_the.text += BaseInfo.formatMoneyDetailDot(tg.menhgia) + " vnđ = " + BaseInfo.formatMoneyDetailDot(tg.xu) + " " + Res.MONEY_FREE + "\n";
     }
 }
Exemplo n.º 6
0
        public int CapNhatTyGia(TyGia tg)
        {
            int cql = tg.ConQuanLy == true ? 1 : 0;

            string sql = "update TYGIA set " +
                         string.Format("TenTyGia=N'{0}',TyGiaQuyDoi={1} ,ConQuanLy={2} where MaTyGia='{3}'",
                                       tg.TenTyGia, tg.TyGiaQuyDoi, cql, tg.MaTyGia);

            return(Execute.InsertUpdateDelete(sql));
        }
Exemplo n.º 7
0
        TyGia ChuyenSangDTO()
        {
            TyGia kq = new TyGia();

            kq.Ma          = txtMa.Text;
            kq.Ten         = txtTen.Text;
            kq.TyGiaQuyDoi = float.Parse(txtTyGiaQuyDoi.Text);
            kq.ConQL       = XL_NUTCHECK.Check(checkConQL);
            return(kq);
        }
Exemplo n.º 8
0
        private TyGia LayTGDangChon()
        {
            TyGia tg = new TyGia();

            tg.MaTyGia     = gvTyGia.GetRowCellValue(CurRowIndex, "MaTyGia").ToString();
            tg.TenTyGia    = gvTyGia.GetRowCellValue(CurRowIndex, "TenTyGia").ToString();
            tg.TyGiaQuyDoi = int.Parse(gvTyGia.GetRowCellValue(CurRowIndex, "TyGiaQuyDoi").ToString());
            tg.ConQuanLy   = bool.Parse(gvTyGia.GetRowCellValue(CurRowIndex, "ConQuanLy").ToString());

            return(tg);
        }
Exemplo n.º 9
0
        public int ThemTyGia(TyGia tg)
        {
            int cql = tg.ConQuanLy == true ? 1 : 0;

            string sql = "insert into TYGIA " +
                         "(MaTyGia,TenTyGia,TyGiaQuyDoi,ConQuanLy) " +
                         string.Format("values ('{0}',N'{1}',{2},{3})",
                                       tg.MaTyGia, tg.TenTyGia, tg.TyGiaQuyDoi, cql);

            return(Execute.InsertUpdateDelete(sql));
        }
Exemplo n.º 10
0
        private void barbtntigia_ItemClick(object sender, ItemClickEventArgs e)
        {
            TyGia TyGia = new TyGia();

            if (ExistsForm(TyGia))
            {
                return;
            }
            TyGia.MdiParent = this;
            TyGia.Show();
        }
Exemplo n.º 11
0
        private void BtnSua_Click(object sender, EventArgs e)
        {
            if (CurRowIndex >= 0)
            {
                TyGia tg = LayTGDangChon();

                frmThemTyGia frmSua = new frmThemTyGia(tg);
                frmSua.CapNhatThanhCong += FillGridView;
                frmSua.CapNhatThanhCong += NhatKySua;
                frmSua.ShowDialog();
            }
        }
Exemplo n.º 12
0
        //dùng để sửa
        public frmThemTyGia(TyGia tg)
        {
            InitializeComponent();

            isInsert  = false;
            this.Text = "Cập nhật Tiền Tệ";

            // button
            btnLuu.Click  += BtnLuu_Click;
            btnDong.Click += BtnDong_Click;

            FillTyGia(tg);
        }
Exemplo n.º 13
0
        private TyGia TruyenDuLieu()
        {
            TyGia  kq          = new TyGia();
            int    row_index   = gridView1.FocusedRowHandle;
            object Ma          = gridView1.GetRowCellValue(row_index, "Ma");
            object Ten         = gridView1.GetRowCellValue(row_index, "Ten");
            object TyGiaQuyDoi = gridView1.GetRowCellValue(row_index, "TyGiaQuyDoi");

            kq.Ma          = Ma.ToString();
            kq.Ten         = Ten.ToString();
            kq.TyGiaQuyDoi = float.Parse(TyGiaQuyDoi.ToString());
            return(kq);
        }
Exemplo n.º 14
0
        //chuyen bang thanh list
        public static List <TyGia> ChuyenDoiDTOTyGia(DataTable bang)
        {
            List <TyGia> kq = new List <TyGia>();

            foreach (DataRow dong in bang.Rows)
            {
                TyGia a = new TyGia();
                a.MaTyGia        = dong["MaTyGia"].ToString();
                a.TenTyGia       = dong["TenTyGia"].ToString();
                a.QuyDoiTienViet = dong["QuyDoiTienViet"].ToString();
                kq.Add(a);
            }
            return(kq);
        }
Exemplo n.º 15
0
        private void BtnLuu_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTenTyGia.Text) || string.IsNullOrEmpty(txtMaTyGia.Text))
            {
                MessageBox.Show("Không được bỏ trống Tên hoặc Mã");
            }
            else
            {
                TyGia tg = new TyGia();
                tg.MaTyGia     = txtMaTyGia.Text;
                tg.TenTyGia    = txtTenTyGia.Text;
                tg.TyGiaQuyDoi = int.Parse(ceTyGiaQuyDoi.Value.ToString());
                tg.ConQuanLy   = cbConQuanLy.Checked;

                if (isInsert == true)
                {
                    if (nv_tg.KiemTraMaTonTai(txtMaTyGia.Text) == true)
                    {
                        MessageBox.Show("Mã này đã tồn tại, vui lòng nhập mã khác", "Trùng Lặp Mã", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        int kq = nv_tg.ThemTyGia(tg);
                        if (kq >= 1)
                        {
                            ThemThanhCong();
                            MessageBox.Show("Thêm thành công");
                        }
                        else
                        {
                            MessageBox.Show("Thất Bại");
                        }
                    }
                }
                else
                {
                    int kq = nv_tg.CapNhatTyGia(tg);
                    if (kq >= 1)
                    {
                        CapNhatThanhCong();
                        MessageBox.Show("Cập nhật thành công");
                    }
                    else
                    {
                        MessageBox.Show("Thất Bại");
                    }
                }
            }
        }
Exemplo n.º 16
0
 public static void SuaTyGia(TyGia kq)
 {
     XL_DULIEU.ThucThi(CommandType.StoredProcedure, "SuaTyGia",
                       new SqlParameter {
         ParameterName = "@ma", Value = kq.Ma
     },
                       new SqlParameter {
         ParameterName = "@ten", Value = kq.Ten
     },
                       new SqlParameter {
         ParameterName = "@tygiaquydoi", Value = kq.TyGiaQuyDoi
     },
                       new SqlParameter {
         ParameterName = "@conquanly", Value = kq.ConQL
     });
 }
Exemplo n.º 17
0
 public void infoTygia()
 {
     LoadAssetBundle.LoadPrefab("prefabs", "ItemMenhGia", (obj) => {
         GameObject menhgia = obj;
         menhgia.transform.SetParent(objListTheCao.transform);
         menhgia.transform.localScale       = Vector3.one;
         menhgia.GetComponent <Text>().text = BaseInfo.formatMoneyDetailDot(BaseInfo.gI().list_tygia[0].menhgia) + " VND = " + BaseInfo.formatMoneyDetailDot(BaseInfo.gI().list_tygia[0].xu) + " " + Res.MONEY_VIP;
         //Debug.LogError("list_tygia " + BaseInfo.gI().list_tygia.Count + (menhgia == null));
         for (int i = 1; i < BaseInfo.gI().list_tygia.Count; i++)
         {
             GameObject mg = Instantiate(menhgia);
             mg.transform.SetParent(objListTheCao.transform);
             mg.transform.localScale = Vector3.one;
             TyGia tg = (TyGia)BaseInfo.gI().list_tygia[i];
             mg.GetComponent <Text>().text = BaseInfo.formatMoneyDetailDot(tg.menhgia) + " VND = " + BaseInfo.formatMoneyDetailDot(tg.xu) + " " + Res.MONEY_VIP;
         }
     });
 }
Exemplo n.º 18
0
 public int CapNhatTyGia(TyGia tg)
 {
     return(xl_tg.CapNhatTyGia(tg));
 }
Exemplo n.º 19
0
 public int ThemTyGia(TyGia tg)
 {
     return(xl_tg.ThemTyGia(tg));
 }