123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- 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 AlertSettingSuperSmallForm : LYFZ.Software.UI.CameraControlBook.SuperSmallForm.AlertSettingSuperSmallForm
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
- public AlertSettingSuperSmallForm()
- {
- this.Load += AlertSettingSuperSmallForm_Load;
- this.btnSaveed.Click += btnSaveed_Click;
- this.btnColseed.Click += btnColseed_Click;
- this.chkSelectionFilm_OriginalFilm.Click += chkSelectionFilm_OriginalFilm_Click;
- this.chkSelectionFilm_EarlyRepair.Click += chkSelectionFilm_EarlyRepair_Click;
- this.txtSelectionFilm.KeyPress += txtSelectionFilm_KeyPress;
- this.txtLookDesign.KeyPress += txtLookDesign_KeyPress;
- this.txtPickup.KeyPress += txtPickup_KeyPress;
- this.txtSelectionFilm.Leave += txtSelectionFilm_Leave;
- this.txtLookDesign.Leave += txtLookDesign_Leave;
- this.txtPickup.Leave += txtPickup_Leave;
- }
-
-
-
- public bool IsSaveed = false;
- string StrID = "";
-
-
-
-
-
- void AlertSettingSuperSmallForm_Load(object sender, EventArgs e)
- {
- DataTable dt = orbll.GetView_Custom("tb_ErpSystemConfigure", StrWhere: "Sconfig_Code = 'ReservationDateBeforeRemind'", ShowColumnName: "ID,Sconfig_Value").Tables[0];
- if (dt.Rows.Count > 0)
- {
- StrID = dt.Rows[0]["ID"].ToString().Trim();
- DataTable tbl = new Json.JsontoDataTable().toObject(dt.Rows[0]["Sconfig_Value"].ToString().Trim());
- for (int i = 0; i < tbl.Rows.Count; i++)
- {
- switch (tbl.Rows[i]["StrCode"].ToString().Trim())
- {
- case "SelectionFilm":
- this.chk_SelectionFilm.Checked = Convert.ToBoolean(tbl.Rows[i]["StrIsShow"].ToString().Trim());
- this.txtSelectionFilm.Text = tbl.Rows[i]["StrValue"].ToString().Trim();
- switch (tbl.Rows[i]["StrValueType"].ToString().Trim())
- {
- case "EarlyRepair":
- this.chkSelectionFilm_EarlyRepair.Checked = true;
- this.chkSelectionFilm_OriginalFilm.Checked = false;
- break;
- case "OriginalFilm":
- this.chkSelectionFilm_EarlyRepair.Checked = false;
- this.chkSelectionFilm_OriginalFilm.Checked = true;
- break;
- }
- break;
- case "LookDesign":
- this.chk_LookDesign.Checked = Convert.ToBoolean(tbl.Rows[i]["StrIsShow"].ToString().Trim());
- this.txtLookDesign.Text = tbl.Rows[i]["StrValue"].ToString().Trim();
- break;
- case "Pickup":
- this.chk_Pickup.Checked = Convert.ToBoolean(tbl.Rows[i]["StrIsShow"].ToString().Trim());
- this.txtPickup.Text = tbl.Rows[i]["StrValue"].ToString().Trim();
- break;
- }
- }
- }
- }
-
-
-
-
-
- void btnSaveed_Click(object sender, EventArgs e)
- {
- if (!this.chkSelectionFilm_EarlyRepair.Checked && !this.chkSelectionFilm_OriginalFilm.Checked)
- { MessageBoxCustom.Show("选片预约前未导片,必须选择'按原片'或'按初修片'"); return; }
- if(string.IsNullOrEmpty(this.txtSelectionFilm.Text))
- {
- this.txtSelectionFilm.Text = "0";
- }
- if (string.IsNullOrEmpty(this.txtLookDesign.Text))
- {
- this.txtLookDesign.Text = "0";
- }
- if (string.IsNullOrEmpty(this.txtPickup.Text))
- {
- this.txtPickup.Text = "0";
- }
- DataTable newdtb = new DataTable();
- newdtb.Columns.Add("StrCode", typeof(string));
- newdtb.Columns.Add("StrName", typeof(string));
- newdtb.Columns.Add("StrIsShow", typeof(string));
- newdtb.Columns.Add("StrValue", typeof(string));
- newdtb.Columns.Add("StrValueType", typeof(string));
- newdtb.Columns.Add("StrExplain", typeof(string));
- DataRow newRow = newdtb.NewRow();
- newRow["StrCode"] = "SelectionFilm";
- newRow["StrName"] = "选片预约前天未导片预警";
- newRow["StrIsShow"] = this.chk_SelectionFilm.Checked.ToString().Trim();
- newRow["StrValue"] = this.txtSelectionFilm.Text.Trim();
- newRow["StrValueType"] = this.chkSelectionFilm_EarlyRepair.Checked ? this.chkSelectionFilm_EarlyRepair.Name.Trim().Split('_')[1] : this.chkSelectionFilm_OriginalFilm.Name.Trim().Split('_')[1];
- newRow["StrExplain"] = "如果StrValueType为EarlyRepair则按初修交片日期算,如果StrValueType为OriginalFilm则按原片最后交片日期算.";
- newdtb.Rows.Add(newRow);
- newRow = newdtb.NewRow();
- newRow["StrCode"] = "LookDesign";
- newRow["StrName"] = "看样预约前天未导片预警";
- newRow["StrIsShow"] = this.chk_LookDesign.Checked.ToString().Trim();
- newRow["StrValue"] = this.txtLookDesign.Text.Trim();
- newRow["StrValueType"] = "";
- newRow["StrExplain"] = "";
- newdtb.Rows.Add(newRow);
- newRow = newdtb.NewRow();
- newRow["StrCode"] = "Pickup";
- newRow["StrName"] = "取件预约前天未回片预警 ";
- newRow["StrIsShow"] = this.chk_Pickup.Checked.ToString().Trim();
- newRow["StrValue"] = this.txtPickup.Text.Trim();
- newRow["StrValueType"] = "";
- newRow["StrExplain"] = "";
- newdtb.Rows.Add(newRow);
- string ModifiedData = "ds" + new Json.JsontoDataTable().toJson(newdtb);
- LYFZ.Model.Model_ErpSystemConfigure model = null;
- if (string.IsNullOrEmpty(StrID))
- { model = new Model.Model_ErpSystemConfigure(); }
- else
- { model = sgbll.GetModel(Convert.ToInt32(this.StrID)); }
- new Model.Model_ErpSystemConfigure();
- model.Sconfig_Code = "ReservationDateBeforeRemind";
- model.Sconfig_Name = "预约日期前几天提醒";
- model.Sconfig_Value = ModifiedData;
- model.Sconfig_IsEnabled = true;
- model.Sconfig_Remark = "";
- model.Sconfig_Type = "";
- model.Sconfig_Order = 1;
- model.Sconfig_CreateDatetime = SDateTime.Now;
- model.Sconfig_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- if (string.IsNullOrEmpty(StrID))
- { this.IsSaveed = sgbll.Add(model); }
- else
- { this.IsSaveed = sgbll.Update(model); }
- if (!this.IsSaveed)
- { MessageBoxCustom.Show("保存失败!"); }
- else
- { MessageBoxCustom.Show("保存成功!"); }
- }
-
-
-
-
-
- void btnColseed_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
-
-
-
-
- void chkSelectionFilm_OriginalFilm_Click(object sender, EventArgs e)
- {
- this.chkSelectionFilm_OriginalFilm.Checked = true;
- this.chkSelectionFilm_EarlyRepair.Checked = false;
- }
-
-
-
-
-
- void chkSelectionFilm_EarlyRepair_Click(object sender, EventArgs e)
- {
- this.chkSelectionFilm_OriginalFilm.Checked = false;
- this.chkSelectionFilm_EarlyRepair.Checked = true;
- }
-
-
-
-
-
- void txtSelectionFilm_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
- { e.Handled = true; }
- }
-
-
-
-
-
- void txtLookDesign_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
- { e.Handled = true; }
- }
-
-
-
-
-
- void txtPickup_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
- { e.Handled = true; }
- }
-
-
-
-
-
- void txtSelectionFilm_Leave(object sender, EventArgs e)
- {
- try { this.txtSelectionFilm.Text = Convert.ToInt32(this.txtSelectionFilm.Text.Trim()).ToString(); }
- catch
- { }
- }
-
-
-
-
-
- void txtLookDesign_Leave(object sender, EventArgs e)
- {
- try { this.txtLookDesign.Text = Convert.ToInt32(this.txtLookDesign.Text.Trim()).ToString(); }
- catch
- { }
- }
-
-
-
-
-
- void txtPickup_Leave(object sender, EventArgs e)
- {
- try { this.txtPickup.Text = Convert.ToInt32(this.txtPickup.Text.Trim()).ToString(); }
- catch
- { }
- }
- }
- }
|