-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmap-page.aspx.cs
92 lines (88 loc) · 3.34 KB
/
map-page.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using Database;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class map : PublicUser
{
public other_Webpage seo { get; set; }
public string strLocations { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
try
{
urlRequest.Value = urlDomainShare + Request.RawUrl.Substring(0, Request.RawUrl.IndexOf('?'));
}
catch
{
urlRequest.Value = urlDomainShare + Request.RawUrl;
}
seo = dbConnect.other_Webpages.Single(n => n.Id == 66);
if (!IsPostBack)
{
seo.ViewCount += 1;
try { dbConnect.SubmitChanges(); } catch { }
}
//load product
if (!IsPostBack)
{
ddlSort.DataSource = SortProductModelUtils.getListSort();
ddlSort.DataValueField = "Value";
ddlSort.DataTextField = "Text";
ddlSort.DataBind();
ddlSort.SelectedValue = "7";
ddlVungMien.DataSource = dbConnect.tblRegions.Where(n => n.IsStatus == true);
ddlVungMien.DataValueField = "Id";
ddlVungMien.DataTextField = "Name";
ddlVungMien.DataBind();
ddlVungMien.Items.Insert(0, new ListItem("Vùng miền", ""));
ProductCategorysUtils.loadDropDownListPublic(ddlDanhMuc);
}
if (Request["cate"] != null) { ddlDanhMuc.SelectedValue = Request["cate"] + ""; }
if (Request["reg"] != null) { ddlVungMien.SelectedValue = Request["reg"] + ""; }
if (Request["sort"] != null) { ddlSort.SelectedValue = Request["sort"] + ""; }
if (Request["key"] != null) { txtKeyword.Text = Request["key"] + ""; }
string cateIds = "";
int reg = 0;
if (ddlVungMien.SelectedValue != "") { reg = int.Parse(ddlVungMien.SelectedValue); }
try
{
var pro_Category = dbConnect.pro_Categories.Single(n => n.Id == int.Parse(ddlDanhMuc.SelectedValue));
var categoryResults = dbConnect.proGetChildLevelCategory(pro_Category.Id, pro_Category.Name).ToList();
cateIds = string.Join(",", categoryResults.Distinct().Select(n => n.child).Distinct());
}
catch { }
var items = dbConnect.getListShop(txtKeyword.Text, reg, cateIds, int.Parse(ddlSort.SelectedValue))
.Distinct()
.Select(n => new
{
n.Id,
n.Name,
n.Price,
n.Banner,
n.StatusCss,
n.StatusName,
n.Code,
n.ExchangeRate,
n.Summary,
n.RankingCount
})
.ToList().Distinct();
var lstLocation = new List<store_ShopLocation>();
foreach (var item in items)
{
foreach (var loc in dbConnect.store_ShopLocations.Where(n => n.store_ShopRentalId == item.Id
&& n.IsStatus == true && n.Long != "" && n.Lat != ""
&& n.Long != null && n.Lat != null))
{
strLocations += (","+ "['"+item.Name.Replace("'","\"")+"', "+loc.Lat+", "+loc.Long+", "+loc.Id+"]");
}
}
if (strLocations.Length > 0)
{
strLocations = strLocations.Substring(1);
}
}
}