protected void Submit_OnClick(object sender, EventArgs e) { #region 验证 if (string.IsNullOrEmpty(PLogTeacherName.Text.Trim())) { LabMS.Common.JShelper.JSAlert(Page, "err", "教师名称不能为空!"); return; } else if (PLogTeacherName.Text.Trim().Length > 40) { LabMS.Common.JShelper.JSAlert(Page, "err", "教师名称不能超过40字符!"); return; } if (string.IsNullOrEmpty(PLogTime.Text.Trim())) { LabMS.Common.JShelper.JSAlert(Page, "err", "时间不能为空!"); return; } if (string.IsNullOrEmpty(PLogLabIntro.Text.Trim())) { LabMS.Common.JShelper.JSAlert(Page, "err", "实验教学情况不能为空!"); return; } else if (PLogLabIntro.Text.Trim().Length > 100) { LabMS.Common.JShelper.JSAlert(Page, "err", "实验教学简况长度不能超过100个字符!"); return; } if (string.IsNullOrEmpty(PLogEquipment.Text.Trim())) { LabMS.Common.JShelper.JSAlert(Page, "err", "仪器设备运行情况不能为空!"); return; } else if (PLogEquipment.Text.Trim().Length > 100) { LabMS.Common.JShelper.JSAlert(Page, "err", "仪器设备运行情况长度不能超过100个字符!"); return; } if (PLogOther.Text.Trim().Length > 100) { LabMS.Common.JShelper.JSAlert(Page, "err", "其它情况长度不能超过100个字符!"); return; } #endregion LabMS.Model.PositionLog posLog = new LabMS.Model.PositionLog(); LabMS.Model.PositionLog posLogTemp = new LabMS.Model.PositionLog(); LabMS.BLL.PositionLog posLogInfo = new LabMS.BLL.PositionLog(); //posLog.ID = int.Parse(Request.QueryString["ID"]); //posLog.PLog_TeacherCode = positionLog.GetTeacherCode(PLogTeacherName.Text.Trim()); //posLog.PLog_TeacherName = PLogTeacherName.Text.Trim(); int PID = 0; if (!int.TryParse(Request.QueryString["ID"], out PID)) { Common.JShelper.JSAlert(Page, "err", "参数错误!"); return; } posLogTemp = posLogInfo.GetModel(PID); posLog.ID = posLogTemp.ID; posLog.PLog_TeacherCode = posLogTemp.PLog_TeacherCode; posLog.PLog_TeacherName = posLogTemp.PLog_TeacherName; posLog.PLog_IP = posLogTemp.PLog_IP; posLog.PLog_Time = Convert.ToDateTime(PLogTime.Text.Trim()); posLog.PLog_LabIntro = PLogLabIntro.Text.ToString().Trim(); posLog.PLog_Equipment = PLogEquipment.Text.Trim(); posLog.PLog_Other = PLogOther.Text.Trim(); posLog.PLog_RecodeTime = DateTime.Now; posLogInfo.Update(posLog); LabMS.Common.JShelper.JSAlertAndRedirect(Page, "EditSuccess", "修改成功!", "ListPositionLog.aspx"); }
//绑定数据 private void BindData(int ID) { LabMS.BLL.PositionLog pLog = new LabMS.BLL.PositionLog(); LabMS.Model.PositionLog pLogInfo = new LabMS.Model.PositionLog(); pLogInfo = pLog.GetModel(ID); PLogTeacherName.Text = pLogInfo.PLog_TeacherName; PLogTime.Text = pLogInfo.PLog_Time.Value.ToShortDateString(); PLogEquipment.Text = pLogInfo.PLog_Equipment; PLogLabIntro.Text = pLogInfo.PLog_LabIntro; PLogOther.Text = pLogInfo.PLog_Other; }