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));
    }
Пример #2
0
    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);
    }
Пример #3
0
    public static void ConvertUrlsToInData(string url)
    {
        WebService.LinkDetails wss = new WebService.LinkDetails();
        WebService             ws  = new WebService();

        wss = ws.GetDetails(url);
        string imgurl = "";

        if (wss.Image != null)
        {
            imgurl = wss.Image.Url;
        }
        else if (wss.Images != null)
        {
            if (wss.Images.Count > 0)
            {
                imgurl = wss.Images[0].Url;
            }
        }
        URL_data urld = new URL_data();

        urld.url = wss.Url;
        if (wss.Title != null)
        {
            urld.title = wss.Title;
        }
        if (wss.Description != null)
        {
            urld.des = wss.Description;
        }

        if (imgurl != "")
        {
            if (UrlExists(imgurl))
            {
                urld.image_url = imgurl;
            }
        }


        GCP_MYSQL gc1    = new GCP_MYSQL();
        string    Query1 = "insert into status_messages_link_info(link,image_url,title,des,update_time)";

        Query1 += " values('" + url + "','" + urld.image_url + "','" + urld.title + "','" + urld.des + "',NOW());";
        string resin1 = gc1.insert_cmd(Query1);
    }
    public static string write_message(string param1)
    {
        string id = RemoveSpecialCharacters(HttpContext.Current.Session["real_id"].ToString());

        string res = id;

        if (id != null)
        {
            if (id.Trim() != "")
            {
                GCP_MYSQL gc     = new GCP_MYSQL();
                string    Query1 = "insert into nursing_room_message(nursing_room_id,type,message,update_time)";
                Query1 += " values('" + id + "',0,'" + param1 + "',NOW());";
                string resin = gc.insert_cmd(Query1);
            }
        }

        return(res);
    }
Пример #5
0
    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);
    }
Пример #6
0
    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);
    }
    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");
            }
        }
        //}
    }
Пример #8
0
    public static string save_list(string param1, string param2, string param3, string param4, string param5, string param6, string param7, string param8, string param9)
    {
        string    res   = "";
        GCP_MYSQL gc    = new GCP_MYSQL();
        string    Query = "";

        if (HttpContext.Current.Session["mid"] != null)
        {
            string id  = HttpContext.Current.Session["mid"].ToString();
            string lan = "";
            if (param6 == null)
            {
                lan = "NULL";
            }
            else
            {
                if (param6.Trim() == "")
                {
                    lan = "NULL";
                }
                else
                {
                    lan = "'" + param6.Trim() + "'";
                }
            }
            string byear = "";
            if (param7 == null)
            {
                byear = "0";
            }
            else
            {
                if (param7.Trim() == "")
                {
                    byear = "0";
                }
                else
                {
                    byear = "'" + param7.Trim() + "'";
                }
            }
            string bmonth = "";
            if (param8 == null)
            {
                bmonth = "0";
            }
            else
            {
                if (param8.Trim() == "")
                {
                    bmonth = "0";
                }
                else
                {
                    bmonth = "'" + param8.Trim() + "'";
                }
            }
            string parent = "";
            if (param9 == null)
            {
                parent = "NULL";
            }
            else
            {
                if (param9.Trim() == "")
                {
                    parent = "NULL";
                }
                else
                {
                    parent = "'" + param9.Trim() + "'";
                }
            }
            string QA1 = "";
            if (param2 == null)
            {
                QA1 = "NULL";
            }
            else
            {
                if (param2.Trim() == "")
                {
                    QA1 = "NULL";
                }
                else
                {
                    QA1 = "'" + param2.Trim() + "'";
                }
            }
            string QA2 = "";
            if (param3 == null)
            {
                QA2 = "NULL";
            }
            else
            {
                if (param3.Trim() == "")
                {
                    QA2 = "NULL";
                }
                else
                {
                    QA2 = "'" + param3.Trim() + "'";
                }
            }
            string QA3 = "";
            if (param4 == null)
            {
                QA3 = "NULL";
            }
            else
            {
                if (param4.Trim() == "")
                {
                    QA3 = "NULL";
                }
                else
                {
                    QA3 = "'" + param4.Trim() + "'";
                }
            }
            string QA4 = "";
            if (param5 == null)
            {
                QA4 = "NULL";
            }
            else
            {
                if (param5.Trim() == "")
                {
                    QA4 = "NULL";
                }
                else
                {
                    QA4 = "'" + param5.Trim() + "'";
                }
            }


            if (id.Trim() != "")
            {
                Query  = "insert into nursing_room_QA(nursing_room_id,language,Q1_baby_year,Q1_baby_month,Q1_parent,Q2_choice,Q3_choice,Q4_choice,Q5_choice,insert_time)";
                Query += " values('" + id.Trim() + "'," + lan + "," + byear + "," + bmonth + "," + parent + "," + QA1 + "," + QA2 + "," + QA3 + "," + QA4 + ",NOW());";

                string rescom = gc.insert_cmd(Query);
                res = rescom;
            }
        }


        return(res);
    }
