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);
            }
        }
    }
    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);
                        }
                    }
                }
            }
        }
    }
Example #3
0
    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 = "未記入もしくは使用できない単語です。";
        }
    }
    public static string send_message(string param1)
    {
        //string result = param1 + "," + param2;
        string result = "";
        string id     = RemoveSpecialCharacters(param1);

        try
        {
            int       pid    = Convert.ToInt32(id);
            GCP_MYSQL gc1    = new GCP_MYSQL();
            string    Query1 = "";
            Query1 = "update nursing_room_phone set get_state='3',get_cut_datetime=NOW() where id='" + pid + "';";
            result = gc1.update_cmd(Query1);
        }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 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");
            }
        }
        //}
    }
Example #7
0
    protected void Page_Init(object sender, EventArgs e)
    {
        Session.Clear();
        //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("QA");
        string QAon  = System.Text.RegularExpressions.Regex.Replace(text1, @"[^a-zA-Z0-9\s]", string.Empty);

        if (QAon == "1")
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "dlg_show();", true);
        }


        //Session["lan"] = "日本語";
        //Session["byear"] = "0";
        //Session["bmonth"] = "0";
        //Session["parent"] = "ママ";
        //Session["QA1"] = null;
        //Session["QA2"] = null;
        //Session["QA3"] = null;
        //Session["QA4"] = null;

        //time
        TimeZoneInfo TPZone = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
        DateTime     indate = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TPZone);
        string       week   = "";

        if (indate.DayOfWeek == DayOfWeek.Monday)
        {
            week = "MON";
        }
        else if (indate.DayOfWeek == DayOfWeek.Tuesday)
        {
            week = "TUE";
        }
        else if (indate.DayOfWeek == DayOfWeek.Wednesday)
        {
            week = "WED";
        }
        else if (indate.DayOfWeek == DayOfWeek.Thursday)
        {
            week = "THU";
        }
        else if (indate.DayOfWeek == DayOfWeek.Friday)
        {
            week = "FRI";
        }
        else if (indate.DayOfWeek == DayOfWeek.Saturday)
        {
            week = "SAT";
        }
        else if (indate.DayOfWeek == DayOfWeek.Sunday)
        {
            week = "SUN";
        }

        Label1.Text = indate.Month.ToString() + "/" + indate.Day.ToString() + "(" + week + ")";
        Label2.Text = indate.ToString("HH:mm");

        string res = LoadWeather();

        Panel1.Controls.Add(new LiteralControl(res));

        string cre = "<span class='bottom_logo'>Created by</span><img src='" + @"img\img\ver1\Trim_logo_grey.png' width='90' height='90'>";

        Panel3.Controls.Add(new LiteralControl(cre));



        //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)
        //        {
        //        }
        //    }
        //}

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

        Query = "select logo,address,GPS_lat,GPS_lng,postal_code 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();
            zipcode = ict2.Table.Rows[0]["postal_code"].ToString();
        }
        bool check_area_same = false;

        if (zipcode.Trim() == "")
        {
            check_area_same = true;
        }

        if (check_area_same)
        {
            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() != "")
            {
                //get location
                //get area
                addr_type addr = new addr_type();
                string    city = "", state = "", country = "", city1 = "", city2 = "", city3 = "";
                result = "";
                var url_loc = "http://maps.google.com/maps/api/geocode/json?sensor=true&language=ja&address=" + GPS_lat + "," + GPS_lng;

                System.Net.HttpWebRequest request_loc = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url_loc);
                using (var response = request_loc.GetResponse())
                    using (System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream()))
                    {
                        result = sr.ReadToEnd();
                    }

                if (result != "")
                {
                    Newtonsoft.Json.Linq.JObject jArray_loc = Newtonsoft.Json.Linq.JObject.Parse(result);
                    string address_for = jArray_loc["results"][0]["formatted_address"].ToString();
                    foreach (var item in jArray_loc["results"][0]["address_components"])
                    {
                        string type = "";
                        foreach (var item_cc in item["types"])
                        {
                            type += (string)item_cc + ",";
                        }
                        type = type.Substring(0, type.Length - 1);
                        if (type == "sublocality,political" || type == "locality,political" || type == "neighborhood,political" || type == "administrative_area_level_3,political")
                        {
                            addr.city = (city == "" || type == "locality,political") ? (string)item["long_name"] : city;
                        }
                        if (type == "administrative_area_level_1,political")
                        {
                            addr.state = (string)item["short_name"];
                        }
                        if (type == "postal_code" || type == "postal_code_prefix,postal_code")
                        {
                            addr.zipcode = (string)item["long_name"];
                        }
                        //if (type == "country,political") {
                        //    addr.country = address_component.long_name;
                        //}
                        if (type == "locality,political,ward")
                        {
                            addr.city1 = (city1 == "" || type == "locality,political,ward") ? (string)item["long_name"] : city1;
                        }
                        if (type == "political,sublocality,sublocality_level_1")
                        {
                            addr.city2 = (city2 == "" || type == "political,sublocality,sublocality_level_1") ? (string)item["long_name"] : city2;
                        }
                        if (type == "political,sublocality,sublocality_level_2")
                        {
                            addr.city3 = (city3 == "" || type == "political,sublocality,sublocality_level_2") ? (string)item["long_name"] : city3;
                        }
                    }
                }
                string local_addr = "", local_addr1 = "";
                local_addr = "";
                if (addr.state != null)
                {
                    local_addr += addr.state;
                }
                if (addr.city != null)
                {
                    local_addr += addr.city;
                }
                local_addr1 = "";
                if (addr.city1 != null)
                {
                    local_addr1 += addr.city1;
                }
                if (addr.city2 != null)
                {
                    local_addr1 += addr.city2;
                }
                if (addr.city3 != null)
                {
                    local_addr1 += addr.city3;
                }
                if (addr.zipcode != null)
                {
                    zipcode = addr.zipcode;
                }
                string zipcode_mm = (zipcode == "") ? "221-0851" : zipcode;

                Query = "update nursing_room set postal_code='" + zipcode_mm + "' where id='" + id + "';";

                result_cmd = gc.update_cmd(Query);
            }
        }

        //button

        com_list = new List <company_group>();
        company_group comg = new company_group();


        Query  = "select b.company_url,b.company_icon,b.company_name,b.company_des";
        Query += " from nursing_room_connect_company as a inner join nursing_room_company as b";
        Query += " on a.nursing_room_company_id=b.id where a.nursing_room_id='" + id + "';";

        DataView sqldr3 = gc.select_cmd(Query);

        int    ind       = 0;
        string zipcode_m = (zipcode == "") ? "221-0851" : zipcode;


        comg       = new company_group();
        comg.name  = "Trim";
        comg.index = ind;
        ind       += 1;
        comg.icon  = @"img/img/ver1/Trim_icon1.png";
        //comg.des = "全ての、こどもたちへ";
        comg.des = "全ての、こどもたちへ全ての、こどもたちへ全ての、こどもたちへ全ての、こどもたちへ全ての、こどもたちへ全ての、こどもたちへ";
        comg.url = @"http:///";
        com_list.Add(comg);
        comg       = new company_group();
        comg.name  = "";
        comg.index = ind;
        ind       += 1;
        comg.icon  = @"img/img/ver1/_Icon.png";
        comg.des   = "地域のみんなとつながる子育てSNS";
        comg.url   = @"https://.jp/main_guest_light.aspx?=" + zipcode_m;
        com_list.Add(comg);
        if (sqldr3.Count > 0)
        {
            for (int i = 0; i < sqldr3.Count; i++)
            {
                comg       = new company_group();
                comg.name  = sqldr3.Table.Rows[i]["company_name"].ToString();
                comg.index = ind;
                ind       += 1;
                comg.icon  = sqldr3.Table.Rows[i]["company_icon"].ToString();
                comg.des   = sqldr3.Table.Rows[i]["company_des"].ToString();
                comg.url   = sqldr3.Table.Rows[i]["company_url"].ToString();
                com_list.Add(comg);
            }
        }

        string res_but = "";

        ////check circle count
        //bool way = false;
        //if (com_list.Count % 2 == 1)
        //{
        //    way = true;
        //}
        //int midd = 0, last_w = 0;
        //if (way)
        //{
        //    midd = (com_list.Count - 1) / 2;
        //    last_w = ((middle_center_panel.Width / 2) - (TextRenderer.MeasureText(usetime_label.Text, usetime_label.Font).Height / 4))
        //        - (midd * 2) * (TextRenderer.MeasureText(usetime_label.Text, usetime_label.Font).Height / 2);
        //    if (last_w < 0) { last_w = 0; }
        //    for (int i = 0; i < com_list.Count; i++)
        //    {

        //        picc = new PictureBox();
        //        picc.Name = "circle_icon_" + i;
        //        //pic_logo.Image = new Bitmap(@"http://openweathermap.org/img/w/" + icon + ".png");
        //        //pic.ImageLocation = @"http://openweathermap.org/img/w/" + icon + ".png";
        //        picc.Image = new Bitmap(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\img\ver1\circle1.png");
        //        //if (ind == 0)
        //        //{
        //        //    picc.Image = new Bitmap(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\img\ver1\circle.png");
        //        //}
        //        picc.SizeMode = PictureBoxSizeMode.StretchImage;
        //        picc.Width = TextRenderer.MeasureText(usetime_label.Text, usetime_label.Font).Height / 2;
        //        picc.Height = TextRenderer.MeasureText(usetime_label.Text, usetime_label.Font).Height / 2;
        //        picc.BackColor = Color.Transparent;
        //        picc.Location = new Point(last_w, middle_center_panel.Height - (middle_center_panel.Height / 10));
        //        last_w += (TextRenderer.MeasureText(usetime_label.Text, usetime_label.Font).Height / 2) * 2;
        //        if (last_w > middle_center_panel.Width) { last_w = middle_center_panel.Width; }
        //        middle_center_panel.Controls.Add(picc);
        //    }
        //}
        //else
        //{
        //    midd = com_list.Count / 2;
        //    last_w = (middle_center_panel.Width / 2)
        //        - (midd * 2) * (TextRenderer.MeasureText(usetime_label.Text, usetime_label.Font).Height / 2);
        //    if (last_w < 0) { last_w = 0; }
        //    for (int i = 0; i < com_list.Count; i++)
        //    {

        //        picc = new PictureBox();
        //        picc.Name = "circle_icon_" + i;
        //        //pic_logo.Image = new Bitmap(@"http://openweathermap.org/img/w/" + icon + ".png");
        //        //pic.ImageLocation = @"http://openweathermap.org/img/w/" + icon + ".png";
        //        picc.Image = new Bitmap(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\img\ver1\circle1.png");
        //        //if (ind == 0)
        //        //{
        //        //    picc.Image = new Bitmap(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\img\ver1\circle.png");
        //        //}
        //        picc.SizeMode = PictureBoxSizeMode.StretchImage;
        //        picc.Width = TextRenderer.MeasureText(usetime_label.Text, usetime_label.Font).Height / 2;
        //        picc.Height = TextRenderer.MeasureText(usetime_label.Text, usetime_label.Font).Height / 2;
        //        picc.BackColor = Color.Transparent;
        //        picc.Location = new Point(last_w, middle_center_panel.Height - (middle_center_panel.Height / 10));
        //        last_w += (TextRenderer.MeasureText(usetime_label.Text, usetime_label.Font).Height / 2) * 2;
        //        if (last_w > middle_center_panel.Width) { last_w = middle_center_panel.Width; }
        //        middle_center_panel.Controls.Add(picc);
        //    }
        //}
        //picc = middle_center_panel.Controls.Find("circle_icon_0", true).FirstOrDefault() as PictureBox;
        //picc.Image = new Bitmap(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\img\ver1\circle.png");


        //<a href="javascript:void(0);" onclick="LinkClick(0);">Windows XP</a>
        //button1.Text = "";
        //button1.TabStop = false;
        //button1.BackColor = Color.Transparent;
        ////button1.BackColor = Color.FromArgb(Convert.ToInt32(255 * 0.37), 22, 53, 48);
        //button1.FlatStyle = FlatStyle.Flat;
        //button1.FlatAppearance.BorderSize = 0;
        //button1.FlatAppearance.MouseOverBackColor = Color.Transparent;
        //button1.FlatAppearance.MouseDownBackColor = Color.Transparent;
        //button1.Height = Convert.ToInt32(middle_center_panel.Height / 12);
        //button1.Width = Convert.ToInt32(middle_center_panel.Height / 10) / 2;
        //button1.Location = new Point(30, ((middle_center_panel.Height / 2) - (button1.Height / 2)));
        //button1.Cursor = Cursors.Hand;
        //button1.BackgroundImage = new Bitmap(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\img\ver1\left2.png");
        //button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;


        //button2.Text = "";
        //button2.TabStop = false;
        //button2.BackColor = Color.Transparent;
        ////button2.BackColor = Color.FromArgb(Convert.ToInt32(255 * 0.37), 22, 53, 48);
        //button2.FlatStyle = FlatStyle.Flat;
        //button2.FlatAppearance.BorderSize = 0;
        //button2.FlatAppearance.MouseOverBackColor = Color.Transparent;
        //button2.FlatAppearance.MouseDownBackColor = Color.Transparent;
        //button2.Height = Convert.ToInt32(middle_center_panel.Height / 12);
        //button2.Width = Convert.ToInt32(middle_center_panel.Height / 10) / 2;
        //button2.Location = new Point(middle_center_panel.Width - 30 - button1.Width, ((middle_center_panel.Height / 2) - (button2.Height / 2)));
        //button2.Cursor = Cursors.Hand;
        //button2.BackgroundImage = new Bitmap(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\img\ver1\right2.png");
        //button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
        res_but  = "<div>&nbsp;</div>";
        res_but += "<table width='100%' height='100%' style='margin:50px 0px 30px 0px;'><tr><td rowspan='2' align='center' width='10%'>";
        //index_cheange = 0;
        res_but += "<a href='javascript:void(0);' onclick='LinkClick();'>";
        res_but += "<img src='" + @"img\img\ver1\left2.png' width='20px' height='40px'>";
        res_but += "</a>";
        res_but += "</td>";
        if (com_list.Count > 0)
        {
            res_but += "<td rowspan='2' width='30%' align='center'>";
            res_but += "<a id='icon_a' class='middle_icon_a' href='" + com_list[0].url + "'>";
            res_but += "<img id='icon_img' class='middle_icon' src='" + com_list[0].icon + "' width='100%' height='100%'>";
            res_but += "</a>";
            res_but += "</td>";
            res_but += "<td class='middle_text'>";
            string word_title = com_list[0].name;
            res_but += "<a id='title_a' href='" + com_list[0].url + "'>";
            res_but += "<span id='title_txt' class='middle_title'>" + word_title + "</span>";
            res_but += "</a>";

            res_but += "</td>";

            res_but += "<td rowspan='2' align='center' width='10%'>";
            res_but += "<a href='javascript:void(0);' onclick='LinkClick1();'>";
            res_but += "<img src='" + @"img\img\ver1\right2.png' width='20px' height='40px'>";
            res_but += "</a>";
            res_but += "</td>";
            res_but += "</tr>";
            res_but += "<tr>";
            res_but += "<td width='40%' class='middle_text1'>";
            string word_des = com_list[0].des;
            res_but += "<a id='des_a' href='" + com_list[0].url + "'>";
            res_but += "<span id='des_txt' class='middle_des'>" + word_des + "</span>";
            res_but += "</a>";

            res_but += "</td>";
        }

        res_but += "</tr><tr><td align='center' colspan='4' height='130px'>";

        //check circle count
        res_but += @"<img id='circle_icon_0' src='img\img\ver1\circle.png' width='10px' height='10px'>";
        for (int i = 1; i < com_list.Count; i++)
        {
            res_but += "&nbsp;<img id='circle_icon_" + i + @"' src='img\img\ver1\circle1.png' width='10px' height='10px'>";
        }

        res_but += "</td></tr></table>";
        res_but += "<div>&nbsp;</div>";
        res_but += @"<script type='text/javascript'>";
        res_but += @"function LinkClick() {
