コード例 #1
0
 private void detach_CTPMs(CTPM entity)
 {
     this.SendPropertyChanging();
     entity.SACH = null;
 }
コード例 #2
0
        private void btMuon_Click(object sender, EventArgs e)
        {
            string   ngay_hen = dtpkNgay_hen_tra.Value.Date.ToShortDateString();
            DateTime ngayhen  = Convert.ToDateTime(ngay_hen);
            TimeSpan limit    = ngayhen - DateTime.Now;

            if (DateTime.Now > ngayhen)
            {
                this.errorProvider1.SetError(dtpkNgay_hen_tra, "Ngay hen tra phai sau ngay cho muon.");
            }
            else
            {
                if (limit.Days > 60)
                {
                    this.errorProvider1.SetError(dtpkNgay_hen_tra, "Ngay muon toi da la 60 ngay");
                }
                else
                {
                    this.errorProvider1.Clear();
                    if (tbMa_doc_gia.Text != "")
                    {
                        var c = from b in a.PHIEUMUONs
                                orderby b.MAPHIEUMUON descending
                                select b;
                        string t = "";
                        foreach (var tmp1 in c)
                        {
                            t = tmp1.MAPHIEUMUON;
                            break;
                        }
                        t = t.Remove(0, 2);
                        if (tbMa_sach_1.Text != "" || tbMa_sach_2.Text != "")
                        {
                            DateTime mm = Convert.ToDateTime(DateTime.Now.ToShortDateString());

                            string tmp = "PM";
                            if ((Convert.ToInt32(t) + 1) < 10)
                            {
                                tmp += "0";
                            }
                            phieu_muon PM = new phieu_muon(tmp + (Convert.ToInt32(t) + 1).ToString(),
                                                           tbMa_doc_gia.Text, mm,
                                                           ngayhen, tbMa_sach_1.Text, tbMa_sach_2.Text);
                            ds_PM.add(PM);
                            loadlistPM();
                            add_lvSach();
                            MessageBox.Show("Cho muon thanh cong");
                            PHIEUMUON PMmoi = new PHIEUMUON();
                            PMmoi.MAPHIEUMUON = tmp + (Convert.ToInt32(t) + 1).ToString();
                            PMmoi.MADOCGIA    = tbtim_Ma_doc_gia.Text;
                            PMmoi.NGAYHENTRA  = ngayhen;
                            PMmoi.NGAYMUON    = mm;
                            a.PHIEUMUONs.InsertOnSubmit(PMmoi);
                            CTPM ctpm_moi1 = new CTPM();
                            CTPM ctpm_moi2 = new CTPM();
                            ctpm_moi1.MAPHIEUMUON = tmp + (Convert.ToInt32(t) + 1).ToString();
                            ctpm_moi2.MAPHIEUMUON = tmp + (Convert.ToInt32(t) + 1).ToString();
                            if (PM.Ma_sach_1 != "")
                            {
                                ctpm_moi1.MASACH = PM.Ma_sach_1;
                                a.CTPMs.InsertOnSubmit(ctpm_moi1);
                                a.SubmitChanges();
                            }
                            if (PM.Ma_sach_2 != "")
                            {
                                ctpm_moi2.MASACH = PM.Ma_sach_2;
                                a.CTPMs.InsertOnSubmit(ctpm_moi2);
                                a.SubmitChanges();
                            }

                            loadlistPM(); cleardata();
                        }
                        else
                        {
                            MessageBox.Show("Chua chon sach");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Chua nhap ma doc gia");
                    }
                }
            }
        }
コード例 #3
0
 private void attach_CTPMs(CTPM entity)
 {
     this.SendPropertyChanging();
     entity.SACH = this;
 }
コード例 #4
0
 private void attach_CTPMs(CTPM entity)
 {
     this.SendPropertyChanging();
     entity.PHIEUMUON = this;
 }
コード例 #5
0
 partial void DeleteCTPM(CTPM instance);
コード例 #6
0
 partial void UpdateCTPM(CTPM instance);
コード例 #7
0
 partial void InsertCTPM(CTPM instance);