예제 #1
0
        private void InsertData()
        {
            data = new DTO.LoaiTien();

            data.Ten = tbTen.Text;
            data.Gia = ConvertUtil.ConvertToInt(tbGiaTri.Text);
            data.GhiChu = tbGhiChu.Text;
            data.IsActived = rbSuDung.Checked;

            if (LoaiTienBus.Insert(data))
            {
                if (MessageBox.Show(string.Format(Constant.MESSAGE_INSERT_SUCCESS, "Mệnh giá tiền " + data.Ten) + Constant.MESSAGE_NEW_LINE + Constant.MESSAGE_CONTINUE, Constant.CAPTION_CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    this.Dispose();
                }
            }
            else
            {
                if (MessageBox.Show(string.Format(Constant.MESSAGE_INSERT_ERROR_DUPLICATED, tbGiaTri.Text) +
                    Constant.MESSAGE_NEW_LINE + Constant.MESSAGE_EXIT, Constant.CAPTION_ERROR, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    this.Dispose();
                }
            }
        }
예제 #2
0
        public UcInfo(DTO.LoaiTien data)
        {
            InitializeComponent();

            this.data = data;
            isUpdate = true;
            lbSelect.Text = Constant.DEFAULT_TITLE_EDIT;

            Init();

            tbTen.Text = data.Ten;
            tbGiaTri.Text = data.Gia.ToString();
            tbGhiChu.Text = data.GhiChu;

            if (data.IsActived)
            {
                rbSuDung.Checked = true;
            }
            else
            {
                rbTamNgung.Checked = true;
            }

            if (data.Id == 2)
            {
                tbGiaTri.Enabled = false;
            }
        }
예제 #3
0
        public UcInfo()
        {
            InitializeComponent();

            data = new DTO.LoaiTien();
            isUpdate = false;

            Init();
            RefreshData();
        }
예제 #4
0
        public static bool Delete(LoaiTien data)
        {
            try
            {
                if (data != null)
                {
                    dbContext.LoaiTiens.DeleteOnSubmit(data);
                    dbContext.SubmitChanges();

                    return true;
                }
            }
            catch
            {
                //return false;
            }

            CreateSQlConnection();

            return false;
        }
예제 #5
0
 public static bool Update(LoaiTien data)
 {
     return LoaiTienDao.Update(data);
 }
예제 #6
0
 public static bool Insert(LoaiTien data)
 {
     return LoaiTienDao.Insert(data);
 }
예제 #7
0
 public static bool Delete(LoaiTien data)
 {
     return LoaiTienDao.Delete(data);
 }
예제 #8
0
 partial void DeleteLoaiTien(LoaiTien instance);
예제 #9
0
 partial void UpdateLoaiTien(LoaiTien instance);
예제 #10
0
 partial void InsertLoaiTien(LoaiTien instance);
예제 #11
0
        public static bool Update(LoaiTien data)
        {
            try
            {
                if (data != null)
                {
                    dbContext.SubmitChanges();
                    return true;
                }

                return false;
            }
            catch
            {
                return false;
            }
        }
예제 #12
0
        public static bool Insert(LoaiTien data)
        {
            try
            {
                dbContext.LoaiTiens.InsertOnSubmit(data);
                dbContext.SubmitChanges();

                return true;
            }
            catch
            {
                return false;
            }
        }