public ActionResult AjaxCreateProductNotify(FormCollection form) { int productSysNo = Convert.ToInt32(Request["ProductSysNo"]); string email = HttpUtility.UrlDecode(Request["Email"].ToString()); var temp = ProductNotifyFacade.GetProductNotify(email, productSysNo); if (temp != null) { return(Json(new { Result = false, Message = "该邮箱已订阅此商品!" })); } ProductNotifyInfo entity = new ProductNotifyInfo() { CustomerSysNo = CurrUser.UserSysNo, ProductSysNo = productSysNo, Email = email, Status = 0 }; ProductNotifyFacade.CreateProductNotify(entity); return(Json(new { Result = true, Message = "订阅到货通知成功!" })); }
public virtual bool AddProductNotify(ProductNotifyInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT TOP 0 * FROM Product_Notify"; DtAdd = DBHelper.Query(SqlAdd); DrAdd = DtAdd.NewRow(); DrAdd["Product_Notify_ID"] = entity.Product_Notify_ID; DrAdd["Product_Notify_MemberID"] = entity.Product_Notify_MemberID; DrAdd["Product_Notify_Email"] = entity.Product_Notify_Email; DrAdd["Product_Notify_ProductID"] = entity.Product_Notify_ProductID; DrAdd["Product_Notify_IsNotify"] = entity.Product_Notify_IsNotify; DrAdd["Product_Notify_Addtime"] = entity.Product_Notify_Addtime; DrAdd["Product_Notify_Site"] = entity.Product_Notify_Site; DtAdd.Rows.Add(DrAdd); try { DBHelper.SaveChanges(SqlAdd, DtAdd); return(true); } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } }
private void map(ProductNotifyInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.CustomerSysNo = Util.TrimIntNull(tempdr["CustomerSysNo"]); oParam.ProductSysNo = Util.TrimIntNull(tempdr["ProductSysNo"]); oParam.Email = Util.TrimNull(tempdr["Email"]); oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]); oParam.NotifyTime = Util.TrimDateNull(tempdr["NotifyTime"]); oParam.Status = Util.TrimIntNull(tempdr["Status"]); }
public virtual bool EditProductNotify(ProductNotifyInfo entity, RBACUserInfo UserPrivilege) { if (RBAC.CheckPrivilege(UserPrivilege, "98dd8cbd-8ea7-4a59-89ec-988f149c16bb")) { return(MyDAL.EditProductNotify(entity)); } else { throw new TradePrivilegeException("没有权限,权限代码:98dd8cbd-8ea7-4a59-89ec-988f149c16bb错误"); } }
public virtual IList <ProductNotifyInfo> GetProductNotifys(QueryInfo Query) { int PageSize; int CurrentPage; IList <ProductNotifyInfo> entitys = null; ProductNotifyInfo entity = null; string SqlList, SqlField, SqlOrder, SqlParam, SqlTable; SqlDataReader RdrList = null; try { CurrentPage = Query.CurrentPage; PageSize = Query.PageSize; SqlTable = "Product_Notify"; SqlField = "*"; SqlParam = DBHelper.GetSqlParam(Query.ParamInfos); SqlOrder = DBHelper.GetSqlOrder(Query.OrderInfos); SqlList = DBHelper.GetSqlPage(SqlTable, SqlField, SqlParam, SqlOrder, CurrentPage, PageSize); RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.HasRows) { entitys = new List <ProductNotifyInfo>(); while (RdrList.Read()) { entity = new ProductNotifyInfo(); entity.Product_Notify_ID = Tools.NullInt(RdrList["Product_Notify_ID"]); entity.Product_Notify_MemberID = Tools.NullInt(RdrList["Product_Notify_MemberID"]); entity.Product_Notify_Email = Tools.NullStr(RdrList["Product_Notify_Email"]); entity.Product_Notify_ProductID = Tools.NullInt(RdrList["Product_Notify_ProductID"]); entity.Product_Notify_IsNotify = Tools.NullInt(RdrList["Product_Notify_IsNotify"]); entity.Product_Notify_Addtime = Tools.NullDate(RdrList["Product_Notify_Addtime"]); entity.Product_Notify_Site = Tools.NullStr(RdrList["Product_Notify_Site"]); entitys.Add(entity); entity = null; } } return(entitys); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public void Insert(ProductNotifyInfo oParam) { //如果存在相同的email和productsysno,就提醒登录 string sql = "select top 1 sysno from product_notify where productsysno = " + oParam.ProductSysNo + " and email=" + Util.ToSqlString(oParam.Email); DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) { throw new BizException("已经有相同email的重复记录,如果希望管理您的到货通知,请登录"); } new ProductNotifyDac().Insert(oParam); }
public void Import() { if (!AppConfig.IsImportable) { throw new BizException("Is Importable is false"); } /* do not use the following code after Data Pour in */ string sql = " select top 1 * from product_notify "; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) { throw new BizException("the table product_notify is not empty"); } TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { string sql1 = @"select 1 as sysno, null as notifytime, wp.webusersysno as customersysno, con_product.newsysno as productsysno, notifytool as email, createtime, status from ipp2003..wish_product as wp, ippconvert..productbasic as con_product where wp.productsysno = con_product.oldsysno" ; DataSet ds1 = SqlHelper.ExecuteDataSet(sql1); /* * <option value="-1">Abandon</option> * <option value="0">UnNotify</option> * <option value="1">Notified</option> * */ foreach (DataRow dr1 in ds1.Tables[0].Rows) { ProductNotifyInfo oInfo = new ProductNotifyInfo(); map(oInfo, dr1); new ProductNotifyDac().Insert(oInfo); } scope.Complete(); } }
public static int CreateProductNotify(ProductNotifyInfo info) { DataCommand dataCommand = DataCommandManager.GetDataCommand("Customer_CreateProductNotify"); dataCommand.SetParameterValue("@CustomerSysNo", info.CustomerSysNo); dataCommand.SetParameterValue("@ProductSysNo", info.ProductSysNo); dataCommand.SetParameterValue("@Email", info.Email); dataCommand.SetParameterValue("@Status", info.Status); dataCommand.SetParameterValue("@LanguageCode", ConstValue.LanguageCode); dataCommand.SetParameterValue("@CompanyCode", ConstValue.CompanyCode); dataCommand.SetParameterValue("@StoreCompanyCode", ConstValue.StoreCompanyCode); return(dataCommand.ExecuteScalar <int>()); }
public void ProductNotifySend() { int Product_Notify_ID = tools.CheckInt(Request.QueryString["Notify_ID"]); ProductNotifyInfo entity = MyBLL.GetProductNotifyByID(Product_Notify_ID, Public.GetUserPrivilege()); if (entity != null) { ProductInfo productinfo = MyProduct.GetProductByID(entity.Product_Notify_ProductID, Public.GetUserPrivilege()); if (productinfo != null) { Sendmail(entity.Product_Notify_Email, Application["site_name"].ToString() + "到货通知", productinfo.Product_Name + "已到货!", Application["site_name"].ToString() + "通知您," + productinfo.Product_Name + "已到货,期待您的选购!"); entity.Product_Notify_IsNotify = 1; MyBLL.EditProductNotify(entity, Public.GetUserPrivilege()); } } Public.Msg("positive", "操作成功", "操作成功", true, "Product_Notify_list.aspx"); }
public virtual bool EditProductNotify(ProductNotifyInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT * FROM Product_Notify WHERE Product_Notify_ID = " + entity.Product_Notify_ID; DtAdd = DBHelper.Query(SqlAdd); try { if (DtAdd.Rows.Count > 0) { DrAdd = DtAdd.Rows[0]; DrAdd["Product_Notify_ID"] = entity.Product_Notify_ID; DrAdd["Product_Notify_MemberID"] = entity.Product_Notify_MemberID; DrAdd["Product_Notify_Email"] = entity.Product_Notify_Email; DrAdd["Product_Notify_ProductID"] = entity.Product_Notify_ProductID; DrAdd["Product_Notify_IsNotify"] = entity.Product_Notify_IsNotify; DrAdd["Product_Notify_Addtime"] = entity.Product_Notify_Addtime; DrAdd["Product_Notify_Site"] = entity.Product_Notify_Site; DBHelper.SaveChanges(SqlAdd, DtAdd); } else { return(false); } } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } return(true); }
public virtual ProductNotifyInfo GetProductNotifyByID(int ID) { ProductNotifyInfo entity = null; SqlDataReader RdrList = null; try { string SqlList; SqlList = "SELECT * FROM Product_Notify WHERE Product_Notify_ID = " + ID; RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.Read()) { entity = new ProductNotifyInfo(); entity.Product_Notify_ID = Tools.NullInt(RdrList["Product_Notify_ID"]); entity.Product_Notify_MemberID = Tools.NullInt(RdrList["Product_Notify_MemberID"]); entity.Product_Notify_Email = Tools.NullStr(RdrList["Product_Notify_Email"]); entity.Product_Notify_ProductID = Tools.NullInt(RdrList["Product_Notify_ProductID"]); entity.Product_Notify_IsNotify = Tools.NullInt(RdrList["Product_Notify_IsNotify"]); entity.Product_Notify_Addtime = Tools.NullDate(RdrList["Product_Notify_Addtime"]); entity.Product_Notify_Site = Tools.NullStr(RdrList["Product_Notify_Site"]); } return(entity); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public static int CreateProductNotify(ProductNotifyInfo info) { return(ProductNotifyDA.CreateProductNotify(info)); }
public int Insert(ProductNotifyInfo oParam) { string sql = @"INSERT INTO Product_Notify ( CustomerSysNo, ProductSysNo, Email, CreateTime, NotifyTime, Status ) VALUES ( @CustomerSysNo, @ProductSysNo, @Email, @CreateTime, @NotifyTime, @Status );set @SysNo = SCOPE_IDENTITY();"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4); SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4); SqlParameter paramEmail = new SqlParameter("@Email", SqlDbType.NVarChar, 50); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); SqlParameter paramNotifyTime = new SqlParameter("@NotifyTime", SqlDbType.DateTime); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); paramSysNo.Direction = ParameterDirection.Output; if (oParam.CustomerSysNo != AppConst.IntNull) { paramCustomerSysNo.Value = oParam.CustomerSysNo; } else { paramCustomerSysNo.Value = System.DBNull.Value; } if (oParam.ProductSysNo != AppConst.IntNull) { paramProductSysNo.Value = oParam.ProductSysNo; } else { paramProductSysNo.Value = System.DBNull.Value; } if (oParam.Email != AppConst.StringNull) { paramEmail.Value = oParam.Email; } else { paramEmail.Value = System.DBNull.Value; } if (oParam.CreateTime != AppConst.DateTimeNull) { paramCreateTime.Value = oParam.CreateTime; } else { paramCreateTime.Value = System.DBNull.Value; } if (oParam.NotifyTime != AppConst.DateTimeNull) { paramNotifyTime.Value = oParam.NotifyTime; } else { paramNotifyTime.Value = System.DBNull.Value; } if (oParam.Status != AppConst.IntNull) { paramStatus.Value = oParam.Status; } else { paramStatus.Value = System.DBNull.Value; } cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramCustomerSysNo); cmd.Parameters.Add(paramProductSysNo); cmd.Parameters.Add(paramEmail); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramNotifyTime); cmd.Parameters.Add(paramStatus); return(SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo)); }
public void DoNotify(int poSysNo) { // 以后增加90天删除的功能。 string sql = @"select product.sysno, productname from po_item, inventory, product, product_price where product.sysno = po_item.productsysno and product.sysno = inventory.productsysno and product.sysno = product_price.productsysno and availableqty+virtualqty>0 @onlineShowLimit and po_item.posysno = @poSysNo" ; sql = sql.Replace("@onlineShowLimit", OnlineListManager.GetInstance().onlineShowLimit); sql = sql.Replace("@poSysNo", poSysNo.ToString()); DataSet ds = SqlHelper.ExecuteDataSet(sql); if (!Util.HasMoreRow(ds)) { return; } foreach (DataRow dr in ds.Tables[0].Rows) { int productSysNo = Util.TrimIntNull(dr["sysno"]); string productName = Util.TrimNull(dr["productname"]); string sql2 = @"select * from product_notify where productsysno =" + productSysNo.ToString() + " and status=" + (int)AppEnum.ProductNotifyStatus.UnNotify; DataSet ds2 = SqlHelper.ExecuteDataSet(sql2); if (!Util.HasMoreRow(ds2)) { continue; } string mailBody = @"您好!<br>您关注的商品@productlink已经到货,请及时到ORS商城网订购。<br>如果您查看的时候,该商品又处于缺货 状态,您可以选择该商品,点击重新提醒。<br>请更新您的到货通知列表,以确保您能得到及时,准确地信息。 <br>所有到货通知,自生成或最后更新日起,保留90天。" ; string mailSubject = "ORS商城网到货通知-@productname"; mailBody = mailBody.Replace("@productlink", "<a href='http://www.baby1one.com.cn/Items/ItemDetail.aspx?ItemID=" + productSysNo.ToString() + "'>" + productName + "</a>"); mailSubject = mailSubject.Replace("@productname", productName); Hashtable ht = new Hashtable(2); foreach (DataRow dr2 in ds2.Tables[0].Rows) { ProductNotifyInfo o = new ProductNotifyInfo(); map(o, dr2); EmailInfo oEmail = new EmailInfo(o.Email, mailSubject, mailBody); EmailManager.GetInstance().InsertEmail(oEmail); ht.Clear(); ht.Add("SysNo", o.SysNo); ht.Add("NotifyTime", DateTime.Now); ht.Add("Status", (int)AppEnum.ProductNotifyStatus.Notified); this.Update(ht); } } }
public virtual bool AddProductNotify(ProductNotifyInfo entity) { return(MyDAL.AddProductNotify(entity)); }