protected void init_form(string ctrID) { if (!string.IsNullOrEmpty(ctrID)) { _FriendLinksEntity = DataProvider.GetInstance().GetFriendLinksEntity(int.Parse(ctrID)); TextBox_LinkTextCN.Text = _FriendLinksEntity.LinkTextCN.ToString(); TextBox_LinkTextEN.Text = _FriendLinksEntity.LinkTextEN.ToString(); TextBox_IconUrl.Text = _FriendLinksEntity.IconUrl.ToString(); TextBox_LinkUrl.Text = _FriendLinksEntity.LinkUrl.ToString(); TextBox_IsEnable.Text = _FriendLinksEntity.IsEnable.ToString(); TextBox_DisplayIndex.Text = _FriendLinksEntity.DisplayIndex.ToString(); TextBox_OwnerID.Text = _FriendLinksEntity.OwnerID.ToString(); } }
private MideFrameWork.Data.Entity.FriendLinksEntity GetFriendLinks(DataRow dr) { MideFrameWork.Data.Entity.FriendLinksEntity info = new MideFrameWork.Data.Entity.FriendLinksEntity(); if(DBNull.Value==dr["ID"]) info.ID=0; else info.ID=int.Parse(dr["ID"].ToString()); if(DBNull.Value==dr["IconUrl"]) info.IconUrl= string.Empty; else info.IconUrl= dr["IconUrl"].ToString(); if(DBNull.Value==dr["LinkTextCN"]) info.LinkTextCN= string.Empty; else info.LinkTextCN= dr["LinkTextCN"].ToString(); if(DBNull.Value==dr["LinkTextEN"]) info.LinkTextEN= string.Empty; else info.LinkTextEN= dr["LinkTextEN"].ToString(); if(DBNull.Value==dr["LinkUrl"]) info.LinkUrl= string.Empty; else info.LinkUrl= dr["LinkUrl"].ToString(); if(DBNull.Value==dr["IsEnable"]) info.IsEnable=0; else info.IsEnable=int.Parse(dr["IsEnable"].ToString()); if(DBNull.Value==dr["DisplayIndex"]) info.DisplayIndex=0; else info.DisplayIndex=int.Parse(dr["DisplayIndex"].ToString()); if(DBNull.Value==dr["OwnerID"]) info.OwnerID=0; else info.OwnerID=int.Parse(dr["OwnerID"].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 FriendLinksAdd() { #region 判断是否可空 var _LinkTextCN = Request.Form["TextBox_LinkTextCN"]; if (string.IsNullOrEmpty(_LinkTextCN)) { Alert("[ 中文标题 ]不能为空"); return; } var _LinkTextEN = Request.Form["TextBox_LinkTextEN"]; if (string.IsNullOrEmpty(_LinkTextEN)) { Alert("[ 英文标题 ]不能为空"); return; } var _IconUrl = Request.Form["TextBox_IconUrl"]; if (string.IsNullOrEmpty(_IconUrl)) { Alert("[ 图标地址 ]不能为空"); return; } var _LinkUrl = Request.Form["TextBox_LinkUrl"]; if (string.IsNullOrEmpty(_LinkUrl)) { Alert("[ 连接地址 ]不能为空"); return; } var _IsEnable = Request.Form["TextBox_IsEnable"]; if (string.IsNullOrEmpty(_IsEnable)) { Alert("[ 是否启用 ]不能为空"); return; } var _DisplayIndex = Request.Form["TextBox_DisplayIndex"]; if (string.IsNullOrEmpty(_DisplayIndex)) { Alert("[ 显示顺序 ]不能为空"); return; } var _OwnerID = Request.Form["TextBox_OwnerID"]; if (string.IsNullOrEmpty(_OwnerID)) { Alert("[ 所属者ID ]不能为空"); return; } #endregion #region 获取数据 FriendLinksEntity _FriendLinksEntity = new FriendLinksEntity(); _FriendLinksEntity.LinkTextCN =Convert.ToString(_LinkTextCN.ToString()); _FriendLinksEntity.LinkTextEN =Convert.ToString(_LinkTextEN.ToString()); _FriendLinksEntity.IconUrl =Convert.ToString(_IconUrl.ToString()); _FriendLinksEntity.LinkUrl =Convert.ToString(_LinkUrl.ToString()); _FriendLinksEntity.IsEnable =Convert.ToInt32(_IsEnable.ToString()); _FriendLinksEntity.DisplayIndex =Convert.ToInt32(_DisplayIndex.ToString()); _FriendLinksEntity.OwnerID =Convert.ToInt32(_OwnerID.ToString()); _FriendLinksEntity.CreateDate =DateTime.Now; _FriendLinksEntity.UpdateDate =DateTime.Now; try { DataProvider.GetInstance().AddFriendLinks(_FriendLinksEntity); } catch { WriteLog("FriendLinksAdd", "添加FriendLinks", "插入数据库时出错", Common.DailyUtility.MideSmsType.LogType.SystemLog); Alert("添加数据时出错,请重试"); return; } Alert("添加FriendLinks成功"); }