Пример #9
0
    public string LoadWeather()
    {
        string result_res = "";

        if (Session["mid"] != null)
        {
            if (Session["mid"].ToString().Trim() != "")
            {
                string id = Session["mid"].ToString();

                string GPS_lat = "", GPS_lng = "", result = "";

                Query = "select logo,address,GPS_lat,GPS_lng from nursing_room where id='" + id + "';";

                DataView ict2 = gc.select_cmd(Query);
                if (ict2.Count > 0)
                {
                    GPS_lat = ict2.Table.Rows[0]["GPS_lat"].ToString();
                    GPS_lng = ict2.Table.Rows[0]["GPS_lng"].ToString();
                }


                bool check_gps = false;
                if (GPS_lat.Trim() == "")
                {
                    check_gps = true;
                }
                if (GPS_lng.Trim() == "")
                {
                    check_gps = true;
                }
                if (check_gps)
                {
                    GPS_lat = "35.447821";
                    GPS_lng = "139.641685";
                }

                //no GPS no weather and area
                if (GPS_lat.Trim() != "" && GPS_lng.Trim() != "")
                {
                    double te = 0; int tempc = 0; string icon = "";
                    //get five day weather
                    //check database info
                    DateTime     last_date;
                    TimeZoneInfo TPZone = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
                    DateTime     todate = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TPZone);

                    Query = "select * from nursing_room_weather_info where nursing_room_id='" + id + "' order by dtime desc;";

                    DataView ict_date = gc.select_cmd(Query);
                    if (ict_date.Count > 0)
                    {
                        last_date = Convert.ToDateTime(ict_date.Table.Rows[0]["dtime"].ToString());
                    }
                    else
                    {
                        last_date = new DateTime(2000, 5, 7);
                    }
                    List <string>   fftemp      = new List <string>();
                    List <DateTime> fftime      = new List <DateTime>();
                    List <string>   ffweat      = new List <string>();
                    double          compute_day = (last_date - todate).TotalDays;
                    if (compute_day < 1)
                    {
                        //update weather information from website

                        //get weather info from website
                        var url_five = new Uri("http://api.openweathermap.org/data/2.5/forecast?lat=" + GPS_lat + "&lon=" + GPS_lng + "&units=imperial&appid=9c293c963735c31fbc771ef88e9c3455");

                        string result_five = "";
                        System.Net.HttpWebRequest request_five = (HttpWebRequest)HttpWebRequest.Create(url_five);
                        using (var response = request_five.GetResponse())
                            using (StreamReader sr = new System.IO.StreamReader(response.GetResponseStream()))
                            {
                                result_five = sr.ReadToEnd();
                            }

                        Newtonsoft.Json.Linq.JObject jArray_five = JObject.Parse(result_five);

                        //dt_txt
                        bool check_same = false;
                        int  tempcc     = 0;
                        foreach (Newtonsoft.Json.Linq.JObject jArray_five1 in jArray_five["list"])
                        {
                            te     = Convert.ToDouble((string)jArray_five1["main"]["temp"]) - 32;
                            tempcc = 0;
                            if (te != 0)
                            {
                                tempcc = Convert.ToInt32(System.Math.Round((te * 5 / 9), 0, MidpointRounding.AwayFromZero));
                            }
                            fftemp.Add(tempcc.ToString());
                            fftime.Add((DateTime)jArray_five1["dt_txt"]);
                            ffweat.Add((string)jArray_five1["weather"][0]["icon"]);

                            if (check_same == false)
                            {
                                Query = "select * from nursing_room_weather_info where nursing_room_id='" + id + "' and dtime='" + jArray_five1["dt_txt"].ToString() + "';";

                                DataView ict_check_same = gc.select_cmd(Query);
                                if (ict_check_same.Count == 0)
                                {
                                    check_same = true;
                                }
                            }
                            else
                            {
                                Query      = "insert into nursing_room_weather_info (nursing_room_id,tempture,weather_icon,dtime,update_time)";
                                Query     += " VALUES ('" + id + "','" + tempcc.ToString() + "','" + jArray_five1["weather"][0]["icon"].ToString() + "','" + jArray_five1["dt_txt"].ToString() + "',NOW())";
                                result_cmd = gc.insert_cmd(Query);
                            }
                        }
                    }
                    else
                    {
                        //get weather information from database
                        Query = "select * from nursing_room_weather_info where nursing_room_id='" + id + "' and dtime>'" + todate.ToString("yyyy-MM-dd HH:mm:ss.fff") + "' order by dtime asc;";

                        DataView ict_info = gc.select_cmd(Query);
                        if (ict_info.Count > 0)
                        {
                            for (int i = 0; i < ict_info.Count; i++)
                            {
                                fftime.Add(Convert.ToDateTime(ict_info.Table.Rows[i]["dtime"].ToString()));
                                fftemp.Add(ict_info.Table.Rows[i]["tempture"].ToString());
                                ffweat.Add(ict_info.Table.Rows[i]["weather_icon"].ToString());
                            }
                        }
                    }

                    //check log



                    DateTime indate_com = DateTime.Now;
                    int      index      = 0;
                    //for (int i = 0; i < fftime.Count; i++)
                    //{
                    //    int comm = DateTime.Compare(indate_com, fftime[i]);
                    //    if (comm <0)
                    //    {
                    //        index = i;
                    //        break;
                    //    }
                    //}

                    tempc = Convert.ToInt32(fftemp[0]);
                    icon  = ffweat[0];

                    //if (index - 1 > -1)
                    //{
                    //    tempc = Convert.ToInt32(fftemp[index - 1]);
                    //    icon = ffweat[index - 1];
                    //}
                    //else
                    //{
                    //    tempc = Convert.ToInt32(fftemp[index]);
                    //    icon = ffweat[index];
                    //}


                    //string tempf = (string)jArray["main"]["temp"], humidity = (string)jArray["main"]["humidity"], pressure = (string)jArray["main"]["pressure"];
                    //string tempf_min = (string)jArray["main"]["temp_min"], tempf_max = (string)jArray["main"]["temp_max"];
                    //string main_w = (string)jArray["weather"][0]["main"], des = (string)jArray["weather"][0]["description"];
                    //string icon = (string)jArray["weather"][0]["icon"], speed = (string)jArray["wind"]["speed"];

                    Label la;
                    result_res = "";
                    //get 15 hours after
                    int last_h_old = 10;
                    result_res += "<table><tr>";
                    for (int i = 0; i < 5; i++)
                    {
                        result_res += "<td align='center' width='100px'>";
                        int last_h = last_h_old;
                        //PictureBox pic = new PictureBox();
                        //pic.Name = "weather_icon_label0";
                        //pic_logo.Image = new Bitmap(@"http://openweathermap.org/img/w/" + icon + ".png");
                        //pic.ImageLocation = @"http://openweathermap.org/img/w/" + icon + ".png";

                        if (i > 0)
                        {
                            result_res += "<img src='" + @"img\img\ver1\weather\" + ffweat[i] + ".png' width='50' height='50'>";
                        }
                        else
                        {
                            result_res += "<img src='" + @"img\img\ver1\weather\" + icon + ".png' width='50' height='50'>";
                        }
                        //pic.SizeMode = PictureBoxSizeMode.StretchImage;
                        //pic.Width = 60;
                        //pic.Height = 60;
                        //pic.BackColor = Color.Transparent;
                        //pic.Location = new Point(((weather_panel.Width / 5) * i), last_h);
                        //last_h = last_h + pic.Height + 5;
                        //Invoke(new Action(() =>
                        //{
                        //    weather_panel.Controls.Add(pic);
                        //}));
                        //int oldw = pic.Width + (pic.Width / 10);

                        //18
                        string temp_la = "NOW";
                        //la = new Label();
                        //la.Name = "temp_m_label" + i.ToString();
                        //la.ForeColor = ColorTranslator.FromHtml("#323837");
                        //la.Font = GetCustomFont(Properties.Resources.Khula_Regular, 12.0f, FontStyle.Regular);
                        //la.Text = "NOW";
                        //la.BackColor = Color.Transparent;
                        if (i > 0)
                        {
                            if (fftime[i].Hour >= 12)
                            {
                                temp_la = fftime[i].Hour + "PM";
                            }
                            else
                            {
                                temp_la = fftime[i].Hour + "AM";
                            }
                        }

                        result_res += "<br/><span class='temp_la1'>" + temp_la + "</span>";

                        //la.Width = TextRenderer.MeasureText(la.Text, la.Font).Width;
                        //la.Height = TextRenderer.MeasureText(la.Text, la.Font).Height;
                        //la.Location = new Point(((weather_panel.Width / 5) * i) + (pic.Width / 2) - (la.Width / 2), last_h);
                        //last_h = last_h + TextRenderer.MeasureText(la.Text, la.Font).Height + 5;
                        //Invoke(new Action(() =>
                        //{
                        //    weather_panel.Controls.Add(la);
                        //}));

                        temp_la = tempc.ToString() + "°";
                        if (i > 0)
                        {
                            temp_la = fftemp[i] + "°";
                        }
                        result_res += "<br/><span class='temp_la'>" + temp_la + "</span>";
                        ////18
                        //la = new Label();
                        //la.Name = "temp_m_label_0";
                        //la.ForeColor = ColorTranslator.FromHtml("#323837");
                        //la.Font = GetCustomFont(Properties.Resources.Lato_Regular, 16.0f, FontStyle.Regular);
                        //la.Text = tempc.ToString() + "°";
                        //la.BackColor = Color.Transparent;
                        //if (i > 0)
                        //{
                        //    la.Text = fftemp[index] + "°";
                        //}
                        //la.Width = TextRenderer.MeasureText(la.Text, la.Font).Width;
                        //la.Height = TextRenderer.MeasureText(la.Text, la.Font).Height;
                        //la.Location = new Point(((weather_panel.Width / 5) * i) + (pic.Width / 2) - (la.Width / 2), last_h);
                        //Invoke(new Action(() =>
                        //{
                        //    weather_panel.Controls.Add(la);
                        //}));
                        if (i > 0)
                        {
                            index += 1;
                        }

                        result_res += "</td>";
                        if (i == 0)
                        {
                            result_res += "<td align='center' width='20px'><img src='" + @"img\img\ver1\weather_line.png' width='2' height='100'></td>";
                        }
                    }
                    result_res += "</tr></table>";
                }
            }
        }

        return(result_res);
    }
