예제 #1
0
 private void OKButton_Click(object sender, RoutedEventArgs e)
 {
     FunAndPro callF = new FunAndPro();
     callF.GetDateTime();
     if (this.txtusr.Text == "" || this.txtusrn.Text == "" )
     {
         MessageBox.Show("Nhập chưa đủ dữ liệu");
     }
     else
     {
         // lay hopdong                                    
        // LoadOp.Entities.ElementAt(0).user_name = txtusrn.Text.Trim();
         internet_log dsl = new internet_log
         {
             user_name = txtusrn.Text.Trim(),
             n_user_name = LoadOp.Entities.ElementAt(0).user_name,
             //ten_dktb = LoadOp.Entities.ElementAt(0).ten_dktb,
             //ten_nsd = LoadOp.Entities.ElementAt(0).ten_nsd,
             //dia_chitb = LoadOp.Entities.ElementAt(0).dia_chitb,
             //dc_tbld = LoadOp.Entities.ElementAt(0).dc_tbld,
             //sohopdong = LoadOp.Entities.ElementAt(0).sohopdong,
             //ngay_hd = LoadOp.Entities.ElementAt(0).ngay_hd,
             //ngay_ld = LoadOp.Entities.ElementAt(0).ngay_ld,
             //tuyen_tc = LoadOp.Entities.ElementAt(0).tuyen_tc,
             //goi_cuoc = LoadOp.Entities.ElementAt(0).goi_cuoc,
             //toc_do = LoadOp.Entities.ElementAt(0).toc_do,
             //so_dt = LoadOp.Entities.ElementAt(0).so_dt,                    
             //ht_ld = LoadOp.Entities.ElementAt(0).ht_ld,
             //ma_huyen = LoadOp.Entities.ElementAt(0).ma_huyen,
             //socmnd = LoadOp.Entities.ElementAt(0).socmnd,
             //may_ngung = LoadOp.Entities.ElementAt(0).may_ngung,
             //noi_cap = LoadOp.Entities.ElementAt(0).noi_cap,
             //ngay_cap = LoadOp.Entities.ElementAt(0).ngay_cap,
             //ma_kh = LoadOp.Entities.ElementAt(0).ma_kh,
             //ngay_kn = LoadOp.Entities.ElementAt(0).ngay_kn,
             //note_ngay_kn = LoadOp.Entities.ElementAt(0).note_ngay_kn,
             //ms_thue = LoadOp.Entities.ElementAt(0).ms_thue,
             //ngan_hang = LoadOp.Entities.ElementAt(0).ngan_hang,
             //ma_km = LoadOp.Entities.ElementAt(0).ma_km,
             //ma_nhom = LoadOp.Entities.ElementAt(0).ma_nhom,
             //ma_nghe = LoadOp.Entities.ElementAt(0).ma_nghe,
             //ma_nvcs = LoadOp.Entities.ElementAt(0).ma_nvcs,
             user_login = App.User_name,
             thoi_gian = App.Current_d
         };
         dstb.internet_logs.Add(dsl);
         dstb.SubmitChanges(OnSubmitCompleted, true);
     }             
 }        
