private string getStringCZ(Model.ReceiveInfo offer) { string op = ""; op += "<input type='button' value='修改' class='btn btn-success btn-sm' onclick=\"pcallhtml('/mobile/html/AddReceive.aspx?id=" + offer.Id + "', '新增收货人');\" /><br/>"; op += "<input type='button' value='删除' class='btn btn-success btn-sm' onclick='delreceive(" + offer.Id + ")' /><br/>"; return(op); }
/// <summary> /// 更新一条数据 /// </summary> public static Hashtable Update(Model.ReceiveInfo model, Hashtable MyHs) { string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("update ReceiveInfo set "); strSql.Append(" IsDeleted = @IsDeleted , "); strSql.Append(" Status = @Status , "); strSql.Append(" IsMain = @IsMain , "); strSql.Append(" ZipCode = @ZipCode , "); strSql.Append(" MID = @MID , "); strSql.Append(" Province = @Province , "); strSql.Append(" City = @City , "); strSql.Append(" Zone = @Zone , "); strSql.Append(" Tel = @Tel , "); strSql.Append(" Receiver = @Receiver , "); strSql.Append(" Phone = @Phone , "); strSql.Append(" Address = @Address "); strSql.Append(" where Id=@Id "); strSql.AppendFormat(" ;select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4), new SqlParameter("@IsDeleted", SqlDbType.Bit, 1), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@IsMain", SqlDbType.Bit, 1), new SqlParameter("@ZipCode", SqlDbType.NChar, 10), new SqlParameter("@MID", SqlDbType.VarChar, 50), new SqlParameter("@Province", SqlDbType.NVarChar, 50), new SqlParameter("@City", SqlDbType.NVarChar, 50), new SqlParameter("@Zone", SqlDbType.NVarChar, 50), new SqlParameter("@Tel", SqlDbType.VarChar, 20), new SqlParameter("@Receiver", SqlDbType.VarChar, 20), new SqlParameter("@Phone", SqlDbType.VarChar, 20), new SqlParameter("@Address", SqlDbType.NVarChar, 500) }; parameters[0].Value = model.Id; parameters[1].Value = model.IsDeleted; parameters[2].Value = model.Status; parameters[3].Value = model.IsMain; parameters[4].Value = model.ZipCode; parameters[5].Value = model.MID; parameters[6].Value = model.Province; parameters[7].Value = model.City; parameters[8].Value = model.Zone; parameters[9].Value = model.Tel; parameters[10].Value = model.Receiver; parameters[11].Value = model.Phone; parameters[12].Value = model.Address; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
/// <summary> /// 增加一条数据 /// </summary> public static Hashtable Insert(Model.ReceiveInfo model, Hashtable MyHs) { string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into ReceiveInfo("); strSql.Append("IsDeleted,Status,IsMain,ZipCode,MID,Province,City,Zone,Tel,Receiver,Phone,Address"); strSql.Append(") values ("); strSql.Append("@IsDeleted,@Status,@IsMain,@ZipCode,@MID,@Province,@City,@Zone,@Tel,@Receiver,@Phone,@Address"); strSql.Append(") "); strSql.AppendFormat(";select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@IsDeleted", SqlDbType.Bit, 1), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@IsMain", SqlDbType.Bit, 1), new SqlParameter("@ZipCode", SqlDbType.NChar, 10), new SqlParameter("@MID", SqlDbType.VarChar, 50), new SqlParameter("@Province", SqlDbType.NVarChar, 50), new SqlParameter("@City", SqlDbType.NVarChar, 50), new SqlParameter("@Zone", SqlDbType.NVarChar, 50), new SqlParameter("@Tel", SqlDbType.VarChar, 20), new SqlParameter("@Receiver", SqlDbType.VarChar, 20), new SqlParameter("@Phone", SqlDbType.VarChar, 20), new SqlParameter("@Address", SqlDbType.NVarChar, 500) }; parameters[0].Value = model.IsDeleted; parameters[1].Value = model.Status; parameters[2].Value = model.IsMain; parameters[3].Value = model.ZipCode; parameters[4].Value = model.MID; parameters[5].Value = model.Province; parameters[6].Value = model.City; parameters[7].Value = model.Zone; parameters[8].Value = model.Tel; parameters[9].Value = model.Receiver; parameters[10].Value = model.Phone; parameters[11].Value = model.Address; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
protected override void SetValue(string id) { string oid = HttpUtility.UrlDecode(Request["id"].Trim());//订单Id hidId.Value = oid; orderModel = BLL.Order.GetModel(oid); ReceiveInfoModel = BLL.ReceiveInfo.GetModel(orderModel.ReceiveId); ViewState["OrderInfo"] = orderModel; Session["OrderId"] = oid; List <Model.OrderDetail> listdetail = BLL.OrderDetail.GetList(" OrderCode='" + orderModel.Code + "';"); foreach (Model.OrderDetail item in listdetail) { Model.Goods gs = BLL.Goods.GetModel(item.GId); if (gs != null) { strgoods += gs.GName + " " + item.GCount + gs.Unit + ";<br/>"; } } }
protected override void SetValue(string id) { string oid = HttpUtility.UrlDecode(Request["id"].Trim());//订单Id hidId.Value = oid; orderModel = BLL.Order.GetModel(oid); ReceiveInfoModel = BLL.ReceiveInfo.GetModel(orderModel.ReceiveId); ViewState["OrderInfo"] = orderModel; Session["OrderId"] = oid; string gids = ""; foreach (Model.OrderDetail od in orderModel.OrderDetail) { gids += od.GId + ","; } gids = gids.TrimEnd(','); var listGood = BLL.Goods.GetList("GID in (" + gids + ")"); repGoodList.DataSource = listGood; repGoodList.DataBind(); }
//添加收货人,并保证只有一个默认收货人 protected override string btnAdd_Click() { string sid = Request.Form["hidId"]; Hashtable myHs = new Hashtable(); Model.ReceiveInfo obj = null; if (string.IsNullOrEmpty(sid) || sid == "0") { //添加 obj = ReceiveInfoModel; obj.MID = TModel.MID; BLL.ReceiveInfo.Insert(obj, myHs); if (obj.IsMain == true) { BLL.ReceiveInfo.UpdateToNoMian(TModel.MID, "0"); } } else { obj = ReceiveInfoModel; BLL.ReceiveInfo.Update(obj, myHs); if (obj.IsMain == true) { BLL.ReceiveInfo.UpdateToNoMian(TModel.MID, obj.Id.ToString()); } } if (BLL.CommonBase.RunHashtable(myHs)) { var list = BLL.ReceiveInfo.GetList("IsDeleted=0 and MID='" + TModel.MID + "'"); if (list.Where(c => c.IsMain == true).Count() <= 0) { Model.ReceiveInfo info = list[0]; info.IsMain = true; BLL.ReceiveInfo.Update(info); } return("操作成功"); } return("操作失败"); }
/// <summary> /// 实体转换 /// <summary> private static Model.ReceiveInfo TranEntity(DataRow dr) { if (dr != null) { Model.ReceiveInfo model = new Model.ReceiveInfo(); if (!string.IsNullOrEmpty(dr["Id"].ToString())) { model.Id = int.Parse(dr["Id"].ToString()); } if (!string.IsNullOrEmpty(dr["IsDeleted"].ToString())) { model.IsDeleted = bool.Parse(dr["IsDeleted"].ToString()); } if (!string.IsNullOrEmpty(dr["Status"].ToString())) { model.Status = int.Parse(dr["Status"].ToString()); } if (!string.IsNullOrEmpty(dr["IsMain"].ToString())) { model.IsMain = bool.Parse(dr["IsMain"].ToString()); } model.ZipCode = dr["ZipCode"].ToString(); model.MID = dr["MID"].ToString(); model.Province = dr["Province"].ToString(); model.City = dr["City"].ToString(); model.Zone = dr["Zone"].ToString(); model.Tel = dr["Tel"].ToString(); model.Receiver = dr["Receiver"].ToString(); model.Phone = dr["Phone"].ToString(); model.Address = dr["Address"].ToString(); return(model); } else { return(null); } }
public static bool Update(Model.ReceiveInfo model) { return(yny_003.DAL.ReceiveInfo.Update(model)); }
public static Hashtable Update(Model.ReceiveInfo model, Hashtable MyHs) { return(yny_003.DAL.ReceiveInfo.Update(model, MyHs)); }
public static bool Insert(Model.ReceiveInfo model) { return(yny_003.DAL.ReceiveInfo.Insert(model)); }
public static Hashtable Insert(Model.ReceiveInfo model, Hashtable MyHs) { return(yny_003.DAL.ReceiveInfo.Insert(model, MyHs)); }
/// <summary> /// 增加一条数据 /// </summary> public static bool Insert(Model.ReceiveInfo model) { return(DAL.CommonBase.RunHashtable(Insert(model, new Hashtable()))); }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(Model.ReceiveInfo model) { return(DAL.CommonBase.RunHashtable(Update(model, new Hashtable()))); }