private void BindInfo() { //实体基类 See_AnimalInfo objSee_AnimalInfo = new See_AnimalInfo(); //以主键查询数据 objSee_AnimalInfo = SqlDataProvider.SqlDataProvider.GetInfoSee_AnimalInfoByUserID(this.UserId); if ((objSee_AnimalInfo != null)) { //加载绑定数 //txtNo.Text = objSee_AnimalInfo.No.ToString(); txtName.Text = objSee_AnimalInfo.Name.ToString(); ddlSex.SelectedValue = objSee_AnimalInfo.Sex.ToString(); txtKind.Text = objSee_AnimalInfo.Kind.ToString(); txtAge.Text = objSee_AnimalInfo.Age.ToString(); txtColor.Text = objSee_AnimalInfo.Color.ToString(); txtDescription.Text = objSee_AnimalInfo.Description.ToString(); ddlIsImmune.SelectedValue = Convert.ToBoolean(objSee_AnimalInfo.IsImmune) == true ? "是" : "否"; ddlIsJY.SelectedValue = objSee_AnimalInfo.Par1; imgShow.Src = _filedir + objSee_AnimalInfo.Picture.ToString(); } See_PersonInfo objSee_PersonInfo = SqlDataProvider.SqlDataProvider.GetInfoSee_PersonInfoByUserID(this.UserId); if ((objSee_PersonInfo != null)) { if (objSee_PersonInfo.Code != "") { chkHasCode.Checked = true; txtCode.Enabled = false; } txtCode.Text = objSee_PersonInfo.Code.ToString(); } }
protected void BindData() { //根据UserID获取宠物信息 See_AnimalInfo info = SqlDataProvider.SqlDataProvider.GetInfoSee_AnimalInfoByUserID(this.UserId); if (info != null) { lblNo.Text = info.No; lblName.Text = info.Name; lblSex.Text = info.Sex; lblKind.Text = info.Kind; lblAge.Text = info.Age; lblColor.Text = info.Color; lblDescription.Text = info.Description; imPicture.ImageUrl = "/Portals/SEEKPETInfo/" + info.Picture; } }
protected void btnSeach_Click(object sender, EventArgs e) { if (txtCode.Text != "") { AnmialID = 0; See_Code info = SqlDataProvider.SqlDataProvider.GetInfoSee_CodeByCode(txtCode.Text); if (info != null) { int userid = info.UserID; See_AnimalInfo objSee_AnimalInfo = SqlDataProvider.SqlDataProvider.GetInfoSee_AnimalInfoByUserID(userid); if (objSee_AnimalInfo != null) { paDetail.Visible = true; paSeach.Visible = false; AnmialID = objSee_AnimalInfo.ID; lblNo.Text = objSee_AnimalInfo.No.ToString(); lblName.Text = objSee_AnimalInfo.Name.ToString(); lblSex.Text = objSee_AnimalInfo.Sex.ToString(); lblKind.Text = objSee_AnimalInfo.Kind.ToString(); lblAge.Text = objSee_AnimalInfo.Age.ToString(); lblColor.Text = objSee_AnimalInfo.Color.ToString(); lblDescription.Text = objSee_AnimalInfo.Description.ToString(); lblIsImmune.Text = objSee_AnimalInfo.IsImmune ? "已绝育" : "未绝育"; imgPicture.ImageUrl = "/Portals/SEEKPETInfo/" + objSee_AnimalInfo.Picture.ToString(); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "resultTip", "<script>alert('未绑定!');</script>"); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "resultTip", "<script>alert('信息不存在!');</script>"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { return; } if (chkHasCode.Checked) { //判断code See_Code objcode = SqlDataProvider.SqlDataProvider.GetInfoSee_CodeByCode(txtCode.Text); if (objcode != null) { if (objcode.UserID > 0 && objcode.UserID != this.UserId) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "resultTip", "<script>alert('芯片编码已使用!');</script>"); return; } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "resultTip", "<script>alert('芯片编码不存在!');</script>"); return; } } See_AnimalInfo objSee_AnimalInfo = new See_AnimalInfo(); EasySite.Common.Utilities.CBO.InitializeObject(objSee_AnimalInfo, typeof(See_AnimalInfo)); //绑定更新数据信息 objSee_AnimalInfo.UserID = this.UserId; //objSee_AnimalInfo.No = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtNo.Text); objSee_AnimalInfo.Name = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtName.Text); objSee_AnimalInfo.Sex = ddlSex.SelectedValue; objSee_AnimalInfo.Kind = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtKind.Text); objSee_AnimalInfo.Age = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtAge.Text); objSee_AnimalInfo.Color = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtColor.Text); objSee_AnimalInfo.Description = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtDescription.Text); objSee_AnimalInfo.IsImmune = ddlIsImmune.SelectedValue == "是" ? true : false; objSee_AnimalInfo.Par1 = ddlIsJY.SelectedValue; objSee_AnimalInfo.Picture = hidImgName.Value; objSee_AnimalInfo.CreateTime = DateTime.Now; //objSee_AnimalInfo.Par1 = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtPar1.Text); //objSee_AnimalInfo.Par2 = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtPar2.Text); //objSee_AnimalInfo.Par3 = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtPar3.Text); //objSee_AnimalInfo.Par4 = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtPar4.Text); //objSee_AnimalInfo.Par5 = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtPar5.Text); SqlDataProvider.SqlDataProvider.InsertOrUpdateSee_AnimalInfo(objSee_AnimalInfo); See_PersonInfo objSee_PersonInfo = new See_PersonInfo(); objSee_PersonInfo.UserID = this.UserId; objSee_PersonInfo.Code = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtCode.Text); SqlDataProvider.SqlDataProvider.InsertOrUpdateSee_PersonInfo(objSee_PersonInfo); if (chkHasCode.Checked && txtCode.Text != "") { SqlDataProvider.SqlDataProvider.UpdateSee_CodeInfoByCode(UserId, txtCode.Text); } Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "resultTip", "<script>alert('提交成功!');window.location.href=window.location.href;</script>"); } catch (Exception exc) { EasySite.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// 更新一条信息 /// </summary> /// <param name="objSee_AnimalInfo">实例对象</param> public static void UpdateSee_AnimalInfo(See_AnimalInfo objSee_AnimalInfo) { Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(strDBConnectionString, "See_AnimalInfo_Update", GetNull(objSee_AnimalInfo.ID), GetNull(objSee_AnimalInfo.UserID), objSee_AnimalInfo.No, objSee_AnimalInfo.Name, objSee_AnimalInfo.Sex, objSee_AnimalInfo.Kind, objSee_AnimalInfo.Age, objSee_AnimalInfo.Color, objSee_AnimalInfo.Description, GetNull(objSee_AnimalInfo.IsImmune), objSee_AnimalInfo.Picture, GetNull(objSee_AnimalInfo.CreateTime), objSee_AnimalInfo.Par1, objSee_AnimalInfo.Par2, objSee_AnimalInfo.Par3, objSee_AnimalInfo.Par4, objSee_AnimalInfo.Par5); }
public static Int32 InsertOrUpdateSee_AnimalInfo(See_AnimalInfo objSee_AnimalInfo) { return Convert.ToInt32(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(strDBConnectionString, "See_AnimalInfo_InsertOrUpdate", GetNull(objSee_AnimalInfo.UserID), objSee_AnimalInfo.No, objSee_AnimalInfo.Name, objSee_AnimalInfo.Sex, objSee_AnimalInfo.Kind, objSee_AnimalInfo.Age, objSee_AnimalInfo.Color, objSee_AnimalInfo.Description, GetNull(objSee_AnimalInfo.IsImmune), objSee_AnimalInfo.Picture, GetNull(objSee_AnimalInfo.CreateTime), objSee_AnimalInfo.Par1, objSee_AnimalInfo.Par2, objSee_AnimalInfo.Par3, objSee_AnimalInfo.Par4, objSee_AnimalInfo.Par5)); }