修改 超管,oem 修改和查看每个用户的附加金额
This commit is contained in:
1 parent
b2e75e6e1d
commit
82ae679dbd
13 files changed
+3300
-2740
No files matched your search
@@ -12,7 +12,8 @@ namespace AllBase.Model.DBModel
|
|||||||
public string oem_id { get; set; }
|
public string oem_id { get; set; }
|
||||||
public string oem_name { get; set; }
|
public string oem_name { get; set; }
|
||||||
public string oem_owner { get; set; }
|
public string oem_owner { get; set; }
|
||||||
public string oem_icon { get; set; }
|
public string parent_oem_id { get; set; }
|
||||||
|
public string oem_icon { get; set; }
|
||||||
public string oem_img { get; set; }
|
public string oem_img { get; set; }
|
||||||
public DateTime add_time { get; set; }
|
public DateTime add_time { get; set; }
|
||||||
public DateTime mdy_time { get; set; }
|
public DateTime mdy_time { get; set; }
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<ErrorReportUrlHistory />
|
<ErrorReportUrlHistory />
|
||||||
<FallbackCulture>zh-CN</FallbackCulture>
|
<FallbackCulture>zh-CN</FallbackCulture>
|
||||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||||
<ActiveDebugProfile>Production</ActiveDebugProfile>
|
<ActiveDebugProfile>Development</ActiveDebugProfile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||||
|
|||||||
+157
@@ -0,0 +1,157 @@
|
|||||||
|
namespace TemuKJD.UserComponent;
|
||||||
|
|
||||||
|
partial class InputDialog
|
||||||
|
{
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && components != null)
|
||||||
|
components.Dispose();
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.layout = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.lblPrompt = new System.Windows.Forms.Label();
|
||||||
|
this.txtInput = new System.Windows.Forms.TextBox();
|
||||||
|
this.buttons = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.btnCancel = new System.Windows.Forms.Button();
|
||||||
|
this.btnOk = new System.Windows.Forms.Button();
|
||||||
|
this.lblError = new System.Windows.Forms.Label();
|
||||||
|
this.layout.SuspendLayout();
|
||||||
|
this.buttons.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// layout
|
||||||
|
//
|
||||||
|
this.layout.AutoSize = true;
|
||||||
|
this.layout.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
this.layout.ColumnCount = 1;
|
||||||
|
this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.layout.Controls.Add(this.lblPrompt, 0, 0);
|
||||||
|
this.layout.Controls.Add(this.txtInput, 0, 1);
|
||||||
|
this.layout.Controls.Add(this.buttons, 0, 2);
|
||||||
|
this.layout.Controls.Add(this.lblError, 0, 3);
|
||||||
|
this.layout.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.layout.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.layout.Name = "layout";
|
||||||
|
this.layout.Padding = new System.Windows.Forms.Padding(15);
|
||||||
|
this.layout.RowCount = 4;
|
||||||
|
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
|
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
|
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
|
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||||
|
this.layout.Size = new System.Drawing.Size(360, 143);
|
||||||
|
this.layout.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// lblPrompt
|
||||||
|
//
|
||||||
|
this.lblPrompt.AutoSize = true;
|
||||||
|
this.lblPrompt.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.lblPrompt.Location = new System.Drawing.Point(15, 15);
|
||||||
|
this.lblPrompt.Margin = new System.Windows.Forms.Padding(0, 0, 0, 10);
|
||||||
|
this.lblPrompt.MaximumSize = new System.Drawing.Size(330, 0);
|
||||||
|
this.lblPrompt.Name = "lblPrompt";
|
||||||
|
this.lblPrompt.Size = new System.Drawing.Size(330, 12);
|
||||||
|
this.lblPrompt.TabIndex = 0;
|
||||||
|
this.lblPrompt.Text = "请输入:";
|
||||||
|
//
|
||||||
|
// txtInput
|
||||||
|
//
|
||||||
|
this.txtInput.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.txtInput.Location = new System.Drawing.Point(15, 37);
|
||||||
|
this.txtInput.Margin = new System.Windows.Forms.Padding(0, 0, 0, 12);
|
||||||
|
this.txtInput.Name = "txtInput";
|
||||||
|
this.txtInput.Size = new System.Drawing.Size(330, 21);
|
||||||
|
this.txtInput.TabIndex = 0;
|
||||||
|
this.txtInput.TextChanged += new System.EventHandler(this.txtInput_TextChanged);
|
||||||
|
//
|
||||||
|
// buttons
|
||||||
|
//
|
||||||
|
this.buttons.AutoSize = true;
|
||||||
|
this.buttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
this.buttons.Controls.Add(this.btnCancel);
|
||||||
|
this.buttons.Controls.Add(this.btnOk);
|
||||||
|
this.buttons.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.buttons.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||||
|
this.buttons.Location = new System.Drawing.Point(15, 70);
|
||||||
|
this.buttons.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.buttons.Name = "buttons";
|
||||||
|
this.buttons.Size = new System.Drawing.Size(330, 28);
|
||||||
|
this.buttons.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// btnCancel
|
||||||
|
//
|
||||||
|
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
|
this.btnCancel.Location = new System.Drawing.Point(255, 0);
|
||||||
|
this.btnCancel.Margin = new System.Windows.Forms.Padding(10, 0, 0, 0);
|
||||||
|
this.btnCancel.Name = "btnCancel";
|
||||||
|
this.btnCancel.Size = new System.Drawing.Size(75, 28);
|
||||||
|
this.btnCancel.TabIndex = 1;
|
||||||
|
this.btnCancel.Text = "取消";
|
||||||
|
this.btnCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btnOk
|
||||||
|
//
|
||||||
|
this.btnOk.Location = new System.Drawing.Point(170, 0);
|
||||||
|
this.btnOk.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.btnOk.Name = "btnOk";
|
||||||
|
this.btnOk.Size = new System.Drawing.Size(75, 28);
|
||||||
|
this.btnOk.TabIndex = 0;
|
||||||
|
this.btnOk.Text = "确定";
|
||||||
|
this.btnOk.UseVisualStyleBackColor = true;
|
||||||
|
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
|
||||||
|
//
|
||||||
|
// lblError
|
||||||
|
//
|
||||||
|
this.lblError.AutoSize = true;
|
||||||
|
this.lblError.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.lblError.ForeColor = System.Drawing.Color.Firebrick;
|
||||||
|
this.lblError.Location = new System.Drawing.Point(15, 108);
|
||||||
|
this.lblError.Margin = new System.Windows.Forms.Padding(0, 10, 0, 0);
|
||||||
|
this.lblError.MaximumSize = new System.Drawing.Size(330, 0);
|
||||||
|
this.lblError.MinimumSize = new System.Drawing.Size(0, 20);
|
||||||
|
this.lblError.Name = "lblError";
|
||||||
|
this.lblError.Size = new System.Drawing.Size(330, 20);
|
||||||
|
this.lblError.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// InputDialog
|
||||||
|
//
|
||||||
|
this.AcceptButton = this.btnOk;
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.AutoSize = true;
|
||||||
|
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
this.CancelButton = this.btnCancel;
|
||||||
|
this.ClientSize = new System.Drawing.Size(360, 144);
|
||||||
|
this.Controls.Add(this.layout);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
this.MinimumSize = new System.Drawing.Size(376, 39);
|
||||||
|
this.Name = "InputDialog";
|
||||||
|
this.ShowInTaskbar = false;
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
this.Text = "输入";
|
||||||
|
this.layout.ResumeLayout(false);
|
||||||
|
this.layout.PerformLayout();
|
||||||
|
this.buttons.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.TableLayoutPanel layout;
|
||||||
|
private System.Windows.Forms.Label lblPrompt;
|
||||||
|
private System.Windows.Forms.TextBox txtInput;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel buttons;
|
||||||
|
private System.Windows.Forms.Button btnOk;
|
||||||
|
private System.Windows.Forms.Button btnCancel;
|
||||||
|
private System.Windows.Forms.Label lblError;
|
||||||
|
}
|
||||||
@@ -1,81 +1,130 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Globalization;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TemuKJD.UserComponent;
|
namespace TemuKJD.UserComponent;
|
||||||
|
|
||||||
public class InputDialog : Form
|
public partial class InputDialog : Form
|
||||||
{
|
{
|
||||||
private TextBox txtInput;
|
private readonly InputDialogType inputType;
|
||||||
private Button btnOk;
|
private readonly Func<string, string> validator;
|
||||||
private Button btnCancel;
|
|
||||||
|
|
||||||
/// <summary>用户输入的内容(点确定后有效)</summary>
|
/// <summary>用户输入的内容(点确定后有效)</summary>
|
||||||
public string InputText { get; private set; } = string.Empty;
|
public string InputText { get; private set; } = string.Empty;
|
||||||
|
|
||||||
public InputDialog(string prompt, string title = "输入", string defaultValue = "")
|
public InputDialog() : this(string.Empty)
|
||||||
{
|
{
|
||||||
// 窗体基本设置
|
|
||||||
this.Text = title;
|
|
||||||
this.FormBorderStyle = FormBorderStyle.FixedDialog;
|
|
||||||
this.StartPosition = FormStartPosition.CenterParent;
|
|
||||||
this.MaximizeBox = false;
|
|
||||||
this.MinimizeBox = false;
|
|
||||||
this.ClientSize = new Size(360, 130);
|
|
||||||
|
|
||||||
// 提示标签
|
|
||||||
var lblPrompt = new Label
|
|
||||||
{
|
|
||||||
Text = prompt,
|
|
||||||
Location = new Point(15, 15),
|
|
||||||
AutoSize = true,
|
|
||||||
MaximumSize = new Size(330, 0)
|
|
||||||
};
|
|
||||||
|
|
||||||
// 输入框
|
|
||||||
txtInput = new TextBox
|
|
||||||
{
|
|
||||||
Text = defaultValue,
|
|
||||||
Location = new Point(15, 45),
|
|
||||||
Width = 330
|
|
||||||
};
|
|
||||||
txtInput.SelectAll();
|
|
||||||
|
|
||||||
// 确定按钮
|
|
||||||
btnOk = new Button
|
|
||||||
{
|
|
||||||
Text = "确定",
|
|
||||||
DialogResult = DialogResult.OK,
|
|
||||||
Location = new Point(185, 85),
|
|
||||||
Width = 75
|
|
||||||
};
|
|
||||||
btnOk.Click += (s, e) =>
|
|
||||||
{
|
|
||||||
InputText = txtInput.Text;
|
|
||||||
this.DialogResult = DialogResult.OK;
|
|
||||||
this.Close();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 取消按钮
|
|
||||||
btnCancel = new Button
|
|
||||||
{
|
|
||||||
Text = "取消",
|
|
||||||
DialogResult = DialogResult.Cancel,
|
|
||||||
Location = new Point(270, 85),
|
|
||||||
Width = 75
|
|
||||||
};
|
|
||||||
|
|
||||||
this.Controls.AddRange(new Control[] { lblPrompt, txtInput, btnOk, btnCancel });
|
|
||||||
this.AcceptButton = btnOk;
|
|
||||||
this.CancelButton = btnCancel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>便捷静态方法:弹出输入框并返回输入内容,取消返回 null</summary>
|
/// <param name="inputType">输入类型,数字按当前区域格式验证。</param>
|
||||||
public static string Show(string prompt, string title = "输入", string defaultValue = "")
|
/// <param name="validator">类型验证通过后调用;返回错误信息,null 或空字符串表示通过。</param>
|
||||||
|
public InputDialog(string prompt, string title = "输入", string defaultValue = "",
|
||||||
|
InputDialogType inputType = InputDialogType.Text, Func<string, string> validator = null)
|
||||||
{
|
{
|
||||||
using (var dlg = new InputDialog(prompt, title, defaultValue))
|
if (!Enum.IsDefined(typeof(InputDialogType), inputType))
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(inputType));
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
this.inputType = inputType;
|
||||||
|
this.validator = validator;
|
||||||
|
Text = title;
|
||||||
|
lblPrompt.Text = prompt;
|
||||||
|
txtInput.Text = defaultValue;
|
||||||
|
txtInput.SelectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOk_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string value = txtInput.Text;
|
||||||
|
string error = null;
|
||||||
|
if (inputType == InputDialogType.Integer && !int.TryParse(value, out _))
|
||||||
|
error = "请输入有效的整数(-2147483648 至 2147483647)。";
|
||||||
|
else if (inputType == InputDialogType.Decimal && !decimal.TryParse(value, out _))
|
||||||
|
error = "请输入有效的小数。";
|
||||||
|
else if (validator != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
error = validator(value);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
error = "验证失败:" + ex.Message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lblError.Text = error ?? string.Empty;
|
||||||
|
if (!string.IsNullOrEmpty(error))
|
||||||
|
{
|
||||||
|
txtInput.Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputText = value;
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtInput_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
lblError.Text = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>弹出输入框并返回输入内容,取消返回 null;validator 返回错误信息,空值表示通过。</summary>
|
||||||
|
public static string Show(string prompt, string title = "输入", string defaultValue = "",
|
||||||
|
InputDialogType inputType = InputDialogType.Text, Func<string, string> validator = null)
|
||||||
|
{
|
||||||
|
using (var dlg = new InputDialog(prompt, title, defaultValue, inputType, validator))
|
||||||
{
|
{
|
||||||
return dlg.ShowDialog() == DialogResult.OK ? dlg.InputText : null;
|
return dlg.ShowDialog() == DialogResult.OK ? dlg.InputText : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>输入数值,取消返回 null;支持整数、float、double 和 decimal,按当前区域格式解析。</summary>
|
||||||
|
/// <param name="validator">接收解析后的数值,返回错误信息;null 或空字符串表示通过。</param>
|
||||||
|
public static T? Show<T>(string prompt, string title = "输入", T defaultValue = default,
|
||||||
|
Func<T, string> validator = null) where T : struct, IConvertible
|
||||||
|
{
|
||||||
|
var typeCode = Type.GetTypeCode(typeof(T));
|
||||||
|
if (typeof(T).IsEnum || typeCode < TypeCode.SByte || typeCode > TypeCode.Decimal)
|
||||||
|
throw new NotSupportedException("仅支持整数、float、double 和 decimal 类型。");
|
||||||
|
|
||||||
|
T value = default;
|
||||||
|
using (var dlg = new InputDialog(prompt, title, defaultValue.ToString(CultureInfo.CurrentCulture),
|
||||||
|
validator: text => ValidateNumber(text, validator, out value)))
|
||||||
|
{
|
||||||
|
return dlg.ShowDialog() == DialogResult.OK ? value : (T?)null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ValidateNumber<T>(string text, Func<T, string> validator, out T value)
|
||||||
|
where T : struct, IConvertible
|
||||||
|
{
|
||||||
|
value = default;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
value = (T)Convert.ChangeType(text, typeof(T), CultureInfo.CurrentCulture);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
return $"请输入有效的 {typeof(T).Name} 数值。";
|
||||||
|
}
|
||||||
|
catch (OverflowException)
|
||||||
|
{
|
||||||
|
return $"输入超出 {typeof(T).Name} 的取值范围。";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value is float single && (float.IsNaN(single) || float.IsInfinity(single))
|
||||||
|
|| value is double number && (double.IsNaN(number) || double.IsInfinity(number)))
|
||||||
|
return "请输入有限数值。";
|
||||||
|
|
||||||
|
return validator?.Invoke(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum InputDialogType
|
||||||
|
{
|
||||||
|
Text,
|
||||||
|
Integer,
|
||||||
|
Decimal
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
+2010
-2010
File diff suppressed because it is too large.
Load diff
@@ -275,7 +275,6 @@ namespace TemuKJD.WXForms.AdminForms
|
|||||||
private void btnRefresh_Click(object sender, EventArgs e)
|
private void btnRefresh_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ucSplitPage1.CurrentPage = 1;
|
ucSplitPage1.CurrentPage = 1;
|
||||||
GetUser();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dgvUser_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
private void dgvUser_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
|||||||
+566
-507
File diff suppressed because it is too large.
Load diff
@@ -2,6 +2,7 @@
|
|||||||
using AllBase.Model.DBModel;
|
using AllBase.Model.DBModel;
|
||||||
using AllBase.Model.Result;
|
using AllBase.Model.Result;
|
||||||
using NaiBa.Util.Extension;
|
using NaiBa.Util.Extension;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -15,190 +16,260 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TemuKJD.BaseForms;
|
using TemuKJD.BaseForms;
|
||||||
|
using TemuKJD.UserComponent;
|
||||||
using Work;
|
using Work;
|
||||||
|
using Work.GoodDetail;
|
||||||
|
|
||||||
namespace TemuKJD.WXForms.AdminForms
|
namespace TemuKJD.WXForms.AdminForms
|
||||||
{
|
{
|
||||||
public partial class WxAdminOemManageForm : BaseForm
|
public partial class WxAdminOemManageForm : BaseForm
|
||||||
{
|
{
|
||||||
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
|
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
|
||||||
public WxAdminOemManageForm()
|
private DataGridViewRow SelectedRow { get; set; }
|
||||||
{
|
public WxAdminOemManageForm()
|
||||||
InitializeComponent();
|
{
|
||||||
}
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
private void WxOemManageForm_Load(object sender, EventArgs e)
|
private void WxOemManageForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
IsFormLoad = true;
|
IsFormLoad = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WxOemManageForm_VisibleChanged(object sender, EventArgs e)
|
private void WxOemManageForm_VisibleChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (IsFirstVisibile)
|
if (IsFirstVisibile)
|
||||||
{
|
{
|
||||||
btnSearch_Click(null, null);
|
btnSearch_Click(null, null);
|
||||||
|
|
||||||
IsFirstVisibile = false;
|
IsFirstVisibile = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnAddMdy_Click(object sender, EventArgs e)
|
private void btnAddMdy_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StringBuilder data = new StringBuilder();
|
StringBuilder data = new StringBuilder();
|
||||||
data.Append(UserLogin.GetSignaturex());
|
data.Append(UserLogin.GetSignaturex());
|
||||||
data.Append("&oem_id=" + GetHtml.UrlEncodeUtf8(txtOemId.Text.Trim()));
|
data.Append("&oem_id=" + GetHtml.UrlEncodeUtf8(txtOemId.Text.Trim()));
|
||||||
data.Append("&oem_name=" + GetHtml.UrlEncodeUtf8(txtOemName.Text.Trim()));
|
data.Append("&oem_name=" + GetHtml.UrlEncodeUtf8(txtOemName.Text.Trim()));
|
||||||
data.Append("&oem_owner=" + GetHtml.UrlEncodeUtf8(txtOemOwner.Text.Trim()));
|
data.Append("&oem_owner=" + GetHtml.UrlEncodeUtf8(txtOemOwner.Text.Trim()));
|
||||||
|
data.Append("&parent_oemid=" + GetHtml.UrlEncodeUtf8(txtParentOemId.Text.Trim()));
|
||||||
|
string url = BaseClass.BuildWXObjString("user/add_mdy_oem");
|
||||||
|
string html = GetHtml.PostUtf8(url, data.ToString()).Trim();
|
||||||
|
|
||||||
string url = BaseClass.BuildWXObjString("user/add_mdy_oem");
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||||
string html = GetHtml.PostUtf8(url, data.ToString()).Trim();
|
{
|
||||||
|
var msg = BaseRegex.GetStringJson(ref html, "msg");
|
||||||
|
if (string.IsNullOrEmpty(msg))
|
||||||
|
msg = html;
|
||||||
|
BaseMsgForm.ShowError(msg, "错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
btnCancelEdit_Click(null, null);
|
||||||
|
btnSearch_Click(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
private void btnCancelEdit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var msg = BaseRegex.GetStringJson(ref html, "msg");
|
txtOemId.Text = "";
|
||||||
if (string.IsNullOrEmpty(msg))
|
txtOemName.Text = "";
|
||||||
msg = html;
|
txtOemOwner.Text = "";
|
||||||
BaseMsgForm.ShowError(msg, "错误");
|
txtOemId.ReadOnly = false;
|
||||||
return;
|
txtParentOemId.ReadOnly = false;
|
||||||
}
|
txtParentOemId.Text = "";
|
||||||
if (btnAddMdy.Text != "添加贴牌")
|
btnAddMdy.Text = "添加贴牌";
|
||||||
btnCancelEdit_Click(null, null);
|
}
|
||||||
btnSearch_Click(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnCancelEdit_Click(object sender, EventArgs e)
|
private void lblRandomOemId_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||||
{
|
{
|
||||||
txtOemId.Text = "";
|
this.txtOemId.Text = DateTime.Now.ToString("yy") + Randomx.GetNumber(2) + Randomx.GetWordWithNumber(4);
|
||||||
txtOemName.Text = "";
|
}
|
||||||
txtOemOwner.Text = "";
|
|
||||||
txtOemId.ReadOnly = false;
|
|
||||||
btnAddMdy.Text = "添加贴牌";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void lblRandomOemId_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
public string DbId = "";
|
||||||
{
|
private void dgvOem_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
this.txtOemId.Text = DateTime.Now.ToString("yy") + Randomx.GetNumber(2) + Randomx.GetWordWithNumber(4);
|
{
|
||||||
}
|
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||||
|
return;
|
||||||
|
string columText = dgvOem.Columns[e.ColumnIndex].HeaderText;
|
||||||
|
string columName = dgvOem.Columns[e.ColumnIndex].Name;
|
||||||
|
string id = dgvOem.Rows[e.RowIndex].Cells["colId"].Value.ToString();
|
||||||
|
string oemId = dgvOem.Rows[e.RowIndex].Cells["colOemId"].Value.ToString();
|
||||||
|
string oemName = dgvOem.Rows[e.RowIndex].Cells["colOemName"].Value.ToString();
|
||||||
|
string oemOwner = dgvOem.Rows[e.RowIndex].Cells["colOemOwner"].Value.ToString();
|
||||||
|
string parentOemId = dgvOem.Rows[e.RowIndex].Cells["colParentOemId"].Value.ToString();
|
||||||
|
var row = dgvOem.Rows[e.RowIndex];
|
||||||
|
if (columText == "编辑")
|
||||||
|
{
|
||||||
|
DbId = id;
|
||||||
|
txtOemId.ReadOnly = true;
|
||||||
|
txtParentOemId.ReadOnly = true;
|
||||||
|
txtOemId.Text = oemId;
|
||||||
|
txtOemName.Text = oemName;
|
||||||
|
txtOemOwner.Text = oemOwner;
|
||||||
|
txtParentOemId.Text = parentOemId;
|
||||||
|
|
||||||
public string DbId = "";
|
btnAddMdy.Text = "编辑贴牌";
|
||||||
private void dgvOem_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
}
|
||||||
{
|
if (columText == "删除")
|
||||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
{
|
||||||
return;
|
if (BaseMsgForm.ShowConfirm("是否删除,删除后无法再次添加", "提示").DialogResult == DialogResult.OK)
|
||||||
string columText = dgvOem.Columns[e.ColumnIndex].HeaderText;
|
{
|
||||||
string columName = dgvOem.Columns[e.ColumnIndex].Name;
|
DeleteOem(id);
|
||||||
string id = dgvOem.Rows[e.RowIndex].Cells["colId"].Value.ToString();
|
}
|
||||||
string oemId = dgvOem.Rows[e.RowIndex].Cells["colOemId"].Value.ToString();
|
}
|
||||||
string oemName = dgvOem.Rows[e.RowIndex].Cells["colOemName"].Value.ToString();
|
if (columText == "选择")
|
||||||
string oemOwner = dgvOem.Rows[e.RowIndex].Cells["colOemOwner"].Value.ToString();
|
{
|
||||||
var row = dgvOem.Rows[e.RowIndex];
|
foreach (DataGridViewRow item in dgvOem.Rows)
|
||||||
if (columText == "编辑")
|
{
|
||||||
{
|
item.Cells["colCheck"].Value = false;
|
||||||
DbId = id;
|
}
|
||||||
txtOemId.ReadOnly = true;
|
SelectedRow = dgvOem.Rows[e.RowIndex];
|
||||||
txtOemId.Text = oemId;
|
SelectedRow.Cells["colCheck"].Value = true;
|
||||||
txtOemName.Text = oemName;
|
|
||||||
txtOemOwner.Text = oemOwner;
|
|
||||||
btnAddMdy.Text = "编辑贴牌";
|
|
||||||
}
|
|
||||||
if (columText == "删除")
|
|
||||||
{
|
|
||||||
if (BaseMsgForm.ShowConfirm("是否删除,删除后无法再次添加", "提示").DialogResult == DialogResult.OK)
|
|
||||||
{
|
|
||||||
DeleteOem(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteOem(string dbId)
|
}
|
||||||
{
|
}
|
||||||
StringBuilder data = new StringBuilder();
|
|
||||||
data.Append(UserLogin.GetSignaturex());
|
|
||||||
data.Append("&db_id=" + dbId);
|
|
||||||
|
|
||||||
string url = BaseClass.BuildWXObjString("user/del_oem");
|
private void DeleteOem(string dbId)
|
||||||
string html = GetHtml.PostUtf8(url, data.ToString()).Trim();
|
{
|
||||||
|
StringBuilder data = new StringBuilder();
|
||||||
|
data.Append(UserLogin.GetSignaturex());
|
||||||
|
data.Append("&db_id=" + dbId);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
string url = BaseClass.BuildWXObjString("user/del_oem");
|
||||||
{
|
string html = GetHtml.PostUtf8(url, data.ToString()).Trim();
|
||||||
var msg = BaseRegex.GetStringJson(ref html, "msg");
|
|
||||||
if (string.IsNullOrEmpty(msg))
|
|
||||||
msg = html;
|
|
||||||
BaseMsgForm.ShowError(msg, "错误");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
btnSearch_Click(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnSearch_Click(object sender, EventArgs e)
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||||
{
|
{
|
||||||
if (cancellationTokenSource != null)
|
var msg = BaseRegex.GetStringJson(ref html, "msg");
|
||||||
cancellationTokenSource.Cancel();
|
if (string.IsNullOrEmpty(msg))
|
||||||
dgvOem.Rows.Clear();
|
msg = html;
|
||||||
|
BaseMsgForm.ShowError(msg, "错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
btnSearch_Click(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
cancellationTokenSource = new CancellationTokenSource();
|
private void btnSearch_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (cancellationTokenSource != null)
|
||||||
|
cancellationTokenSource.Cancel();
|
||||||
|
dgvOem.Rows.Clear();
|
||||||
|
|
||||||
Task.Run(() => {
|
cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
var cancelToken = cancellationTokenSource;
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
|
||||||
StringBuilder data = new StringBuilder();
|
var cancelToken = cancellationTokenSource;
|
||||||
data.Append(UserLogin.GetSignaturex());
|
|
||||||
data.Append("&oem_id=" + GetHtml.UrlEncodeUtf8(txtSearchOemId.Text.Trim()));
|
|
||||||
data.Append("&oem_name=" + GetHtml.UrlEncodeUtf8(txtSearchOemName.Text.Trim()));
|
|
||||||
|
|
||||||
string url = BaseClass.BuildWXObjString("user/get_oem");
|
StringBuilder data = new StringBuilder();
|
||||||
string html = GetHtml.PostUtf8(url, data.ToString()).Trim();
|
data.Append(UserLogin.GetSignaturex());
|
||||||
|
data.Append("&oem_id=" + GetHtml.UrlEncodeUtf8(txtSearchOemId.Text.Trim()));
|
||||||
|
data.Append("&oem_name=" + GetHtml.UrlEncodeUtf8(txtSearchOemName.Text.Trim()));
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
string url = BaseClass.BuildWXObjString("user/get_oem");
|
||||||
{
|
string html = GetHtml.PostUtf8(url, data.ToString()).Trim();
|
||||||
var msg = BaseRegex.GetStringJson(ref html, "msg");
|
|
||||||
if (string.IsNullOrEmpty(msg))
|
|
||||||
msg = html;
|
|
||||||
BaseMsgForm.ShowError(msg, "错误");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var jArr = JObject.Parse(html)["data"];
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||||
|
{
|
||||||
|
var msg = BaseRegex.GetStringJson(ref html, "msg");
|
||||||
|
if (string.IsNullOrEmpty(msg))
|
||||||
|
msg = html;
|
||||||
|
BaseMsgForm.ShowError(msg, "错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var jArr = JObject.Parse(html)["data"];
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = JsonHelper.DeserializeJsonToList<oem>(JsonHelper.SerializeObject(jArr)).ToList();
|
var list = JsonHelper.DeserializeJsonToList<oem>(JsonHelper.SerializeObject(jArr)).ToList();
|
||||||
|
|
||||||
Invoke(new Action(() => { dgvOem.Rows.Clear(); }));
|
Invoke(new Action(() => { dgvOem.Rows.Clear(); }));
|
||||||
|
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
{
|
{
|
||||||
if (cancelToken.IsCancellationRequested)
|
if (cancelToken.IsCancellationRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Invoke(new Action(() =>
|
Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
this.dgvOem.Rows.Add(
|
this.dgvOem.Rows.Add(
|
||||||
false,
|
false,
|
||||||
item.id,
|
item.id,
|
||||||
item.oem_id,
|
item.oem_id,
|
||||||
item.oem_name,
|
item.oem_name,
|
||||||
item.oem_owner,
|
item.oem_owner,
|
||||||
"",
|
item.parent_oem_id,
|
||||||
"",
|
"",
|
||||||
"编辑",
|
"",
|
||||||
"删除"
|
"编辑",
|
||||||
);
|
"删除"
|
||||||
}));
|
);
|
||||||
}
|
}));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
}, cancellationTokenSource.Token);
|
}
|
||||||
}
|
}, cancellationTokenSource.Token);
|
||||||
|
}
|
||||||
|
|
||||||
private void btnClear_Click(object sender, EventArgs e)
|
private void btnClear_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
txtSearchOemId.Text = "";
|
txtSearchOemId.Text = "";
|
||||||
txtSearchOemName.Text = "";
|
txtSearchOemName.Text = "";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private async void btn_SetMarkup_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
btn_SetMarkup.Enabled = true;
|
||||||
|
if (SelectedRow == null)
|
||||||
|
{
|
||||||
|
BaseMsgForm.ShowError("必须选择一条");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string parent_oemId = SelectedRow.Cells["colParentOemId"].Value.ToString();
|
||||||
|
if (string.IsNullOrEmpty(parent_oemId))
|
||||||
|
{
|
||||||
|
BaseMsgForm.ShowError("必须有父级代理");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string oemName = SelectedRow.Cells["colOemName"].Value.ToString();
|
||||||
|
string oemId = SelectedRow.Cells["colOemId"].Value.ToString();
|
||||||
|
var value = InputDialog.Show<decimal>($"{oemName} 加价 (元)", "所有类型加价", 0, v =>
|
||||||
|
{
|
||||||
|
if (v < 0) return "加价不能小于0";
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
if (value.HasValue == false) return;
|
||||||
|
|
||||||
|
string url = BaseClass.BuildWXObjString("user/SetMarkupRule");
|
||||||
|
var data = UserLogin.GetSignPostData(new
|
||||||
|
{
|
||||||
|
TargetType = 1,
|
||||||
|
TargetId = oemId,
|
||||||
|
PaymentType = 20,
|
||||||
|
Markup = (int)(value.Value * 100m)
|
||||||
|
});
|
||||||
|
string html = await GetHtml.PostJsonAsync(url, data);
|
||||||
|
var result = JsonConvert.DeserializeObject<Result>(html);
|
||||||
|
if (result.Code != 200)
|
||||||
|
{
|
||||||
|
throw new Exception(result.Msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
BaseMsgForm.ShowError(ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
btn_SetMarkup.Enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -126,6 +126,9 @@
|
|||||||
<metadata name="colOemOwner.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="colOemOwner.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="colParentOemId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="colIco.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="colIco.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net462</TargetFramework>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<LangVersion>12</LangVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="../../TEMUKJD/UserComponent/InputDialog.cs" Link="InputDialog.cs" />
|
||||||
|
<Compile Include="../../TEMUKJD/UserComponent/InputDialog.Designer.cs" Link="InputDialog.Designer.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace TemuKJD.UserComponent;
|
||||||
|
|
||||||
|
public partial class InputDialog
|
||||||
|
{
|
||||||
|
[STAThread]
|
||||||
|
private static void Main()
|
||||||
|
{
|
||||||
|
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||||
|
Check(ValidateNumber<int>("123", null, out var integer) == null && integer == 123, "泛型 int");
|
||||||
|
Check(ValidateNumber<float>("1.25", null, out var single) == null && single == 1.25f, "泛型 float");
|
||||||
|
Check(ValidateNumber<double>("1e100", null, out var number) == null && number == 1e100, "泛型 double");
|
||||||
|
Check(ValidateNumber<decimal>("12.50", null, out var amount) == null && amount == 12.50m, "泛型 decimal");
|
||||||
|
Check(ValidateNumber<long>("9223372036854775807", null, out var large) == null && large == long.MaxValue, "泛型 long");
|
||||||
|
Check(ValidateNumber<uint>("-1", null, out _) != null, "无符号负数");
|
||||||
|
Check(ValidateNumber<int>("2147483648", null, out _) != null, "泛型整数溢出");
|
||||||
|
Check(ValidateNumber<float>("1e100", null, out _) != null, "浮点溢出");
|
||||||
|
foreach (string invalid in new[] { "", "abc", "NaN", "Infinity", "-Infinity" })
|
||||||
|
Check(ValidateNumber<double>(invalid, _ => throw new Exception("不应调用"), out _) != null, "无效浮点数:" + invalid);
|
||||||
|
Check(ValidateNumber<int>("0", value => value > 0 ? null : "必须大于零", out _) == "必须大于零", "类型化回调");
|
||||||
|
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr-FR");
|
||||||
|
Check(ValidateNumber<double>("1,5", null, out var localized) == null && localized == 1.5, "区域格式");
|
||||||
|
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||||
|
foreach (string value in new[] { "0", "-2147483648", "2147483647" })
|
||||||
|
CheckAccepted(InputDialogType.Integer, value);
|
||||||
|
foreach (string value in new[] { "", "1.5", "abc", "2147483648" })
|
||||||
|
{
|
||||||
|
using var dialog = new InputDialog("整数", defaultValue: value,
|
||||||
|
inputType: InputDialogType.Integer, validator: _ => throw new Exception("不应调用"));
|
||||||
|
dialog.btnOk_Click(null, EventArgs.Empty);
|
||||||
|
Check(dialog.DialogResult == DialogResult.None && dialog.lblError.Text.StartsWith("请输入"), "整数拒绝:" + value);
|
||||||
|
Check(dialog.InputText == "", "失败不能提交输入");
|
||||||
|
}
|
||||||
|
CheckAccepted(InputDialogType.Text, "");
|
||||||
|
CheckAccepted(InputDialogType.Decimal, "-12.50");
|
||||||
|
using (var dialog = new InputDialog("小数", defaultValue: "79228162514264337593543950336",
|
||||||
|
inputType: InputDialogType.Decimal))
|
||||||
|
{
|
||||||
|
dialog.btnOk_Click(null, EventArgs.Empty);
|
||||||
|
Check(dialog.DialogResult == DialogResult.None && dialog.lblError.Text != "", "小数溢出");
|
||||||
|
}
|
||||||
|
|
||||||
|
int calls = 0;
|
||||||
|
using (var dialog = new InputDialog("名称", validator: value =>
|
||||||
|
{
|
||||||
|
calls++;
|
||||||
|
return value == "有效" ? null : "名称无效";
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
dialog.btnOk_Click(null, EventArgs.Empty);
|
||||||
|
Check(dialog.DialogResult == DialogResult.None && dialog.lblError.Text == "名称无效", "回调错误");
|
||||||
|
dialog.txtInput.Text = "有效";
|
||||||
|
Check(dialog.lblError.Text == "", "编辑清除错误");
|
||||||
|
dialog.btnOk_Click(null, EventArgs.Empty);
|
||||||
|
Check(dialog.DialogResult == DialogResult.OK && dialog.InputText == "有效" && calls == 2, "回调通过");
|
||||||
|
}
|
||||||
|
using (var dialog = new InputDialog("异常", validator: _ => throw new InvalidOperationException("测试异常")))
|
||||||
|
{
|
||||||
|
dialog.btnOk_Click(null, EventArgs.Empty);
|
||||||
|
Check(dialog.DialogResult == DialogResult.None && dialog.lblError.Text.Contains("测试异常"), "回调异常");
|
||||||
|
Check(((Button)dialog.AcceptButton).DialogResult == DialogResult.None, "确定按钮不得绕过验证");
|
||||||
|
Check(((Button)dialog.CancelButton).DialogResult == DialogResult.Cancel, "取消按钮");
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dialog = new InputDialog("非法类型", inputType: (InputDialogType)99);
|
||||||
|
throw new Exception("非法类型未拒绝");
|
||||||
|
}
|
||||||
|
catch (ArgumentOutOfRangeException) { }
|
||||||
|
Console.WriteLine("InputDialog self-checks passed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CheckAccepted(InputDialogType type, string value)
|
||||||
|
{
|
||||||
|
using var dialog = new InputDialog("输入", defaultValue: value, inputType: type, validator: _ => "");
|
||||||
|
dialog.btnOk_Click(null, EventArgs.Empty);
|
||||||
|
Check(dialog.DialogResult == DialogResult.OK && dialog.InputText == value, "接受:" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Check(bool condition, string message)
|
||||||
|
{
|
||||||
|
if (!condition)
|
||||||
|
throw new Exception(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -143,7 +143,7 @@ namespace KJD.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestWXToPDDV4()
|
public void TestWXToPDDV4()
|
||||||
{
|
{
|
||||||
string filePath = @"C:\Users\chaih\Documents\xwechat_files\hongfei357_a567\msg\file\2026-10\10001443620622.json";
|
string filePath = @"C:\Users\chaih\Documents\xwechat_files\hongfei357_a567\msg\file\2026-11\10000087348819.txt";
|
||||||
var frontProdInfo = ConverterToPddFactory.Convert(filePath);
|
var frontProdInfo = ConverterToPddFactory.Convert(filePath);
|
||||||
var isMatch = frontProdInfo != null;
|
var isMatch = frontProdInfo != null;
|
||||||
Console.WriteLine(frontProdInfo.Skus.Count);
|
Console.WriteLine(frontProdInfo.Skus.Count);
|
||||||
|
|||||||
Reference in new issue
Block a user