Beispiel #1
0
        public static bool Delete(DinhLuong data, User user)
        {
            try
            {
                if (data != null)
                {
                    dbContext.DinhLuongs.DeleteOnSubmit(data);
                    dbContext.SubmitChanges();

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

            CreateSQlConnection();

            return false;
        }
Beispiel #2
0
 public static bool Update(DinhLuong data, User user)
 {
     return DinhLuongDao.Update(data, user);
 }
Beispiel #3
0
 public static bool Insert(DinhLuong data, User user)
 {
     return DinhLuongDao.Insert(data, user);
 }
Beispiel #4
0
 public static bool Delete(DinhLuong data, User user)
 {
     return DinhLuongDao.Delete(data, user);
 }
Beispiel #5
0
 partial void DeleteDinhLuong(DinhLuong instance);
Beispiel #6
0
 partial void UpdateDinhLuong(DinhLuong instance);
Beispiel #7
0
 partial void InsertDinhLuong(DinhLuong instance);
Beispiel #8
0
		private void detach_DinhLuongs(DinhLuong entity)
		{
			this.SendPropertyChanging();
			entity.SanPham = null;
		}
Beispiel #9
0
		private void detach_DinhLuongs(DinhLuong entity)
		{
			this.SendPropertyChanging();
			entity.NguyenLieu = null;
		}
Beispiel #10
0
        private void UpdateDinhLuong()
        {
            if (!DeleteDataHoaDonDetail())
            {
                return;
            }

            for (int i = 0; i < dgvThongTin.RowCount; i++)
            {
                if (dgvThongTin[colId.Name, i].Value != null && !string.IsNullOrEmpty(dgvThongTin[colId.Name, i].Value.ToString()))
                {
                    DTO.DinhLuong dataDL = DinhLuongBus.GetById(ConvertUtil.ConvertToInt(dgvThongTin[colId.Name, i].Value));

                    dataDL.IdNguyenLieu = ConvertUtil.ConvertToInt(dgvThongTin[colIdNL.Name, i].Value);
                    dataDL.SoLuong = ConvertUtil.ConvertToDouble(dgvThongTin[colUocLuong.Name, i].Value);
                    dataDL.GhiChu = dgvThongTin[colGhiChu.Name, i].Value == null ? string.Empty : dgvThongTin[colGhiChu.Name, i].Value.ToString();

                    if (!DinhLuongBus.Update(dataDL, FormMain.user))
                    {
                        if (MessageBox.Show(Constant.MESSAGE_UPDATE_ERROR + Constant.MESSAGE_NEW_LINE + Constant.MESSAGE_EXIT, Constant.CAPTION_ERROR, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                        {
                            this.Dispose();
                        }

                        return;
                    }
                }
                else
                {
                    DTO.DinhLuong dataDL = new DTO.DinhLuong();

                    dataDL.IdSanPham = data.Id;
                    dataDL.IdNguyenLieu = ConvertUtil.ConvertToInt(dgvThongTin[colIdNL.Name, i].Value);
                    dataDL.SoLuong = ConvertUtil.ConvertToDouble(dgvThongTin[colUocLuong.Name, i].Value);
                    dataDL.GhiChu = dgvThongTin[colGhiChu.Name, i].Value == null ? string.Empty : dgvThongTin[colGhiChu.Name, i].Value.ToString();

                    if (!DinhLuongBus.Insert(dataDL, FormMain.user))
                    {
                        if (MessageBox.Show(Constant.MESSAGE_UPDATE_ERROR + Constant.MESSAGE_NEW_LINE + Constant.MESSAGE_EXIT, Constant.CAPTION_ERROR, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                        {
                            this.Dispose();
                        }

                        return;
                    }
                }
            }

            if (MessageBox.Show(string.Format(Constant.MESSAGE_UPDATE_SUCCESS, "Sản phẩm " + data.MaSanPham) + Constant.MESSAGE_NEW_LINE + Constant.MESSAGE_EXIT, Constant.CAPTION_CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                this.Dispose();
            }
        }
Beispiel #11
0
        public static bool Update(DinhLuong data, User user)
        {
            try
            {
                if (data != null)
                {
                    dbContext.SubmitChanges();
                    return true;
                }

                return false;
            }
            catch
            {
                return false;
            }
        }
Beispiel #12
0
        public static bool Insert(DinhLuong data, User user)
        {
            try
            {
                dbContext.DinhLuongs.InsertOnSubmit(data);
                dbContext.SubmitChanges();

                return true;
            }
            catch
            {
                return false;
            }
        }