Пример #10
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        string FB_id = "";

        if (FB_id_hidd.Value != "")
        {
            FB_id = FB_id_hidd.Value;
        }
        string cov = "";

        if (FB_cov_hidd.Value != "")
        {
            cov = FB_cov_hidd.Value;
        }

        string name       = name_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
        string loginname  = loginname_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
        bool   check_mail = CheckEmailFormat(loginname);
        string photo      = "";

        if (Session["head_photo"] != null)
        {
            photo = Session["head_photo"].ToString();
        }

        string password   = password_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
        string c_password = password_TextBox_check.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();


        bool check_name = false, check_loginname = false, check_photo = false, check_password = false, check_c_password = false, check_password_same = false, check_loginname_same = false;

        if (name != "")
        {
            check_name      = true;
            name_Label.Text = "";
        }
        else
        {
            check_name      = false;
            name_Label.Text = "未記入もしくは使用できない単語です。";
        }
        if (loginname != "")
        {
            check_loginname = true;
            if (check_mail)
            {
                Query  = "select login_name from user_login";
                Query += " where login_name='" + loginname + "';";
                DataView ict_f = gc.select_cmd(Query);
                if (ict_f.Count > 0)
                {
                    check_loginname_same = false;
                    loginname_Label.Text = "既に登録されているメールアドレスです。";
                }
                else
                {
                    check_loginname_same = true;
                    loginname_Label.Text = "";
                }
            }
            else
            {
                loginname_Label.Text = "無効なメールアドレスです";
            }
        }
        else
        {
            check_loginname      = false;
            loginname_Label.Text = "未記入もしくは使用できない単語です。";
        }
        if (photo != "")
        {
            check_photo      = true;
            photo_Label.Text = "";
        }
        else
        {
            check_photo      = false;
            photo_Label.Text = "アイコンに使用する画像をアップロードしてください。";
        }
        if (password != "")
        {
            check_password      = true;
            password_Label.Text = "";
        }
        else
        {
            check_password      = false;
            password_Label.Text = "未記入もしくは使用できない単語です。";
        }
        if (c_password != "")
        {
            check_c_password = true;
            if (password == c_password)
            {
                check_password_same   = true;
                c_password_Label.Text = "";
            }
            else
            {
                check_password_same   = false;
                c_password_Label.Text = "Your confirm password is not equal password.";
            }
        }
        else
        {
            check_c_password      = false;
            c_password_Label.Text = "パスワードが間違っています。";
        }

        bool check_place = false;

        if (Session["place_add"] != null && Session["place_postalcode"] != null)
        {
            if (Session["place_add"].ToString().Trim() != "" && Session["place_postalcode"].ToString().Trim() != "")
            {
                check_place = true;
            }
            else
            {
                check_place        = false;
                c_place_Label.Text = "地域を設定してください";
            }
        }
        else
        {
            check_place        = false;
            c_place_Label.Text = "地域を設定してください";
        }


        if (check_place && check_name && check_loginname && check_photo && check_password && check_c_password && check_password_same && check_mail && check_loginname_same)
        {
            bool check_db = true;

            Query  = "select id from user_login";
            Query += " where login_name='" + loginname + "' and login_password='******';";
            DataView ict_f = gc.select_cmd(Query);
            if (ict_f.Count > 0)
            {
                check_db = false;
            }

            if (check_db)
            {
                Query  = "insert into user_login(login_name,login_password,username,photo,CreatedDate)";
                Query += " values('" + loginname + "','" + password + "','" + name + "','" + photo + "',NOW())";
                resin  = gc.insert_cmd(Query);


                Query  = "select id from user_login";
                Query += " where login_name='" + loginname + "' and login_password='******' and username='******';";
                ict_f  = gc.select_cmd(Query);
                if (ict_f.Count > 0)
                {
                    if (FB_id != "")
                    {
                        Query  = "update user_login";
                        Query += " set FBID='" + FB_id + "'";
                        Query += " where id='" + ict_f.Table.Rows[0]["id"].ToString() + "';";
                        resin  = gc.update_cmd(Query);
                    }
                    if (cov != "")
                    {
                        Query  = "update user_login";
                        Query += " set home_image='" + cov + "'";
                        Query += " where id='" + ict_f.Table.Rows[0]["id"].ToString() + "';";
                        resin  = gc.update_cmd(Query);
                    }
                }

                if (ict_f.Count > 0)
                {
                    SendActivationEmail(Convert.ToInt32(ict_f.Table.Rows[0]["id"].ToString()), loginname, name);
                    Session["id"] = ict_f.Table.Rows[0]["id"].ToString();

                    if (Session["place_add"] != null && Session["place_postalcode"] != null)
                    {
                        Regex  r       = new Regex(@",");
                        string add_str = Session["place_add"].ToString();
                        // Match the regular expression pattern against a text string.
                        Match      m         = r.Match(add_str);
                        List <int> indexlist = new List <int>();
                        while (m.Success)
                        {
                            indexlist.Add(m.Index);
                            m = m.NextMatch();
                        }
                        List <string> addlist = new List <string>();
                        for (int i = 0; i < indexlist.Count; i++)
                        {
                            string add = "";
                            if (i - 1 < 0)
                            {
                                add = add_str.Substring(0, indexlist[i]);
                                addlist.Add(add);
                            }
                            else
                            {
                                add = add_str.Substring(indexlist[i - 1] + 1, indexlist[i] - indexlist[i - 1] - 1);
                                addlist.Add(add);
                            }
                        }


                        add_str = Session["place_postalcode"].ToString();
                        // Match the regular expression pattern against a text string.
                        m         = r.Match(add_str);
                        indexlist = new List <int>();
                        while (m.Success)
                        {
                            indexlist.Add(m.Index);
                            m = m.NextMatch();
                        }
                        List <string> addlist1 = new List <string>();
                        for (int i = 0; i < indexlist.Count; i++)
                        {
                            string add = "";
                            if (i - 1 < 0)
                            {
                                add = add_str.Substring(0, indexlist[i]);
                                addlist1.Add(add);
                            }
                            else
                            {
                                add = add_str.Substring(indexlist[i - 1] + 1, indexlist[i] - indexlist[i - 1] - 1);
                                addlist1.Add(add);
                            }
                        }
                        for (int i = 0; i < addlist.Count; i++)
                        {
                            Query  = "insert into user_login_address(uid,place,postal_code)";
                            Query += " values('" + ict_f.Table.Rows[0]["id"].ToString() + "','" + addlist[i] + "','" + addlist1[i] + "')";
                            resin  = gc.insert_cmd(Query);
                        }
                    }
                }



                name_TextBox.Text           = "";
                loginname_TextBox.Text      = "";
                Session["head_photo"]       = null;
                Image1.ImageUrl             = "";
                password_TextBox.Text       = "";
                password_TextBox_check.Text = "";
                result_Label.Text           = "Success registered. Please check out your email.";

                Response.Redirect("registered.aspx");
            }
            else
            {
                result_Label.Text = "登録に失敗しました。";
            }
        }
        else
        {
            result_Label.Text = "登録に失敗しました。";
        }
    }
