Exemplo n.º 1
0
    /// <summary>
    /// ServicesLog
    /// </summary>
    /// <param name="actionType"></param>
    /// <param name="logInfo"></param>
    public void WXPushLog(string actionType, string logInfo)
    {
        StringBuilder strSql = new StringBuilder();

        strSql.Append("insert into T_WXServicePush_Log(");
        strSql.Append("sysnumber,logTime,actionType,logInfo,MsgType,Event)");
        strSql.Append(" values (");
        strSql.Append("@sysnumber,@logTime,@actionType,@logInfo,@MsgType,@Event)");
        SqlParameter[] parameters =
        {
            new SqlParameter("@sysnumber",  SqlDbType.VarChar,   50),
            new SqlParameter("@logTime",    SqlDbType.DateTime),
            new SqlParameter("@actionType", SqlDbType.VarChar,   50),
            new SqlParameter("@logInfo",    SqlDbType.Text),
            new SqlParameter("@MsgType",    SqlDbType.VarChar,   50),
            new SqlParameter("@Event",      SqlDbType.VarChar,   50),
        };
        parameters[0].Value = Guid.NewGuid().ToString();
        parameters[1].Value = DateTime.Now;
        parameters[2].Value = actionType;
        parameters[3].Value = logInfo;
        parameters[4].Value = GetMsgField(logInfo, "MsgType");
        parameters[5].Value = GetMsgField(logInfo, "Event");

        StarTech.DBUtility.AdoHelper adoHelper = StarTech.DBUtility.AdoHelper.CreateHelper("DB_Instance");
        adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 更新任务表中的自定义集合字段(把所有自定义字段拼接成一个大字符串保存)
    /// </summary>
    protected void UpdateGoodsTable(string goodsId)
    {
        string info = "";

        StarTech.DBUtility.AdoHelper ado = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance);
        DataSet ds    = ado.ExecuteSqlDataset("select * from T_Goods_MoreProperty where goodsId='" + this.id + "'");
        DataSet dsSet = ado.ExecuteSqlDataset("select * from T_Goods_MorePropertySet");

        foreach (DataRow row in ds.Tables[0].Rows)
        {
            DataRow[] rowsSet = dsSet.Tables[0].Select("PropertyId='" + row["PropertyId"].ToString() + "'");
            if (rowsSet.Length > 0)
            {
                info += "{" + row["PropertyId"].ToString() + "$" + rowsSet[0]["propertyName"].ToString() + "$" + row["PropertyValue"].ToString().Replace("'", "’") + "}";
            }
        }
        ado.ExecuteSqlNonQuery("update T_Goods_Info set MorePropertys='" + info + "' where goodsId='" + goodsId + "'");
    }
Exemplo n.º 3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Request["MorePropertyId_AllIds"] != null && Request["MorePropertyId_AllIds"] != "")
     {
         StarTech.DBUtility.AdoHelper ado = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance);
         ado.ExecuteSqlNonQuery("delete  T_Goods_MoreProperty where goodsId='" + this.id + "'");
         foreach (string s in Request["MorePropertyId_AllIds"].Split(','))
         {
             if (Request[s] != null)
             {
                 string k      = s.Replace("MorePropertyId_", "");
                 string v      = Request[s];
                 string sqladd = "insert into T_Goods_MoreProperty(sysnumber,GoodsId,PropertyId,PropertyValue)";
                 sqladd += "values('" + Guid.NewGuid().ToString() + "','" + this.id + "','" + k + "','" + v + "')";
                 ado.ExecuteSqlNonQuery(sqladd);
             }
         }
         UpdateGoodsTable(this.id);
     }
     ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');window.returnValue=1;window.close();</script>");
 }
Exemplo n.º 4
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        GoodsTypeModel mod;

        if (this.id != "" && this.id != null)
        {
            mod = bll.GetModel(this.id);
        }
        else
        {
            mod = new GoodsTypeModel();
        }
        string pPath = "";

        string[] codeList = this.cSelect.hfCode.Split('|');
        StarTech.DBUtility.AdoHelper adoHelper = StarTech.DBUtility.AdoHelper.CreateHelper("DB_Instance");



        if (codeList.Length < 1 || cSelect.hfCode == "")
        {
            mod.PCategoryId   = "";
            mod.CategoryLevel = 1;
            mod.CategoryPath  = mod.CategoryId;
        }
        else
        {
            //if(this.cSelect.categoryID)
            mod.PCategoryId = codeList[codeList.Length - 1];

            DataSet ds = adoHelper.ExecuteSqlDataset("select * from T_Info_Category where categoryid='" + KillSqlIn.Form_ReplaceByString(mod.PCategoryId, 20) + "';");
            mod.CategoryLevel = Convert.ToInt32(ds.Tables[0].Rows[0]["CategoryLevel"].ToString()) + 1;
            pPath             = ds.Tables[0].Rows[0]["CategoryPath"].ToString();
        }

        if (pPath != "")
        {
            pPath += ",";
        }

        mod.CategoryName = this.txtMenuName.Text.Trim();
        //mod.CategoryPath=
        //mod.Remarks = this.txtRemarks.Text.Trim();
        int orderdy = 0;

        int.TryParse(this.txtSort.Text.Trim(), out orderdy);
        mod.Orderby      = orderdy;
        mod.CategoryFlag = (this.cbIsVisible.Checked == true) ? "Course" : "Category";

        if (fuImg.FileName != null && fuImg.FileName != "")
        {
            //mod.Url = fuImg.FileName;
            string nowUrl = Guid.NewGuid().ToString();
            string tzm    = fuImg.FileName.Substring(fuImg.FileName.LastIndexOf("."));
            string url    = "/upload/Category/" + nowUrl + "" + tzm;
            fuImg.SaveAs(Server.MapPath("~" + url));
            mod.Url = url;
        }

        if (this.id != "" && this.id != null)
        {
            if (this.id == mod.PCategoryId)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('上级分类不能选择当前分类');layer_close_refresh();</script>");
                return;
            }
            mod.CategoryPath = pPath + mod.CategoryId;
            if (bll.Update(mod))
            {
                LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "修改任务分类《" + mod.CategoryName + "》", "修改", "", "", HttpContext.Current.Request.Url.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
            }
        }
        else
        {
            mod.CategoryId = IdCreator.CreateId("T_Info_Category", "CategoryId");

            mod.CategoryPath = pPath + mod.CategoryId;
            bll.Add(mod);
            LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "添加任务分类《" + mod.CategoryName + "》;", "添加", "", "", HttpContext.Current.Request.Url.ToString());
            ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('添加成功');layer_close_refresh();</script>");
            //JSUtility.ReplaceOpenerParentWindow("menuTree.aspx");
        }

        //ModMenu detail = new ModMenu();
        //detail.menuName = this.txtMenuName.Text.Trim();
        //detail.menuTarget = this.txtMenuLink.Text.Trim();
        //detail.isShow = (this.cbIsVisible.Checked == true ? 1 : 0);
        //detail.orderIndex = Convert.ToInt32(this.txtSort.Text.Trim());
        //detail.parentMenuId = Convert.ToInt32(this.cSelect.categoryID);
        //if (this._menuId != null)
        //{
        //    int menuId = Convert.ToInt32(this._menuId);
        //    detail.uniqueId = menuId;
        //    this._menu.Update(detail);
        //    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
        //}
        //else
        //{
        //    this._menu.Add(detail);
        //    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('添加成功');layer_close_refresh();</script>");
        //    //JSUtility.ReplaceOpenerParentWindow("menuTree.aspx");
        //}
    }
