/// <summary> /// Create a new thuhoi_thietbi object. /// </summary> /// <param name="id">Initial value of the id property.</param> public static thuhoi_thietbi Createthuhoi_thietbi(global::System.Decimal id) { thuhoi_thietbi thuhoi_thietbi = new thuhoi_thietbi(); thuhoi_thietbi.id = id; return thuhoi_thietbi; }
void SaveData() { Nullable<DateTime> m_ngayhd, m_ngaycat, m_ngayld, m_ngaycap; if (dngayhd.Text.Trim() != "") m_ngayhd = dngayhd.DateTime; else m_ngayhd = null; if (dngaycat.Text.Trim() != "") m_ngaycat = dngaycat.DateTime; else m_ngaycat = null; if (dngayld.Text.Trim() != "") m_ngayld = dngayld.DateTime; else m_ngayld = null; if (dngaycap.Text.Trim() != "") m_ngaycap = dngaycap.DateTime; else m_ngaycap = null; try { // get_hopdong(App.ma_huyen + "/" + this.dngayhd.DateTime.Year.ToString().Substring(2, 2)); if (txttt.Text.Trim() != "X") // khong phai thanh ly thi update { LoadOpMy.Entities.ElementAt(0).ten_dktb = txttentb.Text.Trim(); LoadOpMy.Entities.ElementAt(0).ten_nsd = txttendb.Text.Trim(); LoadOpMy.Entities.ElementAt(0).dia_chitb = txtdctb.Text.Trim(); LoadOpMy.Entities.ElementAt(0).dc_tbld = txtdcld.Text.Trim(); LoadOpMy.Entities.ElementAt(0).sohopdong = txtsohd.Text.Trim(); LoadOpMy.Entities.ElementAt(0).ngay_hd = m_ngayhd; LoadOpMy.Entities.ElementAt(0).ngay_ld = m_ngayld; LoadOpMy.Entities.ElementAt(0).tuyen_tc = cmbtuyen.Text.Trim(); LoadOpMy.Entities.ElementAt(0).goi_cuoc = cmbgoicuoc.GetKeyValue(cmbgoicuoc.SelectedIndex).ToString(); LoadOpMy.Entities.ElementAt(0).so_dt = txtsdt.Text.Trim(); LoadOpMy.Entities.ElementAt(0).toc_do = cmbtocdo.GetKeyValue(cmbtocdo.SelectedIndex).ToString(); LoadOpMy.Entities.ElementAt(0).ma_dv = cmbdichvu.GetKeyValue(cmbdichvu.SelectedIndex).ToString(); LoadOpMy.Entities.ElementAt(0).ht_ld = cmbhtld.Text.Trim().Substring(0, 1); LoadOpMy.Entities.ElementAt(0).ma_huyen = App.ma_huyen; LoadOpMy.Entities.ElementAt(0).socmnd = txtcmnd.Text.Trim(); LoadOpMy.Entities.ElementAt(0).noi_cap = txtnoicap.Text.Trim(); LoadOpMy.Entities.ElementAt(0).ngay_cap = m_ngaycap; LoadOpMy.Entities.ElementAt(0).ma_kh = txtmakh.Text; LoadOpMy.Entities.ElementAt(0).ma_tram = cmbtramvt.GetKeyValue(cmbtramvt.SelectedIndex).ToString(); LoadOpMy.Entities.ElementAt(0).may_ngung = txttt.Text.Trim(); LoadOpMy.Entities.ElementAt(0).ngay_ngung = m_ngaycat; LoadOpMy.Entities.ElementAt(0).thtb = this.chkthtb.IsChecked; LoadOpMy.Entities.ElementAt(0).tenkhkd = FunAndPro.KhongDau(txttentb.Text.Trim()); LoadOpMy.Entities.ElementAt(0).dckd = FunAndPro.KhongDau(txtdctb.Text.Trim()); // LoadOpMy.Entities.ElementAt(0).ms_thue = FunAndPro.ma_st(txtmst.Text.Trim()); LoadOpMy.Entities.ElementAt(0).duong = App.duong; LoadOpMy.Entities.ElementAt(0).xa_phuong = App.phuong; LoadOpMy.Entities.ElementAt(0).khom_ap = App.khom; //LoadOpMy.Entities.ElementAt(0).ma_nhom = cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString(); //LoadOpMy.Entities.ElementAt(0).ma_nghe = cmbnganh.GetKeyValue(cmbnganh.SelectedIndex).ToString(); // LoadOpMy.Entities.ElementAt(0).ngan_hang = txtNH.Text.Trim(); LoadOpMy.Entities.ElementAt(0).ma_km = cmbkm.Text.Trim() == "" ? "0" : cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString(); LoadOpMy.Entities.ElementAt(0).kh_uutien = cmbkhuutien.SelectedIndex == -1 ? "" : cmbkhuutien.GetKeyValue(cmbkhuutien.SelectedIndex).ToString(); } else { if (LoadOpMy.Entities.Count() > 0) // xoa so dt khoi ds_codinh neu chon loai thanh ly hop dong { internet cd = LoadOpMy.Entities.First(); dstb.internets.Remove(cd); } } internet_log dsl = new internet_log { user_name = this.txtusr.Text.Trim(), ten_dktb = this.txttentb.Text.Trim(), ten_nsd = this.txttendb.Text.Trim(), dia_chitb = this.txtdctb.Text.Trim(), dc_tbld = this.txtdcld.Text.Trim(), sohopdong = this.txtsohd.Text.Trim(), ngay_hd = m_ngayhd, ngay_ld = m_ngayld, tuyen_tc = cmbtuyen.Text.Trim(), goi_cuoc = cmbgoicuoc.GetKeyValue(cmbgoicuoc.SelectedIndex).ToString(), so_dt = this.txtsdt.Text.Trim(), toc_do = cmbtocdo.GetKeyValue(cmbtocdo.SelectedIndex).ToString(), ma_dv = cmbdichvu.GetKeyValue(cmbdichvu.SelectedIndex).ToString(), kh_uutien = cmbkhuutien.SelectedIndex == -1 ? "" : cmbkhuutien.GetKeyValue(cmbkhuutien.SelectedIndex).ToString(), ht_ld = this.cmbhtld.Text.Trim() == "" ? "1" : this.cmbhtld.Text.Trim().Substring(0, 1), ma_huyen = App.ma_huyen, socmnd = this.txtcmnd.Text.Trim(), noi_cap = this.txtnoicap.Text.Trim(), ngay_cap = m_ngaycap, ma_kh = this.txtmakh.Text, ngay_ngung = m_ngaycat, may_ngung = this.txttt.Text.Trim(), //ms_thue = FunAndPro.ma_st(this.txtmst.Text.Trim()), //ngan_hang = this.txtNH.Text.Trim(), ma_km = cmbkm.Text.Trim() == "" ? "0" : cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString(), //ma_nhom = cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString(), //ma_nghe = cmbnganh.GetKeyValue(cmbnganh.SelectedIndex).ToString(), thtb = this.chkthtb.IsChecked, ldthtb = this.mlydoth.Text.Trim(), lydocat = mlydo.Text.Trim() == "" ? "" : mlydo.GetKeyValue(mlydo.SelectedIndex).ToString(), user_login = App.User_name, thoi_gian = App.Current_d }; dstb.internet_logs.Add(dsl); if (txttt.Text.Trim() == "C") // neu la cat may thi ghi vao table thuhoi { thuhoi_thietbi th = new thuhoi_thietbi { user_name = this.txtusr.Text.Trim(), dia_chitb=txtdctb.Text.Trim(), dc_tbld=txtdcld.Text.Trim(), goi_cuoc = cmbgoicuoc.GetKeyValue(cmbgoicuoc.SelectedIndex).ToString(), loai_dv="I", ma_huyen=App.ma_huyen, may_ngung="C", ngay_ngung = m_ngaycat, ten_dktb=txttentb.Text.Trim(), toc_do = cmbtocdo.GetKeyValue(cmbtocdo.SelectedIndex).ToString(), thtb=chkthtb.IsChecked, ten_nsd = txttentb.Text.Trim(), seri_ld=seri_ldn, seri_th=txtSeri.Text.Trim(), loai_tb=loai_tbn }; dstb.thuhoi_thietbis.Add(th); } dstb.SubmitChanges(OnSubmitCompleted,true); // enable_control(false); } catch(Exception e) { MessageBox.Show(string.Format("Exception Failed: {0}",e)); } }
/// <summary> /// Deprecated Method for adding a new object to the thuhoi_thietbi EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTothuhoi_thietbi(thuhoi_thietbi thuhoi_thietbi) { base.AddObject("thuhoi_thietbi", thuhoi_thietbi); }