/// <summary> /// 绑定数据 /// </summary> /// <param name="PKID"></param> /// <returns></returns> #region private bool BindInfo(int PKID) private bool BindInfo(int PKID) { bool isReturl = true; //实体基类 See_Hospital objSee_Hospital = new See_Hospital(); //以主键查询数据 objSee_Hospital = SqlDataProvider.SqlDataProvider.GetInfoSee_Hospital(PKID); if ((objSee_Hospital != null)) { //加载绑定数 txtHospitalName.Text = objSee_Hospital.HospitalName.ToString(); txtAddress.Text = objSee_Hospital.Address.ToString(); //txtCoorX.Text = objSee_Hospital.CoorX.ToString(); //txtCoorY.Text = objSee_Hospital.CoorY.ToString(); imgShow.Src = _filedir + objSee_Hospital.Picture.ToString(); hidImgName.Value = objSee_Hospital.Picture.ToString(); txtDescription.Text = objSee_Hospital.Description.ToString(); //绑定城市 Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>setvalue('" + objSee_Hospital.Par1 + "');</script>"); } else { //错误主键 isReturl = false; } return(isReturl); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> #region protected void cmdCommand_Click(object sender, EventArgs e) protected void cmdCommand_Click(object sender, EventArgs e) { try { See_Hospital objSee_Hospital = new See_Hospital(); EasySite.Common.Utilities.CBO.InitializeObject(objSee_Hospital, typeof(See_Hospital)); //绑定更新数据信息 objSee_Hospital.ID = ItemID; objSee_Hospital.HospitalName = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtHospitalName.Text); objSee_Hospital.Address = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtAddress.Text); objSee_Hospital.Picture = hidImgName.Value; objSee_Hospital.Description = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtDescription.Text); objSee_Hospital.Par1 = hidcity.Value; if (!EasySite.Common.Utilities.Null.IsNull(ItemID)) { SqlDataProvider.SqlDataProvider.UpdateSee_Hospital(objSee_Hospital); //EasySite.UI.Skins.Skin.AddModuleMessage(this, "更新成功", EasySite.UI.Skins.Controls.ModuleMessage.ModuleMessageType.GreenSuccess); } else { SqlDataProvider.SqlDataProvider.InsertSee_Hospital(objSee_Hospital); //EasySite.UI.Skins.Skin.AddModuleMessage(this, "添加成功", EasySite.UI.Skins.Controls.ModuleMessage.ModuleMessageType.GreenSuccess); } Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "resultTip", "<script>alert('提交成功!');window.location.href='" + hlkExit.NavigateUrl + "';</script>"); } catch (Exception exc) { EasySite.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// 更新一条信息 /// </summary> /// <param name="objSee_Hospital">实例对象</param> public static void UpdateSee_Hospital(See_Hospital objSee_Hospital) { Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(strDBConnectionString, "See_Hospital_Update", GetNull(objSee_Hospital.ID), objSee_Hospital.HospitalName, objSee_Hospital.Address, objSee_Hospital.CoorX, objSee_Hospital.CoorY, objSee_Hospital.Picture, objSee_Hospital.Description, objSee_Hospital.Par1, objSee_Hospital.Par2, objSee_Hospital.Par3); }
/// <summary> /// 插入一条实例信息 /// </summary> /// <param name="objSee_Hospital">实例对象</param> /// <returns>返回主键ID</returns> public static Int32 InsertSee_Hospital(See_Hospital objSee_Hospital) { return Convert.ToInt32(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(strDBConnectionString, "See_Hospital_Insert", objSee_Hospital.HospitalName, objSee_Hospital.Address, objSee_Hospital.CoorX, objSee_Hospital.CoorY, objSee_Hospital.Picture, objSee_Hospital.Description, objSee_Hospital.Par1, objSee_Hospital.Par2, objSee_Hospital.Par3)); }