Example #1
0
        public void addCaSi(string tenCS)
        {
            List <CaSi> cs2 = da.CaSis.Select(k => k).ToList();

            int[] chuoisoint = new int[cs2.Count()];
            for (int i = 0; i < cs2.Count(); i++)
            {
                string m = cs2[i].maCaSi;
                chuoisoint[i] = int.Parse(m.Substring(2));
            }
            int max = chuoisoint[0];

            for (int j = 1; j < cs2.Count(); j++)
            {
                if (chuoisoint[j] > max)
                {
                    max = chuoisoint[j];
                }
            }


            CaSi cs = new CaSi();

            cs.maCaSi  = "CS" + max;
            cs.tenCaSi = tenCS;

            da.CaSis.InsertOnSubmit(cs);
            da.SubmitChanges();
        }
        public void addCaSi(string tenCS)
        {
            CaSi cs    = new CaSi();
            int  count = da.CaSis.Select(k => k).ToList().Count + 1;

            cs.maCaSi  = "CS00" + count;
            cs.tenCaSi = tenCS;

            da.CaSis.InsertOnSubmit(cs);
            da.SubmitChanges();
        }
Example #3
0
 partial void DeleteCaSi(CaSi instance);
Example #4
0
 partial void UpdateCaSi(CaSi instance);
Example #5
0
 partial void InsertCaSi(CaSi instance);