protected void Page_Load(object sender, EventArgs e) { //string activationCode = !string.IsNullOrEmpty(Request.QueryString["mamaro"]) ? Request.QueryString["mamaro"] : Guid.Empty.ToString(); string text = Page.Request.QueryString.Get("id"); string id = System.Text.RegularExpressions.Regex.Replace(text, @"[^a-zA-Z0-9\s]", string.Empty); Session["mid"] = id; string text1 = Page.Request.QueryString.Get("state"); string QAon = System.Text.RegularExpressions.Regex.Replace(text1, @"[^a-zA-Z0-9\s]", string.Empty); Query = "select id from nursing_room_normal where id='" + id + "';"; DataView ict2 = gc.select_cmd(Query); if (ict2.Count > 0) { string datetimenow = ""; Query = "SELECT NOW() as now;"; DataView ict3 = gc.select_cmd(Query); if (ict3.Count > 0) { datetimenow = ict3.Table.Rows[0]["now"].ToString(); Query = "SELECT * FROM db1.nursing_room_normal_counter where nursing_room_normal_id=" + id + " and update_time='" + datetimenow + "' ORDER BY update_time DESC LIMIT 1;"; DataView ict4 = gc.select_cmd(Query); if (ict4.Count == 0) { Query = "insert into nursing_room_normal_counter(nursing_room_normal_id,state,update_time)"; Query += " VALUES ('" + id + "','" + QAon + "',NOW())"; result_cmd = gc.insert_cmd(Query); } } } Panel1.Controls.Add(new LiteralControl("id:" + id + ",state:" + QAon + "," + result_cmd)); }
protected void Page_Init(object sender, EventArgs e) { Query = "select city_name from City;"; DataView ict_f = gc.select_cmd(Query); City_DropDownList.Items.Clear(); for (int i = 0; i < ict_f.Count; i++) { City_DropDownList.Items.Add(ict_f.Table.Rows[i]["city_name"].ToString()); } City_DropDownList.Items.FindByValue("神奈川県").Selected = true; City_DropDownList.Items.FindByText("神奈川県").Selected = true; }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { string activationCode = !string.IsNullOrEmpty(Request.QueryString["ActivationCode"]) ? Request.QueryString["ActivationCode"] : Guid.Empty.ToString(); Query = "select UserId"; Query += " from UserActivation_registered"; Query += " where ActivationCode='" + activationCode + "';"; DataView ict_f = gc.select_cmd(Query); int id = 0; for (int i = 0; i < ict_f.Count; i++) { id = Convert.ToInt32(ict_f.Table.Rows[i]["UserId"].ToString()); } if (id == 0) { Response.Redirect("main.aspx"); } else { Session["id"] = id; Response.Redirect("registered.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { List <img_group> lis = new List <img_group>(); img_group imf = new img_group(); Query = "select t.id,CONCAT('https://storage.googleapis.com//nursing_room/',t.foo) as fooz from( SELECT SUBSTRING_INDEX(url,'/nursing_room/',-1) as foo,id FROM MakeLocaldb1.nursing_room_grid_eye where url like 'https://s3-ap-northeast-1.amazonaws.com//nursing_room/%' ) as t;"; DataView ict2 = gc.select_cmd(Query); if (ict2.Count > 0) { for (int i = 0; i < ict2.Count; i++) { imf = new img_group(); imf.id = ict2.Table.Rows[i]["id"].ToString(); imf.url = ict2.Table.Rows[i]["fooz"].ToString(); lis.Add(imf); } for (int i = 0; i < lis.Count; i++) { Panel1.Controls.Add(new LiteralControl("id:" + lis[i].id + ",url:" + lis[i].url + "</br>")); Query = "update nursing_room_grid_eye set url='" + lis[i].url + "' where id='" + lis[i].id + "';"; result_cmd = gc.update_cmd(Query); } } }
public static string search_grid(string param1, string param3) { GCP_MYSQL gc1 = new GCP_MYSQL(); string Query1 = ""; string resin = ""; string result = ""; Query1 = "SELECT message_type,postal_code,place FROM status_messages WHERE message_type =" + param1 + @" LIMIT " + (Convert.ToInt32(param3) * 10) + ",10;"; DataView ict_f = gc1.select_cmd(Query1); result += "<table width='100%'>"; result += "<tr>"; result += "<td>カテゴリー</td>"; result += "<td>郵便番号</td>"; result += "<td>所在地</td>"; result += "</tr>"; if (ict_f.Count > 0) { for (int i = 0; i < ict_f.Count; i++) { result += "<tr>"; result += "<td>"; string type = ""; if (ict_f.Table.Rows[i]["message_type"].ToString() == "0") { result += "お食事"; } else if (ict_f.Table.Rows[i]["message_type"].ToString() == "1") { result += "人気スポット"; } else if (ict_f.Table.Rows[i]["message_type"].ToString() == "2") { result += "イベント"; } else if (ict_f.Table.Rows[i]["message_type"].ToString() == "3") { result += "病院"; } else if (ict_f.Table.Rows[i]["message_type"].ToString() == "4") { result += "公園/レジャー"; } else if (ict_f.Table.Rows[i]["message_type"].ToString() == "5") { result += "授乳室"; } else if (ict_f.Table.Rows[i]["message_type"].ToString() == "6") { result += "指定なし"; } result += "</td>"; result += "<td>" + ict_f.Table.Rows[i]["postal_code"].ToString() + @"</td>"; result += "<td>" + ict_f.Table.Rows[i]["place"].ToString() + @"</td>"; result += "</tr>"; } } return(result); }
public static string check_login(string param1, string param2) { //string result = param1 + "," + param2; string result = ""; try { string username = param1.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim(); string password = param2.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim(); string usernames = RemoveSpecialCharacters(username); string passwords = RemoveSpecialCharacters(password); if (usernames != "" && passwords != "") { GCP_MYSQL gc = new GCP_MYSQL(); string Query = "select id from nursing_room_manager where account='" + usernames + "';"; DataView ict_ff = gc.select_cmd(Query); if (ict_ff.Count > 0) { string Query1 = "select id from nursing_room_manager where account='" + usernames + "' and password='******';"; DataView ict_ff1 = gc.select_cmd(Query1); if (ict_ff1.Count > 0) { HttpContext.Current.Session["manager_page"] = ict_ff1.Table.Rows[0]["id"].ToString(); //result = HttpContext.Current.Session["manager"].ToString(); result = "ログインできました。"; } else { result = "パスワードが間違っています。"; } } else { result = "アカウントが間違っています。"; } } } catch (Exception ex) { result = "ログインできませんでした。"; //return result; throw ex; } return(result); }
protected void Page_Init(object sender, EventArgs e) { List <string> uni_id = new List <string>(); string Query = ""; GCP_MYSQL gc = new GCP_MYSQL(); Panel1.Controls.Clear(); Query = "select id,company_name"; Query += " from nursing_room_from;"; DataView ict_place = gc.select_cmd(Query); if (ict_place.Count > 0) { for (int i = 0; i < ict_place.Count; i++) { bool checksame = true; for (int ix = 0; ix < uni_id.Count; ix++) { if (uni_id[ix] == ict_place.Table.Rows[i]["company_name"].ToString()) { checksame = false; } } if (checksame) { uni_id.Add(ict_place.Table.Rows[i]["company_name"].ToString()); Panel1.Controls.Add(new LiteralControl("<fieldset><legend style='font-size: large; font-weight: bold'>" + ict_place.Table.Rows[i]["company_name"].ToString() + "</legend>")); Query = "select nursing_room_id"; Query += " from nursing_room_connect_from where nursing_room_from_id='" + ict_place.Table.Rows[i]["id"].ToString() + "';"; DataView ict_place1 = gc.select_cmd(Query); if (ict_place1.Count > 0) { for (int ii = 0; ii < ict_place1.Count; ii++) { Panel1.Controls.Add(new LiteralControl(ict_place1.Table.Rows[ii]["nursing_room_id"].ToString())); Panel1.Controls.Add(new LiteralControl("<br/>")); } } Panel1.Controls.Add(new LiteralControl("</fieldset>")); } } } }
protected void Page_Init(object sender, EventArgs e) { string Query = ""; GCP_MYSQL gc = new GCP_MYSQL(); Panel1.Controls.Clear(); DateTime maxtime; Query = "select nursing_room_id,max(update_time) as maxtime from MakeLocaldb1.nursing_room_wifi_state where TIMESTAMPDIFF(HOUR,update_time, CONVERT(NOW(),DATETIME))<24 group by nursing_room_id;"; DataView ict = gc.select_cmd(Query); if (ict.Count > 0) { for (int i = 0; i < ict.Count; i++) { GCP_MYSQL gc1 = new GCP_MYSQL(); string Query1 = ""; maxtime = Convert.ToDateTime(ict.Table.Rows[i]["maxtime"].ToString()); Query1 = "select a.id,b.name,b.address,b.GPS_lat,b.GPS_lng,b.company,b.company_tel,b.remote_name"; Query1 += " from nursing_room_wifi_state as a inner join nursing_room as b on b.id=a.nursing_room_id"; Query1 += " where a.nursing_room_id='" + ict.Table.Rows[i]["nursing_room_id"].ToString() + "' and a.update_time between'" + maxtime.ToString("yyyy-MM-dd HH:mm:ss") + ".000" + "' and '" + maxtime.ToString("yyyy-MM-dd HH:mm:ss") + ".999" + "' order by a.update_time;"; DataView ict1 = gc1.select_cmd(Query1); if (ict1.Count > 0) { for (int i1 = 0; i1 < ict1.Count; i1++) { Panel1.Controls.Add(new LiteralControl("<fieldset><legend style='font-size: large; font-weight: bold'>" + ict1.Table.Rows[i1]["name"].ToString() + "</legend>")); Panel1.Controls.Add(new LiteralControl("Connect name: " + ict1.Table.Rows[i1]["remote_name"].ToString())); Panel1.Controls.Add(new LiteralControl("<br/>")); Panel1.Controls.Add(new LiteralControl("ID: " + ict.Table.Rows[i]["nursing_room_id"].ToString())); Panel1.Controls.Add(new LiteralControl("<br/>")); Panel1.Controls.Add(new LiteralControl("update_time: " + ict.Table.Rows[i]["maxtime"].ToString())); Panel1.Controls.Add(new LiteralControl("<br/>")); Panel1.Controls.Add(new LiteralControl("address: " + ict1.Table.Rows[i1]["address"].ToString())); Panel1.Controls.Add(new LiteralControl("<br/>")); Panel1.Controls.Add(new LiteralControl("GPS_lat: " + ict1.Table.Rows[i1]["GPS_lat"].ToString())); Panel1.Controls.Add(new LiteralControl("<br/>")); Panel1.Controls.Add(new LiteralControl("GPS_lng: " + ict1.Table.Rows[i1]["GPS_lng"].ToString())); Panel1.Controls.Add(new LiteralControl("<br/>")); Panel1.Controls.Add(new LiteralControl("company: " + ict1.Table.Rows[i1]["company"].ToString())); Panel1.Controls.Add(new LiteralControl("<br/>")); Panel1.Controls.Add(new LiteralControl("company_tel: " + ict1.Table.Rows[i1]["company_tel"].ToString())); Panel1.Controls.Add(new LiteralControl("<br/>")); Panel1.Controls.Add(new LiteralControl("</fieldset>")); } } } } }
public static string Save(string param1, string param2, string param3) { GCP_MYSQL gc1 = new GCP_MYSQL(); string Query1 = ""; string resin = ""; string result = param1 + "," + param2 + "," + param3; string id = param1.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim(); string age = param2.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim(); string sex = param3.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim(); try { int sexx = 0; if (sex == "Girl") { sexx = 0; } if (sex == "Boy") { sexx = 1; } int iid = Convert.ToInt32(id); int iage = Convert.ToInt32(age); Query1 = "select id from user_login"; Query1 += " where id='" + iid + "';"; DataView ict_f = gc1.select_cmd(Query1); if (ict_f.Count > 0) { Query1 = "insert into user_family(uid,family_old,sex)"; Query1 += " values('" + iid + "','" + iage + "','" + sexx + "')"; resin = gc1.insert_cmd(Query1); result = "success"; //return result; } result = "fail"; //return result; } catch (Exception ex) { result = "fail"; //return result; throw ex; } return(result); }
public static void ConvertUrlsInData(string msg) { string regex = @"((www\.|(http|https|ftp|news|file)+\:\/\/)[_.a-z0-9-]+\.[a-z0-9\/_:@=.+?,##%&~-]*[^.|\'|\# |!|\(|?|,| |>|<|;|\)])"; Regex r = new Regex(regex, RegexOptions.IgnoreCase); MatchCollection mactches = r.Matches(msg); foreach (Match match in mactches) { GCP_MYSQL gc1 = new GCP_MYSQL(); string Query1 = "select id from status_messages_link_info where link like '" + match.Value + "';"; DataView ict1 = gc1.select_cmd(Query1); if (ict1.Count == 0) { ConvertUrlsToInData(match.Value); } } }
protected void Page_Load(object sender, EventArgs e) { Label_logo.Attributes.Add("onclick", "javascript:self.location='main.aspx';"); Label_logo.Style["cursor"] = "pointer"; if (!this.IsPostBack) { string activationCode = !string.IsNullOrEmpty(Request.QueryString["ActivationCode"]) ? Request.QueryString["ActivationCode"] : Guid.Empty.ToString(); Query = "select uid,supp_id,uiacdid"; Query += " from user_information_store_week_appointment_check_check"; Query += " where ActivationCode='" + activationCode + "';"; DataView ict_f = gc.select_cmd(Query); int id = 0, supid = 0, uiacdid = 0; for (int i = 0; i < ict_f.Count; i++) { id = Convert.ToInt32(ict_f.Table.Rows[i]["uid"].ToString()); supid = Convert.ToInt32(ict_f.Table.Rows[i]["supp_id"].ToString()); uiacdid = Convert.ToInt32(ict_f.Table.Rows[i]["uiacdid"].ToString()); } //now time string startd = DateTime.Now.Date.ToString("yyyy-MM-dd"); string starth = Convert.ToInt32(DateTime.Now.ToString("HH")).ToString(); string startm = DateTime.Now.Minute.ToString(); string starts = DateTime.Now.Second.ToString(); string start = startd + " " + starth + ":" + startm + ":" + starts; //now time if (Session["id"] != null) { if (Session["id"].ToString() == supid.ToString()) { Response.Redirect("main.aspx"); } else { ltMessage.Text = "このアカウントはサポーター登録されていません。"; } } else { ltMessage.Text = "Fail."; } Label1.Text = "10"; } }
protected void Page_Init(object sender, EventArgs e) { string Query = ""; GCP_MYSQL gc = new GCP_MYSQL(); Panel1.Controls.Clear(); Query = "select * from nursing_room;"; DataView ict_place = gc.select_cmd(Query); if (ict_place.Count > 0) { for (int i = 0; i < ict_place.Count; i++) { Panel1.Controls.Add(new LiteralControl("<input name='user_active_col[]' type='checkbox' value='" + ict_place.Table.Rows[i]["id"].ToString() + "'> " + ict_place.Table.Rows[i]["name"].ToString() + "")); Panel1.Controls.Add(new LiteralControl("<br/>")); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["seak_URLinfo"] != null) { if (Session["seak_URLinfo"].ToString() == "true") { ListBox1.Items.Clear(); ListBox2.Items.Clear(); ListBox3.Items.Clear(); ListBox4.Items.Clear(); ListBox5.Items.Clear(); ListBox6.Items.Clear(); gc = new GCP_MYSQL(); Query = "select *,TIMESTAMPDIFF(minute, update_time, NOW()) as difftime from status_messages_link_info order by difftime DESC LIMIT 50;"; DataView ict2 = gc.select_cmd(Query); URL_data URL_info = new URL_data(); if (ict2.Count > 0) { for (int i = 0; i < ict2.Count; i++) { if (Convert.ToInt32(ict2.Table.Rows[i]["difftime"].ToString()) > 30) { URL_info = new URL_data(); URL_info = ConvertUrlsToDIV(ict2.Table.Rows[i]["link"].ToString()); Query = "update status_messages_link_info set image_url='" + URL_info.image_url + "',title='" + URL_info.title + "'"; Query += ",des='" + URL_info.des + "',update_time=NOW() where id='" + ict2.Table.Rows[i]["id"].ToString() + "';"; result_cmd = gc.update_cmd(Query); ListBox1.Items.Add(URL_info.url); ListBox2.Items.Add(URL_info.title); ListBox3.Items.Add(URL_info.des); ListBox4.Items.Add(URL_info.image_url); ListBox6.Items.Add(URL_info.update_time); } } } } } }
public static string[] Getsearch(string prefix) { GCP_MYSQL gc1 = new GCP_MYSQL(); string Query1 = ""; string resin = ""; List <string> customers = new List <string>(); Query1 = "select id,username,photo from user_login where username like '" + prefix.Replace("'", "").Replace(@"""", "") + "%'"; DataView ict_sf = gc1.select_cmd(Query1); for (int i = 0; i < ict_sf.Count; i++) { string cutstr = ict_sf.Table.Rows[i]["photo"].ToString(); int ind = cutstr.IndexOf(@"/"); string cutstr1 = cutstr.Substring(ind + 1, cutstr.Length - ind - 1); customers.Add(string.Format("{0};{1};{2}", ict_sf.Table.Rows[i]["username"], ict_sf.Table.Rows[i]["id"], cutstr1)); } return(customers.ToArray()); }
protected void Button1_Click(object sender, EventArgs e) { GCP_MYSQL gc1 = new GCP_MYSQL(); string Query1 = ""; string resin = ""; string loginname = loginname_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim(); bool check_mail = CheckEmailFormat(loginname); if (loginname != "") { if (check_mail) { Query1 = "select id,username from user_login"; Query1 += " where login_name='" + loginname + "';"; DataView ict_f = gc1.select_cmd(Query1); if (ict_f.Count > 0) { result_Label.Text = ""; string activationCode = Guid.NewGuid().ToString(); Query1 = "update user_login set login_password='******'"; Query1 += " where id='" + ict_f.Table.Rows[0]["id"].ToString() + "';"; resin = gc1.update_cmd(Query1); SendActivationEmail(loginname, ict_f.Table.Rows[0]["username"].ToString(), activationCode); result_Label.Text = "メールをご確認ください。"; } else { result_Label.Text = "このメールアドレスはまだ登録されていません。"; } } else { result_Label.Text = "無効なメールアドレスです。"; } } else { result_Label.Text = "未記入もしくは使用できない単語です。"; } }
protected void Page_Init(object sender, EventArgs e) { if (this.Request.QueryString["mid"] != null) { string activationCode = !string.IsNullOrEmpty(Request.QueryString["mid"]) ? Request.QueryString["mid"] : Guid.Empty.ToString(); if (activationCode != "") { Session["mamaro_id"] = activationCode; Response.Redirect("mamaro_message.aspx"); } } else { } try { string touid = RemoveSpecialCharacters(Session["mamaro_id"].ToString()); gc = new GCP_MYSQL(); Literal lip = new Literal(); Query = "select id from nursing_room where QRcode='" + touid + "';"; DataView ict_ff = gc.select_cmd(Query); if (ict_ff.Count > 0) { Session["real_id"] = ict_ff.Table.Rows[0]["id"].ToString(); } else { Response.Redirect(@"http:///"); } } catch (Exception ex) { Response.Redirect(@"http:///"); } }
protected void UploadDocument(object sender, EventArgs e) { string input = "", DirRoot = "", filename = ""; int stringindex = 0, cut = 0; Boolean check = false; Session["head_photo"] = null; if (fuDocument.HasFile) { HttpPostedFile postedFile = fuDocument.PostedFile; DirRoot = System.IO.Path.GetExtension(postedFile.FileName).ToUpper().Replace(".", ""); Query = "select id,name from filename_extension"; DataView ou1 = gc.select_cmd(Query); for (int i = 0; i < ou1.Count; i++) { if (DirRoot.ToUpper() == ou1.Table.Rows[i]["name"].ToString().ToUpper()) { check = true; } } if (check) { filename = DateTime.Now.ToString("yyyyMMddHHmmssffff") + @"." + DirRoot; Google.Apis.Auth.OAuth2.GoogleCredential credential = GCP_AUTH.AuthExplicit(); string imgurl = GCP_AUTH.upload_file_stream("", "upload/test", filename, postedFile.InputStream, credential); //AmazonUpload aws = new AmazonUpload(); //string imgurl = aws.AmazonUpload_file("", "upload/test", filename, postedFile.InputStream); //fuDocument.SaveAs(Server.MapPath("head_photo") + "\\" + filename); Image1.ImageUrl = imgurl; Image1.Attributes.Add("style", "display:block"); Session["head_photo"] = "~/" + imgurl; } else { ScriptManager.RegisterStartupScript(fuDocument, fuDocument.GetType(), "alert", "alert('filename extension is not in role!')", true); } } }
protected void Page_Init(object sender, EventArgs e) { string Query = ""; GCP_MYSQL gc = new GCP_MYSQL(); javascriptPanel.Controls.Clear(); Query = "select a.video_des,a.company_name,count(a.id) as totalplay"; Query += " from nursing_room_video_info as a"; Query += " inner join nursing_room_video_play_detail as b"; Query += " on a.id=b.nursing_room_video_info_id"; Query += " group by a.id"; DataView ict_place = gc.select_cmd(Query); string res = ""; //mamaro video total play times res += @"<script> window.onload = function () { var options = { animationEnabled: true, title: { text: " + '"' + @"mamaro Video" + '"' + @" }, data: [{ type: " + '"' + @"doughnut" + '"' + @", innerRadius: " + '"' + @"40%" + '"' + @", showInLegend: true, legendText: " + '"' + @"{label}" + '"' + @", indexLabel: " + '"' + @"{label}: #percent%" + '"' + @", dataPoints: [" ; if (ict_place.Count > 0) { for (int i = 0; i < ict_place.Count; i++) { res += @" { label: " + '"' + ict_place.Table.Rows[i]["video_des"].ToString() + '"' + @", y: " + ict_place.Table.Rows[i]["totalplay"].ToString() + @" },"; } } res += @"] }] }; $(" + '"' + @"#chartContainer" + '"' + @").CanvasJSChart(options);"; //mamaro time analysis Random rnd = new Random(Guid.NewGuid().GetHashCode()); Color randomColor; String strHtmlColor; tg = new List <time_group>(); time_group tig = new time_group(); res += @"options = { animationEnabled: true, theme: " + '"' + @"light2" + '"' + @", title:{ text: " + '"' + @" time analysis" + '"' + @" }, axisY2:{ prefix: " + '"' + @"" + '"' + @", lineThickness: 0 }, toolTip: { shared: true }, legend:{ verticalAlign: " + '"' + @"top" + '"' + @", horizontalAlign: " + '"' + @"center" + '"' + @" }, data: [" ; Query = "select video_des,company_name,id"; Query += " from nursing_room_video_info;"; ict_place = gc.select_cmd(Query); DataView ict_pl; if (ict_place.Count > 0) { for (int i = 0; i < ict_place.Count; i++) { tig = new time_group(); tig.id = ict_place.Table.Rows[i]["id"].ToString(); randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256)); strHtmlColor = System.Drawing.ColorTranslator.ToHtml(randomColor); tig.stu += @" { type: " + '"' + @"stackedBar" + '"' + @", showInLegend: true, name: " + '"' + ict_place.Table.Rows[i]["video_des"].ToString() + '"' + @", axisYType: " + '"' + @"secondary" + '"' + @", color: " + '"' + strHtmlColor + '"' + @", dataPoints: [" ; tg.Add(tig); } } for (int i = 9; i < 24; i++) { string timestr = i + "時-" + (i + 1) + "時"; Query = "select a.id,a.video_des,a.company_name,count(a.id) as totalplay"; Query += " from nursing_room_video_info as a"; Query += " inner join nursing_room_video_play_detail as b"; Query += " on a.id=b.nursing_room_video_info_id"; Query += " where HOUR(b.update_time) between " + i + " and " + (i + 1) + ""; Query += " group by a.id"; ict_pl = gc.select_cmd(Query); if (ict_pl.Count > 0) { for (int j = 0; j < ict_pl.Count; j++) { for (int ii = 0; ii < tg.Count; ii++) { if (tg[ii].id == ict_pl.Table.Rows[j]["id"].ToString()) { tg[ii].stu += @"{ y: " + ict_pl.Table.Rows[j]["totalplay"].ToString() + ", label: " + '"' + timestr + '"' + @" },"; } } } } } for (int i = 0; i < tg.Count; i++) { tg[i].stu += @"] }," ; } for (int i = 0; i < tg.Count; i++) { res += tg[i].stu; } res += @"] };"; res += @"$(" + '"' + @"#chartContainer1" + '"' + @").CanvasJSChart(options); "; //mamaro play how many video tgm_list = new List <time_group_mamaro>(); time_group_mamaro tgm = new time_group_mamaro(); Query = "select c.id as nid,c.name,a.id,a.video_des,a.company_name,count(a.id) as totalplay"; Query += " from nursing_room_video_info as a"; Query += " inner join nursing_room_video_play_detail as b"; Query += " on a.id=b.nursing_room_video_info_id"; Query += " inner join nursing_room as c"; Query += " on b.nursing_room_id=c.id"; Query += " group by c.id,a.id"; ict_place = gc.select_cmd(Query); if (ict_place.Count > 0) { for (int i = 0; i < ict_place.Count; i++) { tgm = new time_group_mamaro(); tgm.id = ict_place.Table.Rows[i]["nid"].ToString(); tgm.name = ict_place.Table.Rows[i]["name"].ToString(); tgm.video_des = ict_place.Table.Rows[i]["video_des"].ToString(); tgm.total = Convert.ToInt32(ict_place.Table.Rows[i]["totalplay"].ToString()); tgm_list.Add(tgm); } } res += @"options = { animationEnabled: true, title: { text: " + '"' + @" Play Video Times" + '"' + @" }, data: [{ type: " + '"' + @"doughnut" + '"' + @", innerRadius: " + '"' + @"40%" + '"' + @", showInLegend: true, legendText: " + '"' + @"{label}" + '"' + @", indexLabel: " + '"' + @"{label}: #percent%" + '"' + @", dataPoints: [" ; string smalljava = ""; string choice = ""; // string choice = @"<script> // $( function() { // $( " + '"' + @"#accordion" + '"' + @" ).accordion({ // heightStyle: " + '"' + @"content" + '"' + @" // }); // } ); // </script> //<div id=" + '"' + @"accordion" + '"' + @">"; Query = "select id,name"; Query += " from nursing_room;"; ict_place = gc.select_cmd(Query); if (ict_place.Count > 0) { for (int i = 0; i < ict_place.Count; i++) { int total = 0; string name = ict_place.Table.Rows[i]["name"].ToString(); bool chc = false; string cho = @" options = { animationEnabled: true, title: { text: " + '"' + name + '"' + @" }, data: [{ type: " + '"' + @"doughnut" + '"' + @", innerRadius: " + '"' + @"40%" + '"' + @", showInLegend: true, legendText: " + '"' + @"{label}" + '"' + @", indexLabel: " + '"' + @"{label}: #percent%" + '"' + @", dataPoints: [" ; for (int ii = 0; ii < tgm_list.Count; ii++) { if (ict_place.Table.Rows[i]["id"].ToString() == tgm_list[ii].id) { total += tgm_list[ii].total; //mamaro detail cho += @" { label: " + '"' + tgm_list[ii].video_des + '"' + @", y: " + tgm_list[ii].total + @" },"; chc = true; } } cho += @"] }] }; $(" + '"' + @"#chartContainer_" + i.ToString() + '"' + @").CanvasJSChart(options);"; if (chc) { smalljava += cho; } if (total > 0) { res += @" { label: " + '"' + name + '"' + @", y: " + total + @" },"; //mamaro detail //choice += "<h3>" + name + "</h3><div style=" + '"' + @"height: 300px; width: 100%;" + '"' + @"><div id=" + '"' + @"chartContainer_" + i.ToString() + '"' + @" style=" + '"' + @"height: 300px; width: 100%;" + '"' + @"></div></div>"; choice += "<h3>" + name + "</h3><div id=" + '"' + @"chartContainer_" + i.ToString() + '"' + @" style=" + '"' + @"height: 300px; width: 100%;" + '"' + @"></div>"; } } } //choice += "</div>"; res += @"] }] }; $(" + '"' + @"#chartContainer2" + '"' + @").CanvasJSChart(options);"; res += smalljava; res += @" } </script> "; detailPanel.Controls.Add(new LiteralControl(choice)); javascriptPanel.Controls.Add(new LiteralControl(res)); }
protected void Page_Init(object sender, EventArgs e) { gc = new GCP_MYSQL(); Panel mypan = (Panel)this.FindControl("main_Panel"); Literal lip = new Literal(); Query = "select * from nursing_room;"; DataView ict_ff = gc.select_cmd(Query); lip.Text += @"<hr>"; if (ict_ff.Count > 0) { for (int i = 0; i < ict_ff.Count; i++) { lip.Text += @"<div id=" + '"' + @"chart-container" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + @"><svg width=" + '"' + @"90px" + '"' + @" height=" + '"' + @"90px" + '"' + @" xmlns=" + '"' + @"http://www.w3.org/2000/svg" + '"' + @" viewBox=" + '"' + @"0 0 100 100" + '"' + @" preserveAspectRatio=" + '"' + @"xMidYMid" + '"' + @" class=" + '"' + @"lds-rolling" + '"' + @" style=" + '"' + @"background: none;" + '"' + @"><circle cx=" + '"' + @"50" + '"' + @" cy=" + '"' + @"50" + '"' + @" fill=" + '"' + @"none" + '"' + @" ng-attr-stroke=" + '"' + @"{{config.color}}" + '"' + @" ng-attr-stroke-width=" + '"' + @"{{config.width}}" + '"' + @" ng-attr-r=" + '"' + @"{{config.radius}}" + '"' + @" ng-attr-stroke-dasharray=" + '"' + @"{{config.dasharray}}" + '"' + @" stroke=" + '"' + @"#6ac1a5" + '"' + @" stroke-width=" + '"' + @"9" + '"' + @" r=" + '"' + @"33" + '"' + @" stroke-dasharray=" + '"' + @"155.50883635269477 53.83627878423159" + '"' + @" transform=" + '"' + @"rotate(324 50 50)" + '"' + @"><animateTransform attributeName=" + '"' + @"transform" + '"' + @" type=" + '"' + @"rotate" + '"' + @" calcMode=" + '"' + @"linear" + '"' + @" values=" + '"' + @"0 50 50;360 50 50" + '"' + @" keyTimes=" + '"' + @"0;1" + '"' + @" dur=" + '"' + @"1s" + '"' + @" begin=" + '"' + @"0s" + '"' + @" repeatCount=" + '"' + @"indefinite" + '"' + @"></animateTransform></circle></svg></div>"; lip.Text += @"<div id=" + '"' + @"chart-container_" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + @"><svg width=" + '"' + @"90px" + '"' + @" height=" + '"' + @"90px" + '"' + @" xmlns=" + '"' + @"http://www.w3.org/2000/svg" + '"' + @" viewBox=" + '"' + @"0 0 100 100" + '"' + @" preserveAspectRatio=" + '"' + @"xMidYMid" + '"' + @" class=" + '"' + @"lds-rolling" + '"' + @" style=" + '"' + @"background: none;" + '"' + @"><circle cx=" + '"' + @"50" + '"' + @" cy=" + '"' + @"50" + '"' + @" fill=" + '"' + @"none" + '"' + @" ng-attr-stroke=" + '"' + @"{{config.color}}" + '"' + @" ng-attr-stroke-width=" + '"' + @"{{config.width}}" + '"' + @" ng-attr-r=" + '"' + @"{{config.radius}}" + '"' + @" ng-attr-stroke-dasharray=" + '"' + @"{{config.dasharray}}" + '"' + @" stroke=" + '"' + @"#6ac1a5" + '"' + @" stroke-width=" + '"' + @"9" + '"' + @" r=" + '"' + @"33" + '"' + @" stroke-dasharray=" + '"' + @"155.50883635269477 53.83627878423159" + '"' + @" transform=" + '"' + @"rotate(324 50 50)" + '"' + @"><animateTransform attributeName=" + '"' + @"transform" + '"' + @" type=" + '"' + @"rotate" + '"' + @" calcMode=" + '"' + @"linear" + '"' + @" values=" + '"' + @"0 50 50;360 50 50" + '"' + @" keyTimes=" + '"' + @"0;1" + '"' + @" dur=" + '"' + @"1s" + '"' + @" begin=" + '"' + @"0s" + '"' + @" repeatCount=" + '"' + @"indefinite" + '"' + @"></animateTransform></circle></svg></div>"; lip.Text += @"<hr id=" + '"' + @"hrdiv" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + @">"; } } lip.Text += "<style type=" + '"' + @"text/css" + '"' + @">"; lip.Text += @".body { text-align: center; }"; lip.Text += "</style>"; lip.Text += "<script src=" + '"' + @"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js" + '"' + @"></script>"; lip.Text += "<script src=" + '"' + @"https://static.fusioncharts.com/code/latest/fusioncharts.js" + '"' + @"></script>"; lip.Text += "<script src=" + '"' + @"https://www.gstatic.com/firebasejs/4.6.2/firebase-app.js" + '"' + @"></script>"; lip.Text += "<script src=" + '"' + @"https://www.gstatic.com/firebasejs/4.6.2/firebase-database.js" + '"' + @"></script>"; lip.Text += @" <script> var firebase; var config = { databaseURL: " + '"' + @"" + '"' + @" }; firebase.initializeApp(config);"; if (ict_ff.Count > 0) { for (int i = 0; i < ict_ff.Count; i++) { lip.Text += @" function getData" + ict_ff.Table.Rows[i]["id"].ToString() + @"(callbackIN) { var ref = firebase.database().ref('/mamaro/system_info/" + ict_ff.Table.Rows[i]["id"].ToString() + @"/').limitToLast(10); ref.once('value').then(function (snapshot) { var cdata = []; for (var i in snapshot.val()) { cdata.push({ label: snapshot.val()[i].time, value: snapshot.val()[i].total_cpu }); } callbackIN(cdata) }); ref.on('value', function (snapshot) { var cdata = []; for (var i in snapshot.val()) { cdata.push({ label: snapshot.val()[i].time, value: snapshot.val()[i].total_cpu }); } callbackIN(cdata) }); } window.addEventListener(" + '"' + @"load" + '"' + @", getData" + ict_ff.Table.Rows[i]["id"].ToString() + @"(genFunction" + ict_ff.Table.Rows[i]["id"].ToString() + @")); function genFunction" + ict_ff.Table.Rows[i]["id"].ToString() + @"(data) { var cdata = []; var len = data.length; for (var i = 1; i < len; i++) { cdata.push({ label: data[i]['label'], value: data[i]['value'] }); } if(len==0){ $(function(){ $show = $('#chart-container" + ict_ff.Table.Rows[i]["id"].ToString() + @"'); $show.hide(); $show1 = $('#hrdiv" + ict_ff.Table.Rows[i]["id"].ToString() + @"'); $show1.hide(); }); }else{ var firebaseChart = new FusionCharts({ type: 'area2d', renderAt: 'chart-container" + ict_ff.Table.Rows[i]["id"].ToString() + @"', width: '100%', height: '400', dataFormat: 'json', dataSource: { " + '"' + @"chart" + '"' + @": { " + '"' + @"caption" + '"' + @": " + '"' + ict_ff.Table.Rows[i]["name"].ToString() + @" cpu %" + '"' + @", " + '"' + @"subCaption" + '"' + @": " + '"' + ict_ff.Table.Rows[i]["id"].ToString() + '"' + @", " + '"' + @"subCaptionFontBold" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"captionFontSize" + '"' + @": " + '"' + @"20" + '"' + @", " + '"' + @"subCaptionFontSize" + '"' + @": " + '"' + @"17" + '"' + @", " + '"' + @"captionPadding" + '"' + @": " + '"' + @"15" + '"' + @", " + '"' + @"captionFontColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"baseFontSize" + '"' + @": " + '"' + @"14" + '"' + @", " + '"' + @"baseFont" + '"' + @": " + '"' + @"Barlow" + '"' + @", " + '"' + @"canvasBgAlpha" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"bgColor" + '"' + @": " + '"' + @"#FFFFFF" + '"' + @", " + '"' + @"bgAlpha" + '"' + @": " + '"' + @"100" + '"' + @", " + '"' + @"showBorder" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"showCanvasBorder" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"showPlotBorder" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"showAlternateHGridColor" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"usePlotGradientColor" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"paletteColors" + '"' + @": " + '"' + @"#6AC1A5" + '"' + @", " + '"' + @"showValues" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"divLineAlpha" + '"' + @": " + '"' + @"5" + '"' + @", " + '"' + @"showAxisLines" + '"' + @": " + '"' + @"1" + '"' + @", " + '"' + @"drawAnchors" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"xAxisLineColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"xAxisLineThickness" + '"' + @": " + '"' + @"0.7" + '"' + @", " + '"' + @"xAxisLineAlpha" + '"' + @": " + '"' + @"50" + '"' + @", " + '"' + @"yAxisLineColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"yAxisLineThickness" + '"' + @": " + '"' + @"0.7" + '"' + @", " + '"' + @"yAxisLineAlpha" + '"' + @": " + '"' + @"50" + '"' + @", " + '"' + @"baseFontColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"toolTipBgColor" + '"' + @": " + '"' + @"#FA8D67" + '"' + @", " + '"' + @"toolTipPadding" + '"' + @": " + '"' + @"10" + '"' + @", " + '"' + @"toolTipColor" + '"' + @": " + '"' + @"#FFFFFF" + '"' + @", " + '"' + @"toolTipBorderRadius" + '"' + @": " + '"' + @"3" + '"' + @", " + '"' + @"toolTipBorderAlpha" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"drawCrossLine" + '"' + @": " + '"' + @"1" + '"' + @", " + '"' + @"crossLineColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"crossLineAlpha" + '"' + @": " + '"' + @"60" + '"' + @", " + '"' + @"crossLineThickness" + '"' + @": " + '"' + @"0.7" + '"' + @", " + '"' + @"alignCaptionWithCanvas" + '"' + @": " + '"' + @"1" + '"' + @" }, " + '"' + @"data" + '"' + @": cdata } }); firebaseChart.render(); } }"; lip.Text += @" function getData_" + ict_ff.Table.Rows[i]["id"].ToString() + @"(callbackIN) { var ref = firebase.database().ref('/mamaro/system_info/" + ict_ff.Table.Rows[i]["id"].ToString() + @"/').limitToLast(10); ref.once('value').then(function (snapshot) { var cdata = []; for (var i in snapshot.val()) { cdata.push({ label: snapshot.val()[i].time, value: snapshot.val()[i].total_mem }); } callbackIN(cdata) }); ref.on('value', function (snapshot) { var cdata = []; for (var i in snapshot.val()) { cdata.push({ label: snapshot.val()[i].time, value: snapshot.val()[i].total_mem }); } callbackIN(cdata) }); } window.addEventListener(" + '"' + @"load" + '"' + @", getData_" + ict_ff.Table.Rows[i]["id"].ToString() + @"(genFunction_" + ict_ff.Table.Rows[i]["id"].ToString() + @")); function genFunction_" + ict_ff.Table.Rows[i]["id"].ToString() + @"(data) { var cdata = []; var len = data.length; for (var i = 1; i < len; i++) { cdata.push({ label: data[i]['label'], value: data[i]['value'] }); } if(len==0){ $(function(){ $show = $('#chart-container_" + ict_ff.Table.Rows[i]["id"].ToString() + @"'); $show.hide(); }); }else{ var firebaseChart = new FusionCharts({ type: 'area2d', renderAt: 'chart-container_" + ict_ff.Table.Rows[i]["id"].ToString() + @"', width: '100%', height: '400', dataFormat: 'json', dataSource: { " + '"' + @"chart" + '"' + @": { " + '"' + @"caption" + '"' + @": " + '"' + ict_ff.Table.Rows[i]["name"].ToString() + @" memory MB" + '"' + @", " + '"' + @"subCaption" + '"' + @": " + '"' + ict_ff.Table.Rows[i]["id"].ToString() + '"' + @", " + '"' + @"subCaptionFontBold" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"captionFontSize" + '"' + @": " + '"' + @"20" + '"' + @", " + '"' + @"subCaptionFontSize" + '"' + @": " + '"' + @"17" + '"' + @", " + '"' + @"captionPadding" + '"' + @": " + '"' + @"15" + '"' + @", " + '"' + @"captionFontColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"baseFontSize" + '"' + @": " + '"' + @"14" + '"' + @", " + '"' + @"baseFont" + '"' + @": " + '"' + @"Barlow" + '"' + @", " + '"' + @"canvasBgAlpha" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"bgColor" + '"' + @": " + '"' + @"#FFFFFF" + '"' + @", " + '"' + @"bgAlpha" + '"' + @": " + '"' + @"100" + '"' + @", " + '"' + @"showBorder" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"showCanvasBorder" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"showPlotBorder" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"showAlternateHGridColor" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"usePlotGradientColor" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"paletteColors" + '"' + @": " + '"' + @"#6AC1A5" + '"' + @", " + '"' + @"showValues" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"divLineAlpha" + '"' + @": " + '"' + @"5" + '"' + @", " + '"' + @"showAxisLines" + '"' + @": " + '"' + @"1" + '"' + @", " + '"' + @"drawAnchors" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"xAxisLineColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"xAxisLineThickness" + '"' + @": " + '"' + @"0.7" + '"' + @", " + '"' + @"xAxisLineAlpha" + '"' + @": " + '"' + @"50" + '"' + @", " + '"' + @"yAxisLineColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"yAxisLineThickness" + '"' + @": " + '"' + @"0.7" + '"' + @", " + '"' + @"yAxisLineAlpha" + '"' + @": " + '"' + @"50" + '"' + @", " + '"' + @"baseFontColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"toolTipBgColor" + '"' + @": " + '"' + @"#FA8D67" + '"' + @", " + '"' + @"toolTipPadding" + '"' + @": " + '"' + @"10" + '"' + @", " + '"' + @"toolTipColor" + '"' + @": " + '"' + @"#FFFFFF" + '"' + @", " + '"' + @"toolTipBorderRadius" + '"' + @": " + '"' + @"3" + '"' + @", " + '"' + @"toolTipBorderAlpha" + '"' + @": " + '"' + @"0" + '"' + @", " + '"' + @"drawCrossLine" + '"' + @": " + '"' + @"1" + '"' + @", " + '"' + @"crossLineColor" + '"' + @": " + '"' + @"#8C8C8C" + '"' + @", " + '"' + @"crossLineAlpha" + '"' + @": " + '"' + @"60" + '"' + @", " + '"' + @"crossLineThickness" + '"' + @": " + '"' + @"0.7" + '"' + @", " + '"' + @"alignCaptionWithCanvas" + '"' + @": " + '"' + @"1" + '"' + @" }, " + '"' + @"data" + '"' + @": cdata } }); firebaseChart.render(); } }"; } } lip.Text += @"</script>"; mypan.Controls.Add(lip); }
public static string check_user(string param1, string param2, string param3, string param4) { string res = ""; GCP_MYSQL gc = new GCP_MYSQL(); string Query = ""; if (HttpContext.Current.Session["QR"] != null) { if (HttpContext.Current.Session["QR"].ToString().Trim() != "") { string QRcode = HttpContext.Current.Session["QR"].ToString(); Query = "select id"; Query += " from nursing_room where QRcode='" + QRcode + "';"; DataView ict_place = gc.select_cmd(Query); string userinfo = ""; string userinfo1 = ""; string userinfo2 = ""; string userinfo3 = ""; if (ict_place.Count > 0) { string id = ict_place.Table.Rows[0]["id"].ToString(); if (param1 == null) { userinfo = "NULL"; } else { if (param1.Trim() == "") { userinfo = "NULL"; } else { userinfo = "'" + param1.Trim() + "'"; } } if (param2 == null) { userinfo1 = "NULL"; } else { if (param2.Trim() == "") { userinfo1 = "NULL"; } else { userinfo1 = "'" + param2.Trim() + "'"; } } if (param3 == null) { userinfo2 = "NULL"; } else { if (param3.Trim() == "") { userinfo2 = "NULL"; } else { userinfo2 = "'" + param3.Trim() + "'"; } } if (param4 == null) { userinfo3 = "NULL"; } else { if (param4.Trim() == "") { userinfo3 = "NULL"; } else { userinfo3 = "'" + param4.Trim() + "'"; } } if (id.Trim() != "") { Query = "insert into nursing_room_QR_counter(nursing_room_id,user_os,user_os_ver,user_browser,user_browser_ver,insert_time)"; Query += " values('" + id.Trim() + "'," + userinfo + "," + userinfo1 + "," + userinfo2 + "," + userinfo3 + ",NOW());"; string rescom = gc.insert_cmd(Query); res = rescom; } } else { } } } return(res); }
protected void Page_Init(object sender, EventArgs e) { //test //Session["manager_page"] = "1"; if (Session["manager_page"] != null) { if (Session["manager_page"].ToString().Trim() != "") { room_id = Session["manager_page"].ToString().Trim(); //select info from mamaro DB GCP_MYSQL gc = new GCP_MYSQL(); Literal lip = new Literal(); //lip.Text += "<script src=" + '"' + @"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js" + '"' + @"></script>"; string Query = ""; if (room_id == "2") { Query = "select * from nursing_room;"; } else { Query = "select c.id,c.name,c.babymap_place_id,c.QRcode,c.close from nursing_room_manager as a "; Query += "inner join nursing_room_connect_manager as b on a.id=b.nursing_room_manager_id "; Query += "inner join nursing_room as c on b.nursing_room_id=c.id and a.id='" + room_id + "'; "; } DataView ict_ff = gc.select_cmd(Query); if (ict_ff.Count > 0) { for (int i = 0; i < ict_ff.Count; i++) { if (ict_ff.Table.Rows[i]["close"].ToString() == "0") { lip.Text += "<br><div class='center' id=" + '"' + "m_" + i + '"' + ">" + ict_ff.Table.Rows[i]["name"].ToString() + @"<br><br> <img id=" + '"' + "img_" + i + '"' + @" src='https://storage.googleapis.com//upload/nursing_room/mamaro_on.png' alt='" + ict_ff.Table.Rows[i]["name"].ToString() + @"' style='width:100px;height:100px;'>"; if (room_id == "2") { lip.Text += "<img id=" + '"' + "imgoff_" + i + '"' + @" src='https://storage.googleapis.com//upload/nursing_room/mamaro_off.png' alt='" + ict_ff.Table.Rows[i]["name"].ToString() + @"' style='width:100px;height:100px;'>"; } lip.Text += @"<div id=" + '"' + "write_" + i + '"' + @"> <hr>"; GCP_MYSQL gc1 = new GCP_MYSQL(); string Query1 = "select * from nursing_room_message_check where nursing_room_id='" + ict_ff.Table.Rows[i]["id"].ToString() + "';"; DataView ict_ff1 = gc1.select_cmd(Query1); if (ict_ff1.Count > 0) { for (int ii = 0; ii < ict_ff1.Count; ii++) { lip.Text += @"<p>" + ict_ff1.Table.Rows[ii]["update_time"].ToString() + @"</p> <p>" + ict_ff1.Table.Rows[ii]["message"].ToString() + @"</p> <p>"; if (ict_ff1.Table.Rows[ii]["pdf_url"].ToString() != "") { lip.Text += @" <a href='" + ict_ff1.Table.Rows[ii]["pdf_url"].ToString() + @"' target='_blank'><img src='./images/mamaro_manager/pdf-icon.png' title='PDF' width='100' height='100' /></a>"; } if (ict_ff1.Table.Rows[ii]["csv_url"].ToString() != "") { lip.Text += @" <a href='" + ict_ff1.Table.Rows[ii]["csv_url"].ToString() + @"' target='_blank'><img src='./images/mamaro_manager/Files-Csv-icon.png' title='CSV' width='100' height='100' /></a>"; } lip.Text += @"</p> <hr> "; } } lip.Text += @" <div id=" + '"' + "but_" + i + '"' + @">back</div> </div>"; if (room_id == "2") { lip.Text += "<div id=" + '"' + "edit_" + i + '"' + @"><hr> <p>Content:</p> <p> <textarea style='width: 100%;height:300px;' id =" + '"' + "mess_" + i + '"' + @" rows = '3' cols = '80'></textarea> </p> <hr> <p>PDF:</p> <p><input type='file' id='file" + i + @"' name='file' /></p> <img id=" + '"' + "butup_" + i + '"' + @" src='./images/mamaro_manager/upload-file.png' title='upload' width='100' height='100' /> <div id='img" + i + @"' style='width:100%;word-break: break-all;'></div> <hr> <script type='text/javascript'> $(function () { $('#butup_" + i + @"').click(function () { ajaxFileUpload" + i + @"(); }) }) function ajaxFileUpload" + i + @"() { $.ajaxFileUpload ( { url: '/upload.aspx', secureuri: false, fileElementId: 'file" + i + @"', dataType: 'JSON', success: function (data, status) { console.log(data); $('#img" + i + @"').empty(); $('#img" + i + @"').append(data); }, error: function (data, status, e) { alert(e); } } ) return false; } </script> <p>CSV:</p> <p><input type='file' id='file_" + i + @"' name='file' /></p> <img id=" + '"' + "butup__" + i + '"' + @" src='./images/mamaro_manager/upload-file.png' title='upload' width='100' height='100' /> <div id='imgg" + i + @"' style='width:100%;word-break: break-all;'></div> <hr> <div id=" + '"' + "butt_" + i + '"' + @">submit</div><hr> <div id=" + '"' + "buttb_" + i + '"' + @">back</div> <script type='text/javascript'> $(function () { $('#butup__" + i + @"').click(function () { ajaxFileUpload_" + i + @"(); }) }) function ajaxFileUpload_" + i + @"() { $.ajaxFileUpload ( { url: '/upload.aspx', secureuri: false, fileElementId: 'file_" + i + @"', dataType: 'JSON', success: function (data, status) { console.log(data); $('#imgg" + i + @"').empty(); $('#imgg" + i + @"').append(data); }, error: function (data, status, e) { alert(e); } } ) return false; } $(function(){ $show1 = $('#edit_" + i + @"'); $show1.hide(); $show2 = $('#imgoff_" + i + @"'); $show2.show(); $show3 = $('#butt_" + i + @"'); $show3.hide(); $show4 = $('#buttb_" + i + @"'); $show4.hide(); $('#imgoff_" + i + @"').click(function () { $show1 = $('#edit_" + i + @"'); $show1.show(); $show2 = $('#imgoff_" + i + @"'); $show2.hide(); $show3 = $('#butt_" + i + @"'); $show3.show(); $show4 = $('#buttb_" + i + @"'); $show4.show(); }); $('#butt_" + i + @"').click(function () { $show1 = $('#edit_" + i + @"'); $show1.hide(); $show2 = $('#imgoff_" + i + @"'); $show2.show(); $show3 = $('#butt_" + i + @"'); $show3.hide(); $show4 = $('#buttb_" + i + @"'); $show4.hide(); }); $('#buttb_" + i + @"').click(function () { $show1 = $('#edit_" + i + @"'); $show1.hide(); $show2 = $('#imgoff_" + i + @"'); $show2.show(); $show3 = $('#butt_" + i + @"'); $show3.hide(); $show4 = $('#buttb_" + i + @"'); $show4.hide(); }); $(" + '"' + @"#butt_" + i + '"' + @").click(function () { $.ajax({ type: " + '"' + @"POST" + '"' + @", url: " + '"' + @"mamaro_check_message.aspx/send_message" + '"' + @", data: " + '"' + @"{param1: '" + '"' + @" + $('#mess_" + i + @"').val() + " + '"' + @"' ,param2: '" + ict_ff.Table.Rows[i]["QRcode"].ToString() + @"' ,param3: '" + '"' + @" + $('#img" + i + @"').text() + " + '"' + @"' ,param4: '" + '"' + @" + $('#imgg" + i + @"').text() + " + '"' + @"' }" + '"' + @", contentType: " + '"' + @"application/json; charset=utf-8" + '"' + @", dataType: " + '"' + @"json" + '"' + @", async: true, cache: false, success: function (result) { alert(result.d); }, error: function (result) { console.log(result.d); } }); }); }); </script> "; lip.Text += "</div>"; } lip.Text += @"</div><br>"; lip.Text += @"<script type=" + '"' + "text/javascript" + '"' + @"> $(function(){ $show1 = $('#write_" + i + @"'); $show1.hide(); $show2 = $('#img_" + i + @"'); $show2.show(); $show3 = $('#but_" + i + @"'); $show3.hide(); $('#img_" + i + @"').click(function () { $show1 = $('#write_" + i + @"'); $show1.show(); $show2 = $('#img_" + i + @"'); $show2.hide(); $show3 = $('#but_" + i + @"'); $show3.show(); }); $('#but_" + i + @"').click(function () { $show1 = $('#write_" + i + @"'); $show1.hide(); $show2 = $('#img_" + i + @"'); $show2.show(); $show3 = $('#but_" + i + @"'); $show3.hide(); }); }); </script>"; } } } main_Panel.Controls.Add(lip); } else { Session.Clear(); Response.Redirect("mamaro_manager.aspx"); } } else { Session.Clear(); Response.Redirect("mamaro_manager.aspx"); } }
public static string send_message(string param1, string param2, string param3, string param4) { //string result = param1 + "," + param2; string result = ""; string QR = RemoveSpecialCharacters(param2); GCP_MYSQL gc = new GCP_MYSQL(); string Query = "select * from nursing_room where QRcode='" + QR + "';"; DataView ict_ff = gc.select_cmd(Query); if (ict_ff.Count > 0) { string Query1 = "insert into nursing_room_message_check(nursing_room_id,message,pdf_url,csv_url,update_time)"; Query1 += " values('" + ict_ff.Table.Rows[0]["id"].ToString() + "','" + param1 + "','" + param3 + "','" + param4 + "',NOW());"; GCP_MYSQL gc1 = new GCP_MYSQL(); result = gc1.insert_cmd(Query1); ////var url_five = new Uri("http://35.185.155.136/api/places/get_official_info?id=" + ict_ff.Table.Rows[0]["babymap_place_id"].ToString()); //using (WebClient wc = new WebClient()) //{ // wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); // try // { // wc.Encoding = Encoding.UTF8; // NameValueCollection nc = new NameValueCollection(); // nc["id"] = ict_ff.Table.Rows[0]["babymap_place_id"].ToString().Trim(); // nc["tel"] = param3; // nc["url"] = param4; // nc["usable_week_day"] = param5; // nc["remarks"] = param1; // byte[] bResult = wc.UploadValues("http:///api/places/edit_official_info", nc); // string resultXML = Encoding.UTF8.GetString(bResult); // if (resultXML != "" || resultXML != "null") // { // Newtonsoft.Json.Linq.JObject jArray_loc = Newtonsoft.Json.Linq.JObject.Parse(resultXML); // string res = jArray_loc["result"].ToString(); // result = res; // jArray_loc = null; // } // else // { // } // nc = null; // bResult = null; // GC.Collect(); // GC.WaitForPendingFinalizers(); // } // catch (WebException ex) // { // } //} } //try //{ // string username = param1.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim(); // string password = param2.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim(); // string usernames = RemoveSpecialCharacters(username); // string passwords = RemoveSpecialCharacters(password); // if (usernames != "" && passwords != "") // { // GCP_MYSQL gc = new GCP_MYSQL(); // string Query = "select id from nursing_room_manager where account='" + usernames + "';"; // DataView ict_ff = gc.select_cmd(Query); // if (ict_ff.Count > 0) // { // string Query1 = "select id from nursing_room_manager where account='" + usernames + "' and password='******';"; // DataView ict_ff1 = gc.select_cmd(Query1); // if (ict_ff1.Count > 0) // { // HttpContext.Current.Session["manager_page"] = ict_ff1.Table.Rows[0]["id"].ToString(); // //result = HttpContext.Current.Session["manager"].ToString(); // result = "ログインできました。"; // } // else // { // result = "パスワードが間違っています。"; // } // } // else // { // result = "アカウントが間違っています。"; // } // } //} //catch (Exception ex) //{ // result = "ログインできませんでした。"; // //return result; // throw ex; //} return(result); }
public static string check_mamaro(string param1, string param2, string param3, string param4, string param5, string param6, string param7) { GCP_MYSQL gc = new GCP_MYSQL(); string Query = ""; int QAcou = 0; int QAcou1 = 0; string result = ""; DateTime start = Convert.ToDateTime(param1.Trim()); DateTime end = Convert.ToDateTime(param2.Trim()); if (param7 == "") { param7 = "300"; } try { if (start != null && end != null) { state_group sg = new state_group(); QA_group qaa = new QA_group(); state_list = new List <state_group>(); lock_state_list = new List <state_group>(); QA_list = new List <QA_group>(); string room_id = param6; //mamaro QA Query = "select * from nursing_room_QA where nursing_room_id='" + room_id + "' and insert_time between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "';"; DataView ict = gc.select_cmd(Query); QAcou = ict.Count; if (ict.Count > 0) { for (int i = 0; i < ict.Count; i++) { qaa = new QA_group(); qaa.answer_datetime = Convert.ToDateTime(ict.Table.Rows[i]["insert_time"].ToString()); qaa.baby_m = ict.Table.Rows[i]["Q1_baby_month"].ToString(); qaa.baby_y = ict.Table.Rows[i]["Q1_baby_year"].ToString(); qaa.lan = ict.Table.Rows[i]["language"].ToString(); qaa.parent = ict.Table.Rows[i]["Q1_parent"].ToString(); qaa.Q2_choice = ict.Table.Rows[i]["Q2_choice"].ToString(); qaa.Q3_choice = ict.Table.Rows[i]["Q3_choice"].ToString(); qaa.Q4_choice = ict.Table.Rows[i]["Q4_choice"].ToString(); qaa.Q5_choice = ict.Table.Rows[i]["Q5_choice"].ToString(); QA_list.Add(qaa); } } QA_group_1 qaa_1 = new QA_group_1(); QA_list_1 = new List <QA_group_1>(); //mamaro new QA Query = "select * from nursing_room_QA1 where nursing_room_id='" + room_id + "' and insert_time between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "';"; ict = gc.select_cmd(Query); QAcou1 = ict.Count; if (ict.Count > 0) { for (int i = 0; i < ict.Count; i++) { qaa_1 = new QA_group_1(); qaa_1.answer_datetime = Convert.ToDateTime(ict.Table.Rows[i]["insert_time"].ToString()); qaa_1.baby_y_m = ict.Table.Rows[i]["Q1_baby_year_month"].ToString(); qaa_1.lan = ict.Table.Rows[i]["language"].ToString(); qaa_1.parent = ict.Table.Rows[i]["Q1_parent"].ToString(); qaa_1.Q2_choice = ict.Table.Rows[i]["Q2_choice"].ToString(); qaa_1.Q3_choice = ict.Table.Rows[i]["Q3_choice"].ToString(); qaa_1.Q4_choice = ict.Table.Rows[i]["Q4_choice"].ToString(); qaa_1.Q5_choice = ict.Table.Rows[i]["Q5_choice"].ToString(); qaa_1.Q6_choice = ict.Table.Rows[i]["Q6_choice"].ToString(); QA_list_1.Add(qaa_1); } } //state time Query = "select * from nursing_room_state_time where nursing_room_id='" + room_id + "' and update_time between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "' order by update_time asc;"; ict = gc.select_cmd(Query); if (ict.Count > 0) { for (int i = 0; i < ict.Count; i++) { sg = new state_group(); sg.state = Convert.ToInt32(ict.Table.Rows[i]["state"].ToString()); sg.update = Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()); state_list.Add(sg); } } List <state_group> check_list = new List <state_group>(); for (int i = 0; i < state_list.Count; i++) { if (state_list[i].state == 1) { sg = new state_group(); sg.state = state_list[i].state; sg.update = state_list[i].update; check_list.Add(sg); int index = i + 1; while (index < state_list.Count) { if (state_list[index].state == 0) { sg = new state_group(); sg.state = state_list[index].state; sg.update = state_list[index].update; check_list.Add(sg); break; } index += 1; } } } //lock state time Query = "select * from nursing_room_lock_state_time where nursing_room_id='" + room_id + "' and update_time between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "' order by update_time asc;;"; ict = gc.select_cmd(Query); if (ict.Count > 0) { if (room_id == "9") { for (int i = 0; i < ict.Count; i++) { sg = new state_group(); if (Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()).Year <= 2017 && Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()).Month <= 11 && Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()).Day <= 26) { if (Convert.ToInt32(ict.Table.Rows[i]["lock_state"].ToString()) == 0) { sg.state = 1; } else { sg.state = 0; } } else { sg.state = Convert.ToInt32(ict.Table.Rows[i]["lock_state"].ToString()); } sg.update = Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()); lock_state_list.Add(sg); } } else { for (int i = 0; i < ict.Count; i++) { sg = new state_group(); sg.state = Convert.ToInt32(ict.Table.Rows[i]["lock_state"].ToString()); sg.update = Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()); lock_state_list.Add(sg); } } } List <state_group> check_list1 = new List <state_group>(); for (int i = 0; i < lock_state_list.Count; i++) { if (lock_state_list[i].state == 0) { sg = new state_group(); sg.state = lock_state_list[i].state; sg.update = lock_state_list[i].update; check_list1.Add(sg); int index = i + 1; while (index < lock_state_list.Count) { if (lock_state_list[index].state == 1) { sg = new state_group(); sg.state = lock_state_list[index].state; sg.update = lock_state_list[index].update; check_list1.Add(sg); break; } index += 1; } } } //Chart1.Series.Clear(); //每次使用此function前先清除圖表 //Series series1 = new Series("use time(second)", 1200); //初始畫線條(名稱,最大值) //series1.Color = Color.Blue; //設定線條顏色 //series1.Font = new System.Drawing.Font("新細明體", 10); //設定字型 //series1.ChartType = SeriesChartType.Line; //設定線條種類 //Chart1.ChartAreas[0].AxisY.Minimum = 0;//設定Y軸最小值 //Chart1.ChartAreas[0].AxisY.Maximum = 1200;//設定Y軸最大值 ////chart1.ChartAreas[0].AxisY.Enabled= AxisEnabled.False; //隱藏Y 軸標示 ////chart1.ChartAreas[0].AxisY.MajorGrid.Enabled= true; //隱藏Y軸標線 //series1.IsValueShownAsLabel = true; //是否把數值顯示在線上 string monstr = "var MONTHS = ["; monstr += "];"; string monstt = ""; string arrva = ""; double avg = 0, coun = 0, hcou = 0, havg = 0; double compute_day = -1; DateTime first_d, second_d; for (int i = 0; i < check_list.Count; i++) { compute_day = -1; if (check_list[i].state == 1) { first_d = Convert.ToDateTime(check_list[i].update); int index = i + 1; while (index < check_list.Count) { if (check_list[index].state == 0) { second_d = Convert.ToDateTime(check_list[index].update); compute_day = (second_d - first_d).TotalSeconds; break; } index += 1; } if (compute_day > -1) { //monstt+=check_list[i].update.ToString("yyyyMMddHHmmss")+","; //arrva +=compute_day+ ","; if (compute_day < 1801) { coun += 1; avg += compute_day; monstt += check_list[i].update.ToString("yyyyMMddHHmmss") + ","; arrva += compute_day + ","; } if (compute_day >= Convert.ToInt32(param7) && compute_day < 1801) { hcou += 1; havg += compute_day; } //series1.Points.AddXY(i.ToString(), compute_day); //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: " + check_list[index].update.ToString("yyyy-MM-dd HH:mm:ss")); //listBox3.Items.Add("Total sec: " + compute_day); } else { //DateTime todate = DateTime.Now; //double compute_day1 = (todate - first_d).TotalSeconds; //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: NO"); //listBox3.Items.Add("Total sec: NO"); } } } if (monstt != "") { monstt = monstt.Substring(0, monstt.Length - 1); } if (arrva != "") { arrva = arrva.Substring(0, arrva.Length - 1); } //Chart1.Series.Add(series1);//將線畫在圖上 //for (int i = 0; i < check_list.Count; i++) //{ // listBox1.Items.Add(check_list[i].state); // listBox2.Items.Add(check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss")); //} string res = @"<fieldset> <legend>State Time</legend><br/> <script type='text/javascript'> var config = { type: 'line', data: { labels: [" + monstt + @"], datasets: [{ label: 'Use time dataset', fill: false, backgroundColor: 'rgb(" + param3 + @", " + param4 + @", " + param5 + @")', borderColor: 'rgb(" + param3 + @", " + param4 + @", " + param5 + @")', data: [" + arrva + @" ], }] }, options: { responsive: true, title: { display: true, text: 'Use Time Line Chart' }, tooltips: { mode: 'index', intersect: false, }, hover: { mode: 'nearest', intersect: true }, scales: { xAxes: [{ display: true, scaleLabel: { display: true, labelString: 'DateTime' } }], yAxes: [{ display: true, scaleLabel: { display: true, labelString: 'Time(second)' } }] } } }; var ctx = document.getElementById('canvas').getContext('2d'); window.myLine = new Chart(ctx, config); </script> <canvas id='canvas'></canvas> <br/> <h2>Total users:</h2> <br/> <h2>" + coun.ToString() + @"</h2> <br/> <h2>AVG use time (second):</h2> <br/> <h2>" + (avg /= coun).ToString() + @"</h2> <br/> <h2>Long users(after " + param7 + @" second):</h2> <br/> <h2>" + hcou.ToString() + @"</h2> <br/> <h2>Long users AVG use time(after " + param7 + @" second)(second):</h2> <br/> <h2>" + (havg /= hcou).ToString() + @"</h2> </fieldset> "; monstr = "var MONTHS = ["; monstr += "];"; monstt = ""; arrva = ""; avg = 0; coun = 0; hcou = 0; havg = 0; compute_day = -1; for (int i = 0; i < check_list1.Count; i++) { compute_day = -1; if (check_list1[i].state == 0) { first_d = Convert.ToDateTime(check_list1[i].update); int index = i + 1; while (index < check_list1.Count) { if (check_list1[index].state == 1) { second_d = Convert.ToDateTime(check_list1[index].update); compute_day = (second_d - first_d).TotalSeconds; break; } index += 1; } if (compute_day > -1) { //monstt += check_list1[i].update.ToString("yyyyMMddHHmmss") + ","; //arrva += compute_day + ","; if (compute_day < 1801) { coun += 1; avg += compute_day; monstt += check_list1[i].update.ToString("yyyyMMddHHmmss") + ","; arrva += compute_day + ","; } if (compute_day >= Convert.ToInt32(param7) && compute_day < 1801) { hcou += 1; havg += compute_day; } //series1.Points.AddXY(i.ToString(), compute_day); //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: " + check_list[index].update.ToString("yyyy-MM-dd HH:mm:ss")); //listBox3.Items.Add("Total sec: " + compute_day); } else { //DateTime todate = DateTime.Now; //double compute_day1 = (todate - first_d).TotalSeconds; //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: NO"); //listBox3.Items.Add("Total sec: NO"); } } } if (monstt != "") { monstt = monstt.Substring(0, monstt.Length - 1); } if (arrva != "") { arrva = arrva.Substring(0, arrva.Length - 1); } res += @"<fieldset> <legend>Lock State Time</legend><br/> <script type='text/javascript'> var config1 = { type: 'line', data: { labels: [" + monstt + @"], datasets: [{ label: 'Lock Use time dataset', fill: false, backgroundColor: 'rgb(" + param3 + @", " + param4 + @", " + param5 + @")', borderColor: 'rgb(" + param3 + @", " + param4 + @", " + param5 + @")', data: [" + arrva + @" ], }] }, options: { responsive: true, title: { display: true, text: 'Lock Use Time Line Chart' }, tooltips: { mode: 'index', intersect: false, }, hover: { mode: 'nearest', intersect: true }, scales: { xAxes: [{ display: true, scaleLabel: { display: true, labelString: 'DateTime' } }], yAxes: [{ display: true, scaleLabel: { display: true, labelString: 'Time(second)' } }] } } }; var ctx1 = document.getElementById('canvas1').getContext('2d'); window.myLine = new Chart(ctx1, config1); </script> <canvas id='canvas1'></canvas> <br/> <h2>Total users:</h2> <br/> <h2>" + coun.ToString() + @"</h2> <br/> <h2>AVG use time (second):</h2> <br/> <h2>" + (avg /= coun).ToString() + @"</h2> <br/> <h2>Long users(after " + param7 + @" second):</h2> <br/> <h2>" + hcou.ToString() + @"</h2> <br/> <h2>Long users AVG use time(after " + param7 + @" second)(second):</h2> <br/> <h2>" + (havg /= hcou).ToString() + @"</h2> <br/> <br/> <h2>QA count:</h2> <br/> <h2>" + QAcou.ToString() + @"</h2> <br/> <h2>new QA count:</h2> <br/> <h2>" + QAcou1.ToString() + @"</h2> <br/> </fieldset> "; res += @"<fieldset><legend style='font-size: large; font-weight: bold'>QA detail</legend>"; res += @"<div id='dvData'> <table> <tr> <td>日時</td> <td>言語 (language)</td> <td>お子さまのご年齢は</td> <td>あなたは</td> <td>mamaroがどこにあったら便利? ( 複数選択可 )</td> <td>mamaroをどこで知った? ( 複数選択可 )</td> <td>mamaroに 「もっとこんな機能が欲しい。こんなのがあったら嬉しい。」というものはありますか?</td> <td>授乳室は個室派?わいわい派?</td> </tr>"; //QA detail for (int i = 0; i < QA_list.Count; i++) { res += @"<tr> <td>" + QA_list[i].answer_datetime.ToString("yyyy-MM-dd HH:mm:ss") + @"</td> <td>" + QA_list[i].lan + @"</td> <td>" + QA_list[i].baby_y + @"歳 " + QA_list[i].baby_m + @"ヶ月</td> <td>" + QA_list[i].parent + @"</td> <td>" + QA_list[i].Q2_choice.Replace(",", ".") + @"</td> <td>" + QA_list[i].Q3_choice.Replace(",", ".") + @"</td> <td>" + QA_list[i].Q4_choice.Replace(",", ".") + @"</td> <td>" + QA_list[i].Q5_choice.Replace(",", ".") + @"</td> </tr> "; } res += @"</table> </div>"; res += @"</fieldset><hr/>"; //new QA res += @"<fieldset><legend style='font-size: large; font-weight: bold'>new QA detail</legend>"; res += @"<div id='dvData_new'> <table> <tr> <td>日時</td> <td>言語 (language)</td> <td>お子さまのご年齢は</td> <td>お子さまとの関係</td> <td>mamaroのご利用は何回目ですが?</td> <td>mamaroをどのようにして知りましたか?</td> <td>mamaroの空室状況をBabymapというアプリで調べることができるのを知っていましたか?</td> <td>mamaroで" + '"' + @"気に入っているポイント" + '"' + @"を教えてください。(複数選択可)</td> <td>mamaroの満足度を教えてください。</td> </tr>"; //QA detail for (int i = 0; i < QA_list_1.Count; i++) { res += @"<tr> <td>" + QA_list_1[i].answer_datetime.ToString("yyyy-MM-dd HH:mm:ss") + @"</td> <td>" + QA_list_1[i].lan + @"</td> <td>" + QA_list_1[i].baby_y_m + @"</td> <td>" + QA_list_1[i].parent + @"</td> <td>" + QA_list_1[i].Q2_choice.Replace(",", ".") + @"</td> <td>" + QA_list_1[i].Q3_choice.Replace(",", ".") + @"</td> <td>" + QA_list_1[i].Q4_choice.Replace(",", ".") + @"</td> <td>" + QA_list_1[i].Q5_choice.Replace(",", ".") + @"</td> <td>" + QA_list_1[i].Q6_choice.Replace(",", ".") + @"</td> </tr> "; } res += @"</table> </div>"; res += @"</fieldset><hr/>"; // res += @"<script type='text/javascript'> // //</script>"; result = res; //result = "fail"; } } catch (Exception ex) { //result = "fail"; //return result; throw ex; } return(result); }
protected void Page_Init(object sender, EventArgs e) { gc = new GCP_MYSQL(); Panel mypan = (Panel)this.FindControl("main_Panel"); Literal lip = new Literal(); Query = "select * from nursing_room;"; DataView ict_ff = gc.select_cmd(Query); bool chee = true; lip.Text += "<script src=" + '"' + @"http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" + '"' + @"></script>"; lip.Text += "<script src=" + '"' + @"http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js" + '"' + @"></script>"; lip.Text += "<link rel='stylesheet' href='css/jquery.switchButton.css'>"; lip.Text += "<script src=" + '"' + @"js/jquery.switchButton.js" + '"' + @"></script>"; if (ict_ff.Count > 0) { for (int i = 0; i < ict_ff.Count; i++) { lip.Text += "<br><div class='center'>" + ict_ff.Table.Rows[i]["name"].ToString() + @"<br><br>"; //lip.Text += "<div id=" + '"' + "mamaroname" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + ">" + ict_ff.Table.Rows[i]["name"].ToString() + @"</div>"; lip.Text += @" <div class='slider demo' id='slider-" + i + @"'> <input type='checkbox' value='" + ict_ff.Table.Rows[i]["id"].ToString() + @"' checked> </div> "; string state = "false"; if (ict_ff.Table.Rows[i]["close"].ToString() == "0") { state = "true"; } lip.Text += @"<script type=" + '"' + "text/javascript" + '"' + @"> $(function() { $('#slider-" + i + @".demo input').switchButton({ checked:" + state + @", width: 100, height: 40, button_width: 50, on_callback(){ console.log('on'); $.ajax({ type: " + '"' + @"POST" + '"' + @", url: " + '"' + @"mamaro_switch.aspx/send_on" + '"' + @", data: " + '"' + @"{param1: '" + '"' + @" + $('#slider-" + i + @".demo input').val() + " + '"' + @"' }" + '"' + @", contentType: " + '"' + @"application/json; charset=utf-8" + '"' + @", dataType: " + '"' + @"json" + '"' + @", async: true, cache: false, success: function (result) { console.log(result.d); }, error: function (result) { console.log(result.d); } }); }, off_callback(){ console.log('off'); $.ajax({ type: " + '"' + @"POST" + '"' + @", url: " + '"' + @"mamaro_switch.aspx/send_off" + '"' + @", data: " + '"' + @"{param1: '" + '"' + @" + $('#slider-" + i + @".demo input').val() + " + '"' + @"' }" + '"' + @", contentType: " + '"' + @"application/json; charset=utf-8" + '"' + @", dataType: " + '"' + @"json" + '"' + @", async: true, cache: false, success: function (result) { console.log(result.d); }, error: function (result) { console.log(result.d); } }); }, }); }) </script> "; lip.Text += "</div>"; //if (ict_ff.Table.Rows[i]["close"].ToString() == "0") //{ // lip.Text += "<div id=" + '"' + "mamaroname" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + ">" + ict_ff.Table.Rows[i]["name"].ToString() + @"</div>"; // lip.Text += "<div id=" + '"' + "mamarotime" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + "></div>"; //} } } // lip.Text += @" //<div class='slider demo' id='slider-1'> // <input type='checkbox' value='abc' checked> // </div> //<div class='slider demo' id='slider-2'> // <input type='checkbox' value='efg' checked> // </div> //"; // lip.Text += @"<script type=" + '"' + "text/javascript" + '"' + @"> //$(function() { // // //$('#slider-1.demo input').switchButton({ //checked:true, // width: 100, // height: 40, // button_width: 50, //on_callback(){ //console.log('on'); //console.log($('#slider-1.demo input').val()); //}, //off_callback(){ //console.log('off'); //}, // }); // // //$('#slider-2.demo input').switchButton({ //checked:true, // width: 100, // height: 40, // button_width: 50, //on_callback(){ //console.log('on'); //console.log($('#slider-2.demo input').val()); //}, //off_callback(){ //console.log('off'); //}, // }); // // // // }) //</script> //"; //if (ict_ff.Count > 0) //{ // for (int i = 0; i < ict_ff.Count; i++) // { // lip.Text += "<div id=" + '"' + "mamaroname" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + ">" + ict_ff.Table.Rows[i]["name"].ToString() + @"</div>"; // lip.Text += "<div id=" + '"' + "mamarotime" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + "></div>"; // //if (ict_ff.Table.Rows[i]["close"].ToString() == "0") // //{ // // lip.Text += "<div id=" + '"' + "mamaroname" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + ">" + ict_ff.Table.Rows[i]["name"].ToString() + @"</div>"; // // lip.Text += "<div id=" + '"' + "mamarotime" + ict_ff.Table.Rows[i]["id"].ToString() + '"' + "></div>"; // //} // } //} main_Panel.Controls.Add(lip); }
public static string check_mamaro(string param1, string param2, string param3, string param4, string param5) { //test //int comid = 26; //List<int> comlist = new List<int>(); //comlist.Add(comid); //comlist.Add(Convert.ToInt32( param6)); string[] liness = param3.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); List <string> res_list = new List <string>(); GCP_MYSQL gc = new GCP_MYSQL(); string Query = ""; int QAcou = 0; int QAcou1 = 0; string result = ""; DateTime start = Convert.ToDateTime(param1.Trim()); DateTime end = Convert.ToDateTime(param2.Trim()); if (param4 == "") { param4 = "30"; } try { if (start != null && end != null) { string label = ""; string res = ""; string res1 = ""; for (int kk = 0; kk < liness.Length; kk++) { state_group sg = new state_group(); QA_group qaa = new QA_group(); state_list = new List <state_group>(); lock_state_list = new List <state_group>(); QA_list = new List <QA_group>(); string room_id = liness[kk]; //mamaro name string mamaname = ""; Query = "select * from nursing_room where id='" + room_id + "';"; DataView ict = gc.select_cmd(Query); if (ict.Count > 0) { mamaname = ict.Table.Rows[0]["name"].ToString(); } //mamaro QA Query = "select * from nursing_room_QA where nursing_room_id='" + room_id + "' and insert_time between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "';"; ict = gc.select_cmd(Query); QAcou = ict.Count; if (ict.Count > 0) { for (int i = 0; i < ict.Count; i++) { qaa = new QA_group(); qaa.answer_datetime = Convert.ToDateTime(ict.Table.Rows[i]["insert_time"].ToString()); qaa.baby_m = ict.Table.Rows[i]["Q1_baby_month"].ToString(); qaa.baby_y = ict.Table.Rows[i]["Q1_baby_year"].ToString(); qaa.lan = ict.Table.Rows[i]["language"].ToString(); qaa.parent = ict.Table.Rows[i]["Q1_parent"].ToString(); qaa.Q2_choice = ict.Table.Rows[i]["Q2_choice"].ToString(); qaa.Q3_choice = ict.Table.Rows[i]["Q3_choice"].ToString(); qaa.Q4_choice = ict.Table.Rows[i]["Q4_choice"].ToString(); qaa.Q5_choice = ict.Table.Rows[i]["Q5_choice"].ToString(); QA_list.Add(qaa); } } QA_group_1 qaa_1 = new QA_group_1(); QA_list_1 = new List <QA_group_1>(); //mamaro new QA Query = "select * from nursing_room_QA1 where nursing_room_id='" + room_id + "' and insert_time between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "';"; ict = gc.select_cmd(Query); QAcou1 = ict.Count; if (ict.Count > 0) { for (int i = 0; i < ict.Count; i++) { qaa_1 = new QA_group_1(); qaa_1.answer_datetime = Convert.ToDateTime(ict.Table.Rows[i]["insert_time"].ToString()); qaa_1.baby_y_m = ict.Table.Rows[i]["Q1_baby_year_month"].ToString(); qaa_1.lan = ict.Table.Rows[i]["language"].ToString(); qaa_1.parent = ict.Table.Rows[i]["Q1_parent"].ToString(); qaa_1.Q2_choice = ict.Table.Rows[i]["Q2_choice"].ToString(); qaa_1.Q3_choice = ict.Table.Rows[i]["Q3_choice"].ToString(); qaa_1.Q4_choice = ict.Table.Rows[i]["Q4_choice"].ToString(); qaa_1.Q5_choice = ict.Table.Rows[i]["Q5_choice"].ToString(); qaa_1.Q6_choice = ict.Table.Rows[i]["Q6_choice"].ToString(); QA_list_1.Add(qaa_1); } } //lock state time Query = "select * from nursing_room_lock_state_time where nursing_room_id='" + room_id + "' and update_time between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "' order by update_time asc;;"; ict = gc.select_cmd(Query); if (ict.Count > 0) { if (room_id == "9") { for (int i = 0; i < ict.Count; i++) { sg = new state_group(); if (Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()).Year <= 2017 && Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()).Month <= 11 && Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()).Day <= 26) { if (Convert.ToInt32(ict.Table.Rows[i]["lock_state"].ToString()) == 0) { sg.state = 1; } else { sg.state = 0; } } else { sg.state = Convert.ToInt32(ict.Table.Rows[i]["lock_state"].ToString()); } sg.update = Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()); lock_state_list.Add(sg); } } else { for (int i = 0; i < ict.Count; i++) { sg = new state_group(); sg.state = Convert.ToInt32(ict.Table.Rows[i]["lock_state"].ToString()); sg.update = Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()); lock_state_list.Add(sg); } } } List <state_group> check_list1 = new List <state_group>(); for (int i = 0; i < lock_state_list.Count; i++) { if (lock_state_list[i].state == 0) { sg = new state_group(); sg.state = lock_state_list[i].state; sg.update = lock_state_list[i].update; check_list1.Add(sg); int index = i + 1; while (index < lock_state_list.Count) { if (lock_state_list[index].state == 1) { sg = new state_group(); sg.state = lock_state_list[index].state; sg.update = lock_state_list[index].update; check_list1.Add(sg); break; } index += 1; } } } //Chart1.Series.Clear(); //每次使用此function前先清除圖表 //Series series1 = new Series("use time(second)", 1200); //初始畫線條(名稱,最大值) //series1.Color = Color.Blue; //設定線條顏色 //series1.Font = new System.Drawing.Font("新細明體", 10); //設定字型 //series1.ChartType = SeriesChartType.Line; //設定線條種類 //Chart1.ChartAreas[0].AxisY.Minimum = 0;//設定Y軸最小值 //Chart1.ChartAreas[0].AxisY.Maximum = 1200;//設定Y軸最大值 ////chart1.ChartAreas[0].AxisY.Enabled= AxisEnabled.False; //隱藏Y 軸標示 ////chart1.ChartAreas[0].AxisY.MajorGrid.Enabled= true; //隱藏Y軸標線 //series1.IsValueShownAsLabel = true; //是否把數值顯示在線上 string monstr = "var MONTHS = ["; monstr += "];"; string monstt = ""; string arrva = ""; double avg = 0, coun = 0, hcou = 0, havg = 0; double compute_day = -1; DateTime first_d, second_d; List <int> count_list = new List <int>(); usercou_list = new List <user_group>(); user_group ug = new user_group(); int basesec = Convert.ToInt32(param4); int coun_start = 0; int coun_end = basesec; int couuuu = 0; //Chart1.Series.Add(series1);//將線畫在圖上 //for (int i = 0; i < check_list.Count; i++) //{ // listBox1.Items.Add(check_list[i].state); // listBox2.Items.Add(check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss")); //} Random rnd = new Random(Guid.NewGuid().GetHashCode()); int r = rnd.Next(256); rnd = new Random(Guid.NewGuid().GetHashCode()); int g = rnd.Next(256); rnd = new Random(Guid.NewGuid().GetHashCode()); int b = rnd.Next(256); monstr = "var MONTHS = ["; monstr += "];"; monstt = ""; arrva = ""; avg = 0; coun = 0; hcou = 0; havg = 0; compute_day = -1; count_list = new List <int>(); for (int i = 0; i < check_list1.Count; i++) { compute_day = -1; if (check_list1[i].state == 0) { first_d = Convert.ToDateTime(check_list1[i].update); int index = i + 1; while (index < check_list1.Count) { if (check_list1[index].state == 1) { second_d = Convert.ToDateTime(check_list1[index].update); compute_day = (second_d - first_d).TotalSeconds; break; } index += 1; } if (compute_day > -1) { //monstt += check_list1[i].update.ToString("yyyyMMddHHmmss") + ","; //arrva += compute_day + ","; if (compute_day < 1801) { coun += 1; avg += compute_day; //monstt += check_list1[i].update.ToString("yyyyMMddHHmmss") + ","; //arrva += compute_day + ","; count_list.Add(Convert.ToInt32(compute_day)); } if (compute_day >= Convert.ToInt32(param4) && compute_day < 1801) { hcou += 1; havg += compute_day; } //series1.Points.AddXY(i.ToString(), compute_day); //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: " + check_list[index].update.ToString("yyyy-MM-dd HH:mm:ss")); //listBox3.Items.Add("Total sec: " + compute_day); } else { //DateTime todate = DateTime.Now; //double compute_day1 = (todate - first_d).TotalSeconds; //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: NO"); //listBox3.Items.Add("Total sec: NO"); } } } usercou_list = new List <user_group>(); ug = new user_group(); basesec = Convert.ToInt32(param4); coun_start = 0; coun_end = basesec; couuuu = 0; for (int i = 0; i < Convert.ToInt32(param5); i += basesec) { couuuu = 0; ug = new user_group(); ug.sec = i; for (int ii = 0; ii < count_list.Count; ii++) { if (count_list[ii] > i) { couuuu += 1; } //if (count_list[ii] > i && count_list[ii] < (i + basesec)) //{ // couuuu += 1; //} } ug.total = couuuu; usercou_list.Add(ug); } for (int i = 0; i < usercou_list.Count; i++) { //monstt += usercou_list[i].sec.ToString() + ","; if (usercou_list[i].sec % 60 == 0) { monstt += (usercou_list[i].sec / 60).ToString() + ","; } else { monstt += " ,"; } arrva += usercou_list[i].total.ToString() + ","; } if (monstt != "") { monstt = monstt.Substring(0, monstt.Length - 1); } if (arrva != "") { arrva = arrva.Substring(0, arrva.Length - 1); } rnd = new Random(Guid.NewGuid().GetHashCode()); r = rnd.Next(256); rnd = new Random(Guid.NewGuid().GetHashCode()); g = rnd.Next(256); rnd = new Random(Guid.NewGuid().GetHashCode()); b = rnd.Next(256); res1 += @"{ label: '" + mamaname + @"', fill: false, backgroundColor: 'rgb(" + r + @", " + g + @", " + b + @")', borderColor: 'rgb(" + r + @", " + g + @", " + b + @")', data: [" + arrva + @" ], },"; res = @"{ label: '" + mamaname + @"', fill: false, backgroundColor: 'rgb(" + r + @", " + g + @", " + b + @")', borderColor: 'rgb(" + r + @", " + g + @", " + b + @")', data: [" + arrva + @" ], },"; label = monstt; string ress = @"<fieldset> <legend>" + mamaname + @"</legend><br/> <script type='text/javascript'> var config" + kk + @" = { type: 'line', data: { labels: [" + label + @"], datasets: [" + res + @"] }, options: { responsive: true, title: { display: true, text: '" + mamaname + @"' }, tooltips: { mode: 'index', intersect: false, }, hover: { mode: 'nearest', intersect: true }, scales: { xAxes: [{ display: true, scaleLabel: { display: true, labelString: '滞在時間(分)' } }], yAxes: [{ display: true, scaleLabel: { display: true, labelString: '利用人数(人)' } }] }, animation: { onComplete: function () { var ctx = this.chart.ctx; ctx.font = Chart.helpers.fontString(Chart.defaults.global.defaultFontFamily, 'normal', Chart.defaults.global.defaultFontFamily); ctx.fillStyle = 'black'; ctx.textAlign = 'center'; ctx.textBaseline = 'bottom'; this.data.datasets.forEach(function (dataset) { for (var i = 0; i < dataset.data.length; i++) { for(var key in dataset._meta) { var model = dataset._meta[key].data[i]._model; ctx.fillText(dataset.data[i], model.x, model.y - 5); } } }); done" + kk + @"(); } } } }; var ctx" + kk + @" = document.getElementById('canvas" + kk + @"').getContext('2d'); window.myLine = new Chart(ctx" + kk + @", config" + kk + @"); function done" + kk + @"(){ var url_base64 = document.getElementById('canvas" + kk + @"').toDataURL('image/png'); link" + kk + @".href = url_base64; } </script> <canvas id='canvas" + kk + @"'></canvas> <br/> <a id='link" + kk + @"' download='" + mamaname + @".png'>Save as Image</a> <br/> </fieldset> "; res_list.Add(ress); // res += @"<script type='text/javascript'> // //</script>"; //result = res; //result = "fail"; } result = @"<fieldset> <legend>ALL mamaro</legend><br/> <script type='text/javascript'> var config = { type: 'line', data: { labels: [" + label + @"], datasets: [" + res1 + @"] }, options: { responsive: true, title: { display: true, text: 'ALL mamaro' }, tooltips: { mode: 'index', intersect: false, }, hover: { mode: 'nearest', intersect: true }, scales: { xAxes: [{ display: true, scaleLabel: { display: true, labelString: '滞在時間(分)' } }], yAxes: [{ display: true, scaleLabel: { display: true, labelString: '利用人数(人)' } }] }, animation: { onComplete: done } } }; var ctx = document.getElementById('canvas').getContext('2d'); window.myLine = new Chart(ctx, config); function done(){ var url_base64 = document.getElementById('canvas').toDataURL('image/png'); link.href = url_base64; } </script> <canvas id='canvas'></canvas> <br/> <a id='link' download='allmamaro.png'>Save as Image</a> <br/><br/> </fieldset> "; for (int hh = 0; hh < res_list.Count; hh++) { result += res_list[hh]; } } } catch (Exception ex) { //result = "fail"; //return result; throw ex; } return(result); }
protected void Page_Init(object sender, EventArgs e) { if (this.Request.QueryString["mamarocall"] != null) { string activationCode = !string.IsNullOrEmpty(Request.QueryString["mamarocall"]) ? Request.QueryString["mamarocall"] : Guid.Empty.ToString(); if (activationCode != "") { Session["tmp_call_id"] = activationCode; Response.Redirect("mamaro_call.aspx"); } } if (Session["tmp_call_id"] != null) { if (Session["tmp_call_id"].ToString() != "") { //// string QR = RemoveSpecialCharacters(Session["tmp_call_id"].ToString()); GCP_MYSQL gc = new GCP_MYSQL(); Literal lip = new Literal(); Literal lip_call = new Literal(); string Query = ""; Query = "select a.id,a.name,a.close,b.id as pid from nursing_room as a inner join nursing_room_phone as b "; Query += "on a.id=b.nursing_room_id and b.code='" + QR + "';"; DataView ict_ff = gc.select_cmd(Query); if (ict_ff.Count > 0) { if (ict_ff.Table.Rows[0]["close"].ToString() == "0") { GCP_MYSQL gc1 = new GCP_MYSQL(); string Query1 = ""; Query1 = "update nursing_room_phone set get_state='1',get_datetime=NOW() where id='" + ict_ff.Table.Rows[0]["pid"].ToString() + "';"; string rescmd = gc1.update_cmd(Query1); DateTime nowdate = DateTime.Now; DateTime utc = nowdate.ToUniversalTime(); TimeZoneInfo jst = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time"); DateTime now_jst = TimeZoneInfo.ConvertTimeFromUtc(utc, jst); lip.Text += "<br><div class='center' id=" + '"' + "m_" + '"' + ">" + ict_ff.Table.Rows[0]["name"].ToString() + @"<br><br> <img id=" + '"' + "img_" + '"' + @" src='https://storage.googleapis.com//upload/nursing_room/mamaro_off.png' alt='" + ict_ff.Table.Rows[0]["name"].ToString() + @"' style='width:100px;height:100px;'><br> <img id='cutoff' src='./images/call_img/hotline.gif' alt='" + ict_ff.Table.Rows[0]["name"].ToString() + @"' style='width:300px;height:200px;'>"; lip.Text += @"<iframe id='content_if' allow='camera; microphone' src='https://appear.in/" + QR + @"' width='1' height='1' frameborder='0'></iframe>"; lip.Text += "<script src=" + '"' + @"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js" + '"' + @"></script>"; lip.Text += "<script src=" + '"' + @"https://www.gstatic.com/firebasejs/4.6.2/firebase-app.js" + '"' + @"></script>"; lip.Text += "<script src=" + '"' + @"https://www.gstatic.com/firebasejs/4.6.2/firebase-database.js" + '"' + @"></script>"; lip.Text += @"<script type=" + '"' + "text/javascript" + '"' + @"> var firebase; var config = { databaseURL: " + '"' + @"url" + '"' + @" }; firebase.initializeApp(config); function writecallData() { var myRef = firebase.database().ref('/mamarocall/get/" + ict_ff.Table.Rows[0]["id"].ToString() + @"').push(); var now = new Date(); var newData={ mamaro_id: '" + ict_ff.Table.Rows[0]["id"].ToString() + @"', QRcode: '" + QR + @"', state: '1', time : '" + now_jst.ToString("yyyy-MM-dd HH:mm:ss") + @"' } myRef.push(newData); } writecallData(); function writecallData1() { var myRef = firebase.database().ref('/mamarocall/get/" + ict_ff.Table.Rows[0]["id"].ToString() + @"').push(); var now = new Date(); var newData={ mamaro_id: '" + ict_ff.Table.Rows[0]["id"].ToString() + @"', QRcode: '" + QR + @"', state: '3', time : '" + now_jst.ToString("yyyy-MM-dd HH:mm:ss") + @"' } myRef.push(newData); } var ref = firebase.database().ref('/mamarocall/send/" + ict_ff.Table.Rows[0]["id"].ToString() + @"/').limitToLast(10); ref.on('value', function (snapshot) { var cdata = []; for (var i in snapshot.val()) { cdata.push({ label: snapshot.val()[i].time, value: snapshot.val()[i].state }); } var len = cdata.length; var checkmama=1; $(function(){ $show1 = $('#img_'); $show1.attr('src','https://storage.googleapis.com//upload/nursing_room/mamaro_off.png'); }); for (var i = 0; i < len; i++) { var chec=1; if(cdata[i].value=='0') { if(i+1<len) { if(cdata[i+1].value=='2') { chec=0; }else{ chec=0; } } if(chec>0) { $(function(){ $show1 = $('#img_'); $show1.attr('src','https://storage.googleapis.com//upload/nursing_room/mamaro_on.png'); }); } } } }); $(function(){ $('#cutoff').click(function () { loadIframe('content_if', 'http://www.trim-inc.com/'); writecallData1(); $.ajax({ type: " + '"' + @"POST" + '"' + @", url: " + '"' + @"mamaro_call.aspx/send_message" + '"' + @", data: " + '"' + @"{param1: '" + ict_ff.Table.Rows[0]["pid"].ToString() + @"' }" + '"' + @", contentType: " + '"' + @"application/json; charset=utf-8" + '"' + @", dataType: " + '"' + @"json" + '"' + @", async: true, cache: false, success: function (result) { if (result.d.length > 0){ alert(result.d); } else{ alert('error'); } }, error: function (result) { console.log(result.d); } }); }); function loadIframe(iframeName, url) { var $iframe = $('#' + iframeName); if ($iframe.length) { $iframe.attr('src', url); return false; } return true; } }); </script> "; lip.Text += @"</div>"; } } mainPanel.Controls.Add(lip); //// } } }
protected void Page_Init(object sender, EventArgs e) { gc = new GCP_MYSQL(); Panel mypan = (Panel)this.FindControl("main_Panel"); Literal lip = new Literal(); Query = "select * from nursing_room;"; DataView ict_ff = gc.select_cmd(Query); bool chee = true; lip.Text += "<script src=" + '"' + @"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js" + '"' + @"></script>"; lip.Text += @"<script type=" + '"' + "text/javascript" + '"' + @"> var numm=0; "; lip.Text += @" var pinImage_off = 'https://storage.googleapis.com//upload/nursing_room/.png'; var pinImage_on = 'https://storage.googleapis.com//upload/nursing_room/.png'; var locations = ["; int num = 1; if (ict_ff.Count > 0) { for (int i = 0; i < ict_ff.Count; i++) { if (ict_ff.Table.Rows[i]["close"].ToString() == "0") { lip.Text += "['" + ict_ff.Table.Rows[i]["name"].ToString() + @"', " + ict_ff.Table.Rows[i]["GPS_lat"].ToString() + @", " + ict_ff.Table.Rows[i]["GPS_lng"].ToString() + @"," + ict_ff.Table.Rows[i]["id"].ToString() + @", " + num + @"],"; num += 1; } } } lip.Text += @"]; var markers = []; var map; function initMap() { map = new google.maps.Map(document.getElementById('map'), { zoom: 6, center: new google.maps.LatLng(36.452569, 138.749121), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i < locations.length; i++) { marker = new google.maps.Marker({ id: locations[i][3], position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map, icon: pinImage_on, scaledSize: new google.maps.Size(30, 30) }); markers.push(marker); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); } } function showMarkers() { changeicon(map); } function changeicon(map) { for (var i = 0; i < markers.length; i++) { for (var ii = 0; ii < arrcheck.length; ii++) { if(arrcheck[ii][0]==markers[i].id) { if(arrcheck[ii][1]==0){ markers[i].icon=pinImage_on; } else{ markers[i].icon=pinImage_off; } } } markers[i].setMap(map); } } </script> <script async defer src=" + '"' + "https://maps.googleapis.com/maps/api/js?key=&libraries=drawing&language=ja&callback=initMap" + '"' + @"> </script> "; main_Panel.Controls.Add(lip); }
public static string check_mamaro(string param1, string param2, string param7) { GCP_MYSQL gc = new GCP_MYSQL(); string Query = ""; int QAcou = 0; int QAcou1 = 0; string result = ""; DateTime start = Convert.ToDateTime(param1.Trim()); DateTime end = Convert.ToDateTime(param2.Trim()); state_detail_list = new List <state_detail>(); string res = @"<br/><h2>年月日:</h2>"; res += @"<br/><h2>" + start.Year + "年" + start.Month + "月" + start.Day + "日 ~ " + end.Year + "年" + end.Month + "月" + end.Day + "日" + @"</h2><br /><br />"; if (param7 == "") { param7 = "300"; } try { if (start != null && end != null) { Query = "select id,name"; Query += " from nursing_room;"; DataView ict_place = gc.select_cmd(Query); if (ict_place.Count > 0) { for (int ih = 0; ih < ict_place.Count; ih++) { state_group sg = new state_group(); state_detail sgg = new state_detail(); state_list = new List <state_group>(); lock_state_list = new List <state_group>(); string room_id = ict_place.Table.Rows[ih]["id"].ToString(); //mamaro QA //state time Query = "select * from nursing_room_state_time where nursing_room_id='" + room_id + "' and update_time between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "' order by update_time asc;"; DataView ict = gc.select_cmd(Query); if (ict.Count > 0) { for (int i = 0; i < ict.Count; i++) { sg = new state_group(); sg.state = Convert.ToInt32(ict.Table.Rows[i]["state"].ToString()); sg.update = Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()); state_list.Add(sg); } } List <state_group> check_list = new List <state_group>(); for (int i = 0; i < state_list.Count; i++) { if (state_list[i].state == 1) { sg = new state_group(); sg.state = state_list[i].state; sg.update = state_list[i].update; check_list.Add(sg); int index = i + 1; while (index < state_list.Count) { if (state_list[index].state == 0) { sg = new state_group(); sg.state = state_list[index].state; sg.update = state_list[index].update; check_list.Add(sg); break; } index += 1; } } } //lock state time Query = "select * from nursing_room_lock_state_time where nursing_room_id='" + room_id + "' and update_time between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "' order by update_time asc;;"; ict = gc.select_cmd(Query); if (ict.Count > 0) { if (room_id == "9") { for (int i = 0; i < ict.Count; i++) { sg = new state_group(); if (Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()).Year <= 2017 && Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()).Month <= 11 && Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()).Day <= 26) { if (Convert.ToInt32(ict.Table.Rows[i]["lock_state"].ToString()) == 0) { sg.state = 1; } else { sg.state = 0; } } else { sg.state = Convert.ToInt32(ict.Table.Rows[i]["lock_state"].ToString()); } sg.update = Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()); lock_state_list.Add(sg); } } else { for (int i = 0; i < ict.Count; i++) { sg = new state_group(); sg.state = Convert.ToInt32(ict.Table.Rows[i]["lock_state"].ToString()); sg.update = Convert.ToDateTime(ict.Table.Rows[i]["update_time"].ToString()); lock_state_list.Add(sg); } } } List <state_group> check_list1 = new List <state_group>(); for (int i = 0; i < lock_state_list.Count; i++) { if (lock_state_list[i].state == 0) { sg = new state_group(); sg.state = lock_state_list[i].state; sg.update = lock_state_list[i].update; check_list1.Add(sg); int index = i + 1; while (index < lock_state_list.Count) { if (lock_state_list[index].state == 1) { sg = new state_group(); sg.state = lock_state_list[index].state; sg.update = lock_state_list[index].update; check_list1.Add(sg); break; } index += 1; } } } //Chart1.Series.Clear(); //每次使用此function前先清除圖表 //Series series1 = new Series("use time(second)", 1200); //初始畫線條(名稱,最大值) //series1.Color = Color.Blue; //設定線條顏色 //series1.Font = new System.Drawing.Font("新細明體", 10); //設定字型 //series1.ChartType = SeriesChartType.Line; //設定線條種類 //Chart1.ChartAreas[0].AxisY.Minimum = 0;//設定Y軸最小值 //Chart1.ChartAreas[0].AxisY.Maximum = 1200;//設定Y軸最大值 ////chart1.ChartAreas[0].AxisY.Enabled= AxisEnabled.False; //隱藏Y 軸標示 ////chart1.ChartAreas[0].AxisY.MajorGrid.Enabled= true; //隱藏Y軸標線 //series1.IsValueShownAsLabel = true; //是否把數值顯示在線上 string monstr = "var MONTHS = ["; monstr += "];"; string monstt = ""; string arrva = ""; double avg = 0, coun = 0, hcou = 0, havg = 0; double compute_day = -1; DateTime first_d, second_d; for (int i = 0; i < check_list.Count; i++) { compute_day = -1; if (check_list[i].state == 1) { first_d = Convert.ToDateTime(check_list[i].update); int index = i + 1; while (index < check_list.Count) { if (check_list[index].state == 0) { second_d = Convert.ToDateTime(check_list[index].update); compute_day = (second_d - first_d).TotalSeconds; break; } index += 1; } if (compute_day > -1) { //monstt+=check_list[i].update.ToString("yyyyMMddHHmmss")+","; //arrva +=compute_day+ ","; if (compute_day < 1801) { coun += 1; avg += compute_day; monstt += check_list[i].update.ToString("yyyyMMddHHmmss") + ","; arrva += compute_day + ","; } if (compute_day >= Convert.ToInt32(param7) && compute_day < 1801) { hcou += 1; havg += compute_day; } //series1.Points.AddXY(i.ToString(), compute_day); //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: " + check_list[index].update.ToString("yyyy-MM-dd HH:mm:ss")); //listBox3.Items.Add("Total sec: " + compute_day); } else { //DateTime todate = DateTime.Now; //double compute_day1 = (todate - first_d).TotalSeconds; //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: NO"); //listBox3.Items.Add("Total sec: NO"); } } } if (monstt != "") { monstt = monstt.Substring(0, monstt.Length - 1); } if (arrva != "") { arrva = arrva.Substring(0, arrva.Length - 1); } //Chart1.Series.Add(series1);//將線畫在圖上 //for (int i = 0; i < check_list.Count; i++) //{ // listBox1.Items.Add(check_list[i].state); // listBox2.Items.Add(check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss")); //} if (check_list1.Count > 0 && check_list.Count > 0) { sgg.answer_datetime_s = start.Year + "年" + start.Month + "月" + start.Day + "日"; sgg.answer_datetime_e = end.Year + "年" + end.Month + "月" + end.Day + "日"; sgg.name = ict_place.Table.Rows[ih]["name"].ToString(); double lll = havg / hcou; if (hcou == 0) { lll = 0; } res += @"<br/><fieldset> <legend>" + ict_place.Table.Rows[ih]["name"].ToString() + @"</legend><br/> <br/> <h2>" + param7 + @"秒以上の利用回数(総数):</h2> <br/> <h2>" + hcou.ToString() + @"</h2> <br/> <h2>" + param7 + @"秒以上のみでの平均利用時間(秒)(総利用者):</h2> <br/> <h2>" + lll.ToString() + @"</h2> "; sgg.time1 = hcou.ToString(); sgg.time2 = lll.ToString(); monstr = "var MONTHS = ["; monstr += "];"; monstt = ""; arrva = ""; avg = 0; coun = 0; hcou = 0; havg = 0; compute_day = -1; for (int i = 0; i < check_list1.Count; i++) { compute_day = -1; if (check_list1[i].state == 0) { first_d = Convert.ToDateTime(check_list1[i].update); int index = i + 1; while (index < check_list1.Count) { if (check_list1[index].state == 1) { second_d = Convert.ToDateTime(check_list1[index].update); compute_day = (second_d - first_d).TotalSeconds; break; } index += 1; } if (compute_day > -1) { //monstt += check_list1[i].update.ToString("yyyyMMddHHmmss") + ","; //arrva += compute_day + ","; if (compute_day < 1801) { coun += 1; avg += compute_day; monstt += check_list1[i].update.ToString("yyyyMMddHHmmss") + ","; arrva += compute_day + ","; } if (compute_day >= Convert.ToInt32(param7) && compute_day < 1801) { hcou += 1; havg += compute_day; } //series1.Points.AddXY(i.ToString(), compute_day); //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: " + check_list[index].update.ToString("yyyy-MM-dd HH:mm:ss")); //listBox3.Items.Add("Total sec: " + compute_day); } else { //DateTime todate = DateTime.Now; //double compute_day1 = (todate - first_d).TotalSeconds; //listBox3.Items.Add("Start time: " + check_list[i].update.ToString("yyyy-MM-dd HH:mm:ss") + " ~"); //listBox3.Items.Add("End time: NO"); //listBox3.Items.Add("Total sec: NO"); } } } if (monstt != "") { monstt = monstt.Substring(0, monstt.Length - 1); } if (arrva != "") { arrva = arrva.Substring(0, arrva.Length - 1); } lll = havg / hcou; if (hcou == 0) { lll = 0; } double avggg = avg / coun; if (avg == 0) { avggg = 0; } res += @" <br/> <h2>利用者数:</h2> <br/> <h2>" + coun.ToString() + @"</h2> <br/> <h2>平均利用時間(秒):</h2> <br/> <h2>" + avggg.ToString() + @"</h2> <br/> <h2>" + param7 + @"秒以上の利用回数(施錠して利用):</h2> <br/> <h2>" + hcou.ToString() + @"</h2> <br/> <h2>" + param7 + @"秒以上のみでの平均利用時間(秒)(施錠利用者):</h2> <br/> <h2>" + lll.ToString() + @"</h2> <br/> <br/> </fieldset> "; sgg.time3 = coun.ToString(); sgg.time4 = avggg.ToString(); sgg.time5 = hcou.ToString(); sgg.time6 = lll.ToString(); state_detail_list.Add(sgg); // res += @"<script type='text/javascript'> // //</script>"; } //result = "fail"; } } result = res; res = ""; if (state_detail_list.Count > 0) { res += @"<fieldset><legend style='font-size: large; font-weight: bold'>state detail</legend>"; res += @"<div id='dvData'> <table> <tr> <td>開始日</td> <td>終了日</td> <td>名前</td> <td>" + param7 + @"秒以上の利用回数(総数)</td> <td>" + param7 + @"秒以上のみでの平均利用時間(秒)(総利用者)</td> <td>利用者数</td> <td>平均利用時間(秒)</td> <td>" + param7 + @"秒以上の利用回数(施錠して利用)</td> <td>" + param7 + @"秒以上のみでの平均利用時間(秒)(施錠利用者)</td> </tr>"; for (int i = 0; i < state_detail_list.Count; i++) { res += @"<tr> <td>" + state_detail_list[i].answer_datetime_s + @"</td> <td>" + state_detail_list[i].answer_datetime_e + @"</td> <td>" + state_detail_list[i].name + @"</td> <td>" + state_detail_list[i].time1 + @"</td> <td>" + state_detail_list[i].time2 + @"</td> <td>" + state_detail_list[i].time3 + @"</td> <td>" + state_detail_list[i].time4 + @"</td> <td>" + state_detail_list[i].time5 + @"</td> <td>" + state_detail_list[i].time6 + @"</td> </tr> "; } res += @"</table> </div>"; res += @"</fieldset><hr/>"; } result += res; } } catch (Exception ex) { //result = "fail"; //return result; throw ex; } return(result); }
protected void Page_Init(object sender, EventArgs e) { Panel pdn = (Panel)this.FindControl("new_message_Panel"); Query = "select message,year,month,day "; Query += " from home_message"; Query += " ORDER BY year desc,month desc,day desc,hour desc,minute desc,second desc;"; DataView ict_f = gc.select_cmd(Query); pdn.Controls.Add(new LiteralControl("<table width='100%'>")); for (int i = 0; i < ict_f.Count; i++) { int year = Convert.ToInt32(ict_f.Table.Rows[i]["year"].ToString()); int month = Convert.ToInt32(ict_f.Table.Rows[i]["month"].ToString()); int day = Convert.ToInt32(ict_f.Table.Rows[i]["day"].ToString()); string mon = month.ToString(); if (month < 10) { mon = "0" + month.ToString(); } string da = day.ToString(); if (day < 10) { da = "0" + day.ToString(); } pdn.Controls.Add(new LiteralControl("<tr>")); pdn.Controls.Add(new LiteralControl("<td width='20%' valign='top'>")); Label la_d = new Label(); la_d.Text = year.ToString() + "." + mon + "." + da; pdn.Controls.Add(la_d); pdn.Controls.Add(new LiteralControl("</td>")); pdn.Controls.Add(new LiteralControl("<td width='60%' valign='top'>")); Label la = new Label(); la.Text = ""; la.Text = ict_f.Table.Rows[i]["message"].ToString(); //if (ict_f.Table.Rows[i]["message"].ToString().Length < 35) //{ // la.Text = ict_f.Table.Rows[i]["message"].ToString(); //} //else //{ // la.Text = ict_f.Table.Rows[i]["message"].ToString().Substring(0, 35) + "‧‧‧"; //} pdn.Controls.Add(la); pdn.Controls.Add(new LiteralControl("</td>")); pdn.Controls.Add(new LiteralControl("<td width='20%' valign='top'>")); DateTime date = new DateTime(year, month, day); if ((DateTime.Now - date).TotalDays < 14) { Image img = new Image(); img.ImageUrl = "~/images/home_images/new.png"; //img.Width = Unit.Percentage(50); img.Style.Add("vertical-align", "text-top"); pdn.Controls.Add(img); //pdn.Controls.Add(new LiteralControl("<img src='images/home_images/new.png' alt='' style='vertical-align: top;'>")); } pdn.Controls.Add(new LiteralControl("</td>")); pdn.Controls.Add(new LiteralControl("</tr>")); } pdn.Controls.Add(new LiteralControl("</table>")); }
protected void Timer1_Tick(object sender, EventArgs e) { gc = new GCP_MYSQL(); Label3.Text = DateTime.Now.ToString(); //if (DateTime.Now.Minute % 10 == 0) //{ // Response.Redirect("twitter_gov.aspx"); //} //Session["seak"] = "false"; //if (DateTime.Now.Minute % 59 == 0) //{ Label4.Text = Session["count_sec"].ToString(); if (DateTime.Now.Second % 10 == 0) { if (Session["count_max"] != null && Session["count_sec"] != null && Session["update_day"] != null) { int total_count = Convert.ToInt32(Session["count_max"].ToString()); int cou = Convert.ToInt32(Session["count_sec"].ToString()); cou += 1; if (cou > total_count) { cou = 1; } Session["count_sec"] = cou.ToString(); List <Posts> posts = new List <Posts>(); posts = get_gnavi_Posts(cou); double lat, lng; Dictionary <string, string> kvp; for (int i = 0; i < posts.Count; i++) { ListBox1.Items.Add(posts[i].id); lat = System.Math.Round(Convert.ToDouble(posts[i].lat), 6, MidpointRounding.AwayFromZero); lng = System.Math.Round(Convert.ToDouble(posts[i].lng), 6, MidpointRounding.AwayFromZero); Query = "select id,_id from gnavi_update"; Query += " where gnavi_id='" + posts[i].id + "' and name='" + posts[i].name + "' and lat='" + lat.ToString() + "' and lng='" + lng.ToString() + "'"; //sql_f.SelectCommand += " and address=N'"+posts[i].address+"' and tel=N'"+posts[i].tel+"' and pr_short=N'"+posts[i].pr_short+"' and image=N'"+posts[i].image+"'"; Query += " and address='" + posts[i].address + "' and tel='" + posts[i].tel + "' and pr_short='" + posts[i].pr_short + "'"; Query += " and url='" + posts[i].url + "' and open_time='" + posts[i].open_time + "' and holiday='" + posts[i].holiday + "' and update_time='" + posts[i].update_time + "';"; DataView ict_f = gc.select_cmd(Query); if (ict_f.Count == 0) { Query = "select id,_id from gnavi_update"; Query += " where gnavi_id='" + posts[i].id + "';"; DataView ict_ff = gc.select_cmd(Query); if (ict_ff.Count > 0) { string baby_id = ict_ff.Table.Rows[0]["_id"].ToString(); using (WebClient wc = new WebClient()) { wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); try { wc.Encoding = Encoding.UTF8; NameValueCollection nc = new NameValueCollection(); nc["Place[id]"] = baby_id; nc["Place[name]"] = posts[i].name; nc["Place[lat]"] = lat.ToString(); nc["Place[lon]"] = lng.ToString(); nc["Review[message]"] = ""; nc["Place[remarks]"] = posts[i].pr_short; nc["Place[milk_seat]"] = "1"; nc["Place[url]"] = posts[i].url; nc["Place[tel]"] = posts[i].tel; nc["Place[address]"] = posts[i].address; nc["Place[usable_week_day]"] = posts[i].holiday; byte[] bResult = wc.UploadValues("api" + baby_id, nc); string resultXML = Encoding.UTF8.GetString(bResult); Label2.Text = resultXML; } catch (WebException ex) { Label5.Text = "error!"; } } Query = "update gnavi_update set name='" + posts[i].name + "',lat='" + lat.ToString() + "',lng='" + lng.ToString() + "',address='" + posts[i].address + "'"; ////can not edit image //sql_f_up.UpdateCommand += ",tel=N'" + posts[i].tel + "',pr_short=N'" + posts[i].pr_short + "',image=N'" + posts[i].image + "',url=N'" + posts[i].url + "'"; Query += ",tel='" + posts[i].tel + "',pr_short='" + posts[i].pr_short + "',url='" + posts[i].url + "'"; Query += ",open_time='" + posts[i].open_time + "',holiday='" + posts[i].holiday + "',update_time='" + posts[i].update_time + "',_update_time=NOW()"; Query += " where id='" + ict_ff.Table.Rows[0]["id"].ToString() + "';"; resin = gc.update_cmd(Query); ListBox2.Items.Add(baby_id); } else { //add new nursing room to DB kvp = new Dictionary <string, string>(); kvp.Add("Place[lat]", lat.ToString()); kvp.Add("Place[lon]", lng.ToString()); kvp.Add("Place[name]", posts[i].name); kvp.Add("Review[star]", "4"); kvp.Add("Review[message]", ""); kvp.Add("Place[remarks]", posts[i].pr_short); kvp.Add("Place[milk_seat]", "1"); kvp.Add("Place[place_category_id]", "1"); kvp.Add("Place[is_official]", "1"); kvp.Add("Place[url]", posts[i].url); kvp.Add("Place[tel]", posts[i].tel); kvp.Add("Place[address]", posts[i].address); kvp.Add("Place[usable_week_day]", posts[i].holiday); kvp.Add("Place[usable_time]", posts[i].open_time); string temp_name = DateTime.Now.ToString("yyyyMMddHHmmssffff"); HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(posts[i].image); HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse(); if (webresponse.StatusCode == HttpStatusCode.OK) { System.Drawing.Image image = System.Drawing.Image.FromStream(webresponse.GetResponseStream()); image.Save(Server.MapPath("~") + @"/images/" + temp_name + ".jpg"); //保存在本地文件夹 image.Dispose(); // } FileInfo[] file_list = new FileInfo[1]; file_list[0] = new FileInfo(Server.MapPath("~") + @"/images/" + temp_name + ".jpg"); string res = ExecutePostRequest(new Uri("api"), kvp, file_list, "image/jpeg"); int babyid = Convert.ToInt32(res.Replace("{", "").Replace("}", "").Replace("result", "").Replace(":", "").Replace("\"", "").Trim()); Label1.Text = babyid.ToString(); if ((System.IO.File.Exists(Server.MapPath("~") + @"/images/" + temp_name + ".jpg"))) { System.IO.File.Delete(Server.MapPath("~") + @"/images/" + temp_name + ".jpg"); } Query = "insert into gnavi_update(gnavi_id,_id,name,lat,lng,address,tel,pr_short,image,url,open_time,holiday,update_time,_update_time)"; Query += " values('" + posts[i].id + "','" + babyid.ToString() + "','" + posts[i].name + "','" + lat.ToString() + "','" + lng.ToString() + "','" + posts[i].address + "','" + posts[i].tel + "'"; Query += ",'" + posts[i].pr_short + "','" + posts[i].image + "','" + posts[i].url + "','" + posts[i].open_time + "','" + posts[i].holiday + "','" + posts[i].update_time + "',NOW());"; resin = gc.insert_cmd(Query); ListBox2.Items.Add(babyid.ToString()); } } } } else { Response.Redirect("get_info_from_gnavi.aspx"); } } //} }