Exemplo n.º 5
0
    /// <summary>
    /// 邦定推广用户的公众号
    /// </summary>
    /// <param name="MsgType"></param>
    /// <param name="wxMsg"></param>
    /// <returns></returns>
    public void BindUser(string MsgType, string wxMsg)
    {
        /*
         * <xml>
         * <ToUserName><![CDATA[gh_384b77007ac6]]></ToUserName>
         * <FromUserName><![CDATA[oKiw2t92-9nwoTj4QXgMiAb1fsnQ]]></FromUserName>
         * <CreateTime>1519282100</CreateTime>
         * <MsgType><![CDATA[event]]></MsgType>
         * <Event><![CDATA[subscribe]]></Event>
         * <EventKey><![CDATA[qrscene_oKiw2t92-9nwoTj4QXgMiAb1fsnQ]]></EventKey>
         * <Ticket><![CDATA[gQGJ8TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyTWJFbzFrR0k4U1QxMDAwMGcwNy0AAgT4Zo5aAwQAAAAA]]></Ticket>
         * </xml>
         */

        if (MsgType == "event")
        {
            string Event = GetMsgField(wxMsg, "Event");
            //if (Event == "subscribe" || Event == "SCAN")
            if (Event == "subscribe")
            {
                //邦定推广用户的公众号
                string myOpenId        = GetMsgField(wxMsg, "EventKey").Replace("qrscene_", "");
                string firendNewOpenId = GetMsgField(wxMsg, "FromUserName");

                JObject userObj    = NG.WeiXin.NGWeiXinUser.GetUserInfoByOpenId(firendNewOpenId);
                string  nickname   = userObj == null ? "" : userObj["nickname"].ToString();
                string  sex        = userObj == null ? "" : userObj["sex"].ToString();
                string  headimgurl = userObj == null ? "" : userObj["headimgurl"].ToString();

                //入库
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into T_WXQRCodeShare_Log(");
                strSql.Append("sysnumber,logTime,myOpenId,firendNewOpenId,firendNewNickname,firendNewSex,firendNewHeader,scanInfo,remarks)");
                strSql.Append(" values (");
                strSql.Append("@sysnumber,@logTime,@myOpenId,@firendNewOpenId,@firendNewNickname,@firendNewSex,@firendNewHeader,@scanInfo,@remarks)");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@sysnumber",         SqlDbType.VarChar,     50),
                    new SqlParameter("@logTime",           SqlDbType.DateTime),
                    new SqlParameter("@myOpenId",          SqlDbType.VarChar,     50),
                    new SqlParameter("@firendNewOpenId",   SqlDbType.VarChar,     50),
                    new SqlParameter("@firendNewNickname", SqlDbType.VarChar,     50),
                    new SqlParameter("@firendNewSex",      SqlDbType.VarChar,     50),
                    new SqlParameter("@firendNewHeader",   SqlDbType.VarChar,    500),
                    new SqlParameter("@scanInfo",          SqlDbType.VarChar,   4000),
                    new SqlParameter("@remarks",           SqlDbType.VarChar,    500),
                };
                parameters[0].Value = Guid.NewGuid().ToString();
                parameters[1].Value = DateTime.Now;
                parameters[2].Value = myOpenId;
                parameters[3].Value = firendNewOpenId;
                parameters[4].Value = nickname;
                parameters[5].Value = sex;
                parameters[6].Value = headimgurl;
                parameters[7].Value = wxMsg;
                parameters[8].Value = "我的二维码推广";

                StarTech.DBUtility.AdoHelper adoHelper = StarTech.DBUtility.AdoHelper.CreateHelper("DB_Instance");
                adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters);

                //消息通知分享推广人
                if (myOpenId != "")
                {
                    WXSendShare(myOpenId, nickname);
                }

                //赠送优惠券
                if (myOpenId != "")
                {
                    object objMemberId = adoHelper.ExecuteSqlScalar("select MemberId from T_Member_Info where WXOpenId='" + myOpenId + "'");
                    if (objMemberId != null)
                    {
                        GetCouponShareBat(objMemberId.ToString());
                    }
                }
            }
        }
    }