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 LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm { public partial class ControlSetSuperSmallForm : LYFZ.Software.UI.CameraControlBook.SuperSmallForm.ControlSetSuperSmallForm { LYFZ.BLL.BLL_ErpSystemConfigure scbll = new LYFZ.BLL.BLL_ErpSystemConfigure(); public ControlSetSuperSmallForm() { this.Load += ControlSetSuperSmallForm_Load; this.btnSaveed.Click += btnSaveed_Click; this.btnCancel.Click += btnCancel_Click; this.txtWedding.KeyPress += txtWedding_KeyPress; this.txtChild.KeyPress += txtChild_KeyPress; this.txtPortrait.KeyPress += txtPortrait_KeyPress; this.txtOther.KeyPress += txtOther_KeyPress; } /// /// 是否保存 /// public bool IsSaveed = false; /// /// 加载类型 /// public ControlSet enumControlSet; /// /// 加载设置类型 /// public enum ControlSet { 拍照客人 = 0, 选片客人 = 1, 看设计客人 = 2, 选礼服客人 = 3, 服务客人 } LYFZ.Model.Model_ErpSystemConfigure model; /// /// 窗体加载 /// /// /// void ControlSetSuperSmallForm_Load(object sender, EventArgs e) { switch (enumControlSet) { case ControlSet.拍照客人: this.panelSeparate.Visible = true; break; case ControlSet.选片客人: case ControlSet.看设计客人: case ControlSet.服务客人: case ControlSet.选礼服客人: this.panelOther.Visible = true; break; } model = scbll.GetModel("Sconfig_Code", "DayRemind"); if (model.ID > 0 && !string.IsNullOrEmpty(model.Sconfig_Value)) { string[] StrArray = model.Sconfig_Value.Trim().Split('|'); switch (enumControlSet) { case ControlSet.拍照客人: string[] StrArray2 = StrArray[0].Trim().Split(','); if (StrArray2.Length >= 1 && StrArray2[0].Trim().Length > 0) { this.txtWedding.Text = StrArray2[0].Trim(); } if (StrArray2.Length >= 2 && StrArray2[1].Trim().Length > 0) { this.txtChild.Text = StrArray2[1].Trim(); } else { this.txtChild.Text = "0"; } if (StrArray2.Length >= 3 && StrArray2[2].Trim().Length > 0) { this.txtPortrait.Text = StrArray2[2].Trim(); } else { this.txtPortrait.Text = "0"; } break; case ControlSet.选片客人: this.txtOther.Text = StrArray[1].Trim(); break; case ControlSet.看设计客人: this.txtOther.Text = StrArray[2].Trim(); break; case ControlSet.选礼服客人: this.txtOther.Text = StrArray[3].Trim(); break; case ControlSet.服务客人: this.txtOther.Text = StrArray[4].Trim(); break; } } } /// /// 保存 /// /// /// void btnSaveed_Click(object sender, EventArgs e) { if (model != null) { string[] strArray = model.Sconfig_Value.Trim().Split('|'); switch (enumControlSet) { case ControlSet.拍照客人: if (string.IsNullOrEmpty(this.txtWedding.Text.Trim())) { MessageBoxCustom.Show("婚纱订单数量不能为空!"); return; } if (string.IsNullOrEmpty(this.txtChild.Text.Trim())) { MessageBoxCustom.Show("儿童订单数量不能为空!"); return; } if (string.IsNullOrEmpty(this.txtPortrait.Text.Trim())) { MessageBoxCustom.Show("写真订单数量不能为空!"); return; } strArray[0] = Convert.ToInt32(this.txtWedding.Text) + "," + Convert.ToInt32(this.txtChild.Text) + "," + Convert.ToInt32(this.txtPortrait.Text); break; case ControlSet.选片客人: if (string.IsNullOrEmpty(this.txtOther.Text.Trim())) { MessageBoxCustom.Show("订单数量不能为空!"); return; } strArray[1] = Convert.ToInt32(this.txtOther.Text).ToString(); break; case ControlSet.看设计客人: if (string.IsNullOrEmpty(this.txtOther.Text.Trim())) { MessageBoxCustom.Show("订单数量不能为空!"); return; } strArray[2] = Convert.ToInt32(this.txtOther.Text).ToString(); break; case ControlSet.选礼服客人: if (string.IsNullOrEmpty(this.txtOther.Text.Trim())) { MessageBoxCustom.Show("订单数量不能为空!"); return; } strArray[3] = Convert.ToInt32(this.txtOther.Text).ToString(); break; case ControlSet.服务客人: if (string.IsNullOrEmpty(this.txtOther.Text.Trim())) { MessageBoxCustom.Show("订单数量不能为空!"); return; } strArray[4] = Convert.ToInt32(this.txtOther.Text).ToString(); break; } model.Sconfig_Value = string.Join("|", strArray); if (!scbll.Update(model)) { MessageBoxCustom.Show("保存失败!"); return; } this.IsSaveed = true; this.btnCancel.Text = " 关 闭"; MessageBoxCustom.Show("保存成功!"); } } /// /// 取消 /// /// /// void btnCancel_Click(object sender, EventArgs e) { this.Close(); } /// /// 文本框限制输入 /// /// /// void txtWedding_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar)) { e.Handled = true; } } /// /// 文本框限制输入 /// /// /// void txtChild_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar)) { e.Handled = true; } } /// /// 文本框限制输入 /// /// /// void txtPortrait_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar)) { e.Handled = true; } } /// /// 文本框限制输入 /// /// /// void txtOther_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar)) { e.Handled = true; } } } }