示例#1
0
        protected static DataTable getBookedByIDAndMonth(string selectedRoad, string month, string year)
        {
            int              SelectedMonth = AppsCont.getMonthValue(month.ToUpper());
            DataTable        dt            = getTableStructure();
            PPJDBDataContext PPJdb         = new PPJDBDataContext();
            //var jalanTempah= PPJdb.JalanTempahs.Select(row => row).Where(rec=>rec.NoRujukanJalan==Convert.ToInt32(selectedRoad)
            //&& Convert.ToDateTime(rec.TarikhMula).Month==Convert.ToInt32(month) && Convert.ToDateTime(rec.TarikhTamat).Month == Convert.ToInt32(month));
            var queryJalanTempah =
                from a in PPJdb.GetTable <JalanTempah>()
                where Convert.ToInt32(Convert.ToDateTime(a.TarikhMula).Month) == SelectedMonth &&
                Convert.ToInt32(Convert.ToDateTime(a.TarikhTamat).Month) == SelectedMonth &&
                a.NoRujukanJalan == Convert.ToInt32(selectedRoad)
                select a;
            int Counter = 0;

            foreach (var c in queryJalanTempah)
            {
                DataRow dr = dt.NewRow();
                dr["No"] = Counter++;
                dr["NoRujukanTempah"]     = c.NoRujukanTempah;
                dr["NoRujukanPermohonan"] = c.NoRujukanPermohonan;
                dr["NoRujukanJalan"]      = c.NoRujukanJalan;
                dr["JumlahTiangTempah"]   = c.JumlahTiangTempah;
                dr["TarikhMula"]          = c.TarikhMula;
                dr["TarikhTamat"]         = c.TarikhTamat;
                dr["HargaSeunit"]         = c.HargaSeunit;
                dr["Jumlah"] = c.Jumlah;
                dt.Rows.Add(dr);
            }
            return(dt);
        }
示例#2
0
        private static string getNoRujukanTempah()
        {
            string NoRujukan = "";

            using (PPJDBDataContext PPJdb = new PPJDBDataContext())
            {
                //var NoRujukanQuery = (from t in PPJdb.JalanTempahs
                //              orderby t.TarikhData descending
                //              select t.NoRujukanPermohonan).First();
                //int LastDigit = 0;
                //int NewDigit = 0;
                //foreach (var item in NoRujukanQuery)
                //{
                //     LastDigit = Convert.ToInt32(item.ToString().Substring(item.ToString().Length - 1, 1));
                //     NewDigit = LastDigit + 1;
                //}

                //return NoRujukan = NoRujukan.Substring(0, NoRujukan.Length - 1) + NewDigit.ToString();
                var q = (from a in PPJdb.GetTable <JalanTempah>()
                         orderby a.NoRujukanTempah descending
                         select a).First();
                int LastDigit = 0;
                int NewDigit  = 0;
                q.NoRujukanPermohonan = q.NoRujukanPermohonan.Replace("\r\n4", "");
                NoRujukan             = q.NoRujukanPermohonan;
                string temp = q.NoRujukanPermohonan.Substring(q.NoRujukanPermohonan.Length - 1, 1);
                LastDigit = Convert.ToInt32(temp);
                NewDigit  = LastDigit + 1;
                return(NoRujukan = NoRujukan.Substring(0, NoRujukan.Length - 1) + NewDigit.ToString());
            }
        }