/// <summary> /// 新增操作,返回自增长ID /// </summary> /// <param name="info"></param> /// <param name="credId"></param> /// <returns></returns> public int InsertCreditInfo(CreditInfo info, out int credId) { credId = 0; if (info == null) { return 0; } return DAL.InsertCreditInfo(info, out credId); }
/// <summary> /// 根据债权ID获取债权信息 /// </summary> /// <param name="credID"></param> /// <returns></returns> public CreditInfo GetCreditInfoByCredID(object credID) { int id = XYECOM.Core.MyConvert.GetInt32(credID.ToString()); CreditInfo info = new CreditInfo(); if (id <= 0) { return info; } return new CreditInfoManager().GetCreditInfoById(id); }
/// <summary> /// 增加债权信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public bool InsertCreditInfo(CreditInfo info) { if (info == null) { return false; } int result = DAL.InsertCreditInfo(info); if (result > 0) { return true; } else { return false; } }
/// <summary> /// 根据编号获取抵债信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public CreditInfo GetCreditInfoById(int id) { string sql = "SELECT * FROM CreditInfo WHERE CreditId = @Id"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@Id",id), }; CreditInfo info = null; using (SqlDataReader reader = XYECOM.Core.Data.SqlHelper.ExecuteReader(CommandType.Text, sql, param)) { if (reader.Read()) { info = new CreditInfo(); info.CreditId = id; info.Title = reader["Title"].ToString(); info.Age = reader["Age"].ToString(); info.ApprovaStatus = Core.MyConvert.GetInt32(reader["ApprovaStatus"].ToString()); info.AreaId = Core.MyConvert.GetInt32(reader["AreaId"].ToString()); info.Arrears = Core.MyConvert.GetDecimal(reader["Arrears"].ToString()); info.Bounty = Core.MyConvert.GetDecimal(reader["Bounty"].ToString()); info.CollectionPeriod = reader["CollectionPeriod"].ToString(); info.CreateDate = Core.MyConvert.GetDateTime(reader["CreateDate"].ToString()); info.DebtObligation = reader["DebtObligation"].ToString(); info.DebtorName = reader["DebtorName"].ToString(); info.DebtorReason = reader["DebtorReason"].ToString(); info.DebtorTelpone = reader["DebtorTelpone"].ToString(); info.DebtorType = reader["DebtorType"].ToString(); info.DepartId = Core.MyConvert.GetInt32(reader["DepartId"].ToString()); info.Introduction = reader["Introduction"].ToString(); info.IsConfirm = Core.MyConvert.GetBoolean(reader["IsConfirm"].ToString()); info.IsCreditEvaluation = Core.MyConvert.GetBoolean(reader["IsCreditEvaluation"].ToString()); info.IsInLitigation = Core.MyConvert.GetBoolean(reader["IsInLitigation"].ToString()); info.IsLitigationed = Core.MyConvert.GetBoolean(reader["IsLitigationed"].ToString()); info.IsSelfCollection = Core.MyConvert.GetBoolean(reader["IsSelfCollection"].ToString()); info.IsServerEvaluation = Core.MyConvert.GetBoolean(reader["IsServerEvaluation"].ToString()); info.IsCreditEvaluation = Core.MyConvert.GetBoolean(reader["IsCreditEvaluation"].ToString()); info.LicenseType = reader["LicenseType"].ToString(); info.PassDate = Core.MyConvert.GetDateTime(reader["PassDate"].ToString()); info.Remark = reader["Remark"].ToString(); info.UserId = Core.MyConvert.GetInt32(reader["UserId"].ToString()); info.IsDraft = Core.MyConvert.GetBoolean(reader["IsDraft"].ToString()); } } return info; }
protected void btnOk_Click(object sender, EventArgs e) { string goUrl = string.Empty; CreditInfo info = new CreditInfo(); info.Title = this.txtTitle.Text.Trim(); info.Age = this.txtAge.Text.Trim(); string radSelect = this.radSelect.SelectedValue; if (radSelect == "草稿") { goUrl = "DraftCreditList.aspx"; info.ApprovaStatus = (int)CreditState.Draft; } else { goUrl = "CreditInfoList.aspx"; info.ApprovaStatus = (int)CreditState.Null; } info.AreaId = MyConvert.GetInt32(this.areaid.Value); info.Arrears = MyConvert.GetDecimal(this.txtArrears.Text.Trim()); info.Bounty = MyConvert.GetDecimal(this.txtBounty.Text.Trim()); info.CollectionPeriod = this.txtCollectionPeriod.Text.Trim(); info.CreateDate = DateTime.Now; string debtObligation = string.Empty; for (int i = 0; i < this.cheDebtObligation.Items.Count; i++) { if (this.cheDebtObligation.Items[i].Selected == true) { debtObligation += this.cheDebtObligation.Items[i].Value + ","; } } if (debtObligation.Length > 0) { info.DebtObligation = debtObligation.Substring(0, debtObligation.Length - 1); } else { info.DebtObligation = ""; } info.DebtorName = this.txtDebtorName.Text.Trim(); info.DebtorReason = this.txtDebtorReason.Text.Trim(); info.DebtorTelpone = this.txtDebtorTelpone.Text.Trim(); info.DebtorType = this.rdDebtorType.SelectedValue; info.DepartId = MyConvert.GetInt32(userinfo.userid.ToString()); info.Introduction = this.txtIntroduction.Text.Trim(); info.IsConfirm = this.radIsConfirm.SelectedValue == "1" ? true : false; info.IsInLitigation = this.radIsInLitigation.SelectedValue == "1" ? true : false; info.IsLitigationed = this.radIsLitigationed.SelectedValue == "1" ? true : false; info.IsSelfCollection = this.radIsSelfCollection.SelectedValue == "1" ? true : false; info.LicenseType = this.rdLicenseType.SelectedValue; info.Remark = this.txtRemark.Text.Trim(); info.IsDraft = false; info.UserId = MyConvert.GetInt32(userinfo.CompanyId.ToString()); int credId = 0; int result = credManage.InsertCreditInfo(info, out credId); string caseType = Request.Form["case"]; if (caseType == "1") { //添加选择的档案信息 RelatedCaseInfoManager relateManage = new RelatedCaseInfoManager(); string strCase = this.hdgetid.Value; string[] cases = strCase.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); relateManage.RelatedInfo(TableInfoType.ZqInfo, credId, userinfo.userid, userinfo.CompanyId, cases); } if (caseType == "0") { Business.CaseManager caseManager = new Business.CaseManager(); string filePath = CaseUploadManager.UpLoadFile(userinfo.CompanyId, userinfo.userid, 0); CaseInfo caseInfo = new CaseInfo(); caseInfo.CaseName = info.Title; caseInfo.CaseTypeId = 0; caseInfo.CaseTypeName = "默认分类"; caseInfo.CompanyId = userinfo.CompanyId; caseInfo.CompanyName = userinfo.CompanyName; caseInfo.CreateDate = DateTime.Now; caseInfo.Description = info.Introduction; caseInfo.FilePath = filePath; caseInfo.PartId = userinfo.userid; caseInfo.PartName = userinfo.LayerName; int infoId = 0; caseManager.Insert(caseInfo, out infoId); RelatedCaseInfoManager relateManage = new RelatedCaseInfoManager(); relateManage.RelatedInfo(TableInfoType.ZqInfo, credId, userinfo.userid, userinfo.CompanyId, infoId); } if (result > 0) { this.udCreditInfo.InfoID = credId; this.udCreditInfo.Update(); GotoMsgBoxPageForDynamicPage("添加债权信息成功!", 1, goUrl); } else { GotoMsgBoxPageForDynamicPage("添加债权信息失败!", 1, goUrl); } }
/// <summary> /// 增加债权信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public int InsertCreditInfo(CreditInfo info) { string sql = @"Insert into CreditInfo (Title,DebtorName,DebtorTelpone,CollectionPeriod,DebtorReason,Arrears,Bounty, Remark,LicenseType,DebtorType,Introduction,Age,IsInLitigation,IsLitigationed,IsSelfCollection,IsConfirm, DebtObligation,DepartId,UserId,ApprovaStatus,CreateDate,AreaId,IsDraft) values (@Title,@DebtorName,@DebtorTelpone,@CollectionPeriod,@DebtorReason,@Arrears,@Bounty,@Remark, @LicenseType,@DebtorType,@Introduction,@Age,@IsInLitigation,@IsLitigationed,@IsSelfCollection,@IsConfirm, @DebtObligation,@DepartId,@UserId,@ApprovaStatus,@CreateDate,@AreaId,@IsDraft)"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@Title",info.Title), new SqlParameter("@DebtorName",info.DebtorName), new SqlParameter("@DebtorTelpone",info.DebtorTelpone), new SqlParameter("@CollectionPeriod",info.CollectionPeriod), new SqlParameter("@DebtorReason",info.DebtorReason), new SqlParameter("@Arrears",info.Arrears), new SqlParameter("@Bounty",info.Bounty), new SqlParameter("@Remark",info.Remark), new SqlParameter("@LicenseType",info.LicenseType), new SqlParameter("@DebtorType",info.DebtorType), new SqlParameter("@Introduction",info.Introduction), new SqlParameter("@Age",info.Age), new SqlParameter("@IsInLitigation",info.IsInLitigation), new SqlParameter("@IsLitigationed",info.IsLitigationed), new SqlParameter("@IsSelfCollection",info.IsSelfCollection), new SqlParameter("@IsConfirm",info.IsConfirm), new SqlParameter("@DebtObligation",info.DebtObligation), new SqlParameter("@DepartId",info.DepartId), new SqlParameter("@UserId",info.UserId), new SqlParameter("@ApprovaStatus",info.ApprovaStatus), new SqlParameter("@CreateDate",info.CreateDate), new SqlParameter("@AreaId",info.AreaId), new SqlParameter("@IsDraft",info.IsDraft) }; int rowAffected = SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param); return rowAffected; }
/// <summary> /// 修改债权信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public int UpdateCreditInfoByID(CreditInfo info) { string sql = @"UPDATE CreditInfo SET Title = @Title,DebtorName=@DebtorName,DebtorTelpone=@DebtorTelpone,CollectionPeriod=@CollectionPeriod,DebtorReason=@DebtorReason, Arrears=@Arrears,Bounty=@Bounty,Remark=@Remark,LicenseType=@LicenseType,DebtorType=@DebtorType,Introduction=@Introduction, Age=@Age,IsInLitigation=@IsInLitigation,IsLitigationed=@IsLitigationed,IsSelfCollection=@IsSelfCollection,IsConfirm=@IsConfirm,DebtObligation=@DebtObligation, ApprovaStatus=@ApprovaStatus,AreaId=@AreaId,IsDraft=@IsDraft WHERE CreditId=@CreditId"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@Title",info.Title), new SqlParameter("@DebtorName",info.DebtorName), new SqlParameter("@DebtorTelpone",info.DebtorTelpone), new SqlParameter("@CollectionPeriod",info.CollectionPeriod), new SqlParameter("@DebtorReason",info.DebtorReason), new SqlParameter("@Arrears",info.Arrears), new SqlParameter("@Bounty",info.Bounty), new SqlParameter("@Remark",info.Remark), new SqlParameter("@LicenseType",info.LicenseType), new SqlParameter("@DebtorType",info.DebtorType), new SqlParameter("@Introduction",info.Introduction), new SqlParameter("@Age",info.Age), new SqlParameter("@IsInLitigation",info.IsInLitigation), new SqlParameter("@IsLitigationed",info.IsLitigationed), new SqlParameter("@IsSelfCollection",info.IsSelfCollection), new SqlParameter("@IsConfirm",info.IsConfirm), new SqlParameter("@DebtObligation",info.DebtObligation), new SqlParameter("@ApprovaStatus",info.ApprovaStatus), new SqlParameter("@AreaId",info.AreaId), new SqlParameter("@CreditId",info.CreditId), new SqlParameter("@IsDraft",info.IsDraft) }; int rowAffected = SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param); return rowAffected; }
/// <summary> /// 新增并获取自增长列的值 /// </summary> /// <param name="info"></param> /// <param name="Id"></param> /// <returns></returns> public int InsertCreditInfo(CreditInfo info, out int Id) { string sql = @"Insert into CreditInfo (Title,DebtorName,DebtorTelpone,CollectionPeriod,DebtorReason,Arrears,Bounty, Remark,LicenseType,DebtorType,Introduction,Age,IsInLitigation,IsLitigationed,IsSelfCollection,IsConfirm, DebtObligation,DepartId,UserId,ApprovaStatus,CreateDate,AreaId,IsDraft) values (@Title,@DebtorName,@DebtorTelpone,@CollectionPeriod,@DebtorReason,@Arrears,@Bounty,@Remark, @LicenseType,@DebtorType,@Introduction,@Age,@IsInLitigation,@IsLitigationed,@IsSelfCollection,@IsConfirm, @DebtObligation,@DepartId,@UserId,@ApprovaStatus,@CreateDate,@AreaId,@IsDraft);select @ID = @@identity"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@ID",SqlDbType.Int), new SqlParameter("@Title",info.Title), new SqlParameter("@DebtorName",info.DebtorName), new SqlParameter("@DebtorTelpone",info.DebtorTelpone), new SqlParameter("@CollectionPeriod",info.CollectionPeriod), new SqlParameter("@DebtorReason",info.DebtorReason), new SqlParameter("@Arrears",info.Arrears), new SqlParameter("@Bounty",info.Bounty), new SqlParameter("@Remark",info.Remark), new SqlParameter("@LicenseType",info.LicenseType), new SqlParameter("@DebtorType",info.DebtorType), new SqlParameter("@Introduction",info.Introduction), new SqlParameter("@Age",info.Age), new SqlParameter("@IsInLitigation",info.IsInLitigation), new SqlParameter("@IsLitigationed",info.IsLitigationed), new SqlParameter("@IsSelfCollection",info.IsSelfCollection), new SqlParameter("@IsConfirm",info.IsConfirm), new SqlParameter("@DebtObligation",info.DebtObligation), new SqlParameter("@DepartId",info.DepartId), new SqlParameter("@UserId",info.UserId), new SqlParameter("@ApprovaStatus",info.ApprovaStatus), new SqlParameter("@CreateDate",info.CreateDate), new SqlParameter("@AreaId",info.AreaId), new SqlParameter("@IsDraft",info.IsDraft) }; 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() != "") Id = (int)param[0].Value; else Id = 0; } else { Id = -1; } return rowAffected; }
/// <summary> /// 修改债权信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public int UpdateCreditInfoByID(CreditInfo info) { if (info == null) { return 0; } return DAL.UpdateCreditInfoByID(info); }