/// <summary> /// 保存操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, EventArgs e) { string title = this.txtTitle.Text.Trim(); decimal linePrice = MyConvert.GetDecimal(this.txtLinePrice.Text.Trim()); int areaId = MyConvert.GetInt32(this.areaid.Value); string typeName = this.droTypeName.SelectedValue; string address = this.txtAddress.Text.Trim(); DateTime date = MyConvert.GetDateTime(this.endDate.Value); string description = this.txtDescription.Text.Trim(); ForeclosedInfo info = new ForeclosedInfo(); info.IdentityNumber = GetUniqueNo(); info.Title = title; info.LinePrice = linePrice; info.AreaId = areaId; info.ForeColseTypeName = typeName; info.Address = address; info.EndDate = date; info.Description = description; info.State = (int)AuditingState.Null; info.DepartmentId =MyConvert.GetInt32(userinfo.userid.ToString()); info.CompanyId = userinfo.CompanyId; info.CreateDate = DateTime.Now; int foreId = 0; int result = foreclosedManager.InsertForeclosedReturnID(info,out foreId); string gotoUrl = "ForeclosedList.aspx"; if (result>0) { this.udForeclosedInfo.InfoID = foreId; udForeclosedInfo.Update(); GotoMsgBoxPageForDynamicPage("添加抵债信息成功!", 1, gotoUrl); } else { GotoMsgBoxPageForDynamicPage("添加抵债信息失败!", 1, gotoUrl); } }
/// <summary> /// 根据抵债编号修改抵债信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public bool UpdateForeclosedByID(ForeclosedInfo info) { int result = DAL.UpdateForeclosedByID(info); if (result > 0) { return true; } else { return false; } }
/// <summary> /// 新增操作,返回自增长ID /// </summary> /// <param name="info"></param> /// <param name="foreId"></param> /// <returns></returns> public int InsertForeclosedReturnID(ForeclosedInfo info, out int foreId) { foreId = 0; if (info == null) { return 0; } return DAL.InsertForeclosed(info, out foreId); }
/// <summary> /// 添加抵债信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public bool InsertForeclosed(ForeclosedInfo info) { int result = DAL.InsertForeclosed(info); if (result > 0) { return true; } else { return false; } }
/// <summary> /// 修改抵债信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public int UpdateForeclosedByID(ForeclosedInfo info) { string sql = @"UPDATE ForeclosedInfo SET Title = @Title,Address=@Address,AreaId=@AreaId,EndDate=@EndDate,LinePrice=@LinePrice,Description=@Description, ForeColseTypeName=@ForeColseTypeName,State=@State WHERE ForeclosedId=@Id"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@Title",info.Title), new SqlParameter("@Address",info.Address), new SqlParameter("@AreaId",info.AreaId), new SqlParameter("@EndDate",info.EndDate), new SqlParameter("@LinePrice",info.LinePrice), new SqlParameter("@Description",info.Description), new SqlParameter("@ForeColseTypeName",info.ForeColseTypeName), new SqlParameter("@State",info.State), new SqlParameter("@Id",info.ForeclosedId) }; int rowAffected = SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param); return rowAffected; }
/// <summary> /// 新增操作,返回自增长ID /// </summary> /// <param name="info"></param> /// <param name="foreId"></param> /// <returns></returns> public int InsertForeclosed(ForeclosedInfo info, out int foreId) { string sql = @"insert into ForeclosedInfo (Title,IdentityNumber,Address,AreaId,EndDate,CreateDate,State, UserId,DepartmentId,LinePrice,description,ForeColseTypeName,HighPrice) values (@Title,@Identitynumber,@Address,@AreaId,@EndDate,@CreateDate,@State,@UserId, @DepartmentId,@LinePrice,@Description,@ForeColseTypeName,0);select @ID = @@identity"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@ID",SqlDbType.Int), new SqlParameter("@Title",info.Title), new SqlParameter("@Identitynumber",info.IdentityNumber), new SqlParameter("@Address",info.Address), new SqlParameter("@AreaId",info.AreaId), new SqlParameter("@EndDate",info.EndDate), new SqlParameter("@CreateDate",info.CreateDate), new SqlParameter("@State",info.State), new SqlParameter("@UserId",info.CompanyId), new SqlParameter("@DepartmentId",info.DepartmentId), new SqlParameter("@LinePrice",info.LinePrice), new SqlParameter("@Description",info.Description), new SqlParameter("@ForeColseTypeName",info.ForeColseTypeName) }; param[0].Direction = ParameterDirection.Output; int rowAffected = SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param); if (rowAffected >= 0) { if (param[0].Value != null && param[0].Value.ToString() != "") foreId = (int)param[0].Value; else foreId = 0; } else { foreId = -1; } return rowAffected; }
/// <summary> /// 新增抵债信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public int InsertForeclosed(ForeclosedInfo info) { string sql = @"insert into ForeclosedInfo (Title,IdentityNumber,Address,AreaId,EndDate,CreateDate,State, UserId,DepartmentId,LinePrice,description,ForeColseTypeName,HighPrice) values (@Title,@Identitynumber,@Address,@AreaId,@EndDate,@CreateDate,@State,@UserId, @DepartmentId,@LinePrice,@Description,@ForeColseTypeName,0)"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@Title",info.Title), new SqlParameter("@Identitynumber",info.IdentityNumber), new SqlParameter("@Address",info.Address), new SqlParameter("@AreaId",info.AreaId), new SqlParameter("@EndDate",info.EndDate), new SqlParameter("@CreateDate",info.CreateDate), new SqlParameter("@State",info.State), new SqlParameter("@UserId",info.CompanyId), new SqlParameter("@DepartmentId",info.DepartmentId), new SqlParameter("@LinePrice",info.LinePrice), new SqlParameter("@Description",info.Description), new SqlParameter("@ForeColseTypeName",info.ForeColseTypeName) }; int rowAffected = SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param); return rowAffected; }
/// <summary> /// 根据抵债ID获取抵债信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public ForeclosedInfo GetForeclosedInfoById(int id) { string sql = "SELECT * FROM dbo.ForeclosedInfo WHERE ForeclosedId = @Id"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@Id",id), }; ForeclosedInfo info = null; using (SqlDataReader reader = XYECOM.Core.Data.SqlHelper.ExecuteReader(CommandType.Text, sql, param)) { if (reader.Read()) { info = new ForeclosedInfo(); info.ForeclosedId = id; info.Title = reader["Title"].ToString(); info.IdentityNumber = reader["IdentityNumber"].ToString(); info.HighPrice = Core.MyConvert.GetDecimal(reader["HighPrice"].ToString()); info.Address = reader["Address"].ToString(); info.EndDate = Core.MyConvert.GetDateTime(reader["EndDate"].ToString()); info.CreateDate = Core.MyConvert.GetDateTime(reader["CreateDate"].ToString()); info.State = Core.MyConvert.GetInt32(reader["State"].ToString()); info.PassDate = Core.MyConvert.GetDateTime(reader["PassDate"].ToString()); info.CompanyId = Core.MyConvert.GetInt32(reader["UserId"].ToString()); info.AreaId = Core.MyConvert.GetInt32(reader["AreaId"].ToString()); info.DepartmentId = Core.MyConvert.GetInt32(reader["DepartmentId"].ToString()); info.Description = reader["Description"].ToString(); info.ForeCloseTypeId = Core.MyConvert.GetInt32(reader["ForeCloseTypeId"].ToString()); info.ForeColseTypeName = reader["ForeColseTypeName"].ToString(); info.LinePrice = Core.MyConvert.GetDecimal(reader["LinePrice"].ToString()); info.PassDate = Core.MyConvert.GetDateTime(reader["PassDate"].ToString()); } } return info; }