private void fill() { Song.Entities.OutlineEvent obj = id < 1 ? new Song.Entities.OutlineEvent() : Business.Do <IOutline>().EventSingle(id); if (id < 1) { InitBind(1); setEventQues(id); setEventFeedback(id); } if (id > 0 && obj != null) { InitBind(obj.Oe_EventType); rblTypes.Enabled = false; //基础信息 tbTitle.Text = obj.Oe_Title; cbIsUse.Checked = obj.Oe_IsUse; tbWidth.Text = obj.Oe_Width.ToString(); tbHeight.Text = obj.Oe_Height.ToString(); tbPoint.Text = obj.Oe_TriggerPoint.ToString(); ListItem liType = rblTypes.Items.FindByValue(obj.Oe_EventType.ToString()); if (liType != null) { rblTypes.SelectedIndex = -1; liType.Selected = true; } } //如果是“提醒” if (obj.Oe_EventType == 1) { tbContext1.Text = obj.Oe_Context; } //如果是“知识展示” if (obj.Oe_EventType == 2) { tbContext2.Text = obj.Oe_Context; } //如果是“课程提问” if (obj.Oe_EventType == 3) { //试题题干 tbQuesTit.Text = obj.Oe_Context; //试题选项 setEventQues(id); //试题答案 //tbAnswer.Text = obj.Oe_Answer; } //如果是“实时反馈” if (obj.Oe_EventType == 4) { tbQuesTit4.Text = obj.Oe_Context; setEventFeedback(id); } }
/// <summary> /// 修改是否使用的状态 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void sbEventUse_Click(object sender, EventArgs e) { StateButton ub = (StateButton)sender; int index = ((GridViewRow)(ub.Parent.Parent)).RowIndex; int id = int.Parse(this.gvEventList.DataKeys[index].Value.ToString()); // Song.Entities.OutlineEvent entity = Business.Do <IOutline>().EventSingle(id); entity.Oe_IsUse = !entity.Oe_IsUse; Business.Do <IOutline>().EventSave(entity); EventBindData(null, null); }
protected void btnEnter_Click(object sender, EventArgs e) { Song.Entities.OutlineEvent obj = id < 1 ? new Song.Entities.OutlineEvent() : Business.Do <IOutline>().EventSingle(id); if (obj == null) { return; } //基础信息 obj.Cou_ID = couid; obj.Ol_ID = olid; obj.Ol_UID = uid; obj.Oe_Title = tbTitle.Text.Trim(); obj.Oe_IsUse = cbIsUse.Checked; int width, height, point, type; int.TryParse(tbWidth.Text, out width); int.TryParse(tbHeight.Text, out height); int.TryParse(tbPoint.Text, out point); int.TryParse(rblTypes.SelectedValue, out type); obj.Oe_Width = width; obj.Oe_Height = height; obj.Oe_TriggerPoint = point; obj.Oe_EventType = type; //如果是“提醒” if (obj.Oe_EventType == 1) { if (tbContext1.Text.Trim().Length > 300) { tbContext1.Text = tbContext1.Text.Substring(0, 300); } obj.Oe_Context = tbContext1.Text.Trim(); } //如果是“知识展示” if (obj.Oe_EventType == 2) { obj.Oe_Context = tbContext2.Text; } //如果是“课程提问” if (obj.Oe_EventType == 3) { //试题题干 obj.Oe_Context = tbQuesTit.Text.Trim(); DataTable dt = getEventQues(); XmlSerializer xmlSerial = new XmlSerializer(typeof(DataTable)); StringWriter sw = new StringWriter(); xmlSerial.Serialize(sw, dt); // 序列化table obj.Oe_Datatable = sw.ToString(); //试题答案 //obj.Oe_Answer = tbAnswer.Text.Trim(); } //如果是“实时反馈” if (obj.Oe_EventType == 4) { obj.Oe_Context = tbQuesTit4.Text.Trim(); DataTable dt = getEventFeedback(); XmlSerializer xmlSerial = new XmlSerializer(typeof(DataTable)); StringWriter sw = new StringWriter(); xmlSerial.Serialize(sw, dt); // 序列化table obj.Oe_Datatable = sw.ToString(); } try { if (id < 1) { //保存 Business.Do <IOutline>().EventAdd(obj); } else { Business.Do <IOutline>().EventSave(obj); } Master.AlertCloseAndRefresh("操作成功"); } catch { throw; } }