public string GetCompanyInformation(int _UserId) { ZhouFu.Bll.DataHandler bll = new Bll.DataHandler(); StringBuilder sbStr = new StringBuilder(); string _Fields = "ID as CompanyId,MonadName,LogoUrl,Phone,MailBox,Type,NumberOfPeople,Nature,Province,City,County,Address,Describe,Url,userid as LoginId,RegisteredCapital,RunRange"; string _SqlWhere = string.Format(" userid='{0}'", _UserId); DataSet ds = bll.GetList("Sm_Monad", _Fields, "ID", 1, 1, false, false, _SqlWhere); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; sbStr.Append("[{\"msg\":\"查询成功\","); sbStr.Append("\"data\":"); string strTemp = EasyUIJsonHelper.TableToJson(dt); DataSet dsFile = bll.GetList("Sm_CaseInformation", "ID,Name,FilePath,bigFilePath", "ID", 100, 1, false, false, "MonadID=" + dt.Rows[0]["LoginId"]); if (dsFile != null && dsFile.Tables[0].Rows.Count > 0) { DataTable dtFile = dsFile.Tables[0]; string strTempFile = EasyUIJsonHelper.TableToJson(dtFile); strTemp = strTemp.Insert((strTemp.Length - 2), ",\"FileList\":" + strTempFile); } sbStr.Append(strTemp); sbStr.Append(",\"state\":\"0\"}]"); } else { sbStr.Append("[{\"msg\":\"查询失败,企业信息不存在\",\"data\":\"\",\"state\":\"1\"}]"); } return(sbStr.ToString()); }
public string GetNewsList(int _ClassId, int _Page, int _PageSize) { StringBuilder sbStr = new StringBuilder(); if (_Page == 0) { _Page = 1; } if (_PageSize == 0) { _PageSize = 10; } StringBuilder sbSqlWhere = new StringBuilder(); sbSqlWhere.AppendFormat(" Isdel=0 and ClassId={0} and IsApp=1", _ClassId); ZhouFu.Bll.DataHandler bll = new Bll.DataHandler(); DataSet ds = bll.GetList("sys_News", "ID,Title,Url,AddTime", "AddTime", _PageSize, _Page, false, false, sbSqlWhere.ToString()); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; sbStr.AppendFormat("[{\"msg\":\"查询成功,无相应的数据。\",\"data\":\"{0}\",\"state\":\"0\"}]", EasyUIJsonHelper.TableToJson(dt)); } else { sbStr.Append("[{\"msg\":\"查询成功,无相应的数据。\",\"data\":\"\",\"state\":\"0\"}]"); } return(sbStr.ToString()); }
public string AddCompanyFiles(string _StrJson) { StringBuilder sbResult = new StringBuilder(); string filepath = string.Empty; int iRowCount = 0; string strTemp = string.Empty; CommonJsonModel model = new CommonJsonModel(Regex.Replace(_StrJson, @"\r\n", "")); List <CommonJsonModel> lst = model.GetCollection(); foreach (CommonJsonModel item in lst) { #region 图片上传 byte[] imgStream = Convert.FromBase64String(item.GetValue("_Stream")); if (!imgStream.Equals("")) { string imgname = DateTime.Now.ToString("yyyyMMddHHmmss") + ".png"; filepath = "/Upload/" + DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.Date.Day.ToString().PadLeft(2, '0') + "/"; string webpath = System.Web.HttpContext.Current.Server.MapPath("/" + filepath); if (!Directory.Exists(webpath)) //不存在此目录则创建目录 { Directory.CreateDirectory(webpath); } FileStream fStream = new FileStream((webpath + imgname), FileMode.Create, FileAccess.Write); BinaryWriter bw = new BinaryWriter(fStream); bw.Write(imgStream); bw.Close(); fStream.Close(); filepath = filepath + imgname; } #endregion Model.Sm_CaseInformation modelCase = new Model.Sm_CaseInformation(); modelCase.Add_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); modelCase.Describe = item.GetValue("_Describe"); modelCase.MonadID = Convert.ToInt32(item.GetValue("_LoginId")); modelCase.FilePath = filepath; iRowCount = new Bll.Sm_CaseInformation().Add(modelCase); if (iRowCount > 0) { DataSet dsFile = new Bll.DataHandler().GetList("Sm_CaseInformation", "ID,Name,FilePath,bigFilePath", "ID", 100, 1, false, false, "MonadID=" + item.GetValue("_LoginId")); if (dsFile != null && dsFile.Tables[0].Rows.Count > 0) { DataTable dtFile = dsFile.Tables[0]; strTemp = EasyUIJsonHelper.TableToJson(dtFile); } sbResult.Append("[{\"msg\":\"添加成功\",\"data\":" + strTemp + ",\"state\":\"0\"}]"); } else { sbResult.Append("[{\"msg\":\"添加失败,服务器处理出错\",\"data\":\"\",\"state\":\"1\"}]"); } } return(sbResult.ToString()); }
public string Login(string _LoginName, string _LoginPassword) { ZhouFu.Bll.DataHandler bll = new Bll.DataHandler(); StringBuilder sbStr = new StringBuilder(); try { string _Fields = "ID,user_name,user_mobile,user_email,user_sex,user_province,user_city,user_county,user_address,user_picture,(select LinkPicture from sys_ManagerGrade where ID=sys_manager.user_category) as user_category,(select picture from dbo.TB_HonorSet where (dbo.sys_Manager.HonorPoints) BETWEEN startnumber and endnumber)as HonorSetPic,AccountBalance,DJAccountBalance,JLAccountBalance,IsEmailVerify,IsMobileVerify,IsPersonVerify,RealName,CodeNumber,DealPassword,bank_id,bank_province,bank_city,bank_address,bank_card,login_category,LastTime"; string _SqlWhere = string.Format(" login_name='{0}' and login_password='******'", _LoginName, DESEncrypt.GetStringMD5(_LoginPassword)); DataSet ds = bll.GetList("sys_manager", _Fields, "ID", 1, 1, false, false, _SqlWhere); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; if (dt.Columns["DealPassword"].ColumnName == "DealPassword") { dt.Rows[0]["DealPassword"] = DESEncrypt.GetStringMD5(dt.Rows[0]["DealPassword"].ToString()); } sbStr.Append("[{\"msg\":\"登陆成功\","); sbStr.Append("\"data\":"); sbStr.Append(EasyUIJsonHelper.TableToJson(dt)); sbStr.Append(",\"state\":\"0\"}]"); ZhouFu.Model.sys_Manager mModel = new ZhouFu.Bll.sys_Manager().GetModel(Convert.ToInt32(dt.Rows[0]["ID"])); mModel.LastTime = DateTime.Now; new ZhouFu.Bll.sys_Manager().Update(mModel); } else { sbStr.Append("[{\"msg\":\"登陆失败,用户名或密码错误\",\"data\":\"\",\"state\":\"1\"}]"); } } catch { sbStr.Append("[{\"msg\":\"登陆失败,服务器处理错误\",\"data\":\"\",\"state\":\"2\"}]"); } return(sbStr.ToString()); }