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

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

            CreateSQlConnection();

            return false;
        }
Example #2
0
 partial void DeleteGiaChinhThuc(GiaChinhThuc instance);
Example #3
0
 partial void UpdateGiaChinhThuc(GiaChinhThuc instance);
Example #4
0
 partial void InsertGiaChinhThuc(GiaChinhThuc instance);
Example #5
0
		private void detach_GiaChinhThucs(GiaChinhThuc entity)
		{
			this.SendPropertyChanging();
			entity.SanPham = null;
		}
Example #6
0
        private void UpdateData()
        {
            foreach (DataGridViewRow row in dgvThongTin.Rows)
            {
                if (row.Cells[colId.Name].Value != null && !string.IsNullOrEmpty(row.Cells[colId.Name].Value.ToString()))
                {
                    DTO.GiaChinhThuc data = GiaChinhThucBus.GetById(ConvertUtil.ConvertToInt(row.Cells[colId.Name].Value));

                    data.Gia = row.Cells[colGia.Name].Value == null ? 0 :
                        ConvertUtil.ConvertToLong(row.Cells[colGia.Name].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty));

                    if (GiaChinhThucBus.Update(data, FormMain.user))
                    {
                        //this.Dispose();
                    }
                    else
                    {
                        if (MessageBox.Show(Constant.MESSAGE_ERROR + Constant.MESSAGE_NEW_LINE + Constant.MESSAGE_EXIT, Constant.CAPTION_ERROR, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                        {
                            //this.Dispose();

                            return;
                        }
                    }
                }
                else
                {
                    DTO.GiaChinhThuc data = new DTO.GiaChinhThuc();

                    data.IdSanPham = ConvertUtil.ConvertToInt(row.Cells[colIdSanPham.Name].Value);
                    data.Gia = row.Cells[colGia.Name].Value == null ? 0 :
                        ConvertUtil.ConvertToLong(row.Cells[colGia.Name].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty));

                    if (GiaChinhThucBus.Insert(data, FormMain.user))
                    {
                        //this.Dispose();
                    }
                    else
                    {
                        if (MessageBox.Show(Constant.MESSAGE_UPDATE_ERROR + Constant.MESSAGE_NEW_LINE + Constant.MESSAGE_EXIT, Constant.CAPTION_ERROR, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                        {
                            //this.Dispose();

                            return;
                        }
                    }
                }
            }

            pbSua.Enabled = false;
            pbSua.Image = Image.FromFile(ConstantResource.CHUC_NANG_ICON_EDIT_DISABLE);

            MessageBox.Show(string.Format(Constant.MESSAGE_UPDATE_SUCCESS, "Giá chính thức"), Constant.CAPTION_CONFIRMATION, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #7
0
        public static bool Update(GiaChinhThuc data, User user)
        {
            try
            {
                if (data != null)
                {
                    dbContext.SubmitChanges();
                    return true;
                }

                return false;
            }
            catch
            {
                return false;
            }
        }
Example #8
0
        public static bool Insert(GiaChinhThuc data, User user)
        {
            try
            {
                if (GetByIdSanPham(data.IdSanPham) != null)
                {
                    return false;
                }

                dbContext.GiaChinhThucs.InsertOnSubmit(data);
                dbContext.SubmitChanges();

                return true;
            }
            catch
            {
                return false;
            }
        }