protected void init_form(string ctrID) { if (!string.IsNullOrEmpty(ctrID)) { _WG_EducationEntity = DataProvider.GetInstance().GetWG_EducationEntity(int.Parse(ctrID)); TextBox_Name.Text = _WG_EducationEntity.Name.ToString(); } }
private MideFrameWork.Data.Entity.WG_EducationEntity GetWG_Education(DataRow dr) { MideFrameWork.Data.Entity.WG_EducationEntity info = new MideFrameWork.Data.Entity.WG_EducationEntity(); if(DBNull.Value==dr["ID"]) info.ID=0; else info.ID=int.Parse(dr["ID"].ToString()); if(DBNull.Value==dr["Name"]) info.Name= string.Empty; else info.Name= dr["Name"].ToString(); if(DBNull.Value==dr["CreateDate"]) info.CreateDate=DateTime.Now; else info.CreateDate=DateTime.Parse(dr["CreateDate"].ToString()); if(DBNull.Value==dr["UpdateDate"]) info.UpdateDate=DateTime.Now; else info.UpdateDate=DateTime.Parse(dr["UpdateDate"].ToString()); return info; }
protected void WG_EducationAdd() { #region 判断是否可空 var _Name = Request.Form["TextBox_Name"]; if (string.IsNullOrEmpty(_Name)) { Alert("[ 学历名称 ]不能为空"); return; } #endregion #region 获取数据 WG_EducationEntity _WG_EducationEntity = new WG_EducationEntity(); _WG_EducationEntity.Name =Convert.ToString(_Name.ToString()); _WG_EducationEntity.CreateDate =DateTime.Now; _WG_EducationEntity.UpdateDate =DateTime.Now; try { DataProvider.GetInstance().AddWG_Education(_WG_EducationEntity); } catch { WriteLog("WG_EducationAdd", "添加WG_Education", "插入数据库时出错", Common.DailyUtility.MideSmsType.LogType.SystemLog); Alert("添加数据时出错,请重试"); return; } Alert("添加WG_Education成功"); }