Exemple #1
0
        //Mã tự phát sinh
        //insert
        public bool Insert(string MaCN, string MaDL, int NoDau, int PSinh, int NoCuoi)
        {
            CONGNO_DAILY temp = new CONGNO_DAILY();

            temp.MaBaoCaoCongNo = MaCN;
            temp.MaDaiLy        = MaDL;
            temp.NoDau          = NoDau;
            temp.PhatSinh       = PSinh;
            temp.NoCuoi         = NoCuoi;

            return(CongNo_DaiLyDAO.Instance.Insert(temp));
        }
        //không cần Create Code

        //insert
        public bool Insert(CONGNO_DAILY cn)
        {
            using (QLDLDataContext db = new QLDLDataContext())
            {
                try
                {
                    db.CONGNO_DAILies.InsertOnSubmit(cn);
                    db.SubmitChanges();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }
        //update
        public bool Update(string MaCN, string MaDL, CONGNO_DAILY cn)
        {
            using (QLDLDataContext db = new QLDLDataContext())
            {
                CONGNO_DAILY temp = db.CONGNO_DAILies.Where(p => p.MaBaoCaoCongNo == MaCN && p.MaDaiLy == MaDL).FirstOrDefault();

                temp.NoDau    = cn.NoDau;
                temp.PhatSinh = cn.PhatSinh;
                temp.NoCuoi   = cn.NoCuoi;

                try
                {
                    db.SubmitChanges();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }
Exemple #4
0
 //Updadte
 public bool Update(string MaCN, string MaDL, CONGNO_DAILY cn)
 {
     return(CongNo_DaiLyDAO.Instance.Update(MaCN, MaDL, cn));
 }