a = window.sessionStorage.getItem(['key2']);
b=0;
if(a=='null')
{
a=" + (com_list.Count - 1) + @";
window.sessionStorage.setItem(['key2'],[a]);
}else
{
b=Number(a);
b=b-1;
if(b==-1)
{
b=" + (com_list.Count - 1) + @";
}
window.sessionStorage.setItem(['key2'],[b]);
}
      var elem = document.getElementById('icon_img');
        var elem_a = document.getElementById('icon_a');
var elem_a1 = document.getElementById('title_a');
var elem_a3 = document.getElementById('des_a');
console.log(b);
 switch (b) {
";
        if (com_list.Count > 0)
        {
            for (int i = 0; i < com_list.Count; i++)
            {
                int bi = i + 1;
                if (bi == com_list.Count)
                {
                    bi = 0;
                }
                res_but += @"case " + i + @":
        var elem_cir = document.getElementById('circle_icon_" + i + @"');
        elem_cir.src = 'img/img/ver1/circle.png';
        var elem_cir1 = document.getElementById('circle_icon_" + bi + @"');
        elem_cir1.src = 'img/img/ver1/circle1.png';
            elem_a.href = '" + com_list[i].url + @"';
          elem.src = '" + com_list[i].icon + @"';
            elem_a1.href = '" + com_list[i].url + @"';
          document.getElementById('title_txt').innerHTML = '" + com_list[i].name + @"';
            elem_a3.href = '" + com_list[i].url + @"';
          document.getElementById('des_txt').innerHTML = '" + com_list[i].des + @"';
          break;
";
            }
        }
        res_but += @"
      }
    }";
        res_but += @"function LinkClick1() {
