Exemplo n.º 1
0
        public bool Update(CsDistrict model)
        {
            var strSql = new StringBuilder();

            strSql.Append("UPDATE CrabShop.dbo.[CsDistrict] SET ");
            strSql.Append("Name = @Name,ParentId = @ParentId,Code = @Code,Sort = @Sort,FirstPrice = @FirstPrice,FllowPrice = @FllowPrice");
            strSql.Append(" WHERE Id = @Id");
            return(DbClient.Excute(strSql.ToString(), model) > 0);
        }
Exemplo n.º 2
0
        public int Add(CsDistrict model)
        {
            var strSql = new StringBuilder();

            strSql.Append("INSERT INTO CrabShop.dbo.[CsDistrict] (");
            strSql.Append("Name,ParentId,Code,Sort,FirstPrice,FllowPrice");
            strSql.Append(") VALUES (");
            strSql.Append("@Name,@ParentId,@Code,@Sort,@FirstPrice,@FllowPrice);");
            strSql.Append("SELECT @@IDENTITY");
            return(DbClient.ExecuteScalar <int>(strSql.ToString(), model));
        }
Exemplo n.º 3
0
        public IHttpActionResult GetAddress(string openId)
        {
            CsUsers user = _csUsersBll.GetModel(openId);

            if (user != null)
            {
                //根据userId查询出发件信息和收获地址信息
                List <CsSend>    sendList = _csSendBll.GetModelList(" and UserId=" + user.UserId).OrderBy(x => x.IsDefault).ThenBy(x => x.SendId).ToList();
                List <CsAddress> addressList = _csAddressBll.GetModelList(" and UserId=" + user.UserId + " and AddressState=1 ").OrderBy(x => x.IsDefault).ThenBy(x => x.AddressId).ToList();
                CsDistrictBll    disBLL = new CsDistrictBll();
                int firstPrice = 0, fllowPrice = 0;

                if (addressList.Count > 0)
                {
                    string     province = addressList[0].Details.Split('&')[0];
                    CsDistrict district = disBLL.GetModel(" Name ='" + province + "'");
                    if (district != null)
                    {
                        firstPrice = district.FirstPrice;
                        fllowPrice = district.FllowPrice;
                    }
                }

                return(Json(new
                {
                    status = true,
                    user,
                    sendList,
                    addressList,
                    firstPrice,
                    fllowPrice
                }));
            }
            LogHelper.Log("public IHttpActionResult GetAddress-------openId:" + openId, "openId 未能查询到用户信息");
            return(Json(new
            {
                status = false,
                user = "",
                sendList = "",
                addressList = "",
                firstPrice = 0,
                fllowPrice = 0
            }));
        }