Example #1
0
        public static bool Insert(LoaiHinh dto)
        {
            try
            {
                VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection();

                VNSC.LoaiHinhs.InsertOnSubmit(dto);
                VNSC.SubmitChanges();
                return true;
            }
            catch (System.Exception ex)
            {
                return false;
            }
        }
 partial void DeleteLoaiHinh(LoaiHinh instance);
Example #3
0
        public static bool UpdateLoaiHinhInfo(LoaiHinh dto)
        {
            try
            {
                VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection();
                LoaiHinh sk = VNSC.LoaiHinhs.Single(P => P.Ma == dto.Ma);
                sk.MaNhomLoaiHinh = dto.MaNhomLoaiHinh;
                sk.Ten = dto.Ten;
                sk.Nganh = dto.Nganh;
                sk.MoTa = dto.MoTa;

                VNSC.SubmitChanges();
                return true;
            }
            catch (System.Exception ex)
            {
                return false;
            }
        }
 partial void InsertLoaiHinh(LoaiHinh instance);
 partial void UpdateLoaiHinh(LoaiHinh instance);
		private void detach_LoaiHinhs(LoaiHinh entity)
		{
			this.SendPropertyChanging();
			entity.NhomLoaiHinh = null;
		}
		private void attach_LoaiHinhs(LoaiHinh entity)
		{
			this.SendPropertyChanging();
			entity.NhomLoaiHinh = this;
		}
Example #8
0
        private void pbHoanTat_Click(object sender, EventArgs e)
        {
            if (lbSelect.Text == "THÊM")
            {
                LoaiHinh dto = new LoaiHinh();
                dto.Ma = tbMa.Text;
                dto.MaNhomLoaiHinh = list_NhomLoaiHinh[cbNhomLoaiHinh.SelectedIndex];
                dto.Ten = tbTen.Text;

                if (rbAu.Checked)
                {
                    dto.Nganh = rbAu.Text;
                }

                if (rbThieu.Checked)
                {
                    dto.Nganh = rbThieu.Text;
                }

                if (rbKha.Checked)
                {
                    dto.Nganh = rbKha.Text;
                }

                if (rbTrang.Checked)
                {
                    dto.Nganh = rbTrang.Text;
                }

                if (rbKhac.Checked)
                {
                    dto.Nganh = tbKhac.Text;
                }

                dto.MoTa = tbMoTa.Text;

                if (LoaiHinh_BUS.Insert(dto))
                {
                    pnQuanLy.Visible = true;
                    pnSelect.Visible = true;
                    pnInfo.Visible = false;

                    NewInfo();

                    lbTitle.Text = "LOẠI HÌNH";
                    lbSelect.Text = "";

                    refreshListView();

                    lvThongTin.SelectedItems.Clear();
                }
                else
                {
                    Form_Notice frm = new Form_Notice("Không thể tạo Loại hình!", false);
                }
            }

            if (lbSelect.Text == "SỬA")
            {
                LoaiHinh dto = LoaiHinh_BUS.TraCuuLoaiHinhTheoMa(tbMa.Text);
                dto.MaNhomLoaiHinh = list_NhomLoaiHinh[cbNhomLoaiHinh.SelectedIndex];
                dto.Ten = tbTen.Text;

                if (rbAu.Checked)
                {
                    dto.Nganh = rbAu.Text;
                }

                if (rbThieu.Checked)
                {
                    dto.Nganh = rbThieu.Text;
                }

                if (rbKha.Checked)
                {
                    dto.Nganh = rbKha.Text;
                }

                if (rbTrang.Checked)
                {
                    dto.Nganh = rbTrang.Text;
                }

                if (rbKhac.Checked)
                {
                    dto.Nganh = tbKhac.Text;
                }

                dto.MoTa = tbMoTa.Text;

                if (LoaiHinh_BUS.UpdateLoaiHinhInfo(dto))
                {
                    pnQuanLy.Visible = true;
                    pnSelect.Visible = true;
                    pnInfo.Visible = false;

                    NewInfo();

                    lbTitle.Text = "LOẠI HÌNH";
                    lbSelect.Text = "";

                    refreshListView();
                }
                else
                {
                    Form_Notice frm = new Form_Notice("Không thể cập nhật Loại hình!", false);
                }
            }
        }
Example #9
0
 public static bool UpdateLoaiHinhInfo(LoaiHinh dto)
 {
     return LoaiHinh_DAO.UpdateLoaiHinhInfo(dto);
 }
Example #10
0
 public static bool Insert(LoaiHinh dto)
 {
     return LoaiHinh_DAO.Insert(dto);
 }