//绑定数据
        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;
        }
Example #2
0
        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");
        }
Example #3
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public LabMS.Model.PositionLog GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ID,PLog_Time,PLog_TeacherCode,PLog_TeacherName,PLog_RecodeTime,PLog_LabIntro,PLog_Equipment,PLog_Other,PLog_IP from PositionLog ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)};
            parameters[0].Value = ID;

            LabMS.Model.PositionLog model=new LabMS.Model.PositionLog();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["ID"].ToString()!="")
                {
                    model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if(ds.Tables[0].Rows[0]["PLog_Time"].ToString()!="")
                {
                    model.PLog_Time=DateTime.Parse(ds.Tables[0].Rows[0]["PLog_Time"].ToString());
                }
                model.PLog_TeacherCode=ds.Tables[0].Rows[0]["PLog_TeacherCode"].ToString();
                model.PLog_TeacherName=ds.Tables[0].Rows[0]["PLog_TeacherName"].ToString();
                if(ds.Tables[0].Rows[0]["PLog_RecodeTime"].ToString()!="")
                {
                    model.PLog_RecodeTime=DateTime.Parse(ds.Tables[0].Rows[0]["PLog_RecodeTime"].ToString());
                }
                model.PLog_LabIntro=ds.Tables[0].Rows[0]["PLog_LabIntro"].ToString();
                model.PLog_Equipment=ds.Tables[0].Rows[0]["PLog_Equipment"].ToString();
                model.PLog_Other=ds.Tables[0].Rows[0]["PLog_Other"].ToString();
                model.PLog_IP=ds.Tables[0].Rows[0]["PLog_IP"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }