public void SetDataUrl_with_no_data_tag() { var target = new PetitionResult(); target.sign_image_dataurl1 = @"iVBORw0KGgoAAAANSUhEUgAAASwAAABkCAYAAAA8AQ3AAAAGxElEQVR4Xu2cu6olRRSG5+odjUVBTAwVfAETAwPFwFAMBCPfQAwGAx9CEETEyEhMDHwGQQMDExERTEQU7zPOzFqwe9jTeE5X167qXn+tb0MxB3Z31VrfX+eb7j77nIsXeEEAAhAQIXBRpE7KhAAEIHABYbEJIAABGQIISyYqCoUABBAWewACEJAhgLBkoqJQCEAAYbEHIAABGQIISyYqCoUABHoJ678D2ssghgAEINCKAMJqRZJ5IACB7gR6CqvX3N2hsMBdBC7BAwJRCPSUyq0oTVLHyQR67pOTi2OCPATYiHmyrunUn0X6FRb7pIYe5zQnwEZsjnSoCa9bN1cQ1lCZSjeDsKTj6178D7bC4wirO2cWKCSAsApBJT7Mn0X+ZOPRxAxoPQgBhBUkiMBluLBu2LgauEZKS0IAYSUJ+oQ2XVg3bfAh4BMgcmobAgirDceRZ3Fh+eDzWCOnLNIbwhIJascy+TWrHeGz9N0EEBY7YokAwloixPubEUBYm6GWXQhhyUY3XuEIa7xMW3eEsFoTZb5qAgirGl2aExFWmqjjN4qw4me0d4UIa+8EWP8OAYTFZlgigLCWCPH+ZgQQ1maoZRdCWLLRjVc4whov09YdIazWRJmvmgDCqkaX5kSElSbq+I0irPgZ7V0hwto7AdbnoTt7oJgAwipGxYG9CXCF1Zuw/vwISz/DYTpAWMNE2a0RhNUNLROvJYCw1hLLdzzCypd52I4RVthowhSGsMJEQSEIiz2wRABhLRHi/c0IIKzNUMsuhLBkoxuvcIQ1XqatO0JYrYkyXzUBhFWNLs2JCCtN1PEbRVjxM9q7QoS1dwKsf4cAwmIzLBFAWEuEeH8zAghrM9SyCyEs2ejGKxxhjZdp644QVmuizFdNAGFVo0tzIsJKE3X8RhFW/Iz2rhBh7Z0A6/PQnT1QTABhFaPiwN4EuMLqTVh/fo Sln+EwHSCsYaLs1gjC6oaWidcSQFh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ENAmgLC086N6CKQigLBSxU2zENAmgLC086N6CKQigLBSxU2zENAmgLC086N6CKQigLBSxU2zENAmgLC086N6CKQigLBSxU2zENAmgLC086N6CKQigLBSxU2zENAmgLC086N6CKQigLBSxU2zENAmgLC086N6CKQigLBSxU2zENAmgLC086N6CKQigLBSxU2zENAmgLC086N6CKQigLBSxU2zENAmgLC086N6CKQicBuPn5xlL8sr7wAAAABJRU5ErkJggg=="; Assert.NotEmpty(target.sign_image_bytes1); Assert.NotEmpty(target.sign_image1); }
public string InsertPetitionResult(PetitionResult pr) { var ret = ""; using (var conn = new NpgsqlConnection(connStr.Value)) { conn.Open(); using (var cmd = new NpgsqlCommand("insert into rn_results (email, name, phone_no, daum_id, work_place, client_ip, sign_image1, sign_image2, insert_dt, sign_radio1, sign_radio2) values (:email, :name, :phone_no, :daum_id, :work_place, :client_ip, :sign_image1, :sign_image2, :insert_dt, :sign_radio1, :sign_radio2)", conn)) { cmd.Parameters.Add(new NpgsqlParameter("email", pr.email)); cmd.Parameters.Add(new NpgsqlParameter("name", pr.name)); cmd.Parameters.Add(new NpgsqlParameter("phone_no", pr.phone_no)); cmd.Parameters.Add(new NpgsqlParameter("daum_id", "")); cmd.Parameters.Add(new NpgsqlParameter("work_place", pr.work_place)); cmd.Parameters.Add(new NpgsqlParameter("client_ip", pr.client_ip)); cmd.Parameters.Add(new NpgsqlParameter("sign_image1", pr.sign_image1 ?? "")); cmd.Parameters.Add(new NpgsqlParameter("sign_image2", pr.sign_image2 ?? "")); cmd.Parameters.Add(new NpgsqlParameter("insert_dt", pr.insert_dt)); cmd.Parameters.Add(new NpgsqlParameter("sign_radio1", pr.sign_radio1)); cmd.Parameters.Add(new NpgsqlParameter("sign_radio2", pr.sign_radio2)); try { cmd.ExecuteNonQuery(); } catch (NpgsqlException ex) { if (ex.Code == "23505") { ret = "email already exists"; } else { throw; } } } } return ret; }