/// <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_Code objSee_Code = new See_Code(); if (ItemID > 0) { objSee_Code = SqlDataProvider.SqlDataProvider.GetInfoSee_Code(ItemID); } //绑定更新数据信息 objSee_Code.Code = PeoNormalControl.CommonClass.Utility.ReplaceSepChars(txtCode.Text); if (!EasySite.Common.Utilities.Null.IsNull(ItemID)) { SqlDataProvider.SqlDataProvider.UpdateSee_Code(objSee_Code); } else { SqlDataProvider.SqlDataProvider.InsertSee_Code(objSee_Code); } 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="PKID"></param> /// <returns></returns> #region private bool BindInfo(int PKID) private bool BindInfo(int PKID) { bool isReturl = true; //实体基类 See_Code objSee_Code = new See_Code(); //以主键查询数据 objSee_Code = SqlDataProvider.SqlDataProvider.GetInfoSee_Code(PKID); if ((objSee_Code != null)) { //加载绑定数 txtCode.Text = objSee_Code.Code.ToString(); } else { //错误主键 isReturl = false; } return(isReturl); }
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_Code">实例对象</param> public static void UpdateSee_Code(See_Code objSee_Code) { Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(strDBConnectionString, "See_Code_Update", GetNull(objSee_Code.ID), objSee_Code.Code, GetNull(objSee_Code.UserID), GetNull(objSee_Code.HospitalID), objSee_Code.IsUse, objSee_Code.Par1, objSee_Code.Par2); }
/// <summary> /// 插入一条实例信息 /// </summary> /// <param name="objSee_Code">实例对象</param> /// <returns>返回主键ID</returns> public static Int32 InsertSee_Code(See_Code objSee_Code) { return Convert.ToInt32(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(strDBConnectionString, "See_Code_Insert", objSee_Code.Code, GetNull(objSee_Code.UserID), GetNull(objSee_Code.HospitalID),objSee_Code.IsUse, objSee_Code.Par1, objSee_Code.Par2)); }