using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using CY.Model; using CY.BLL; using CY.Infrastructure.Common; using CY.BLL.Sys; using CY.BLL.EC; using CY.Infrastructure.DESEncrypt; using CY.Infrastructure.Query; namespace CY.WebForm.Pages.workcar { //吴辉 //新增年检记录 public partial class CarExaminedAdd : BasePage { Sys_DictionaryBLL bll_Sys_DictionaryBLL = null; OA_CarExaminedBll oA_WorkReminderBll = null; public CarExaminedAdd() { bll_Sys_DictionaryBLL = new Sys_DictionaryBLL(); oA_WorkReminderBll = new OA_CarExaminedBll(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { } } //表单提交 protected void btn_submit_form(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.txtExaminedTime.Value)) { JavaScript.MessageBox("年检时间不能为空", this); return; } if (string.IsNullOrEmpty(this.txtExaminedNextTime.Value)) { JavaScript.MessageBox("下次年检时间不能为空", this); return; } DateTime? Runtime1 = DateTime.Parse(this.txtExaminedTime.Value); DateTime? Runtime2 = DateTime.Parse(this.txtExaminedNextTime.Value); if (Runtime1 == null || Runtime2 == null || Runtime1 > Runtime2) { JavaScript.MessageBox("年检时间 不能大于 下次年检时间", this); return; } DateTime nowTime = DateTime.Now; OA_CarExamined m_OA_CarExamined = new OA_CarExamined(); m_OA_CarExamined.CarId = Request["carid"].ToInt32(); m_OA_CarExamined.ExaminedPeople = this.txtExaminedPeople.Value; m_OA_CarExamined.ExaminedTime = this.txtExaminedTime.Value.ToDateTime2(); m_OA_CarExamined.ExaminedNextTime = this.txtExaminedNextTime.Value.ToDateTime2(); m_OA_CarExamined.ExaminedMoney = this.txtExaminedMoney.Value.ToDecimal2(); m_OA_CarExamined.ExaminedRecore = this.txtExaminedRecore.Value; m_OA_CarExamined.ExaminedStatus = 0; m_OA_CarExamined.Operator = CurrentUser.ShortName; m_OA_CarExamined.LastUpdateTime = nowTime; if (oA_WorkReminderBll.InsertModel(m_OA_CarExamined)) JavaScript.MessageBoxCloseAndRefreshFirst("新增成功", this); else JavaScript.MessageBox("操作失败", this); } catch (Exception ex) { PAGEHandleException(ex); JavaScript.MessageBox("操作失败", this); } } } }