public static string GetServerDateString() { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { return(cdc.ExecuteQuery <string>("SELECT CONVERT(varchar(10), GetDate(),126)").FirstOrDefault()); } }
public static DateTime GetServerDateTime() { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { return(cdc.ExecuteQuery <DateTime>("select getdate()").FirstOrDefault()); } }
public static DateTime GetServerDateTime() { using (InhCheckupDataContext dbc = new InhCheckupDataContext()) { DateTime nowdatetime = Convert.ToDateTime(dbc.ExecuteQuery <DateTime>("select GetDate()").FirstOrDefault()); return(nowdatetime); } }
public LabClass.LabConfigResult GetByPaientLab(int tpr_id) { try { LabClass.LabConfigResult result = new LabClass.LabConfigResult { labconfigs = new List <LabClass.LabConfig>() }; using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { string en = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).Select(x => x.tpr_en_no).FirstOrDefault(); var mstLabConfig = cdc.mst_lab_configs.Where(x => x.mlc_status == 'A') .Select(x => new { x.mlc_code, x.mlc_type, x.mlc_sql }).ToList(); foreach (var config in mstLabConfig) { string sql = config.mlc_sql.Replace(@"|tpr_id|", tpr_id.ToString()).Replace(@"|en_no|", "'" + en + "'"); string res = cdc.ExecuteQuery <string>(sql).FirstOrDefault(); if (!string.IsNullOrEmpty(res)) { result.labconfigs.Add(new LabClass.LabConfig { code = config.mlc_code, value = config.mlc_type == 'S' ? @"""" + res + @"""" : castnumber(res) }); } } return(result); } } catch (Exception ex) { Class.globalCls.MessageError("GetLabConfigCls", "GetByPaientLab", ex.Message); throw ex; } }
public List <LabConfig> Get(int tpr_id) { try { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { string en = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).Select(x => x.tpr_en_no).FirstOrDefault(); List <LabConfig> labConfig = new List <LabConfig>(); var mstLabConfig = cdc.mst_lab_configs.Where(x => x.mlc_status == 'A') .Select(x => new { x.mlc_code, x.mlc_type, x.mlc_sql }).ToList(); foreach (var config in mstLabConfig) { string sql = config.mlc_sql.Replace(@"|tpr_id|", tpr_id.ToString()).Replace(@"|en_no|", "'" + en + "'"); string res = cdc.ExecuteQuery <string>(sql).FirstOrDefault(); if (!string.IsNullOrEmpty(res)) { labConfig.Add(new LabConfig { code = config.mlc_code, value = config.mlc_type == 'N' ? res : @"""" + res + @"""" }); } } return(labConfig); } } catch (Exception ex) { globalCls.MessageError("LabConfigCls", "Get(int tpr_id)", ex.Message); return(new List <LabConfig>()); } }