a = window.sessionStorage.getItem(['key2']);
b=0;
if(a==null)
{
a=1;
window.sessionStorage.setItem(['key2'],['1']);
}else
{
b=Number(a);
b=b+1;
if(b==" + com_list.Count + @")
{
b=0;
}
window.sessionStorage.setItem(['key2'],[b]);
}
      var elem = document.getElementById('icon_img');
        var elem_a = document.getElementById('icon_a');
var elem_a1 = document.getElementById('title_a');
var elem_a3 = document.getElementById('des_a');
console.log(b);
 switch (b) {
";
        if (com_list.Count > 0)
        {
            for (int i = 0; i < com_list.Count; i++)
            {
                int bi = i - 1;
                if (bi == -1)
                {
                    bi = com_list.Count - 1;
                }
                res_but += @"case " + i + @":
        var elem_cir = document.getElementById('circle_icon_" + i + @"');
        elem_cir.src = 'img/img/ver1/circle.png';
        var elem_cir1 = document.getElementById('circle_icon_" + bi + @"');
        elem_cir1.src = 'img/img/ver1/circle1.png';
            elem_a.href = '" + com_list[i].url + @"';
          elem.src = '" + com_list[i].icon + @"';
            elem_a1.href = '" + com_list[i].url + @"';
          document.getElementById('title_txt').innerHTML = '" + com_list[i].name + @"';
            elem_a3.href = '" + com_list[i].url + @"';
          document.getElementById('des_txt').innerHTML = '" + com_list[i].des + @"';
          break;
";
            }
        }
        res_but += @"
      }
    }";
        res_but += "</script>";
        Panel2.Controls.Add(new LiteralControl(res_but));
    }
    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 = "登録に失敗しました。";
        }
    }