Пример #11
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (Session["id"] == null)
        {
            ScriptManager.RegisterStartupScript(Button2, Button2.GetType(), "alert", "alert('Sorry you stay too long!')", true);
            Response.Redirect("main.aspx");
        }
        else
        {
            string uid = Session["id"].ToString();

            string real_first_name        = real_first_name_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string real_second_name       = real_second_name_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string real_spell_first_name  = real_spell_first_name_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string real_spell_second_name = real_spell_second_name_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            bool   check_Sex_radio        = false;
            string Sex = "";
            if (Sex_radio.SelectedIndex > -1)
            {
                check_Sex_radio = true;
                Sex             = Sex_radio.SelectedValue;
                sex_Label.Text  = "";
            }
            else
            {
                check_Sex_radio = false;
                Sex             = "";
                sex_Label.Text  = "性別を選択してください。";
            }
            string birth_year = ddlYear.SelectedValue;
            string birth_mon  = ddlMonth.SelectedValue;
            string birth_day  = ddlDay.SelectedValue;

            string work_state = work_DropDownList.SelectedValue;

            string postal_code        = postal_code_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string country            = City_DropDownList.SelectedValue;
            string city               = add_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string chome              = add_TextBox1.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string house_number       = apartment_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string station_line       = train_line_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string station_name       = train_station_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string phone_number       = phone_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string other_phone_number = other_phone_TextBox.Text.Replace("\'", "").Replace("\"", "").Replace("`", "").Trim();
            string relationship       = relationship_DropDownList.SelectedValue;

            bool check_real_first_name = false, check_real_second_name = false, check_real_spell_first_name = false
            , check_real_spell_second_name = false, check_postal_code = false
            , check_city = false, check_chome = false, check_phone_number = false;

            if (real_first_name != "")
            {
                check_real_first_name = true;
                rfname_Label.Text     = "";
            }
            else
            {
                check_real_first_name = false;
                rfname_Label.Text     = "姓を入力してください";
            }

            if (real_second_name != "")
            {
                check_real_second_name = true;
                rsname_Label.Text      = "";
            }
            else
            {
                check_real_second_name = false;
                rsname_Label.Text      = "名を入力してください。";
            }

            if (real_spell_first_name != "")
            {
                check_real_spell_first_name = true;
                rsfname_Label.Text          = "";
            }
            else
            {
                check_real_spell_first_name = false;
                rsfname_Label.Text          = "姓の読みをカタカナで入力してください。";
            }

            if (real_spell_second_name != "")
            {
                check_real_spell_second_name = true;
                rssname_Label.Text           = "";
            }
            else
            {
                check_real_spell_second_name = false;
                rssname_Label.Text           = "名の読みをカタカナで入力してください。";
            }

            if (postal_code != "")
            {
                check_postal_code = true;
                poc_Label.Text    = "";
            }
            else
            {
                check_postal_code = false;
                poc_Label.Text    = "郵便番号をハイフンをつけて入力してください。";
            }
            if (city != "")
            {
                check_city      = true;
                city_Label.Text = "";
            }
            else
            {
                check_city      = false;
                city_Label.Text = "市区町村を入力してください";
            }
            if (chome != "")
            {
                check_chome      = true;
                chome_Label.Text = "";
            }
            else
            {
                check_chome      = false;
                chome_Label.Text = "番地を入力してください。";
            }
            if (phone_number != "")
            {
                check_phone_number = true;
                phone_Label.Text   = "";
            }
            else
            {
                check_phone_number = false;
                phone_Label.Text   = "電話番号を入力してください";
            }


            if (check_Sex_radio && check_real_first_name && check_real_second_name && check_real_spell_first_name &&
                check_real_spell_second_name && check_postal_code && check_city && check_chome && check_phone_number)
            {
                bool check_db = true;

                Query  = "select uid from user_information";
                Query += " where uid='" + uid + "';";
                DataView ict_f = gc.select_cmd(Query);
                if (ict_f.Count > 0)
                {
                    check_db = false;
                }

                if (check_db)
                {
                    Query  = "insert into user_information(uid,real_first_name,real_second_name,real_spell_first_name,real_spell_second_name";
                    Query += ",Sex,birthday_year,birthday_month,birthday_day,live_postal_code,country,city,Chome,phone_number,work_state,relationship";
                    if (house_number != "")
                    {
                        Query += ",house_number";
                    }
                    if (station_line != "")
                    {
                        Query += ",station_line";
                    }
                    if (station_name != "")
                    {
                        Query += ",station_name";
                    }
                    if (other_phone_number != "")
                    {
                        Query += ",other_phone_number";
                    }

                    Query += ") values('" + uid + "','" + real_first_name + "','" + real_second_name + "','" + real_spell_first_name + "'";
                    Query += ",'" + real_spell_second_name + "','" + Sex + "','" + birth_year + "','" + birth_mon + "'";
                    Query += ",'" + birth_day + "','" + postal_code + "','" + country + "','" + city + "'";
                    Query += ",'" + chome + "','" + phone_number + "','" + work_state + "','" + relationship + "'";
                    if (house_number != "")
                    {
                        Query += ",'" + house_number + "'";
                    }
                    if (station_line != "")
                    {
                        Query += ",'" + station_line + "'";
                    }
                    if (station_name != "")
                    {
                        Query += ",'" + station_name + "'";
                    }
                    if (other_phone_number != "")
                    {
                        Query += ",'" + other_phone_number + "'";
                    }
                    Query += ")";
                    resin  = gc.insert_cmd(Query);

                    Session["id"] = uid;


                    real_first_name_TextBox.Text        = "";
                    real_second_name_TextBox.Text       = "";
                    real_spell_first_name_TextBox.Text  = "";
                    real_spell_second_name_TextBox.Text = "";

                    Sex_radio.SelectedIndex = -1;
                    this.PopulateYear();
                    this.PopulateMonth();
                    this.PopulateDay();

                    work_DropDownList.SelectedIndex = 0;
                    postal_code_TextBox.Text        = "";
                    City_DropDownList.Items.FindByValue("神奈川県").Selected = true;
                    City_DropDownList.Items.FindByText("神奈川県").Selected  = true;
                    add_TextBox.Text           = "";
                    add_TextBox1.Text          = "";
                    apartment_TextBox.Text     = "";
                    train_line_TextBox.Text    = "";
                    train_station_TextBox.Text = "";
                    phone_TextBox.Text         = "";
                    other_phone_TextBox.Text   = "";
                    relationship_DropDownList.SelectedIndex = 0;


                    result_Label.Text = "Success registered.";
                    Response.Redirect("registered_1.aspx");
                }
                else
                {
                    result_Label.Text = "登録に失敗しました。";
                }
            }
            else
            {
                result_Label.Text = "登録に失敗しました。";
            }

            //Page.ClientScript.RegisterStartupScript(GetType(), Button2.ID, "save();", true);

            //ScriptManager.RegisterStartupScript(Button2, Button2.GetType(), "alert", "alert('" + birth_year + "," + birth_mon + "," + birth_day + "')", true);



            //ScriptManager.RegisterStartupScript(Button2, Button2.GetType(), "alert", "alert('" + Sex_radio.SelectedIndex + "')", true);

            //Page.ClientScript.RegisterStartupScript(GetType(), Button2.ID, "save();", true);

            //Response.Redirect("registered_1.aspx");
        }
    }
