private void Detachnhanvien_cs(nhanvien_cs entity)
 {
     entity.don_vi = null;
 }
 private bool Filternhanvien_cs(nhanvien_cs entity)
 {
     return (entity.id_donvi == this.ma_dv);
 }
 private void Attachnhanvien_cs(nhanvien_cs entity)
 {
     entity.don_vi = this;
 }
 private bool Filternhanvien_cs(nhanvien_cs entity)
 {
     return (entity.ma_nvcs == this.id_nv_cs);
 }
        private void SaveData(LoadOperation<nhanvien_cs> lo)
        {

            if (lo.Entities.Count() > 0)
            {
                MessageBox.Show("Mã cán bộ " + this.txtmanv.Text.Trim().ToUpper() + " đã tồn tại");
            }
            else
            {

                if (txtmanv.Text.Trim() != "" || txtten.Text.Trim() != "")
                {
                    string m = FunAndPro.GetSelectedKeyValue(cmbdiaban, rowMenu);
                    if (m.Length > 0)
                        m = ";" + m + ";";
                    nhanvien_cs ap = new nhanvien_cs
                    {
                       ma_nvcs = txtmanv.Text.Trim().ToUpper(),
                       ten_nv = this.txtten.Text.Trim(),
                       ma_huyen=App.ma_huyen,
                       kt=checkEdit1.IsChecked,
                       phone=txtphone.Text.Trim(),
                       diaban=m
                    };
                    nhanvien_cs_log apl = new nhanvien_cs_log
                    {
                        ma_nvcs = txtmanv.Text.Trim().ToUpper(),
                        ten_nv = this.txtten.Text.Trim(),
                        ma_huyen = App.ma_huyen,
                        kt = checkEdit1.IsChecked,
                        phone = txtphone.Text.Trim(),
                        diaban = m,
                        users=App.User_name,
                        thoi_gian=App.Current_d
                    };
                    dstb.nhanvien_cs.Add(ap);
                    dstb.nhanvien_cs_logs.Add(apl);
                    dstb.SubmitChanges(OnSubmitCompleted, true);
                }
                else
                    MessageBox.Show("Nhập chưa đủ thông tin hoặc sai qui cách nhập mã cán bộ !");
            }
        }
 /// <summary>
 /// Create a new nhanvien_cs object.
 /// </summary>
 /// <param name="ma_nvcs">Initial value of the ma_nvcs property.</param>
 public static nhanvien_cs Createnhanvien_cs(global::System.String ma_nvcs)
 {
     nhanvien_cs nhanvien_cs = new nhanvien_cs();
     nhanvien_cs.ma_nvcs = ma_nvcs;
     return nhanvien_cs;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the nhanvien_cs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTonhanvien_cs(nhanvien_cs nhanvien_cs)
 {
     base.AddObject("nhanvien_cs", nhanvien_cs);
 }