예제 #2
0
        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));
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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
            {
                // get_hopdong(App.ma_huyen + "/" + this.dngayhd.DateTime.Year.ToString().Substring(2, 2));                
                    
                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).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).kh_uutien = cmbkhuutien.SelectedIndex==-1 ? "" : cmbkhuutien.GetKeyValue(cmbkhuutien.SelectedIndex).ToString();
                LoadOpMy.Entities.ElementAt(0).may_ngung = LoadOpMy.Entities.ElementAt(0).may_ngung.Trim() == "M" ? "D" : LoadOpMy.Entities.ElementAt(0).may_ngung.Trim();
                LoadOpMy.Entities.ElementAt(0).ngay_kn = m_ngaykn;
                LoadOpMy.Entities.ElementAt(0).note_ngay_kn = txtghichu.Text.Trim();
                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 =txtmst.Text.Trim()==""? "": 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).ma_nvcs = cmbcbcs.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbcs.SelectedIndex).ToString();
                LoadOpMy.Entities.ElementAt(0).ma_nvkt = cmbcbkt.SelectedIndex == -1 ? S_null : cmbcbkt.GetKeyValue(cmbcbkt.SelectedIndex).ToString();
                //LoadOpMy.Entities.ElementAt(0).ma_nvld = cmbcbcs.SelectedIndex == -1 ? S_null : cmbcbld.GetKeyValue(cmbcbld.SelectedIndex).ToString();
                LoadOpMy.Entities.ElementAt(0).ngan_hang = txtNH.Text.Trim();
                LoadOpMy.Entities.ElementAt(0).e_mail = txtemail.Text.Trim();
                LoadOpMy.Entities.ElementAt(0).dt_lh = this.txtdtlh.Text.Trim();
                LoadOpMy.Entities.ElementAt(0).ma_km = cmbkm.Text.Trim() == "" ? "0" : cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString();
                LoadOpMy.Entities.ElementAt(0).camket = Convert.ToInt16(this.spcamket.Text);
                LoadOpMy.Entities.ElementAt(0).maxa = App.m_phuong;
                LoadOpMy.Entities.ElementAt(0).loai_cap=cmbloaicap.SelectedIndex == -1 ? "" : cmbloaicap.GetKeyValue(cmbloaicap.SelectedIndex).ToString();
                LoadOpMy.Entities.ElementAt(0).slg_cap = Convert.ToInt16(this.spslcap.Text.Trim());
                LoadOpMy.Entities.ElementAt(0).modem_seri = this.txtseri.Text.Trim();
                LoadOpMy.Entities.ElementAt(0).loai_tb = cmbloaitb.Text.Trim() == "" ? "" : cmbloaitb.GetKeyValue(cmbloaitb.SelectedIndex).ToString();
                LoadOpMy.Entities.ElementAt(0).so_119= so_119;
                LoadOpMy.Entities.ElementAt(0).goi_th = cmbgoith.SelectedIndex == -1 ? S_null : this.cmbgoith.GetKeyValue(cmbgoith.SelectedIndex).ToString().Trim();
                LoadOpMy.Entities.ElementAt(0).id_goicuoc = cmbgoith.SelectedIndex == -1 ? S_null : App.id_goicuoc;


                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(),
                    ht_ld = this.cmbhtld.Text.Trim().Substring(0, 1),
                    ma_huyen = LoadOpMy.Entities.ElementAt(0).ma_huyen,
                    socmnd = this.txtcmnd.Text.Trim(),
                    may_ngung=LoadOpMy.Entities.ElementAt(0).may_ngung.Trim() == "M" ? "D" : LoadOpMy.Entities.ElementAt(0).may_ngung.Trim(),
                    noi_cap = this.txtnoicap.Text.Trim(),
                    ngay_cap = m_ngaycap,
                    ma_kh = this.txtmakh.Text.Trim(),                    
                    ngay_kn = m_ngaykn,
                    note_ngay_kn = this.txtghichu.Text.Trim(),
                    ms_thue = txtmst.Text.Trim() == "" ? "" : FunAndPro.ma_st(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(),
                    camket = Convert.ToInt16(this.spcamket.Text),
                    ma_nvcs = cmbcbcs.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbcs.SelectedIndex).ToString(),
                    ma_nvkt = cmbcbkt.SelectedIndex == -1 ? S_null : cmbcbkt.GetKeyValue(cmbcbkt.SelectedIndex).ToString(),
                    //ma_nvld = cmbcbld.SelectedIndex == -1 ? "" : cmbcbld.GetKeyValue(cmbcbld.SelectedIndex).ToString(),
                    kh_uutien = cmbkhuutien.SelectedIndex==-1 ? "" : cmbkhuutien.GetKeyValue(cmbkhuutien.SelectedIndex).ToString(),
                    user_login = App.User_name,
                    thoi_gian = App.Current_d,
                    dt_lh = this.txtdtlh.Text.Trim(),
                    loai_cap=cmbloaicap.SelectedIndex == -1 ? "" : cmbloaicap.GetKeyValue(cmbloaicap.SelectedIndex).ToString(),
                    slg_cap = Convert.ToInt16(this.spslcap.Text.Trim()),
                    modem_seri = this.txtseri.Text.Trim(),
                    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.internet_logs.Add(dsl);
                dstb.SubmitChanges(OnSubmitCompleted,true);
               // enable_control(false);
                             
            }
            catch(Exception e)
            {
                MessageBox.Show(string.Format("Exception Failed: {0}",e));
            }
        }
예제 #5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the internet_log EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTointernet_log(internet_log internet_log)
 {
     base.AddObject("internet_log", internet_log);
 }
예제 #6
0
 /// <summary>
 /// Create a new internet_log object.
 /// </summary>
 /// <param name="user_name">Initial value of the user_name property.</param>
 /// <param name="id">Initial value of the id property.</param>
 public static internet_log Createinternet_log(global::System.String user_name, global::System.Decimal id)
 {
     internet_log internet_log = new internet_log();
     internet_log.user_name = user_name;
     internet_log.id = id;
     return internet_log;
 }