Пример #12
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        gc = new GCP_MYSQL();
        ListBox2.Items.Clear();
        ListBox3.Items.Clear();
        ListBox4.Items.Clear();
        ListBox5.Items.Clear();
        ListBox6.Items.Clear();
        ListBox7.Items.Clear();
        List <Posts> posts = new List <Posts>();

        posts = getFBPosts();

        List <facebook_message_group> fbg_list = new List <facebook_message_group>();
        facebook_message_group        fbg      = new facebook_message_group();

        for (int i = 0; i < posts.Count; i++)
        {
            ListBox2.Items.Add(posts[i].PostMessage);

            ListBox4.Items.Add(posts[i].created_time.ToString());
            //if (posts[i].description != null)
            //{
            //    ListBox5.Items.Add(posts[i].description.ToString());
            //}
            //if (posts[i].PostShareLink_name != null)
            //{
            //    ListBox6.Items.Add(posts[i].PostShareLink_name.ToString());
            //}
            //System.Drawing.Image img = posts[i].PostImage;
            //Panel2.Controls.Add(new LiteralControl(ConvertUrlsToLinks_DIV(posts[i].PostShareLink)));



            //Image imgg = new Image();
            //imgg.ImageUrl = posts[i].PostPictureUri;
            //Panel1.Controls.Add(imgg);

            fbg = new facebook_message_group();
            int ind = posts[i].PostId.IndexOf("_");
            fbg.user_id = posts[i].PostId.Substring(0, ind);
            ListBox6.Items.Add(posts[i].PostId.Substring(0, ind));
            fbg.mes_id = posts[i].PostId.Substring(ind + 1, posts[i].PostId.Length - ind - 1);
            ListBox7.Items.Add(posts[i].PostId.Substring(ind + 1, posts[i].PostId.Length - ind - 1));
            fbg.username = "******";

            fbg.messgae = posts[i].PostMessage.Replace("\'", "").Replace("\"", "");

            if (posts[i].PostShareLink != null)
            {
                if (posts[i].PostShareLink != "")
                {
                    fbg.sharelist = posts[i].PostShareLink;
                    ListBox3.Items.Add(posts[i].PostShareLink);
                }
            }

            if (posts[i].PostPictureUri != null)
            {
                if (posts[i].PostPictureUri != "")
                {
                    fbg.imglist = posts[i].PostPictureUri;
                    ListBox5.Items.Add(posts[i].PostPictureUri);
                }
            }

            fbg.year  = posts[i].created_time.Year;
            fbg.month = posts[i].created_time.Month;
            fbg.day   = posts[i].created_time.Day;
            fbg.hour  = Convert.ToInt32(posts[i].created_time.ToString("HH"));
            fbg.min   = posts[i].created_time.Minute;
            fbg.sec   = posts[i].created_time.Second;

            fbg_list.Add(fbg);
        }
        for (int i = 0; i < fbg_list.Count; i++)
        {
            Query  = "select facebook_mid";
            Query += " from facebook_message";
            Query += " where facebook_mid='" + fbg_list[i].mes_id + "';";

            DataView ict_sf = gc.select_cmd(Query);
            if (ict_sf.Count == 0)
            {
                Query  = "insert into facebook_message(facebook_mid,facebook_uid,facebook_username,facebook_message,year,month,day,hour,minute,second)";
                Query += " values('" + fbg_list[i].mes_id + "','" + fbg_list[i].user_id + "','" + fbg_list[i].username + "','" + fbg_list[i].messgae + "',";
                Query += "'" + fbg_list[i].year + "','" + fbg_list[i].month + "','" + fbg_list[i].day + "','" + fbg_list[i].hour + "','" + fbg_list[i].min + "','" + fbg_list[i].sec + "');";

                resin = gc.insert_cmd(Query);


                Query  = "select id from facebook_message";
                Query += " where facebook_mid='" + fbg_list[i].mes_id + "' and facebook_uid='" + fbg_list[i].user_id + "' and facebook_username='******'";
                Query += " and facebook_message='" + fbg_list[i].messgae + "' and year='" + fbg_list[i].year + "' and month='" + fbg_list[i].month + "' and day='" + fbg_list[i].day + "' and hour='" + fbg_list[i].hour + "'";
                Query += " and minute='" + fbg_list[i].min + "' and second='" + fbg_list[i].sec + "';";
                DataView ict_ff = gc.select_cmd(Query);
                if (ict_ff.Count > 0)
                {
                    string id = ict_ff.Table.Rows[0]["id"].ToString();
                    if (fbg_list[i].sharelist != "")
                    {
                        Query  = "insert into facebook_message_link(fmid,share_link)";
                        Query += " values('" + id + "','" + fbg_list[i].sharelist + "');";
                        resin  = gc.insert_cmd(Query);
                    }
                    if (fbg_list[i].imglist != "")
                    {
                        Query  = "insert into facebook_message_image(fmid,image_url)";
                        Query += " values('" + id + "','~/" + fbg_list[i].imglist + "');";
                        resin  = gc.insert_cmd(Query);
                    }
                }
            }
        }

        //insert into social media
        //参照元 : 保育や子育てに繋がる遊び情報サイト[ほいくる] Facebook アカウント<br/><br/>
        //postal_code
        //place
        //type 0
        //message_type 6

        Query  = "select id,facebook_message,year,month,day,hour,minute,second";
        Query += " from facebook_message";
        Query += " where smid is null;";
        DataView ict_sff = gc.select_cmd(Query);

        if (ict_sff.Count > 0)
        {
            for (int i = 0; i < ict_sff.Count; i++)
            {
                string message = ict_sff.Table.Rows[i]["facebook_message"].ToString().Replace(@"\t|\n|\r", "<br/>").Replace("\r", "<br/>").Replace("\n", "<br/>");

                Query  = "select share_link";
                Query += " from facebook_message_link";
                Query += " where fmid='" + ict_sff.Table.Rows[i]["id"].ToString() + "';";

                DataView ict_sff1 = gc.select_cmd(Query);
                if (ict_sff1.Count > 0)
                {
                    for (int ii = 0; ii < ict_sff1.Count; ii++)
                    {
                        message += "<br/>" + ict_sff1.Table.Rows[ii]["share_link"].ToString();
                    }
                }
                message += "<br/><br/>参照元 : 保育や子育てに繋がる遊び情報サイト[ほいくる] Facebook アカウント<br/>";
                //uid 50

                Query  = "insert into status_messages(uid,type,message_type,place,message,year,month,day,hour,minute,second,postal_code)";
                Query += " values('52','0','6',NULL,'" + message + "','" + ict_sff.Table.Rows[i]["year"].ToString() + "','" + ict_sff.Table.Rows[i]["month"].ToString() + "'";
                Query += ",'" + ict_sff.Table.Rows[i]["day"].ToString() + "','" + ict_sff.Table.Rows[i]["hour"].ToString() + "','" + ict_sff.Table.Rows[i]["minute"].ToString() + "','" + ict_sff.Table.Rows[i]["second"].ToString() + "',NULL)";
                resin  = gc.insert_cmd(Query);



                string smid = "";

                Query  = "select id from status_messages";
                Query += " where uid='52' and type='0' and message_type='6' and place is null";
                Query += " and message='" + message + "' and year='" + ict_sff.Table.Rows[i]["year"].ToString() + "' and month='" + ict_sff.Table.Rows[i]["month"].ToString() + "' and day='" + ict_sff.Table.Rows[i]["day"].ToString() + "' and hour='" + ict_sff.Table.Rows[i]["hour"].ToString() + "'";
                Query += " and minute='" + ict_sff.Table.Rows[i]["minute"].ToString() + "' and second='" + ict_sff.Table.Rows[i]["second"].ToString() + "' and postal_code is null;";
                DataView ict_f = gc.select_cmd(Query);
                if (ict_f.Count > 0)
                {
                    smid = ict_f.Table.Rows[0]["id"].ToString();

                    Query    = "select image_url";
                    Query   += " from facebook_message_image";
                    Query   += " where fmid='" + ict_sff.Table.Rows[i]["id"].ToString() + "';";
                    ict_sff1 = gc.select_cmd(Query);
                    if (ict_sff1.Count > 0)
                    {
                        for (int ii = 0; ii < ict_sff1.Count; ii++)
                        {
                            Query  = "insert into status_messages_image(smid,filename)";
                            Query += " values('" + ict_f.Table.Rows[0]["id"].ToString() + "','" + ict_sff1.Table.Rows[ii]["image_url"].ToString() + "');";
                            resin  = gc.insert_cmd(Query);
                        }
                    }
                }

                Query  = "update facebook_message set smid='" + smid + "'";
                Query += " where id='" + ict_sff.Table.Rows[i]["id"].ToString() + "';";
                resin  = gc.update_cmd(Query);

                ConvertUrlsInData(message);
            }
        }


        //Panel2.Controls.Add(new LiteralControl(ConvertUrlsToLinks_DIV("http://bit.ly/2hTRHUx")));

        //http://www.city.yokohama.lg.jp/kanagawa/kusei/kutyou/
        // Panel2.Controls.Add(new LiteralControl(ConvertUrlsToLinks_DIV("http://www.city.yokohama.lg.jp/kanagawa/kusei/kutyou/")));

        //https://hoiclue.jp/800002984.html?utm_content=bufferc9bbf&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
        //https://hoiclue.jp/800002984.html
        //Panel2.Controls.Add(new LiteralControl(ConvertUrlsToLinks_DIV("https://hoiclue.jp/800002984.html")));
    }
