/// <summary> /// weidian shenqing /// </summary> void ShenQing1() { if (!IsLogin) { Utils.RCWE_AJAX("-1", "请先登录后再申请开通微店"); } if (!string.IsNullOrEmpty(HuiYuanInfo.WeiDianId)) { Utils.RCWE_AJAX("-2", "你已经申请开通过微店", HuiYuanInfo.WeiDianId); } var info = new Eyousoft_yhq.Model.MWeiDianInfo(); info.HuiYuanId = HuiYuanInfo.UserID; info.JieShao = Utils.GetFormValue("txtJieShao"); info.MingCheng = Utils.GetFormValue("txtMingCheng"); info.ShenHeTime = DateTime.Now; info.ShenQingTime = DateTime.Now; info.Status = Eyousoft_yhq.Model.WeiDianStatus.申请中; info.WeiDianId = Guid.NewGuid().ToString(); info.DianHua = Utils.GetFormValue("txtDianHua"); int bllRetCode = new Eyousoft_yhq.BLL.BWeiDian().WeiDian_C(info); if (bllRetCode == 1) { Utils.RCWE_AJAX("1", "申请成功,请等待审核后为你开通微店", info.WeiDianId); } else { Utils.RCWE_AJAX("0", "申请失败,请重试"); } }
/// <summary> /// 获取微店信息,返回1成功,其它失败 /// </summary> /// <param name="weiDianId">微店编号</param> /// <returns></returns> public Eyousoft_yhq.Model.MWeiDianInfo GetInfo(string weiDianId) { Eyousoft_yhq.Model.MWeiDianInfo info = null; var cmd = _db.GetSqlStringCommand("SELECT * FROM view_WeiDian WHERE WeiDianId=@WeiDianId"); _db.AddInParameter(cmd, "WeiDianId", DbType.AnsiStringFixedLength, weiDianId); using (var rdr = DbHelper.ExecuteReader(cmd, _db)) { if (rdr.Read()) { info = new Eyousoft_yhq.Model.MWeiDianInfo(); info.HuiYuanId = rdr["HuiYuanId"].ToString(); info.IdentityId = rdr.GetInt32(rdr.GetOrdinal("IdentityId")); info.JieShao = rdr["JieShao"].ToString(); info.MingCheng = rdr["MingCheng"].ToString(); info.ShenHeTime = rdr.GetDateTime(rdr.GetOrdinal("ShenHeTime")); info.ShenQingTime = rdr.GetDateTime(rdr.GetOrdinal("ShenQingTime")); info.Status = (Eyousoft_yhq.Model.WeiDianStatus)rdr.GetInt32(rdr.GetOrdinal("Status")); info.WeiDianId = rdr["WeiDianId"].ToString(); info.HuiYuanName = rdr["HuiYuanName"].ToString(); info.YongHuMing = rdr["YongHuMing"].ToString(); info.LogoFilepath = rdr["LogoFilepath"].ToString(); info.DianHua = rdr["DianHua"].ToString(); } } return info; }
/// <summary> /// 微店新增、修改,返回1成功,其它失败 /// </summary> /// <param name="info">实体</param> /// <returns></returns> public int WeiDian_CU(Eyousoft_yhq.Model.MWeiDianInfo info) { var cmd = _db.GetStoredProcCommand("proc_WeiDian_CU"); _db.AddInParameter(cmd, "@WeiDianId", DbType.AnsiStringFixedLength, info.WeiDianId); _db.AddInParameter(cmd, "@HuiYuanId", DbType.AnsiStringFixedLength, info.HuiYuanId); _db.AddInParameter(cmd, "@MingCheng", DbType.String, info.MingCheng); _db.AddInParameter(cmd, "@Status", DbType.Int32, info.Status); _db.AddInParameter(cmd, "@ShenQingTime", DbType.DateTime, info.ShenQingTime); _db.AddInParameter(cmd, "@ShenHeTime", DbType.DateTime, info.ShenHeTime); _db.AddInParameter(cmd, "@JieShao", DbType.String, info.JieShao); _db.AddOutParameter(cmd, "@RetCode", DbType.Int32, 4); _db.AddInParameter(cmd, "@LogoFilepath", DbType.String, info.LogoFilepath); _db.AddInParameter(cmd, "@DianHua", DbType.String, info.DianHua); int sqlExceptionCode = 0; try { DbHelper.RunProcedure(cmd, _db); } catch (System.Data.SqlClient.SqlException e) { sqlExceptionCode = 0 - e.Number; } if (sqlExceptionCode < 0) { return(sqlExceptionCode); } return(Convert.ToInt32(_db.GetParameterValue(cmd, "RetCode"))); }
/// <summary> /// 获取微店信息,返回1成功,其它失败 /// </summary> /// <param name="weiDianId">微店编号</param> /// <returns></returns> public Eyousoft_yhq.Model.MWeiDianInfo GetInfo(string weiDianId) { Eyousoft_yhq.Model.MWeiDianInfo info = null; var cmd = _db.GetSqlStringCommand("SELECT * FROM view_WeiDian WHERE WeiDianId=@WeiDianId"); _db.AddInParameter(cmd, "WeiDianId", DbType.AnsiStringFixedLength, weiDianId); using (var rdr = DbHelper.ExecuteReader(cmd, _db)) { if (rdr.Read()) { info = new Eyousoft_yhq.Model.MWeiDianInfo(); info.HuiYuanId = rdr["HuiYuanId"].ToString(); info.IdentityId = rdr.GetInt32(rdr.GetOrdinal("IdentityId")); info.JieShao = rdr["JieShao"].ToString(); info.MingCheng = rdr["MingCheng"].ToString(); info.ShenHeTime = rdr.GetDateTime(rdr.GetOrdinal("ShenHeTime")); info.ShenQingTime = rdr.GetDateTime(rdr.GetOrdinal("ShenQingTime")); info.Status = (Eyousoft_yhq.Model.WeiDianStatus)rdr.GetInt32(rdr.GetOrdinal("Status")); info.WeiDianId = rdr["WeiDianId"].ToString(); info.HuiYuanName = rdr["HuiYuanName"].ToString(); info.YongHuMing = rdr["YongHuMing"].ToString(); info.LogoFilepath = rdr["LogoFilepath"].ToString(); info.DianHua = rdr["DianHua"].ToString(); } } return(info); }
/// <summary> /// 获取微店信息集合 /// </summary> /// <param name="pageSize">每页记录数</param> /// <param name="pageIndex">页序号</param> /// <param name="recordCount">总记录数</param> /// <param name="chaXun">查询</param> /// <returns></returns> public IList <Eyousoft_yhq.Model.MWeiDianInfo> GetWeiDians(int pageSize, int pageIndex, ref int recordCount, Eyousoft_yhq.Model.MWeiDianChaXunInfo chaXun) { IList <Eyousoft_yhq.Model.MWeiDianInfo> items = new List <Eyousoft_yhq.Model.MWeiDianInfo>(); string fields = "*"; StringBuilder sql = new StringBuilder(); string tableName = "view_WeiDian"; string orderByString = " ShenQingTime DESC "; string sumString = ""; #region chaxun sql.Append(" 1=1 "); if (chaXun != null) { if (!string.IsNullOrEmpty(chaXun.HuiYuanName)) { sql.AppendFormat(" AND HuiYuanName LIKE '%{0}%' ", chaXun.HuiYuanName); } if (!string.IsNullOrEmpty(chaXun.MingCheng)) { sql.AppendFormat(" AND MingCheng LIKE '%{0}%' ", chaXun.MingCheng); } if (chaXun.Status.HasValue) { sql.AppendFormat(" AND Status={0} ", (int)chaXun.Status); } if (!string.IsNullOrEmpty(chaXun.YongHuMing)) { sql.AppendFormat(" AND YongHuMing LIKE '%{0}%' ", chaXun.YongHuMing); } } #endregion using (IDataReader rdr = DbHelper.ExecuteReader1(_db, pageSize, pageIndex, ref recordCount, tableName, fields.ToString(), sql.ToString(), orderByString, sumString)) { while (rdr.Read()) { var item = new Eyousoft_yhq.Model.MWeiDianInfo(); item.HuiYuanId = rdr["HuiYuanId"].ToString(); item.IdentityId = rdr.GetInt32(rdr.GetOrdinal("IdentityId")); item.JieShao = rdr["JieShao"].ToString(); item.MingCheng = rdr["MingCheng"].ToString(); item.ShenHeTime = rdr.GetDateTime(rdr.GetOrdinal("ShenHeTime")); item.ShenQingTime = rdr.GetDateTime(rdr.GetOrdinal("ShenQingTime")); item.Status = (Eyousoft_yhq.Model.WeiDianStatus)rdr.GetInt32(rdr.GetOrdinal("Status")); item.WeiDianId = rdr["WeiDianId"].ToString(); item.HuiYuanName = rdr["HuiYuanName"].ToString(); item.YongHuMing = rdr["YongHuMing"].ToString(); item.LogoFilepath = rdr["LogoFilepath"].ToString(); item.DianHua = rdr["DianHua"].ToString(); items.Add(item); } } return(items); }
/// <summary> /// 微店新增,返回1成功,其它失败 /// </summary> /// <param name="info">实体</param> /// <returns></returns> public int WeiDian_C(Eyousoft_yhq.Model.MWeiDianInfo info) { if (info == null || string.IsNullOrEmpty(info.HuiYuanId) || string.IsNullOrEmpty(info.MingCheng)) { return(0); } info.ShenQingTime = info.ShenHeTime = DateTime.Now; info.WeiDianId = Guid.NewGuid().ToString(); info.Status = Eyousoft_yhq.Model.WeiDianStatus.申请中; int dalRetCode = dal.WeiDian_CU(info); return(dalRetCode); }
/// <summary> /// 微店修改,返回1成功,其它失败 /// </summary> /// <param name="info">实体</param> /// <returns></returns> public int WeiDian_U(Eyousoft_yhq.Model.MWeiDianInfo info) { if (info == null || string.IsNullOrEmpty(info.HuiYuanId) || string.IsNullOrEmpty(info.MingCheng) || string.IsNullOrEmpty(info.WeiDianId)) { return(0); } var info1 = GetInfo(info.WeiDianId); if (info1 == null) { return(0); } info.Status = info1.Status; info.ShenQingTime = info.ShenHeTime = DateTime.Now; int dalRetCode = dal.WeiDian_CU(info); return(dalRetCode); }
/// <summary> /// 获取微店信息集合 /// </summary> /// <param name="pageSize">每页记录数</param> /// <param name="pageIndex">页序号</param> /// <param name="recordCount">总记录数</param> /// <param name="chaXun">查询</param> /// <returns></returns> public IList<Eyousoft_yhq.Model.MWeiDianInfo> GetWeiDians(int pageSize, int pageIndex, ref int recordCount, Eyousoft_yhq.Model.MWeiDianChaXunInfo chaXun) { IList<Eyousoft_yhq.Model.MWeiDianInfo> items = new List<Eyousoft_yhq.Model.MWeiDianInfo>(); string fields = "*"; StringBuilder sql = new StringBuilder(); string tableName = "view_WeiDian"; string orderByString = " ShenQingTime DESC "; string sumString = ""; #region chaxun sql.Append(" 1=1 "); if (chaXun != null) { if (!string.IsNullOrEmpty(chaXun.HuiYuanName)) { sql.AppendFormat(" AND HuiYuanName LIKE '%{0}%' ", chaXun.HuiYuanName); } if (!string.IsNullOrEmpty(chaXun.MingCheng)) { sql.AppendFormat(" AND MingCheng LIKE '%{0}%' ", chaXun.MingCheng); } if (chaXun.Status.HasValue) { sql.AppendFormat(" AND Status={0} ", (int)chaXun.Status); } if (!string.IsNullOrEmpty(chaXun.YongHuMing)) { sql.AppendFormat(" AND YongHuMing LIKE '%{0}%' ", chaXun.YongHuMing); } } #endregion using (IDataReader rdr = DbHelper.ExecuteReader1(_db, pageSize, pageIndex, ref recordCount, tableName, fields.ToString(), sql.ToString(), orderByString, sumString)) { while (rdr.Read()) { var item = new Eyousoft_yhq.Model.MWeiDianInfo(); item.HuiYuanId = rdr["HuiYuanId"].ToString(); item.IdentityId = rdr.GetInt32(rdr.GetOrdinal("IdentityId")); item.JieShao = rdr["JieShao"].ToString(); item.MingCheng = rdr["MingCheng"].ToString(); item.ShenHeTime = rdr.GetDateTime(rdr.GetOrdinal("ShenHeTime")); item.ShenQingTime = rdr.GetDateTime(rdr.GetOrdinal("ShenQingTime")); item.Status = (Eyousoft_yhq.Model.WeiDianStatus)rdr.GetInt32(rdr.GetOrdinal("Status")); item.WeiDianId = rdr["WeiDianId"].ToString(); item.HuiYuanName = rdr["HuiYuanName"].ToString(); item.YongHuMing = rdr["YongHuMing"].ToString(); item.LogoFilepath = rdr["LogoFilepath"].ToString(); item.DianHua = rdr["DianHua"].ToString(); items.Add(item); } } return items; }