protected void Submit_OnClick(object sender, EventArgs e) { #region 验证 if (string.IsNullOrEmpty(PLogTeacherName.Text.Trim())) { LabMS.Common.JShelper.JSAlert(Page, "err", "教师名称不能为空!"); 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; } if (string.IsNullOrEmpty(PLogEquipment.Text.Trim())) { LabMS.Common.JShelper.JSAlert(Page, "err", "仪器设备运行情况不能为空!"); return; } #endregion LabMS.Model.PositionLog posLog = new LabMS.Model.PositionLog(); LabMS.BLL.PositionLog posLogInfo = new LabMS.BLL.PositionLog(); ExtendBLL.PositionLog positionLog = new ExtendBLL.PositionLog(); posLog.PLog_TeacherCode = UserCode; posLog.PLog_TeacherName = PLogTeacherName.Text.Trim(); 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.Add(posLog); LabMS.Common.JShelper.JSAlertAndRedirect(Page,"AddSuccess","添加成功!","AddPositionLog.aspx"); }
//删除人员岗位日志 protected void Delete_OnClick(object sender, EventArgs e) { CheckBox chb; LabMS.BLL.PositionLog pLog = new LabMS.BLL.PositionLog(); try { for (int i = 0; i < gvPositionLogList.Rows.Count; i++) { chb = (CheckBox)gvPositionLogList.Rows[i].FindControl("PositionLogCB"); if (chb.Checked) { string PLID = gvPositionLogList.DataKeys[i].Value.ToString(); pLog.Delete(int.Parse(PLID)); } } BindGridViewList(SearchString()); LabMS.Common.JShelper.JSAlert(Page, "deleteSuccess", "删除成功!"); } catch { LabMS.Common.JShelper.JSAlert(Page, "err", "删除失败!"); } }
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; }
//为GridView绑定数据 private void BindGridViewList(string strWhere) { LabMS.BLL.PositionLog positionLog = new LabMS.BLL.PositionLog(); string loginUserType = UserType; string loginUserCode = UserCode; if (loginUserType.Equals("mana")) { strWhere += " "; } if (loginUserType.Equals("teacher")) { strWhere += " PLog_TeacherCode='" + loginUserCode + "'"; } List<LabMS.Model.PositionLog> positionLogList = positionLog.GetModelList(strWhere); gvPositionLogList.DataSource = positionLogList; gvPositionLogList.DataBind(); }