Пример #13
0
    public static Object[] send_message1(string param1, string param2, string param3, string param4)
    {
        //string result = param1 + "," + param2;
        string result = "";
        string QR     = RemoveSpecialCharacters(param2);

        Object[]  nc     = new Object[5];
        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);

            DateTime     nowdate = DateTime.Now;
            DateTime     utc     = nowdate.ToUniversalTime();
            TimeZoneInfo jst     = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
            DateTime     now_jst = TimeZoneInfo.ConvertTimeFromUtc(utc, jst);
            nc[0] = result;
            string html = @"<p>" + now_jst.ToString("yyyy/MM/dd HH:mm:ss") + @"</p><p>" + param1 + @"</p><p>";
            if (param3 != "")
            {
                html += @"
<a href='" + param3 + @"' target='_blank'><img src='./images/mamaro_manager/pdf-icon.png' title='PDF' width='100' height='100' /></a>";
            }
            if (param4 != "")
            {
                html += @"
<a href='" + param4 + @"' target='_blank'><img src='./images/mamaro_manager/Files-Csv-icon.png' title='CSV' width='100' height='100' /></a>";
            }
            html += @"</p><hr>";
            nc[1] = html;


            ////var url_five = new Uri("http:///api/places/get_official_info?id=" + ict_ff.Table.Rows[0][""].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][""].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(nc);
    }