예제 #7
0
        void Update_data()
        {
            try
            {
            // get_hopdong(App.ma_huyen + "/" + this.dngayhd.DateTime.Year.ToString().Substring(2, 2));
        
               // LoadOptb.Entities.ElementAt(0).user_name = this.txtusr.Text.Trim();
                LoadOptb.Entities.ElementAt(0).ten_dktb = this.txttentb.Text.Trim();
                LoadOptb.Entities.ElementAt(0).ten_nsd = 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).sohopdong = this.txtsohd.Text.Trim();
                LoadOptb.Entities.ElementAt(0).ngay_hd = this.dngayhd.DateTime;
                LoadOptb.Entities.ElementAt(0).tuyen_tc = "";
                LoadOptb.Entities.ElementAt(0).goi_cuoc = cmbgoicuoc.GetKeyValue(cmbgoicuoc.SelectedIndex).ToString();
                LoadOptb.Entities.ElementAt(0).toc_do = cmbtocdo.GetKeyValue(cmbtocdo.SelectedIndex).ToString();
                LoadOptb.Entities.ElementAt(0).so_dt = this.txtsdt.Text.Trim();
                LoadOptb.Entities.ElementAt(0).ma_dv = cmbdichvu.GetKeyValue(cmbdichvu.SelectedIndex).ToString();
                LoadOptb.Entities.ElementAt(0).ht_ld = this.cmbhtld.Text.Trim() == "" ? "0" : this.cmbhtld.Text.Trim().Substring(0, 1);
                LoadOptb.Entities.ElementAt(0).ma_huyen = App.ma_huyen;
                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).ma_kh = this.txtmakh.Text;
                LoadOptb.Entities.ElementAt(0).ma_tram = cmbtramvt.GetKeyValue(cmbtramvt.SelectedIndex).ToString();
                LoadOptb.Entities.ElementAt(0).kh_uutien = cmbkhuutien.GetKeyValue(cmbkhuutien.SelectedIndex).ToString().Trim();
                LoadOptb.Entities.ElementAt(0).may_ngung = "M";
                LoadOptb.Entities.ElementAt(0).ht_tt = cmbhttt.Text.Trim();
                LoadOptb.Entities.ElementAt(0).ngay_kn = this.dngaykn.DateTime;
                LoadOptb.Entities.ElementAt(0).note_ngay_kn = this.txtghichu.Text;
                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).duong = App.duong;
                LoadOptb.Entities.ElementAt(0).xa_phuong = App.phuong;
                LoadOptb.Entities.ElementAt(0).khom_ap = App.khom;
                LoadOptb.Entities.ElementAt(0).maxa = m_phuong;
                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).ngan_hang = this.txtNH.Text.Trim();
                LoadOptb.Entities.ElementAt(0).e_mail = this.txtemail.Text.Trim();
                LoadOptb.Entities.ElementAt(0).camket = Convert.ToInt16(this.spcamket.Text);
                LoadOptb.Entities.ElementAt(0).dt_lh = this.txtdtlh.Text.Trim();
                LoadOptb.Entities.ElementAt(0).ma_km = cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString();                
                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();              


            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 = this.dngayhd.DateTime,
                tuyen_tc = "",
                maxa = m_phuong,
                goi_cuoc = cmbgoicuoc.GetKeyValue(cmbgoicuoc.SelectedIndex).ToString(),
                toc_do = cmbtocdo.GetKeyValue(cmbtocdo.SelectedIndex).ToString(),
                so_dt = this.txtsdt.Text.Trim(),
                // stb_serial = this.txtseri.Text.Trim(),
                ma_dv = cmbdichvu.GetKeyValue(cmbdichvu.SelectedIndex).ToString(),
                ht_ld = 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 = this.dngaycap.DateTime,
                ma_kh = this.txtmakh.Text,
                kh_uutien = cmbkhuutien.GetKeyValue(cmbkhuutien.SelectedIndex).ToString().Trim(),
                may_ngung = "M",
                ht_tt = cmbhttt.Text.Trim(),
                ngay_kn = this.dngaykn.DateTime,
                note_ngay_kn = this.txtghichu.Text,
                ms_thue = FunAndPro.ma_st(this.txtmst.Text.Trim()),
                ngan_hang = this.txtNH.Text.Trim(),
                ma_km = cmbkm.GetKeyValue(cmbkm.SelectedIndex).ToString(),
                ma_nhom = cmbnhom.GetKeyValue(cmbnhom.SelectedIndex).ToString(),
                ma_nghe = cmbnganh.GetKeyValue(cmbnganh.SelectedIndex).ToString(),
                camket = Convert.ToInt16(this.spcamket.Text),
                user_login = App.User_name,
                ma_nvcs = cmbcbcs.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbcs.SelectedIndex).ToString(),
                ma_nvkt = cmbcbkt.SelectedIndex == -1 ? S_null : cmbcbcs.GetKeyValue(cmbcbkt.SelectedIndex).ToString(),
                thoi_gian = App.Current_d,
                dt_lh = this.txtdtlh.Text.Trim(),
                modem_seri = txtseri.Text.Trim(),
                goi_th = cmbgoith.SelectedIndex == -1 ? S_null : this.cmbgoith.GetKeyValue(cmbgoith.SelectedIndex).ToString().Trim(),
                id_goicuoc = App.id_goicuoc                
            };
            dstb.internet_logs.Add(dsl);
            dstb.SubmitChanges(OnSubmitCompleted, true);
            }
            catch(Exception e)
            {
                MessageBox.Show(string.Format("Exception Failed: {0}",e));
            }
        }