public IQueryable GetRITypes() { var dbContext = new IRSAdhocContext(); var query = (from ritype in dbContext.t_core_ri_type where ritype.description != null orderby ritype.description ascending select new { ri_type_id = ritype.ri_type_id, description = ritype.ri_type_code + " " + ritype.description }); return(query); }
public IQueryable GetFrequencies() { var dbContext = new IRSAdhocContext(); var query = (from pfreq in dbContext.t_lkup_frequency where pfreq.freq_desc != null orderby pfreq.freq_desc ascending select new { freq_unit = pfreq.freq_unit, freq_desc = pfreq.freq_desc }); return(query); }
public IQueryable GetPenaltyType() { var dbContext = new IRSAdhocContext(); var query = (from ptype in dbContext.t_lkup_penalty_type where ptype.description != null orderby ptype.description ascending select new { penalty_type = ptype.penalty_type, description = ptype.description }); return(query); }
public IQueryable GetWorkCollection() { var dbContext = new IRSAdhocContext(); var query = (from intt in dbContext.t_pnt_penalty_work_collection_mapping join defn in dbContext.t_rtn_work_collection_defn on intt.work_collection_id equals defn.work_collection_id select new { work_collection_code = defn.work_collection_code + " - " + defn.description, work_collection_id = defn.work_collection_id }); return(query); }
public IQueryable gridViewPenalties_GetData() { var dbContext = new IRSAdhocContext(); var query = (from pdefn in dbContext.t_pnt_penalty_definition join ritype in dbContext.t_core_ri_type on pdefn.ri_type_id equals ritype.ri_type_id join lkupptype in dbContext.t_lkup_penalty_type on pdefn.penalty_type equals lkupptype.penalty_type join lkupfreq in dbContext.t_lkup_frequency on pdefn.frequency equals lkupfreq.freq_unit orderby pdefn.created_date descending select new { PenaltyCode = pdefn.penalty_code, Description = pdefn.penalty_desc, ReturnInstitution = ritype.description, Type = lkupptype.description, Frequency = lkupfreq.freq_desc, FrequnitUnit = pdefn.penalty_freq_unit, EndValidityDate = (pdefn.end_validity_date != null) ? pdefn.end_validity_date : DateTime.MaxValue }); return(query); }
public int Save(t_pnt_penalty_definition penaltymodel, PenaltyWorkCollectionModel penaltyWCModel = null) { using (var dbContext = new IRSAdhocContext()) { using (var tranx = dbContext.Database.BeginTransaction()) { var query = dbContext.t_pnt_penalty_definition.Find("", ""); if (query != null) { dbContext.Entry(query).State = System.Data.Entity.EntityState.Modified; } else { dbContext.t_pnt_penalty_definition.Add(penaltymodel); } tranx.Commit(); } } return(1); }
public static object GetPenaltyDetails(string pcode) { var response = new ResponseHandler(); if (pcode == null || pcode == string.Empty) { response.Status = 0; response.Message = "Invalid penalty or penalty code can not be found"; return(response); } object query; var dbContext = new IRSAdhocContext(); query = dbContext.t_pnt_penalty_definition.Where(xpcode => xpcode.penalty_code == pcode).FirstOrDefault(); if (query != null) { query = (from pdefn in dbContext.t_pnt_penalty_definition join ritype in dbContext.t_core_ri_type on pdefn.ri_type_id equals ritype.ri_type_id join lkupptype in dbContext.t_lkup_penalty_type on pdefn.penalty_type equals lkupptype.penalty_type join lkupfreq in dbContext.t_lkup_frequency on pdefn.frequency equals lkupfreq.freq_unit where pdefn.penalty_code == pcode select new { pcode = pdefn.penalty_code, pdescription = pdefn.penalty_desc, ritypedesc = ritype.description, type = lkupptype.description, freq = lkupfreq.freq_desc, frequnit = pdefn.penalty_freq_unit, dday = pdefn.delivery_deadline_day, dhour = pdefn.delivery_deadline_hr, dmin = pdefn.delivery_deadline_min, plimit = pdefn.min_limit_accepted, pvalue = pdefn.penalty_value, pstartval = pdefn.start_validity_date, pendtval = pdefn.end_validity_date, }).FirstOrDefault(); } else { response.Status = 0; response.Message = "The selected penalty details can not be found."; return(response); } //if(query != null) //{ // response.Status = 1; // response.Message = query; // return response; //} //else //{ // response.Status = 0; // response.Message = "The selected penalty details can not be found."; // return response; //} return(query); }