private void ShowInfo(int id) { GCalendarArrangeBB calendarArrangeBB = new GCalendarArrangeBB(); vGCalendarArrangeData model = new vGCalendarArrangeData(); try { model = calendarArrangeBB.GetVModel(id); this.remindEmpId.Text = model.remindEmpNm; this.subject.Text = model.subject; if (model.arisesDt != string.Empty && model.arisesDt != null) { DateTime arisesDt = Convert.ToDateTime(model.arisesDt); this.arisesDt.Text = arisesDt.ToString("yyyy��MM��dd�� HHʱmm��"); } this.locus.Text = model.locus; this.content.Text = model.content; this.aheadRemindMinutes.Text = model.aheadRemindMinutes.ToString(); if (model.remindTime != string.Empty && model.remindTime != null) { DateTime remindTime = Convert.ToDateTime(model.remindTime); this.remindTime.Text = remindTime.ToString("yyyy��MM��dd�� HHʱmm��"); } } finally { calendarArrangeBB.Dispose(); } }
private void ShowInfo(int id) { GCalendarArrangeBB calendarArrangeBB = new GCalendarArrangeBB(); vGCalendarArrangeData model = new vGCalendarArrangeData(); try { model = calendarArrangeBB.GetVModel(id); this.remindEmpId.Value = model.remindEmpId.ToString(); this.remindEmpNm.Value = model.remindEmpNm; this.subject.Text = model.subject; if (model.arisesDt != string.Empty && model.arisesDt != null) { DateTime arisesDt = Convert.ToDateTime(model.arisesDt); this.arisesDt.Text = arisesDt.ToShortDateString(); if (this.arisesDtH.Items.FindByValue(arisesDt.Hour.ToString()) != null) { this.arisesDtH.SelectedValue = arisesDt.Hour.ToString(); } if (this.arisesDtM.Items.FindByValue(arisesDt.Minute.ToString()) != null) { this.arisesDtM.SelectedValue = arisesDt.Minute.ToString(); } } this.locus.Text = model.locus; this.content.Text = model.content; this.aheadRemindMinutes.Text = model.aheadRemindMinutes.ToString(); if (model.remindTime != string.Empty && model.remindTime != null) { DateTime remindTime = Convert.ToDateTime(model.remindTime); this.remindTime.Text = remindTime.ToShortDateString(); if (this.remindTimeH.Items.FindByValue(remindTime.Hour.ToString()) != null) { this.remindTimeH.SelectedValue = remindTime.Hour.ToString(); } if (this.remindTimeM.Items.FindByValue(remindTime.Minute.ToString()) != null) { this.remindTimeM.SelectedValue = remindTime.Minute.ToString(); } } } finally { calendarArrangeBB.Dispose(); } }
/// <summary> /// �õ�һ����ͼmodel /// </summary> /// <param name="id">����ֵ</param> /// <returns>model</returns> public vGCalendarArrangeData GetVModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from vGCalendarArrange"); strSql.Append(" where id = @id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int) }; parameters[0].Value = id; vGCalendarArrangeData model = new vGCalendarArrangeData(); DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { DataRow row =ds.Tables[0].Rows[0]; if (row["id"] != DBNull.Value) { model.id = Convert.ToInt32(row["id"]); } if (row["remindEmpId"] != DBNull.Value) { model.remindEmpId = Convert.ToInt32(row["remindEmpId"]); } if (row["subject"] != DBNull.Value) { model.subject = Convert.ToString(row["subject"]); } if (row["arisesDt"] != DBNull.Value) { model.arisesDt = Convert.ToString(row["arisesDt"]); } if (row["locus"] != DBNull.Value) { model.locus = Convert.ToString(row["locus"]); } if (row["content"] != DBNull.Value) { model.content = Convert.ToString(row["content"]); } if (row["aheadRemindMinutes"] != DBNull.Value) { model.aheadRemindMinutes = Convert.ToInt32(row["aheadRemindMinutes"]); } if (row["remindTime"] != DBNull.Value) { model.remindTime = Convert.ToString(row["remindTime"]); } if (row["isRead"] != DBNull.Value) { model.isRead = Convert.ToBoolean(row["isRead"]); } if (row["isDel"] != DBNull.Value) { model.isDel = Convert.ToBoolean(row["isDel"]); } if (row["isrtEmpId"] != DBNull.Value) { model.isrtEmpId = Convert.ToInt32(row["isrtEmpId"]); } if (row["isrtDt"] != DBNull.Value) { model.isrtDt = Convert.ToString(row["isrtDt"]); } if (row["updtEmpId"] != DBNull.Value) { model.updtEmpId = Convert.ToInt32(row["updtEmpId"]); } if (row["updtDt"] != DBNull.Value) { model.updtDt = Convert.ToString(row["updtDt"]); } if (row["remindEmpNm"] != DBNull.Value) { model.remindEmpNm = Convert.ToString(row["remindEmpNm"]); } if (row["isrtEmpNm"] != DBNull.Value) { model.isrtEmpNm = Convert.ToString(row["isrtEmpNm"]); } if (row["updtEmpNm"] != DBNull.Value) { model.updtEmpNm = Convert.ToString(row["updtEmpNm"]); } if (row["isReadDesc"] != DBNull.Value) { model.isReadDesc = Convert.ToString(row["isReadDesc"]); } return model; } else { return null; } }