void SaveData() { Nullable<DateTime> m_ngayhd, m_ngaykn, m_ngayld, m_ngaycap; if (dngayhd.Text.Trim() != "") m_ngayhd = dngayhd.DateTime; else m_ngayhd = null; if (dngaykn.Text.Trim() != "") m_ngaykn = dngaykn.DateTime; else m_ngaykn = 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 { LoadOp.Entities.ElementAt(0).ma_kh=this.txtmakh.Text ; LoadOp.Entities.ElementAt(0).sohopdong =this.txtsohd.Text.Trim(); LoadOp.Entities.ElementAt(0).ngay_hd=m_ngayhd; LoadOp.Entities.ElementAt(0).ten_dktb =this.txttentb.Text.Trim() ; LoadOp.Entities.ElementAt(0).ten_dkdb =this.txttendb.Text.Trim(); LoadOp.Entities.ElementAt(0).dia_chitb=this.txtdctb.Text.Trim(); LoadOp.Entities.ElementAt(0).dc_tbld =this.txtdcld.Text.Trim(); LoadOp.Entities.ElementAt(0).tien_tb = this.txttientb.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttientb.Text.Trim()); LoadOp.Entities.ElementAt(0).tb_dv = this.txttbdv.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttbdv.Text.Trim()); LoadOp.Entities.ElementAt(0).tienno = this.txttientbtk.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttientbtk.Text.Trim()); // LoadOp.Entities.ElementAt(0).khg_vat =this.cmbvtci.SelectedIndex ==0 ? false : true; LoadOp.Entities.ElementAt(0).SoSim= this.txtsosim.Text.Trim(); LoadOp.Entities.ElementAt(0).socmnd =this.txtcmnd.Text.Trim(); LoadOp.Entities.ElementAt(0).ngay_ld=m_ngayld; LoadOp.Entities.ElementAt(0).may_ngung = LoadOp.Entities.ElementAt(0).may_ngung.Trim() == "M" ? "D" : LoadOp.Entities.ElementAt(0).may_ngung.Trim(); LoadOp.Entities.ElementAt(0).thangbd =this.txtthangbd.Text.Trim(); LoadOp.Entities.ElementAt(0).noi_cap =this.txtnoicap.Text.Trim(); LoadOp.Entities.ElementAt(0).ngay_cap=m_ngaycap; LoadOp.Entities.ElementAt(0).tai_khoan =this.txttk.Text.Trim(); LoadOp.Entities.ElementAt(0).ngan_hang=this.txtNH.Text.Trim(); LoadOp.Entities.ElementAt(0).ms_thue =FunAndPro.ma_st(this.txtmst.Text.Trim()); LoadOp.Entities.ElementAt(0).ngay_kn=m_ngaykn; LoadOp.Entities.ElementAt(0).note_ngay_kn =this.txtghichu.Text.Trim(); LoadOp.Entities.ElementAt(0).village =cmbxa.GetKeyValue(cmbxa.SelectedIndex).ToString().Trim(); LoadOp.Entities.ElementAt(0).tenkhkd = FunAndPro.KhongDau(this.txttentb.Text.Trim()); LoadOp.Entities.ElementAt(0).dckd = FunAndPro.KhongDau(this.txtdctb.Text.Trim()); LoadOp.Entities.ElementAt(0).ma_tram =cmbtramvt.GetKeyValue(cmbtramvt.SelectedIndex).ToString(); LoadOp.Entities.ElementAt(0).ma_km = cmbkm.Text.Trim() == "" ? "0" : cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString(); LoadOp.Entities.ElementAt(0).ma_nhom =cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString(); LoadOp.Entities.ElementAt(0).ma_nghe = cmbnganh.GetKeyValue(cmbnganh.SelectedIndex).ToString(); LoadOp.Entities.ElementAt(0).ma_nvcs = cmbcbcs.SelectedIndex == -1 ? "" : cmbcbcs.GetKeyValue(cmbcbcs.SelectedIndex).ToString(); LoadOp.Entities.ElementAt(0).ma_nvkt = cmbcbkt.SelectedIndex == -1 ? "" : cmbcbkt.GetKeyValue(cmbcbkt.SelectedIndex).ToString(); LoadOp.Entities.ElementAt(0).pl = Getplkhachhang(cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString()); LoadOp.Entities.ElementAt(0).tuyen_tc = cmbtuyen.Text.Trim(); LoadOp.Entities.ElementAt(0).e_mail = this.txtemail.Text.Trim(); LoadOp.Entities.ElementAt(0).dt_lh = this.txtdtlh.Text.Trim(); LoadOp.Entities.ElementAt(0).loai_tb = Convert.ToBoolean(Convert.ToInt16(cmbloaitb.Text.Substring(0, 1))); LoadOp.Entities.ElementAt(0).camket = Convert.ToInt16(this.spcamket.Text); LoadOp.Entities.ElementAt(0).so_nha = App.sonha; LoadOp.Entities.ElementAt(0).duong = App.duong; LoadOp.Entities.ElementAt(0).xa_phuong = App.phuong; LoadOp.Entities.ElementAt(0).khom_ap = App.khom; LoadOp.Entities.ElementAt(0).so_nhald = App.sonhald; LoadOp.Entities.ElementAt(0).duongld = App.duongld; LoadOp.Entities.ElementAt(0).xa_phuongld = App.phuongld; LoadOp.Entities.ElementAt(0).khom_apld = App.khomld; LoadOp.Entities.ElementAt(0).goi_th = cmbgoith.SelectedIndex == -1 ? S_null : this.cmbgoith.GetKeyValue(cmbgoith.SelectedIndex).ToString().Trim(); LoadOp.Entities.ElementAt(0).id_goicuoc = cmbgoith.SelectedIndex == -1 ? S_null : App.id_goicuoc; OKButton.IsEnabled = false; Gphone_log dsl = new Gphone_log { so_dt = this.txtsdt.Text.Trim(), ten_dktb = this.txttentb.Text.Trim(), ten_dkdb = this.txttendb.Text.Trim(), dia_chitb = this.txtdctb.Text.Trim(), dc_tbld = this.txtdcld.Text.Trim(), tuyen_tc = cmbtuyen.Text.Trim(), tien_tb = this.txttientb.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttientb.Text.Trim()), tb_dv = this.txttbdv.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttbdv.Text.Trim()), tienno = this.txttientbtk.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttientbtk.Text.Trim()), // khg_vat =this.cmbvtci.SelectedIndex ==0 ? false : true, pl = Getplkhachhang(cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString()), may_ngung = LoadOp.Entities.ElementAt(0).may_ngung.Trim() == "M" ? "D" : LoadOp.Entities.ElementAt(0).may_ngung.Trim(), ma_huyen = LoadOp.Entities.ElementAt(0).ma_huyen, sohopdong = this.txtsohd.Text, ngay_hd = m_ngayhd, ngay_ld=m_ngayld, village =cmbxa.GetKeyValue(cmbxa.SelectedIndex).ToString().Trim(), ma_kh = this.txtmakh.Text, ngay_kn = m_ngaykn, note_ngay_kn = this.txtghichu.Text.Trim(), ms_thue = FunAndPro.ma_st(this.txtmst.Text.Trim()), socmnd = this.txtcmnd.Text.Trim(), noi_cap = this.txtnoicap.Text.Trim(), ngay_cap = m_ngaycap, e_mail = this.txtemail.Text.Trim(), thoi_gian = App.Current_d, 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(), ma_nvcs = cmbcbcs.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbcs.SelectedIndex).ToString(), ma_nvkt = cmbcbkt.SelectedIndex == -1 ? S_null : cmbcbkt.GetKeyValue(cmbcbkt.SelectedIndex).ToString(), camket = Convert.ToInt16(this.spcamket.Text), loai_tb = Convert.ToBoolean(Convert.ToInt16(cmbloaitb.Text.Substring(0, 1))), users = App.User_name, dt_lh = this.txtdtlh.Text.Trim(), so_nha = App.sonha, so_nhald = App.sonhald, goi_th = cmbgoith.SelectedIndex == -1 ? S_null : this.cmbgoith.GetKeyValue(cmbgoith.SelectedIndex).ToString().Trim(), id_goicuoc = cmbgoith.SelectedIndex == -1 ? S_null : App.id_goicuoc }; idgoi = App.id_goicuoc; dstb.Gphone_logs.Add(dsl); dstb.SubmitChanges(OnSubmitCompleted, true); // dstb.SubmitChanges(); // xoa cac dich vu da dang ky va ghi lai dv da chon // DeleteCompleted(); //this.OKButton.IsEnabled = false; //this.btnNew.IsEnabled = true; //MessageBox.Show("Đã lưu vào cơ sở dữ liệu"); } catch(Exception e) { MessageBox.Show(string.Format("Exception Failed: {0}",e)); } }
void SaveData() { try { // get_hopdong(App.ma_huyen + "/" + this.dngayhd.DateTime.Year.ToString().Substring(2, 2)); Gphone ds = new Gphone { so_dt = this.txtsdt.Text, SoSim= this.txtsosim.Text.Trim(), ten_dktb = this.txttentb.Text.Trim(), ten_dkdb = this.txttendb.Text.Trim(), dia_chitb = this.txtdctb.Text.Trim(), dc_tbld = this.txtdcld.Text.Trim(), tuyen_tc = "", ma_tram = cmbtramvt.GetKeyValue(cmbtramvt.SelectedIndex).ToString(), pl = Getplkhachhang(cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString().Trim()), village = "", tien_tb = 0, tienno = 0, tb_dv = 0, ngay_ld = null, ngay_mo = null, may_ngung = "M", ngay_ngung = null, keo_may = false, mo_may = false, ma_huyen = App.ma_huyen, stt = 0, sohopdong = this.txtsohd.Text.Trim(), ngay_hd = this.dngayhd.DateTime, thangbd = "", inct = false, ma_kh = this.txtmakh.Text, ngay_kn = dngaykn.Text.Trim() == "" ? D_null : this.dngaykn.DateTime, note_ngay_kn = this.txtghichu.Text.Trim(), tenkhkd = FunAndPro.KhongDau(this.txttentb.Text.Trim()), dckd = FunAndPro.KhongDau(this.txtdctb.Text.Trim()), ms_thue = FunAndPro.ma_st(this.txtmst.Text.Trim()), khg_vat = false, cuoc = 0, ngay = null, duong = App.duong, xa_phuong = App.phuong, khom_ap = App.khom, tbdc = false, kh_db = "", ma_nhom = cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString(), ma_nghe = cmbnganh.GetKeyValue(cmbnganh.SelectedIndex).ToString(), socmnd = this.txtcmnd.Text.Trim(), noi_cap = this.txtnoicap.Text.Trim(), ngay_cap = this.dngaycap.DateTime, ngan_hang = this.txtNH.Text.Trim(), e_mail = this.txtemail.Text.Trim(), camket = Convert.ToInt16(this.spcamket.Text), ma_km = cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString(), loai_tb = Convert.ToBoolean(Convert.ToInt16(cmbloaitb.Text.Substring(0,1))), ma_nvcs = cmbcbcs.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbcs.SelectedIndex).ToString(), ma_nvkt = cmbcbkt.SelectedIndex == -1 ? S_null : cmbcbkt.GetKeyValue(cmbcbkt.SelectedIndex).ToString(), dt_lh = this.txtdtlh.Text.Trim(), goi_th = cmbgoith.SelectedIndex == -1 ? S_null : this.cmbgoith.GetKeyValue(cmbgoith.SelectedIndex).ToString().Trim(), id_goicuoc = App.id_goicuoc }; dstb.Gphones.Add(ds); Gphone_log dsl = new Gphone_log { so_dt = this.txtsdt.Text.Trim(), SoSim = this.txtsosim.Text.Trim(), ten_dktb = this.txttentb.Text.Trim(), ten_dkdb = this.txttendb.Text.Trim(), dia_chitb = this.txtdctb.Text.Trim(), dc_tbld = this.txtdcld.Text.Trim(), tuyen_tc = null, pl = Getplkhachhang(cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString().Trim()), may_ngung = "M", ma_huyen = App.ma_huyen, sohopdong = this.txtsohd.Text, ngay_hd = this.dngayhd.DateTime, ma_kh = this.txtmakh.Text, ngay_kn = dngaykn.Text.Trim() == "" ? D_null : this.dngaykn.DateTime, note_ngay_kn = this.txtghichu.Text.Trim(), ms_thue = FunAndPro.ma_st(this.txtmst.Text.Trim()), socmnd = this.txtcmnd.Text.Trim(), noi_cap = this.txtnoicap.Text.Trim(), ngay_cap = this.dngaycap.DateTime, e_mail = this.txtemail.Text.Trim(), camket = Convert.ToInt16(this.spcamket.Text), thoi_gian = App.Current_d, ma_km = cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString(), ma_nhom = cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString(), ma_nghe = cmbnganh.GetKeyValue(cmbnganh.SelectedIndex).ToString(), loai_tb = Convert.ToBoolean(Convert.ToInt16(cmbloaitb.Text.Substring(0, 1))), ma_nvcs = cmbcbcs.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbcs.SelectedIndex).ToString(), ma_nvkt = cmbcbkt.SelectedIndex == -1 ? S_null : cmbcbkt.GetKeyValue(cmbcbkt.SelectedIndex).ToString(), users = App.User_name, dt_lh = this.txtdtlh.Text.Trim(), goi_th = cmbgoith.SelectedIndex == -1 ? S_null : this.cmbgoith.GetKeyValue(cmbgoith.SelectedIndex).ToString().Trim(), id_goicuoc = App.id_goicuoc }; dstb.Gphone_logs.Add(dsl); dstb.SubmitChanges(OnSubmitCompleted,true); } catch(Exception e) { MessageBox.Show(string.Format("Exception Failed: {0}",e)); } }
void Update_data() { if (App.id_goicuoc == "" && cmbgoith.SelectedIndex != -1) { MessageBox.Show("Chưa chọn thuê bao tích hợp !"); return; } try { // get_hopdong(App.ma_huyen + "/" + this.dngayhd.DateTime.Year.ToString().Substring(2, 2)); // LoadOptb.Entities.ElementAt(0).so_dt = this.txtsdt.Text; LoadOptb.Entities.ElementAt(0).SoSim = this.txtsosim.Text.Trim(); LoadOptb.Entities.ElementAt(0).ten_dktb = this.txttentb.Text.Trim(); LoadOptb.Entities.ElementAt(0).ten_dkdb = this.txttendb.Text.Trim(); LoadOptb.Entities.ElementAt(0).dia_chitb = this.txtdctb.Text.Trim(); LoadOptb.Entities.ElementAt(0).dc_tbld = this.txtdcld.Text.Trim(); LoadOptb.Entities.ElementAt(0).tuyen_tc = ""; LoadOptb.Entities.ElementAt(0).ma_tram = cmbtramvt.GetKeyValue(cmbtramvt.SelectedIndex).ToString(); LoadOptb.Entities.ElementAt(0).pl = Getplkhachhang(cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString().Trim()); LoadOptb.Entities.ElementAt(0).village = ""; LoadOptb.Entities.ElementAt(0).tien_tb = 0; LoadOptb.Entities.ElementAt(0).tienno = 0; LoadOptb.Entities.ElementAt(0).tb_dv = 0; LoadOptb.Entities.ElementAt(0).ngay_ld = null; LoadOptb.Entities.ElementAt(0).ngay_mo = null; LoadOptb.Entities.ElementAt(0).may_ngung = "M"; LoadOptb.Entities.ElementAt(0).ngay_ngung = null; LoadOptb.Entities.ElementAt(0).keo_may = false; LoadOptb.Entities.ElementAt(0).mo_may = false; LoadOptb.Entities.ElementAt(0).ma_huyen = App.ma_huyen; LoadOptb.Entities.ElementAt(0).stt = 0; LoadOptb.Entities.ElementAt(0).sohopdong = this.txtsohd.Text.Trim(); LoadOptb.Entities.ElementAt(0).ngay_hd = this.dngayhd.DateTime; LoadOptb.Entities.ElementAt(0).thangbd = ""; LoadOptb.Entities.ElementAt(0).inct = false; LoadOptb.Entities.ElementAt(0).ma_kh = this.txtmakh.Text; LoadOptb.Entities.ElementAt(0).ngay_kn = dngaykn.Text.Trim() == "" ? D_null : this.dngaykn.DateTime; LoadOptb.Entities.ElementAt(0).note_ngay_kn = this.txtghichu.Text.Trim(); LoadOptb.Entities.ElementAt(0).tenkhkd = FunAndPro.KhongDau(this.txttentb.Text.Trim()); LoadOptb.Entities.ElementAt(0).dckd = FunAndPro.KhongDau(this.txtdctb.Text.Trim()); LoadOptb.Entities.ElementAt(0).ms_thue = FunAndPro.ma_st(this.txtmst.Text.Trim()); LoadOptb.Entities.ElementAt(0).khg_vat = false; LoadOptb.Entities.ElementAt(0).cuoc = 0; LoadOptb.Entities.ElementAt(0).ngay = null; LoadOptb.Entities.ElementAt(0).duong = App.duong; LoadOptb.Entities.ElementAt(0).xa_phuong = App.phuong; LoadOptb.Entities.ElementAt(0).khom_ap = App.khom; LoadOptb.Entities.ElementAt(0).tbdc = false; LoadOptb.Entities.ElementAt(0).kh_db = ""; LoadOptb.Entities.ElementAt(0).ma_nhom = cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString(); LoadOptb.Entities.ElementAt(0).ma_nghe = cmbnganh.GetKeyValue(cmbnganh.SelectedIndex).ToString(); LoadOptb.Entities.ElementAt(0).socmnd = this.txtcmnd.Text.Trim(); LoadOptb.Entities.ElementAt(0).noi_cap = this.txtnoicap.Text.Trim(); LoadOptb.Entities.ElementAt(0).ngay_cap = this.dngaycap.DateTime; LoadOptb.Entities.ElementAt(0).ngan_hang = this.txtNH.Text.Trim(); LoadOptb.Entities.ElementAt(0).e_mail = this.txtemail.Text.Trim(); LoadOptb.Entities.ElementAt(0).dt_lh = this.txtdtlh.Text.Trim(); LoadOptb.Entities.ElementAt(0).camket = Convert.ToInt16(this.spcamket.Text); LoadOptb.Entities.ElementAt(0).ma_km = cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString(); LoadOptb.Entities.ElementAt(0).loai_tb = Convert.ToBoolean(Convert.ToInt16(cmbloaitb.Text.Substring(0, 1))); LoadOptb.Entities.ElementAt(0).ma_nvcs = cmbcbcs.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbcs.SelectedIndex).ToString(); LoadOptb.Entities.ElementAt(0).ma_nvkt = cmbcbkt.SelectedIndex == -1 ? S_null : cmbcbkt.GetKeyValue(cmbcbkt.SelectedIndex).ToString(); Gphone_log dsl = new Gphone_log { so_dt = this.txtsdt.Text.Trim(), SoSim = this.txtsosim.Text.Trim(), ten_dktb = this.txttentb.Text.Trim(), ten_dkdb = this.txttendb.Text.Trim(), dia_chitb = this.txtdctb.Text.Trim(), dc_tbld = this.txtdcld.Text.Trim(), tuyen_tc = null, pl = Getplkhachhang(cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString().Trim()), may_ngung = "M", ma_huyen = App.ma_huyen, sohopdong = this.txtsohd.Text, ngay_hd = this.dngayhd.DateTime, ma_kh = this.txtmakh.Text, ngay_kn = dngaykn.Text.Trim() == "" ? D_null : this.dngaykn.DateTime, note_ngay_kn = this.txtghichu.Text.Trim(), ms_thue = FunAndPro.ma_st(this.txtmst.Text.Trim()), socmnd = this.txtcmnd.Text.Trim(), noi_cap = this.txtnoicap.Text.Trim(), ngay_cap = this.dngaycap.DateTime, e_mail = this.txtemail.Text.Trim(), camket = Convert.ToInt16(this.spcamket.Text), thoi_gian = App.Current_d, ma_km = cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString(), ma_nhom = cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString(), ma_nghe = cmbnganh.GetKeyValue(cmbnganh.SelectedIndex).ToString(), loai_tb = Convert.ToBoolean(Convert.ToInt16(cmbloaitb.Text.Substring(0, 1))), ma_nvcs = cmbcbcs.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbcs.SelectedIndex).ToString(), ma_nvkt = cmbcbkt.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbkt.SelectedIndex).ToString(), users = App.User_name, dt_lh = this.txtdtlh.Text.Trim(), goi_th= cmbgoith.SelectedIndex == -1 ? S_null : this.cmbgoith.GetKeyValue(cmbgoith.SelectedIndex).ToString().Trim(), }; dstb.Gphone_logs.Add(dsl); dstb.SubmitChanges(OnSubmitCompleted, true); } catch (Exception e) { MessageBox.Show(string.Format("Exception Failed: {0}", e)); } }
void SaveDate() { FunAndPro callF = new FunAndPro(); callF.GetDateTime(); Nullable<DateTime> m_ngayhd, m_ngaykn, m_ngayld, m_ngaycap; decimal m_stt1; gridControl1.ShowLoadingPanel = true; for (int i = 0; i < gridControl1.VisibleRowCount; i++) { sdt = gridControl1.GetCellValue(i, sodt).ToString().Trim(); m_stt = (gridControl1.GetCellValue(i, stt) == null || gridControl1.GetCellValue(i, stt).ToString().Trim() == "") ? 0 : Convert.ToDecimal(gridControl1.GetCellValue(i, stt)); m_tuyen = gridControl1.GetCellValue(i, tuyen_tc).ToString().Trim(); // Update ds_codinh for (int j = 0; j < LoadOpS.Entities.Count(); j++) { if (LoadOpS.Entities.ElementAt(j).so_dt.Trim() == sdt) { m_stt1 = (LoadOpS.Entities.ElementAt(j).stt == null || LoadOpS.Entities.ElementAt(j).stt.ToString().Trim() == "") ? 0 : Convert.ToDecimal(LoadOpS.Entities.ElementAt(j).stt); if (LoadOpS.Entities.ElementAt(j).tuyen_tc.Trim() != m_tuyen || m_stt1 != m_stt) { LoadOpS.Entities.ElementAt(j).stt = m_stt; LoadOpS.Entities.ElementAt(j).tuyen_tc = m_tuyen; if (LoadOpS.Entities.ElementAt(j).ngay_hd.HasValue) m_ngayhd = LoadOpS.Entities.ElementAt(j).ngay_hd; else m_ngayhd = null; if (LoadOpS.Entities.ElementAt(j).ngay_kn.HasValue) m_ngaykn = LoadOpS.Entities.ElementAt(j).ngay_kn; else m_ngaykn = null; if (LoadOpS.Entities.ElementAt(j).ngay_ld.HasValue) m_ngayld = LoadOpS.Entities.ElementAt(j).ngay_ld; else m_ngayld = null; if (LoadOpS.Entities.ElementAt(j).ngay_cap.HasValue) m_ngaycap = LoadOpS.Entities.ElementAt(j).ngay_cap; else m_ngaycap = null; codinh_log dsl = new codinh_log { so_dt = LoadOpS.Entities.ElementAt(j).so_dt, ten_dktb = LoadOpS.Entities.ElementAt(j).ten_dktb == null ? "" : LoadOpS.Entities.ElementAt(j).ten_dktb, ten_dkdb = LoadOpS.Entities.ElementAt(j).ten_dkdb == null ? "" : LoadOpS.Entities.ElementAt(j).ten_dkdb, dia_chitb = LoadOpS.Entities.ElementAt(j).dia_chitb == null ? "" : LoadOpS.Entities.ElementAt(j).dia_chitb, dc_tbld = LoadOpS.Entities.ElementAt(j).dc_tbld == null ? "" : LoadOpS.Entities.ElementAt(j).dc_tbld, tuyen_tc = m_tuyen, stt = m_stt, tien_tb = LoadOpS.Entities.ElementAt(j).tien_tb == null ? j : LoadOpS.Entities.ElementAt(j).tien_tb, tb_dv = LoadOpS.Entities.ElementAt(j).tb_dv == null ? j : LoadOpS.Entities.ElementAt(j).tb_dv, tienno = LoadOpS.Entities.ElementAt(j).tienno == null ? j : LoadOpS.Entities.ElementAt(j).tienno, khg_vat = LoadOpS.Entities.ElementAt(j).khg_vat == null ? false : LoadOpS.Entities.ElementAt(j).khg_vat, ma_tram = LoadOpS.Entities.ElementAt(j).ma_tram, pl = LoadOpS.Entities.ElementAt(j).pl, may_ngung = LoadOpS.Entities.ElementAt(j).may_ngung, ma_huyen = LoadOpS.Entities.ElementAt(j).ma_huyen, sohopdong = LoadOpS.Entities.ElementAt(j).sohopdong, ngay_hd = m_ngayhd, ngay_ld = m_ngayld, village = LoadOpS.Entities.ElementAt(j).village, ma_kh = LoadOpS.Entities.ElementAt(j).ma_kh, ngay_kn = m_ngaykn, note_ngay_kn = LoadOpS.Entities.ElementAt(j).note_ngay_kn, ms_thue = LoadOpS.Entities.ElementAt(j).ms_thue, socmnd = LoadOpS.Entities.ElementAt(j).socmnd, noi_cap = LoadOpS.Entities.ElementAt(j).noi_cap, ngay_cap = m_ngaycap, e_mail = LoadOpS.Entities.ElementAt(j).e_mail, thoi_gian = App.Current_d, ma_km = LoadOpS.Entities.ElementAt(j).ma_km, users = App.User_name }; dstb.codinh_logs.Add(dsl); break; } } } for (int k = 0; k < LoadOpG.Entities.Count(); k++) { if (LoadOpG.Entities.ElementAt(k).so_dt == sdt) { if (LoadOpG.Entities.ElementAt(k).tuyen_tc.Trim() != m_tuyen || LoadOpG.Entities.ElementAt(k).stt != m_stt) { LoadOpG.Entities.ElementAt(k).stt = m_stt; LoadOpG.Entities.ElementAt(k).tuyen_tc = m_tuyen; if (LoadOpG.Entities.ElementAt(k).ngay_hd.HasValue) m_ngayhd = LoadOpG.Entities.ElementAt(k).ngay_hd; else m_ngayhd = null; if (LoadOpG.Entities.ElementAt(k).ngay_kn.HasValue) m_ngaykn = LoadOpG.Entities.ElementAt(k).ngay_kn; else m_ngaykn = null; if (LoadOpG.Entities.ElementAt(k).ngay_ld.HasValue) m_ngayld = LoadOpG.Entities.ElementAt(k).ngay_ld; else m_ngayld = null; if (LoadOpG.Entities.ElementAt(k).ngay_cap.HasValue) m_ngaycap = LoadOpG.Entities.ElementAt(k).ngay_cap; else m_ngaycap = null; Gphone_log dsl = new Gphone_log { so_dt = LoadOpG.Entities.ElementAt(k).so_dt, ten_dktb = LoadOpG.Entities.ElementAt(k).ten_dktb == null ? "" : LoadOpG.Entities.ElementAt(k).ten_dktb, ten_dkdb = LoadOpG.Entities.ElementAt(k).ten_dkdb == null ? "" : LoadOpG.Entities.ElementAt(k).ten_dkdb, dia_chitb = LoadOpG.Entities.ElementAt(k).dia_chitb == null ? "" : LoadOpG.Entities.ElementAt(k).dia_chitb, dc_tbld = LoadOpG.Entities.ElementAt(k).dc_tbld == null ? "" : LoadOpG.Entities.ElementAt(k).dc_tbld, tuyen_tc = m_tuyen, stt = m_stt, tien_tb = LoadOpG.Entities.ElementAt(k).tien_tb, tb_dv = LoadOpG.Entities.ElementAt(k).tb_dv, tienno = LoadOpG.Entities.ElementAt(k).tienno, khg_vat = LoadOpG.Entities.ElementAt(k).khg_vat, pl = LoadOpG.Entities.ElementAt(k).pl, may_ngung = LoadOpG.Entities.ElementAt(k).may_ngung, ma_huyen = LoadOpG.Entities.ElementAt(k).ma_huyen, sohopdong = LoadOpG.Entities.ElementAt(k).sohopdong, ngay_hd = m_ngayhd, ngay_ld = m_ngayld, village = LoadOpG.Entities.ElementAt(k).village, ma_kh = LoadOpG.Entities.ElementAt(k).ma_kh, ngay_kn = m_ngaykn, note_ngay_kn = LoadOpG.Entities.ElementAt(k).note_ngay_kn, ms_thue = LoadOpG.Entities.ElementAt(k).ms_thue, socmnd = LoadOpG.Entities.ElementAt(k).socmnd, noi_cap = LoadOpG.Entities.ElementAt(k).noi_cap, ngay_cap = m_ngaycap, e_mail = LoadOpG.Entities.ElementAt(k).e_mail, thoi_gian = App.Current_d, ma_km = LoadOpG.Entities.ElementAt(k).ma_km, users = App.User_name }; dstb.Gphone_logs.Add(dsl); } } } for (int l = 0; l < LoadOpM.Entities.Count(); l++) { if (LoadOpM.Entities.ElementAt(l).user_name.Trim() == sdt) { if (LoadOpM.Entities.ElementAt(l).tuyen_tc.Trim() != m_tuyen || LoadOpM.Entities.ElementAt(l).stt != m_stt) { LoadOpM.Entities.ElementAt(l).stt = m_stt; LoadOpM.Entities.ElementAt(l).tuyen_tc = m_tuyen; if (LoadOpM.Entities.ElementAt(l).ngay_hd.HasValue) m_ngayhd = LoadOpM.Entities.ElementAt(l).ngay_hd; else m_ngayhd = null; if (LoadOpM.Entities.ElementAt(l).ngay_kn.HasValue) m_ngaykn = LoadOpM.Entities.ElementAt(l).ngay_kn; else m_ngaykn = null; if (LoadOpM.Entities.ElementAt(l).ngay_ld.HasValue) m_ngayld = LoadOpM.Entities.ElementAt(l).ngay_ld; else m_ngayld = null; if (LoadOpM.Entities.ElementAt(l).ngay_cap.HasValue) m_ngaycap = LoadOpM.Entities.ElementAt(l).ngay_cap; else m_ngaycap = null; mytv_log dsl = new mytv_log { user_name = LoadOpM.Entities.ElementAt(l).user_name, ten_dktb = LoadOpM.Entities.ElementAt(l).ten_dktb == null ? "" : LoadOpM.Entities.ElementAt(l).ten_dktb, ten_dkdb = LoadOpM.Entities.ElementAt(l).ten_dkdb == null ? "" : LoadOpM.Entities.ElementAt(l).ten_dkdb, dia_chitb = LoadOpM.Entities.ElementAt(l).dia_chitb == null ? "" : LoadOpM.Entities.ElementAt(l).dia_chitb, dc_tbld = LoadOpM.Entities.ElementAt(l).dc_tbld == null ? "" : LoadOpM.Entities.ElementAt(l).dc_tbld, sohopdong = LoadOpM.Entities.ElementAt(l).sohopdong, ngay_hd = m_ngayhd, ngay_ld = m_ngayld, tuyen_tc = m_tuyen, stt = m_stt, goi_cuoc = LoadOpM.Entities.ElementAt(l).goi_cuoc, so_dt = LoadOpM.Entities.ElementAt(l).so_dt == null ? "" : LoadOpM.Entities.ElementAt(l).so_dt, stb_serial = LoadOpM.Entities.ElementAt(l).stb_serial == null ? "" : LoadOpM.Entities.ElementAt(l).stb_serial, loai_cap = LoadOpM.Entities.ElementAt(l).loai_cap == null ? "" : LoadOpM.Entities.ElementAt(l).loai_cap, ht_ld = LoadOpM.Entities.ElementAt(l).ht_ld == null ? "" : LoadOpM.Entities.ElementAt(l).ht_ld, ma_huyen = App.ma_huyen, socmnd = LoadOpM.Entities.ElementAt(l).socmnd == null ? "" : LoadOpM.Entities.ElementAt(l).socmnd, noi_cap = LoadOpM.Entities.ElementAt(l).noi_cap == null ? "" : LoadOpM.Entities.ElementAt(l).noi_cap, ngay_cap = m_ngaycap, ma_kh = LoadOpM.Entities.ElementAt(l).ma_kh, pl = LoadOpM.Entities.ElementAt(l).pl == null ? "" : LoadOpM.Entities.ElementAt(l).pl, ngay_kn = m_ngaykn, note_ngay_kn = LoadOpM.Entities.ElementAt(l).note_ngay_kn == null ? "" : LoadOpM.Entities.ElementAt(l).note_ngay_kn, ms_thue = LoadOpM.Entities.ElementAt(l).ms_thue == null ? "" : LoadOpM.Entities.ElementAt(l).ms_thue, ngan_hang = LoadOpM.Entities.ElementAt(l).ngan_hang == null ? "" : LoadOpM.Entities.ElementAt(l).ngan_hang, ma_km = LoadOpM.Entities.ElementAt(l).ma_km == null ? "" : LoadOpM.Entities.ElementAt(l).ma_km, user_login = App.User_name, thoi_gian = App.Current_d }; dstb.mytv_logs.Add(dsl); } } } // update internet for (int m = 0; m < LoadOpI.Entities.Count(); m++) { if (LoadOpI.Entities.ElementAt(m).user_name.Trim() == sdt) { if (LoadOpI.Entities.ElementAt(m).tuyen_tc.Trim() != m_tuyen || LoadOpI.Entities.ElementAt(m).stt != m_stt) { LoadOpI.Entities.ElementAt(m).stt = m_stt; LoadOpI.Entities.ElementAt(m).tuyen_tc = m_tuyen; if (LoadOpI.Entities.ElementAt(m).ngay_hd.HasValue) m_ngayhd = LoadOpI.Entities.ElementAt(m).ngay_hd; else m_ngayhd = null; if (LoadOpI.Entities.ElementAt(m).ngay_kn.HasValue) m_ngaykn = LoadOpI.Entities.ElementAt(m).ngay_kn; else m_ngaykn = null; if (LoadOpI.Entities.ElementAt(m).ngay_ld.HasValue) m_ngayld = LoadOpI.Entities.ElementAt(m).ngay_ld; else m_ngayld = null; if (LoadOpI.Entities.ElementAt(m).ngay_cap.HasValue) m_ngaycap = LoadOpI.Entities.ElementAt(m).ngay_cap; else m_ngaycap = null; internet_log dsl = new internet_log { user_name = LoadOpI.Entities.ElementAt(m).user_name, ten_dktb = LoadOpI.Entities.ElementAt(m).ten_dktb == null ? "" : LoadOpI.Entities.ElementAt(m).ten_dktb.Trim(), ten_nsd = LoadOpI.Entities.ElementAt(m).ten_nsd == null ? "" : LoadOpI.Entities.ElementAt(m).ten_nsd.Trim(), dia_chitb = LoadOpI.Entities.ElementAt(m).dia_chitb == null ? "" : LoadOpI.Entities.ElementAt(m).dia_chitb.Trim(), dc_tbld = LoadOpI.Entities.ElementAt(m).dc_tbld == null ? "" : LoadOpI.Entities.ElementAt(m).dc_tbld.Trim(), sohopdong =LoadOpI.Entities.ElementAt(m).sohopdong==null? "": LoadOpI.Entities.ElementAt(m).sohopdong.Trim(), //ngay_hd = m_ngayhd, //ngay_ld = m_ngayld, tuyen_tc = m_tuyen, stt = m_stt, goi_cuoc = LoadOpI.Entities.ElementAt(m).goi_cuoc.Trim(), //so_dt = LoadOpI.Entities.ElementAt(m).so_dt == null ? "" : LoadOpI.Entities.ElementAt(m).so_dt, toc_do = LoadOpI.Entities.ElementAt(m).toc_do == null ? "" : LoadOpI.Entities.ElementAt(m).toc_do.Trim(), //may_ngung = LoadOpI.Entities.ElementAt(m).may_ngung == null ? "" : LoadOpI.Entities.ElementAt(m).may_ngung, ma_huyen = App.ma_huyen, //socmnd = LoadOpI.Entities.ElementAt(m).socmnd == null ? "" : LoadOpI.Entities.ElementAt(m).socmnd.Trim(), //noi_cap = LoadOpI.Entities.ElementAt(m).noi_cap == null ? "" : LoadOpI.Entities.ElementAt(m).noi_cap.Trim(), //ngay_cap = m_ngaycap, ma_kh = LoadOpI.Entities.ElementAt(m).ma_kh, //ngay_kn = m_ngaykn, //note_ngay_kn = LoadOpI.Entities.ElementAt(m).note_ngay_kn == null ? "" : LoadOpI.Entities.ElementAt(m).note_ngay_kn.Trim(), //ms_thue = LoadOpI.Entities.ElementAt(m).ms_thue == null ? "" : LoadOpI.Entities.ElementAt(m).ms_thue.Trim(), //ngan_hang = LoadOpI.Entities.ElementAt(m).ngan_hang == null ? "" : LoadOpI.Entities.ElementAt(m).ngan_hang.Trim(), //ma_km = LoadOpI.Entities.ElementAt(m).ma_km == null ? "" : LoadOpI.Entities.ElementAt(m).ma_km.Trim(), //ma_nvcs = LoadOpI.Entities.ElementAt(m).ma_nvcs == null ? "" : LoadOpI.Entities.ElementAt(m).ma_nvcs, user_login = App.User_name, thoi_gian = App.Current_d }; dstb.internet_logs.Add(dsl); } } } // UpdateCodinh(sdt, m_tuyen, m_stt); // UpdateGphone(sdt, m_tuyen, m_stt); // UpdateMytv(sdt, m_tuyen, m_stt); //// xem co phai la thue bao Gphone k ? // EntityQuery<Gphone> QueryG = dstb.GetGphonesQuery(); // LoadOpG = dstb.Load(QueryG.Where(p => p.ma_huyen == App.ma_huyen && p.so_dt == sdt), LoadOpG_Complete, null); // //xem co phai la thue bao MyTv k ? // EntityQuery<mytv> QueryM = dstb.GetMytvsQuery(); // LoadOpM = dstb.Load(QueryM.Where(p => p.user_name.Trim() == sdt), LoadOpM_Complete, null); } dstb.SubmitChanges(OnSubmitCompleted, true); }
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 { if (txttt.Text.Trim() != "X") // khong phai thanh ly thi update { LoadOp.Entities.ElementAt(0).ma_kh=this.txtmakh.Text ; LoadOp.Entities.ElementAt(0).sohopdong =this.txtsohd.Text.Trim(); LoadOp.Entities.ElementAt(0).ngay_hd=m_ngayhd; LoadOp.Entities.ElementAt(0).ten_dktb =this.txttentb.Text.Trim() ; LoadOp.Entities.ElementAt(0).ten_dkdb =this.txttendb.Text.Trim(); LoadOp.Entities.ElementAt(0).dia_chitb=this.txtdctb.Text.Trim(); LoadOp.Entities.ElementAt(0).dc_tbld =this.txtdcld.Text.Trim(); LoadOp.Entities.ElementAt(0).tien_tb = this.txttientb.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttientb.Text.Trim()); LoadOp.Entities.ElementAt(0).tb_dv = this.txttbdv.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttbdv.Text.Trim()); LoadOp.Entities.ElementAt(0).tienno = this.txttientbtk.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttientbtk.Text.Trim()); LoadOp.Entities.ElementAt(0).khg_vat =this.cmbvtci.SelectedIndex ==0 ? false : true; LoadOp.Entities.ElementAt(0).SoSim= this.txtsosim.Text.Trim(); LoadOp.Entities.ElementAt(0).socmnd =this.txtcmnd.Text.Trim(); LoadOp.Entities.ElementAt(0).ngay_ld=m_ngayld; LoadOp.Entities.ElementAt(0).thangbd =this.txtthangbd.Text.Trim(); LoadOp.Entities.ElementAt(0).noi_cap =this.txtnoicap.Text.Trim(); LoadOp.Entities.ElementAt(0).ngay_cap=m_ngaycap; LoadOp.Entities.ElementAt(0).tai_khoan =this.txttk.Text.Trim(); LoadOp.Entities.ElementAt(0).ngan_hang=this.txtNH.Text.Trim(); LoadOp.Entities.ElementAt(0).ms_thue =FunAndPro.ma_st(this.txtmst.Text.Trim()); LoadOp.Entities.ElementAt(0).ngay_ngung=m_ngaycat; LoadOp.Entities.ElementAt(0).may_ngung =this.txttt.Text.Trim(); LoadOp.Entities.ElementAt(0).thtb = false; LoadOp.Entities.ElementAt(0).village =cmbxa.GetKeyValue(cmbxa.SelectedIndex).ToString().Trim(); LoadOp.Entities.ElementAt(0).tenkhkd = FunAndPro.KhongDau(this.txttentb.Text.Trim()); LoadOp.Entities.ElementAt(0).dckd = FunAndPro.KhongDau(this.txtdctb.Text.Trim()); LoadOp.Entities.ElementAt(0).ma_tram =cmbtramvt.GetKeyValue(cmbtramvt.SelectedIndex).ToString(); LoadOp.Entities.ElementAt(0).ma_km = cmbkm.Text.Trim() == "" ? "0" : cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString(); //LoadOp.Entities.ElementAt(0).ma_nhom = cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString(); //LoadOp.Entities.ElementAt(0).ma_nghe = cmbnganh.GetKeyValue(cmbnganh.SelectedIndex).ToString(); //LoadOp.Entities.ElementAt(0).pl = Getplkhachhang(Convert.ToString(cmbnhom.GetKeyValue(cmbnhom.SelectedIndex)).Trim()); LoadOp.Entities.ElementAt(0).tuyen_tc = cmbtuyen.Text.Trim(); LoadOp.Entities.ElementAt(0).loai_tb = Convert.ToBoolean(Convert.ToInt16(cmbloaitb.Text.Substring(0, 1))); LoadOp.Entities.ElementAt(0).so_nha = App.sonha; LoadOp.Entities.ElementAt(0).duong = App.duong; LoadOp.Entities.ElementAt(0).xa_phuong = App.phuong; LoadOp.Entities.ElementAt(0).khom_ap = App.khom; LoadOp.Entities.ElementAt(0).so_nhald = App.sonhald; LoadOp.Entities.ElementAt(0).duongld = App.duongld; LoadOp.Entities.ElementAt(0).xa_phuongld = App.phuongld; LoadOp.Entities.ElementAt(0).khom_apld = App.khomld; Send_SMS(); } else { if (LoadOp.Entities.Count() > 0) // xoa so dt khoi ds_codinh neu chon loai thanh ly hop dong { Gphone cd = LoadOp.Entities.First(); dstb.Gphones.Remove(cd); // xoa cac dich vu da dang ky va ghi lai dv da chon // DeleteCompleted(); } } OKButton.IsEnabled = false; Gphone_log dsl = new Gphone_log { so_dt = this.txtsdt.Text.Trim(), ten_dktb = this.txttentb.Text.Trim(), ten_dkdb = this.txttendb.Text.Trim(), dia_chitb = this.txtdctb.Text.Trim(), dc_tbld = this.txtdcld.Text.Trim(), tuyen_tc = cmbtuyen.Text.Trim(), tien_tb = this.txttientb.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttientb.Text.Trim()), tb_dv = this.txttbdv.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttbdv.Text.Trim()), tienno = this.txttientbtk.Text.Trim() == "" ? 0 : Convert.ToInt32(this.txttientbtk.Text.Trim()), khg_vat =this.cmbvtci.SelectedIndex ==0 ? false : true, //pl = Getplkhachhang(Convert.ToString(cmbnhom.GetKeyValue(cmbnhom.SelectedIndex)).Trim()), may_ngung = this.txttt.Text.Trim(), ma_huyen = App.ma_huyen, sohopdong = this.txtsohd.Text, ngay_hd = m_ngayhd, ngay_ld=m_ngayld, ngay_ngung=m_ngaycat, village =cmbxa.GetKeyValue(cmbxa.SelectedIndex).ToString().Trim(), ma_kh = this.txtmakh.Text, ngay_kn = m_ngaycat, ms_thue = FunAndPro.ma_st(this.txtmst.Text.Trim()), socmnd = this.txtcmnd.Text.Trim(), noi_cap = this.txtnoicap.Text.Trim(), ngay_cap = m_ngaycap, thoi_gian = App.Current_d, 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(), lydocat = mlydo.Text.Trim() == "" ? "" : mlydo.GetKeyValue(mlydo.SelectedIndex).ToString(), loai_tb = Convert.ToBoolean(Convert.ToInt16(cmbloaitb.Text.Substring(0, 1))), users = App.User_name, so_nha = App.sonha, so_nhald = App.sonhald }; dstb.Gphone_logs.Add(dsl); dstb.SubmitChanges(OnSubmitCompleted, true); // dstb.SubmitChanges(); //this.OKButton.IsEnabled = false; //this.btnNew.IsEnabled = true; //MessageBox.Show("Đã lưu vào cơ sở dữ liệu"); } catch(Exception e) { MessageBox.Show(string.Format("Exception Failed: {0}",e)); } }
/// <summary> /// Deprecated Method for adding a new object to the Gphone_log EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGphone_log(Gphone_log gphone_log) { base.AddObject("Gphone_log", gphone_log); }
/// <summary> /// Create a new Gphone_log object. /// </summary> /// <param name="so_dt">Initial value of the so_dt property.</param> /// <param name="id">Initial value of the id property.</param> public static Gphone_log CreateGphone_log(global::System.String so_dt, global::System.Decimal id) { Gphone_log gphone_log = new Gphone_log(); gphone_log.so_dt = so_dt; gphone_log.id = id; return gphone_log; }
private void cmdSua_Click(object sender, RoutedEventArgs e) { FunAndPro callF = new FunAndPro(); callF.GetDateTime(); Nullable<DateTime> m_ngayhd, m_ngaykn, m_ngayld, m_ngaycap; if (LoadOp.Entities.Count() > 0) { MessageBoxResult result = MessageBox.Show("Muốn thay tiền thuê bao tháng này bằng thuê bao tháng kế ?", "Xác nhận", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { gridControl1.ShowLoadingPanel = true; for (int i = 0; i < LoadOp.Entities.Count(); i++) { LoadOp.Entities.ElementAt(i).tien_tb = LoadOp.Entities.ElementAt(i).tienno == null ? 0 : LoadOp.Entities.ElementAt(i).tienno; if (LoadOp.Entities.ElementAt(i).ngay_hd.HasValue) m_ngayhd = LoadOp.Entities.ElementAt(i).ngay_hd; else m_ngayhd = null; if (LoadOp.Entities.ElementAt(i).ngay_kn.HasValue) m_ngaykn = LoadOp.Entities.ElementAt(i).ngay_kn; else m_ngaykn = null; if (LoadOp.Entities.ElementAt(i).ngay_ld.HasValue) m_ngayld = LoadOp.Entities.ElementAt(i).ngay_ld; else m_ngayld = null; if (LoadOp.Entities.ElementAt(i).ngay_cap.HasValue) m_ngaycap = LoadOp.Entities.ElementAt(i).ngay_cap; else m_ngaycap = null; Gphone_log dsl = new Gphone_log { so_dt = LoadOp.Entities.ElementAt(i).so_dt, ten_dktb = LoadOp.Entities.ElementAt(i).ten_dktb == null ? "" : LoadOp.Entities.ElementAt(i).ten_dktb, ten_dkdb = LoadOp.Entities.ElementAt(i).ten_dkdb == null ? "" : LoadOp.Entities.ElementAt(i).ten_dkdb, dia_chitb = LoadOp.Entities.ElementAt(i).dia_chitb == null ? "" : LoadOp.Entities.ElementAt(i).dia_chitb, dc_tbld = LoadOp.Entities.ElementAt(i).dc_tbld == null ? "" : LoadOp.Entities.ElementAt(i).dc_tbld, tuyen_tc = LoadOp.Entities.ElementAt(i).tuyen_tc == null ? "" : LoadOp.Entities.ElementAt(i).tuyen_tc, tien_tb = LoadOp.Entities.ElementAt(i).tien_tb, tb_dv = LoadOp.Entities.ElementAt(i).tb_dv, tienno = LoadOp.Entities.ElementAt(i).tienno, khg_vat = LoadOp.Entities.ElementAt(i).khg_vat, pl = LoadOp.Entities.ElementAt(i).pl, may_ngung = LoadOp.Entities.ElementAt(i).may_ngung, ma_huyen = LoadOp.Entities.ElementAt(i).ma_huyen, sohopdong = LoadOp.Entities.ElementAt(i).sohopdong, ngay_hd = m_ngayhd, ngay_ld = m_ngayld, village = LoadOp.Entities.ElementAt(i).village, ma_kh = LoadOp.Entities.ElementAt(i).ma_kh, ngay_kn = m_ngaykn, note_ngay_kn = LoadOp.Entities.ElementAt(i).note_ngay_kn, ms_thue = LoadOp.Entities.ElementAt(i).ms_thue, socmnd = LoadOp.Entities.ElementAt(i).socmnd, noi_cap = LoadOp.Entities.ElementAt(i).noi_cap, ngay_cap = m_ngaycap, e_mail = LoadOp.Entities.ElementAt(i).e_mail, thoi_gian = App.Current_d, ma_km = LoadOp.Entities.ElementAt(i).ma_km, users = App.User_name }; dstb.Gphone_logs.Add(dsl); } dstb.SubmitChanges(OnSubmitCompleted, true); } } }