Example #1
0
        private void SaveData(LoadOperation<kh_mai> lo)
        {

            if (lo.Entities.Count() > 0)
            {
                MessageBox.Show("Mã chương trình " + this.txtmakm.Text.Trim().ToUpper() + " đã tồn tại");
            }
            else
            {

                if (txtmakm.Text.Trim() != "" || txtten.Text.Trim() != "")
                {
                    kh_mai km = new kh_mai
                    {
                        ma_km = txtmakm.Text.Trim().ToUpper(),
                        ten_ct = txtten.Text.Trim(),
                        ngay_bd = dbatdau.DateTime,
                        ngay_kt=dketthuc.DateTime,
                        hieu_luc= chkhieuluc.IsChecked == true ? true : false
                    };
                    dstb.kh_mais.Add(km);
                    dstb.SubmitChanges(OnSubmitCompleted, true);
                }
                else
                    MessageBox.Show("Nhập chưa đủ thông tin");
            }
        }
 /// <summary>
 /// Create a new kh_mai object.
 /// </summary>
 /// <param name="ma_km">Initial value of the ma_km property.</param>
 /// <param name="hieu_luc">Initial value of the hieu_luc property.</param>
 public static kh_mai Createkh_mai(global::System.String ma_km, global::System.Boolean hieu_luc)
 {
     kh_mai kh_mai = new kh_mai();
     kh_mai.ma_km = ma_km;
     kh_mai.hieu_luc = hieu_luc;
     return kh_mai;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the kh_mai EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTokh_mai(kh_mai kh_mai)
 {
     base.AddObject("kh_mai", kh_mai);
 }