SuperDesign/Source/RySmartEditor/Site/FrmAddSite.cs
zilinsoft ee1a5b9c34 ## 📅2026-04-11 星期六更新
### RySmartEditor    V1.0.2604.1101
- *.[新增]新增支持站点禁用功能。
### SuperDesign    V3.0.2604.1101
- *.[新增]更新dll版本功能新增进度展示,并提示替换的dll数量。
- *.[修复]修复生成C#代码时,多行Cookie和PostData生成错误的BUG。
- *.[修复]修复更新引用dll时,如果dll不存在,会更新失败的BUG。
2026-04-11 13:48:30 +08:00

128 lines
4.4 KiB
C#

using GameBackup3H3.DbOp;
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.Threading.Tasks;
using System.Windows.Forms;
using .Manager;
namespace .Manager.Site
{
public partial class FrmAddSite : Form
{
public string tableName = "Site";
public int isAdd = 1;
public string selectId = "-1";
public FrmAddSite()
{
InitializeComponent();
}
public void GetInfo(string id)
{
selectId = id;
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.User_SQLConn) == 1)
{
DataSet ds = db.ReadData(tableName, id);
if (ds.HaveData())
{
DataRow reader = ds.Tables[0].Rows[0];
#region
var ftpid = reader["ftpId"].ToInt();
var ds_ftp = db.ReadData("select * from Ftp where id="+ftpid);
if (ds_ftp.HaveData()) { DtFtp.Text = ds_ftp.GetRow(0)["name"].ToString(); }
else
{
DtFtp.Text = "无";
}
TxtName.Text = reader["name"].ToString();
TxtLocalPath.Text = reader["localPath"].ToString();
DtFtp.selectId = reader["ftpId"].ToString();
TxtFtpDir.Text = reader["ftpDir"].ToString();
ChkDisabled.Checked = reader["Disabled"].ToInt() == 1;
#endregion
}
ds.Dispose();
}
db.Free();
}
private void BtnOK_Click(object sender, EventArgs e)
{
if (TxtName.Text == "")
{
MessageBox.Show("名称不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (!System.IO.Directory.Exists(TxtLocalPath.Text))
{
MessageBox.Show("本地路径不存在。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
RyQuickSQL mySQL = new RyQuickSQL(tableName);
mySQL.AddField("name", TxtName.Text);
mySQL.AddField("localPath", TxtLocalPath.Text.Trim('\\'));
mySQL.AddField("ftpId",DtFtp.selectId.ToInt());
mySQL.AddField("ftpDir", TxtFtpDir.Text);
mySQL.AddField("Disabled", ChkDisabled.Checked?1:0);
//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();
DialogResult = DialogResult.OK;
}
private void BtnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void BtnBrowserFolder_Click(object sender, EventArgs e)
{
if(folderBrowserDialog1.ShowDialog()==DialogResult.OK)
{
TxtLocalPath.Text = folderBrowserDialog1.SelectedPath;
}
}
private void DtFtp_OnSelected(object sender, EventArgs e)
{
FrmFTPView frm = new FrmFTPView
{
SelectModeOn = true
};
if (frm.ShowDialog()==DialogResult.OK)
{
DtFtp.selectId = frm.SelectedItem.Id.ToString();
DtFtp.Text = frm.SelectedItem.Name;
}
}
private void BtnClearFtp_Click(object sender, EventArgs e)
{
DtFtp.selectId = "-1";
DtFtp.Text ="无";
}
}
}