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; namespace MyHouse.WebAPITool { public partial class FrmCardAdd : RySkins.SKinForm { public int isAdd = 1; public int selectId = 0; public FrmCardAdd() { InitializeComponent(); CbbRepayDateMode.SelectedIndex = 0; } #region 需要修改 public void GetInfo(int id) { selectId = id; string post_str = "api=GetCard&id=" + id; var jsonResult = API.API.Post("Card", "GetCard", post_str); if (jsonResult.IsOK) { DataTable data = jsonResult.List; if (data.Rows.Count > 0) { DataRow row = data.Rows[0]; txtBankName.Text = row["BankName"].ToString(); TxtCardNum.Text = row["CardNum"].ToString(); TxtBillDate.Text= row["BillDate"].ToString(); CbbRepayDateMode.SelectedIndex = row["RePayDateMode"].ToInt(0, 1, 0); TxtRePayDate.Text = row["RePayDate"].ToString(); TxtDes.Text = row["Des"].ToString(); ChkEnabled.Checked = row["Enabled"].ToBool(); var OutTime = row["OutTime"].ToInt64(); DtOutTime.Checked = OutTime > 0; DtOutTime.Value = OutTime.ToDateTime(); var StartTime = row["StartTime"].ToInt(); DtStartTime.Checked = StartTime > 0; if (StartTime > 0) { var day = StartTime % 100; var month = (StartTime - day) / 100; DtStartTime.Value = new DateTime(2000, month, day); } } } else { API.API.ErrorJson(jsonResult); } } private void BtnOK_Click(object sender, EventArgs e) { if (txtBankName.Text == "") { RySkins.Msg.ShowMsg("银行名称不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (TxtCardNum.Text == "") { RySkins.Msg.ShowMsg("银行卡号不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string post_str = "api=SaveCard&id=" + selectId+ "&BankName=" + RyWeb.WebDecode.UrlEncode(txtBankName.Text) + "&CardNum=" + RyWeb.WebDecode.UrlEncode(TxtCardNum.Text)+ "&BillDate=" + TxtBillDate.Text.ToInt() + "&RePayDateMode=" +CbbRepayDateMode.SelectedIndex+ "&RePayDate=" + TxtRePayDate.Text.ToInt()+ "&Des=" + RyWeb.WebDecode.UrlEncode(TxtDes.Text) + "&Enabled=" +(ChkEnabled.Checked?1:0)+ "&StartTime=" + (DtStartTime.Checked ? DtStartTime.Value.Month*100 + DtStartTime.Value.Day : 0) + "&OutTime=" + (DtOutTime.Checked? DtOutTime.Value.ToInt64():0); var jsonResult = API.API.Post("Card", "SaveCard", post_str); if (jsonResult.IsOK) { DialogResult = DialogResult.OK; } else { API.API.ErrorJson(jsonResult); } } #endregion private void BtnCancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; } } }