/// <summary> /// 获取用户信息 /// </summary> /// <returns></returns> public object GetUserMess() { string userName = Tools.SessionHelper.GetSession <Base_UserInfo>(Tools.SessionHelper.SessinoName.CurUser).UserName; List <string> igorelist = new List <string>() { "Orgs", "Roles" }; Base_UserInfo UserInfo = _userInfoBll.FindBy(t => t.UserName == userName).ToList <Base_UserInfo>().FirstOrDefault(); if (UserInfo != null) { return(Common.NewtonJsonHelper.Deserialize <object>(NewtonJsonHelper.Serialize(UserInfo, igorelist), null)); } return(Common.NewtonJsonHelper.Deserialize <object>(NewtonJsonHelper.Serialize("{}", null), null)); }
/// <summary> /// 获取报价表报价成功的数据 /// </summary> /// <param name="page"></param> /// <param name="limit"></param> /// <param name="swhere"></param> /// <param name="sort"></param> /// <returns></returns> public object GetQuoteResultList(int page, int limit, string swhere, string sort) { string user = Tools.SessionHelper.GetSession <Base_UserInfo>(Tools.SessionHelper.SessinoName.CurUser).UserName; List <String> IDs = SessionFactory.GetCurrentSession().QueryOver <SupplierQuote>().Where(o => o.QuotationCompany == user).Select(t => t.InquiryTitle).List <string>().ToList(); //获取我参与过的项目的名称 StringBuilder where = new StringBuilder(); //拼接查询条件(项目名称格式化) foreach (var ID in IDs) { where.Append("'" + ID + "',"); } string ere = where.ToString().TrimEnd(',');//得到字符串并去掉最后的逗号 string temp = "1"; string temp1 = "1"; try { if (swhere != null) { int s = swhere.IndexOf("|"); int a = swhere.LastIndexOf("|"); temp = swhere.Substring(0, s); temp1 = swhere.Substring(a + 1, swhere.Length - a - 1); } } catch (Exception ee) { return("查询抛出异常" + ee); } try { List <SupplierQuote> upLoadList = Tools.ExecSqlHelp.ExecuteSql <SupplierQuote>("SELECT * FROM " + //"SupplierQuote WHERE quotestate=2 and InquiryTitle in (lists)", new List<SqlParameter>(){ // new SqlParameter(){ParameterName="lists",Value=ere} "SupplierQuote WHERE quotestate=2 and " + temp + " like '%" + temp1 + "%' and InquiryTitle in (" + ere + ")", null); //拼接SQL进行查询 return(Common.NewtonJsonHelper.Deserialize <object>("{\"curPage\":" + page + ",\"success\":true,\"total\":" + upLoadList.Count + ",\"QuoteResultList\":" + NewtonJsonHelper.Serialize(upLoadList, null) + "}", null)); //构造返回数据 } catch (Exception ee) { return("查询抛出异常" + ee); } #if debug //try //{ // string userName = Tools.SessionHelper.GetSession<Base_UserInfo>(Tools.SessionHelper.SessinoName.CurUser).UserName;//获取当前用户 // StringBuilder where = new StringBuilder(); // //swhere = swhere != null ? swhere.TrimStart(',') + ",STATE|int|0|=" : "STATE|int|0|="; // //where.Append(swhere); // where.Append(",InquiryTitle|string|"); // foreach (var ID in IDs) // { // where.Append("'" + ID + "',"); // } // string ere = where.ToString().TrimEnd(',') + "|in"; // swhere = string.IsNullOrEmpty(swhere) ? ere : ere + "," + swhere; // ////where.Append(",InquiryTitle in (@"); // //where.Append("InquiryTitle in (@"); // ////foreach (var ID in IDs) // ////{ // //// where.Append("'" + ID + "',"); // ////} // //for (int i = 0; i < IDs.Count; i++) // //{ // // where.Append("'" + IDs[i] + "',"); // //} // //string here = where.ToString().TrimEnd(',') + "@)"; // //swhere = string.IsNullOrEmpty(swhere) ? here : here + "," + swhere; // ////where.Append("@)"); // ////where.AppendFormat(",InquiryTitle in (@{0}@)" , IDs); // ////where.AppendFormat(",InquiryTitle|string|{0}|" + +"in" + ss); // PageParameter pagePara = new PageParameter() // { // PageIndex = page, // Limit = limit, // //Swhere = where.ToString(),a // Swhere = swhere, // Sort = sort, // ObjName = "QuoteResultList", // Igorelist = new List<string>() { "Inquiries" } // }; // QueryParameter query = new QueryParameter("SupplierQuote", pagePara.Swhere, pagePara, null); // return this.GetAllPageList(query); //} //catch (Exception ee) //{ // return null; //} /***/ #endif }