SuperDesign/Source/RySmartEditor/FTP/FrmAddFTP.cs
zilinsoft 993f1ca1a9 ### 2024-12-20 星期五更新
------
#### SuperDesign    V3.0.2412.2001
- *.[新增]新增程序更新日志设置和自动发布功能。
- *.[修复]修复Post数据格式不正确时双击文本框会导致软件闪退的BUG。
2024-12-20 08:15:19 +08:00

101 lines
3.5 KiB
C#

using ryCommon;
using ryCommonDb;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using .Manager;
namespace GameBackup3H3.DbOp
{
public partial class FrmAddFTP : Form
{
public ModalForm mr = null;
public string tableName = "FTP";
public int isAdd = 1;
public string selectId = "-1";
public FrmAddFTP()
{
InitializeComponent();
CbbEncryption.SelectedIndex = 0;
}
#region
public void GetInfo(string id)
{
selectId = id;
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
{
DataSet ds = db.ReadData(tableName, id);
if (mydb.HaveData(ds))
{
DataRow reader = ds.Tables[0].Rows[0];
#region
TxtName.Text = reader["name"].ToString();
TxtHost.Text = reader["ip"].ToString();
TxtPort.Text = reader["port"].ToString();
TxtRemoteDir.Text = reader["remoteDir"].ToString();
TxtUserName.Text = reader["username"].ToString();
TxtPwd.Text = reader["pwd"].ToString();
CbbEncryption.SelectedIndex = reader["encrypt"].ToInt(0,2,0);
TxtDes.Text = reader["des"].ToString();
#endregion
}
}
db.Free();
}
private void BtnOK_Click(object sender, EventArgs e)
{
if (TxtName.Text == "")
{
MessageBox.Show("名称不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
RyQuickSQL mySQL = new RyQuickSQL(tableName);
mySQL.AddField("name", TxtName.Text);
mySQL.AddField("ip", TxtHost.Text);
mySQL.AddField("port", TxtPort.Text.ToInt());
mySQL.AddField("remoteDir", TxtRemoteDir.Text);
mySQL.AddField("username", TxtUserName.Text);
mySQL.AddField("pwd", TxtPwd.Text);
mySQL.AddField("encrypt", CbbEncryption.SelectedIndex);
mySQL.AddField("des", TxtDes.Text);
//DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
{
if (isAdd >= 1)
{
mySQL.AddField("addTime",DateTime.Now);
mySQL.AddField("editTime", DateTime.Now);
db.ExecuteNonQuery(mySQL.GetInsertSQL(), db.GetParameter(mySQL));
}
else
{
mySQL.AddField("editTime", DateTime.Now);
db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where id=" + selectId, db.GetParameter(mySQL));
}
}
db.Free();
ModalForm.SetDialogResult(this, mr, DialogResult.OK);
}
#endregion
private void BtnCancel_Click(object sender, EventArgs e)
{
ModalForm.SetDialogResult(this, mr, DialogResult.Cancel);
}
private void FrmAddFTP_Load(object sender, EventArgs e)
{
}
}
}