//绑定数据 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; }
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"); }
/// <summary> /// ��������б� /// </summary> public List<LabMS.Model.PositionLog> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List<LabMS.Model.PositionLog> modelList = new List<LabMS.Model.PositionLog>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { LabMS.Model.PositionLog model; for (int n = 0; n < rowsCount; n++) { model = new LabMS.Model.PositionLog(); if(ds.Tables[0].Rows[n]["ID"].ToString()!="") { model.ID=int.Parse(ds.Tables[0].Rows[n]["ID"].ToString()); } if(ds.Tables[0].Rows[n]["PLog_Time"].ToString()!="") { model.PLog_Time=DateTime.Parse(ds.Tables[0].Rows[n]["PLog_Time"].ToString()); } model.PLog_TeacherCode=ds.Tables[0].Rows[n]["PLog_TeacherCode"].ToString(); model.PLog_TeacherName=ds.Tables[0].Rows[n]["PLog_TeacherName"].ToString(); if(ds.Tables[0].Rows[n]["PLog_RecodeTime"].ToString()!="") { model.PLog_RecodeTime=DateTime.Parse(ds.Tables[0].Rows[n]["PLog_RecodeTime"].ToString()); } model.PLog_LabIntro=ds.Tables[0].Rows[n]["PLog_LabIntro"].ToString(); model.PLog_Equipment=ds.Tables[0].Rows[n]["PLog_Equipment"].ToString(); model.PLog_Other=ds.Tables[0].Rows[n]["PLog_Other"].ToString(); model.PLog_IP=ds.Tables[0].Rows[n]["PLog_IP"].ToString(); modelList.Add(model); } } return modelList; }