public JsonResult GetClientListForDropDownList(string q) { var list = new BLL.ClientManage.T_tb_ClientManage().GetModelList(" ClientName like '%%" + q + "%%' "); return(Json(list, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 导出药品入库 /// 作者:章建国 /// </summary> /// <returns></returns> public FileResult Export_Sample(string _search, string _searchtype, int _companyid) { DataTable dt = new DataTable(); System.IO.MemoryStream stream = new MemoryStream(); try { string where = " 1=1 "; switch (_searchtype) { case "样品名称": where += string.Format(" and name like '%%{0}%%' ", _search); break; case "样品人": where += string.Format(" and detectionUser like '%%{0}%%' ", _search); break; case "抽样日期": var times = _search.Split(','); where += string.Format(" and detectionDate >= '{0}' and detectionDate <= '{1}' ", times[0], times[1]); break; } if (_companyid > 0) { where += string.Format(" and createUser in (select PersonnelID from tb_InPersonnel where AreaID = {0}) ", _companyid); } else { if (CurrentUserInfo.AreaID > 0 && CurrentUserInfo.DataRange == 3) { int _userid = CurrentUserInfo.PersonnelID; where += string.Format(" and CreateUser = (select PersonnelID from tb_InPersonnel where AreaID = {0} and PersonnelID = {1}) ", CurrentUserInfo.AreaID, _userid); } else if (CurrentUserInfo.AreaID > 0 && CurrentUserInfo.DataRange == 2) { int _userid = CurrentUserInfo.PersonnelID; where += string.Format(" and createUser in (select PersonnelID from tb_InPersonnel where AreaID = {0}) ", CurrentUserInfo.AreaID); } } dt = _samplebll.GetList(where).Tables[0]; BLL.PersonnelManage.T_tb_InPersonnel inpersonnel = new BLL.PersonnelManage.T_tb_InPersonnel(); BLL.ClientManage.T_tb_ClientManage clientManage = new BLL.ClientManage.T_tb_ClientManage(); for (int i = 0; i < dt.Rows.Count; i++) { try { int userid = Convert.ToInt32(dt.Rows[i]["handleUser"]); dt.Rows[i]["handleUser"] = inpersonnel.GetModel(userid).PersonnelName; } catch { } try { int InspectCompany = Convert.ToInt32(dt.Rows[i]["InspectCompany"]); dt.Rows[i]["InspectCompany"] = clientManage.GetModel(InspectCompany).ClientName; } catch { } } stream = PublicClass.ExportSampleToExcel(dt); } catch { } string filename = "样品列表" + DateTime.Now.ToFileTime() + ".xls"; return(File(stream, "application/vnd.ms-excel", filename)); }
public String GetInspectAddressById(Int32 id) { var list = new BLL.ClientManage.T_tb_ClientManage().GetModel(id); return(list.Address); }
/// <summary> /// 获取所有数据列表 /// 作者:章建国 /// </summary> /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns> public string GetSampleList(int pageNumber, int pageSize, string _searchtext, string _searchtype, int _cid) { DataTable dt = new DataTable(); int total = 0; try { string where = " 1=1 "; switch (_searchtype) { case "样品名称": where += string.Format(" and name like '%%{0}%%' ", _searchtext); break; case "样品人": where += string.Format(" and detectionUser like '%%{0}%%' ", _searchtext); break; case "抽样日期": var times = _searchtext.Split(','); where += string.Format(" and detectionDate >= '{0}' and detectionDate <= '{1}' ", times[0], times[1]); break; } if (_cid > 0) { where += string.Format(" and createUser in (select PersonnelID from tb_InPersonnel where AreaID = {0}) ", _cid); } else { if (CurrentUserInfo.AreaID > 0 && CurrentUserInfo.DataRange == 3) { int _userid = CurrentUserInfo.PersonnelID; where += string.Format(" and CreateUser = (select PersonnelID from tb_InPersonnel where AreaID = {0} and PersonnelID = {1}) ", CurrentUserInfo.AreaID, _userid); } else if (CurrentUserInfo.AreaID > 0 && CurrentUserInfo.DataRange == 2) { int _userid = CurrentUserInfo.PersonnelID; where += string.Format(" and createUser in (select PersonnelID from tb_InPersonnel where AreaID = {0}) ", CurrentUserInfo.AreaID); } } dt = _samplebll.GetListByPage(where, "createDate desc", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize).Tables[0]; BLL.PersonnelManage.T_tb_InPersonnel inpersonnel = new BLL.PersonnelManage.T_tb_InPersonnel(); BLL.ClientManage.T_tb_ClientManage clientManage = new BLL.ClientManage.T_tb_ClientManage(); for (int i = 0; i < dt.Rows.Count; i++) { try { int userid = Convert.ToInt32(dt.Rows[i]["handleUser"]); dt.Rows[i]["handleUser"] = inpersonnel.GetModel(userid).PersonnelName; } catch { } try { int InspectCompany = Convert.ToInt32(dt.Rows[i]["InspectCompany"]); dt.Rows[i]["InspectCompany"] = clientManage.GetModel(InspectCompany).ClientName; } catch { } } total = dt.Rows.Count; total = _samplebll.GetModelList(where).Count; } catch { } return(PublicClass.ToJson(dt, total)); }