Changeset 3819
- Timestamp:
- Sep 3, 2009, 6:25:28 PM (15 years ago)
- Location:
- extensions/PiwigoLib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PiwigoLib/PiwigoLib/Proxy/PwgTagsProxy.cs
r3818 r3819 48 48 } 49 49 50 static public PwgTagsProxyResponse pwg_tag_add(string tagName) 51 { 52 PwgTagsProxyResponse response = null; 53 try 54 { 55 StringBuilder data = new StringBuilder(); 56 data.Append("method=pwg.tags.add"); 57 data.Append("&name=" + HttpUtility.UrlEncode(tagName)); 58 59 response = PwgGenericProxy<PwgTagsProxyResponse>.Post( 60 PwgConfigProxy.PwgServeurUriBuilder.Uri, 61 data.ToString()); 62 } 63 catch (Exception ex) 64 { 65 throw new PwgProxyException("pwg_tag_add", ex); 66 } 67 68 return response; 69 } 70 50 71 } 51 72 -
extensions/PiwigoLib/PiwigoLib/Service/PwgTagsService.cs
r3818 r3819 90 90 91 91 92 static public Boolean AddTag(String tagName) 93 { 94 Boolean returnValue = false; 95 96 try 97 { 98 PwgTagsProxyResponse response = PwgTagsProxy.pwg_tag_add(tagName); 99 100 if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok) 101 { 102 if (response.Erreur != null) 103 { 104 throw new PwgServiceException("AddTag, the server has return the error.", 105 response.Erreur.Code, 106 response.Erreur.Message); 107 } 108 else 109 { 110 throw new PwgServiceException("AddTag : a error occurs during server process."); 111 } 112 } 113 else 114 { 115 returnValue = true; 116 } 117 } 118 catch (PwgProxyException ex) 119 { 120 throw new PwgServiceException("AddTag : a error is raised by proxy.", ex); 121 } 122 return returnValue; 123 } 124 92 125 /// <summary> 93 126 /// private: convert response to dto object -
extensions/PiwigoLib/TestPiwigoLib/Form1.Designer.cs
r3816 r3819 29 29 private void InitializeComponent() 30 30 { 31 this.button1 = new System.Windows.Forms.Button(); 32 this.tbUser = new System.Windows.Forms.TextBox(); 33 this.tbPassword = new System.Windows.Forms.TextBox(); 34 this.label1 = new System.Windows.Forms.Label(); 35 this.label2 = new System.Windows.Forms.Label(); 31 36 this.SuspendLayout(); 37 // 38 // button1 39 // 40 this.button1.Location = new System.Drawing.Point(131, 89); 41 this.button1.Name = "button1"; 42 this.button1.Size = new System.Drawing.Size(75, 23); 43 this.button1.TabIndex = 0; 44 this.button1.Text = "Tester"; 45 this.button1.UseVisualStyleBackColor = true; 46 this.button1.Click += new System.EventHandler(this.button1_Click); 47 // 48 // tbUser 49 // 50 this.tbUser.Location = new System.Drawing.Point(68, 12); 51 this.tbUser.Name = "tbUser"; 52 this.tbUser.Size = new System.Drawing.Size(138, 20); 53 this.tbUser.TabIndex = 1; 54 // 55 // tbPassword 56 // 57 this.tbPassword.Location = new System.Drawing.Point(68, 38); 58 this.tbPassword.Name = "tbPassword"; 59 this.tbPassword.PasswordChar = '*'; 60 this.tbPassword.Size = new System.Drawing.Size(138, 20); 61 this.tbPassword.TabIndex = 2; 62 this.tbPassword.UseSystemPasswordChar = true; 63 // 64 // label1 65 // 66 this.label1.AutoSize = true; 67 this.label1.Location = new System.Drawing.Point(12, 15); 68 this.label1.Name = "label1"; 69 this.label1.Size = new System.Drawing.Size(29, 13); 70 this.label1.TabIndex = 3; 71 this.label1.Text = "User"; 72 // 73 // label2 74 // 75 this.label2.AutoSize = true; 76 this.label2.Location = new System.Drawing.Point(12, 41); 77 this.label2.Name = "label2"; 78 this.label2.Size = new System.Drawing.Size(53, 13); 79 this.label2.TabIndex = 4; 80 this.label2.Text = "Password"; 32 81 // 33 82 // Form1 … … 35 84 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 85 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 this.ClientSize = new System.Drawing.Size(292, 266); 86 this.ClientSize = new System.Drawing.Size(221, 143); 87 this.Controls.Add(this.label2); 88 this.Controls.Add(this.label1); 89 this.Controls.Add(this.tbPassword); 90 this.Controls.Add(this.tbUser); 91 this.Controls.Add(this.button1); 38 92 this.Name = "Form1"; 39 93 this.Text = "Form1"; 40 94 this.Load += new System.EventHandler(this.Form1_Load); 41 95 this.ResumeLayout(false); 96 this.PerformLayout(); 42 97 43 98 } 44 99 45 100 #endregion 101 102 private System.Windows.Forms.Button button1; 103 private System.Windows.Forms.TextBox tbUser; 104 private System.Windows.Forms.TextBox tbPassword; 105 private System.Windows.Forms.Label label1; 106 private System.Windows.Forms.Label label2; 46 107 } 47 108 } -
extensions/PiwigoLib/TestPiwigoLib/Form1.cs
r3818 r3819 25 25 private void Form1_Load(object sender, EventArgs e) 26 26 { 27 } 28 29 private void button1_Click(object sender, EventArgs e) 30 { 27 31 PwgConfigProxy.PwgUserAgent = "TestPiwigoLib"; 28 32 PwgConfigProxy.PwgServeurUriBuilder.Host = "bayral.free.fr"; … … 36 40 PwgSession sess = null; 37 41 sess = PwgSessionService.GetPwgSession(); 38 Console.WriteLine("user : " + sess.UserName + " " + sess.Status);42 Console.WriteLine("user : " + sess.UserName + " " + sess.Status); 39 43 40 sess = PwgSessionService.Login( "xxx", "xxx");44 sess = PwgSessionService.Login(tbUser.Text,tbPassword.Text); 41 45 Console.WriteLine("user : " + sess.UserName + " " + sess.Status); 46 47 Boolean rc = PwgTagsService.AddTag("Loic"); 42 48 43 49 List<PwgTag> lstTag = PwgTagsService.GetAdminListOfTag(); … … 46 52 Console.WriteLine("user : " + sess.UserName + " " + sess.Status); 47 53 48 sess = PwgSessionService.Login( "xxx", "xxx");54 sess = PwgSessionService.Login(tbUser.Text, tbPassword.Text); 49 55 Console.WriteLine("user : " + sess.UserName + " " + sess.Status); 50 56 } … … 56 62 57 63 64 58 65 } 59 66 }
Note: See TracChangeset
for help on using the changeset viewer.