Example #9
0
    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_appointment_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())
                {
                    if (id == 0)
                    {
                    }
                    else
                    {
                        Query  = "select id";
                        Query += " from user_information_appointment_check_deal";
                        Query += " where uid='" + id + "' and id='" + uiacdid + "';";

                        DataView ict_f_user = gc.select_cmd(Query);
                        for (int i = 0; i < ict_f_user.Count; i++)
                        {
                            Query  = "update user_information_appointment_check_deal";
                            Query += " set check_success='1',second_check_time='" + start + "' where id='" + ict_f_user.Table.Rows[i]["id"].ToString() + "';";

                            resin = gc.update_cmd(Query);
                        }
                    }

                    string constr = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["mysqlConnectionString"].ConnectionString;
                    using (MySqlConnection con = new MySqlConnection(constr))
                    {
                        using (MySqlCommand cmd = new MySqlCommand("DELETE FROM user_appointment_check WHERE ActivationCode ='" + activationCode + "'"))
                        {
                            using (MySqlDataAdapter sda = new MySqlDataAdapter())
                            {
                                cmd.CommandType = CommandType.Text;
                                cmd.Connection  = con;
                                con.Open();
                                int rowsAffected = cmd.ExecuteNonQuery();
                                con.Close();
                                if (rowsAffected == 1)
                                {
                                    ltMessage.Text = "予約の確認が完了しました。";
                                }
                                else
                                {
                                    ltMessage.Text = "予約の確認に失敗しました。";
                                }
                            }
                        }
                    }
                }
                else
                {
                    ltMessage.Text = "このアカウントはサポーター登録されていません。";
                }
            }
            else
            {
                ltMessage.Text = "失敗しました。";
            }

            Label1.Text = "10";
        }
    }
Example #10
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")));
    }