public static void OpenToDoList() { using (DBToDoList.InhToDoListDataContext cdc = new DBToDoList.InhToDoListDataContext()) { string OTP = new RandomCls.RandomAlphanumeric().RandomString(20); DBToDoList.mst_user_otp mdo = cdc.mst_user_otps.Where(x => x.mul_user_login == Program.CurrentUser.mut_username).FirstOrDefault(); if (mdo == null) { mdo = new DBToDoList.mst_user_otp(); mdo.mul_user_login = Program.CurrentUser.mut_username; cdc.mst_user_otps.InsertOnSubmit(mdo); } mdo.mul_otp = OTP; mdo.mul_expire = Program.GetServerDateTime().AddMinutes(10); try { cdc.SubmitChanges(); } catch { } string url = string.Format(PrePareData.StaticDataCls.ToDoListUrl, Program.CurrentUser.mut_username, OTP); Program.OpenLink(url); } }
private List <string> getListCorp() { try { using (DBToDoList.InhToDoListDataContext itc = new DBToDoList.InhToDoListDataContext()) { var coms = (from icd in itc.index_trn_company_details join tcd in itc.trn_company_details on icd.tcd_id equals tcd.tcd_id select tcd.tcd_tname).ToList(); return(coms); } } catch { return(new List <string>()); } //try //{ // using (InhCheckupDataContext cdc = new InhCheckupDataContext()) // { // List<string> listComp = cdc.vw_patient_corporates // .Where(x => x.companyname != null) // .Select(x => x.companyname) // .Distinct() // .ToList(); // return listComp; // } //} //catch //{ // return new List<string>(); //} }
public List <string> GetListCorp(string prefix) { List <string> data = new List <string>(); using (DBToDoList.InhToDoListDataContext itc = new DBToDoList.InhToDoListDataContext()) { var coms = (from icd in itc.index_trn_company_details join tcd in itc.trn_company_details on icd.tcd_id equals tcd.tcd_id where tcd.tcd_tname.Contains(prefix) select tcd.tcd_tname).ToList(); data = coms; } return(data); }
public ActionResult Search(SearchModel model) { int totalservice = 0; using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { totalservice = cdc.vw_patient_corporates .Where(x => (x.companyname == null ? "" : x.companyname) == (model.companyname == null ? "" : model.companyname) && x.arrived_date.Value.Date >= model.startdate.Date && x.arrived_date.Value.Date <= model.enddate.Date) .Count(); model.totalservice = totalservice; } try { if (model.func == SearchModel.functionCriterias.funcSearch) { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { model.dataListCompany = getListCorp(); using (DBToDoList.InhToDoListDataContext itc = new DBToDoList.InhToDoListDataContext()) { string sub_com = ""; if (!string.IsNullOrEmpty(model.companyname)) { var doc_no = (from itd in itc.index_trn_company_details join tcd in itc.trn_company_details on itd.tcd_id equals tcd.tcd_id where tcd.tcd_tname == model.companyname select itd.tcd_document_no).FirstOrDefault(); sub_com = (from tcd in itc.trn_company_details join itd in itc.index_trn_company_details on tcd.tcd_id equals itd.tcd_id where tcd.tcd_document_no == doc_no select tcd.tcd_legal).FirstOrDefault(); model.sub_companyname = sub_com; if (!string.IsNullOrEmpty(doc_no)) { List <patient> pt = cdc.trn_patient_book_covers .Where(x => x.tcd_document_no == doc_no && x.trn_patient_regi.tpr_arrive_date.Value.Date >= model.startdate.Date && x.trn_patient_regi.tpr_arrive_date.Value.Date <= model.enddate.Date) .Select(x => new patient { hn = x.trn_patient_regi.trn_patient.tpt_hn_no, en = x.trn_patient_regi.tpr_en_no, id = x.trn_patient_regi.trn_patient_book_cover.tpbc_emp_id, name = x.trn_patient_regi.trn_patient.tpt_othername, // arrived = x.trn_patient_regi.trn_patient_regis_detail.tpr_real_arrived_date.Value arrived = cdc.GetArrivedate(x.tpr_id).Value }).OrderBy(x => x.arrived).ToList(); model.listPatient = pt; model.patients = pt.Count(); model.sub_companyname = sub_com; } else { model.listPatient = new List <patient>(); model.patients = model.listPatient.Count(); model.sub_companyname = sub_com; } } else { model.listPatient = new List <patient>(); model.patients = model.listPatient.Count(); model.sub_companyname = sub_com; } //List<patient> pt = cdc.vw_patient_corporates // .Where(x => (x.companyname == null ? "" : x.companyname) == (model.companyname == null ? "" : model.companyname) && // x.arrived_date.Value.Date >= model.startdate.Date && // x.arrived_date.Value.Date <= model.enddate.Date) // .Select(x => new patient // { // hn = x.hn, // en = x.en, // name = x.patient_name, // arrived = x.arrived_date.Value // }).ToList(); //model.listPatient = pt; } } } else { Criterias cModel = new Criterias { companyname = model.companyname, startdate = model.startdate, enddate = model.enddate, patients = model.patients, totalservice = model.totalservice, sub_companyname = model.sub_companyname }; return(SelectReport(model)); } } catch { } return(View("Search", model)); }