Beispiel #1
0
        //lay ma chuyen muc lon nhat
        public string GetMaTLMax()
        {
            SQLDataContext.CreateDataContext();
            string theloai = "";

            try
            {
                //string masach = "";
                int maso;
                SQLDataContext.SQLData.sp_getMaTLMax(ref theloai);
                maso = int.Parse(theloai.Substring(2)) + 1;
                if (maso.ToString().Length == 1)
                {
                    theloai = "TL00" + maso.ToString();
                }
                else if (maso.ToString().Length == 2)
                {
                    theloai = "TL0" + maso.ToString();
                }
                else
                {
                    theloai = "TL" + maso.ToString();
                }

                PHANLOAISACH tl = new PHANLOAISACH();
                tl.MALOAI = theloai;
                SQLDataContext.SQLData.PHANLOAISACHes.InsertOnSubmit(tl);
                SQLDataContext.SQLData.SubmitChanges();
                return(theloai);
            }
            catch
            {
                return("demo");
            }
        }
Beispiel #2
0
 public bool XoaTL(PHANLOAISACH tl)
 {
     try
     {
         SQLDataContext.SQLData.SP_XOATHELOAI(tl.MALOAI);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #3
0
 public bool ThemTL(PHANLOAISACH tl)
 {
     try
     {
         SuaTL(tl);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #4
0
 public bool SuaTL(PHANLOAISACH tl)
 {
     try
     {
         SQLDataContext.SQLData.SP_SUATHELOAI(tl.MALOAI, tl.TENLOAI, tl.MACHUYENMUC);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #5
0
 //delete ma sach rong
 public void DeleteMaTLMax()
 {
     try
     {
         PHANLOAISACH phanloaisach = SQLDataContext.SQLData.PHANLOAISACHes.Single(tl => tl.TENLOAI == null);
         SQLDataContext.SQLData.PHANLOAISACHes.DeleteOnSubmit(phanloaisach);
         SQLDataContext.SQLData.SubmitChanges();
     }
     catch
     {
     }
 }