protected void LoanListDataGrid_ItemCommand(object source, DataGridCommandEventArgs e) { string id = string.Empty; if (e.CommandName == "LoanImageDelete") { int selectindex = e.Item.ItemIndex; id = this.LoanListDataGrid.Items[selectindex].Cells[0].Text; } // Response.Write("<script> if(confirm('是否删除')) document.getElementById('HidderField2').value='1';</script>"); if (!string.IsNullOrEmpty(id) && this.deleteflag == true) { int iSuccess = LoanMethods.DeleteLoanById(Convert.ToInt32(id)); if (iSuccess > 0) { Alert.Show(this, "删除成功!"); } else { Alert.Show(this, "删除失败!"); } if (queryList == null) { queryList = new List <QueryElement>(); } BindLoanListDataGrid(queryList); this.ClientScript.RegisterStartupScript(this.GetType(), "", "HideORShowColumn();", true); } }
protected void btnLoanAddSubmit_Click(object sender, EventArgs e) { BorrowORLoanInfo loanInfo = new BorrowORLoanInfo(); if (!string.IsNullOrEmpty(this.HiddenField1.Value.Trim())) { loanInfo.Id = Convert.ToInt32(this.HiddenField1.Value.Trim()); } else { loanInfo.Id = 0; } #region 验证 if (!CheckLoanAddForm()) { string type = this.RadioLoanAddLoanType.SelectedValue; string temp = this.HidderField2.Value; this.ClientScript.RegisterStartupScript(this.GetType(), "fillForm", "DisplayAddLoandiv('" + type + "');fillFormField({loanAccount:'" + temp + "'});", true); return; } #endregion loanInfo.Borrower = this.txtLoanAddBorrower.Text.Trim(); if (this.RadioLoanAddLoanType.SelectedValue == "2" && !string.IsNullOrEmpty(this.HidderField2.Value.Trim())) { string[] s = this.HidderField2.Value.Split(','); CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(s[0])); loanInfo.LoanAccount = cardInfo.CardNumber; loanInfo.BorrowORLoanAccountId = cardInfo.Id; } loanInfo.Lender = this.txtLoanAddLender.Text.Trim(); loanInfo.BorrowedAccount = this.txtLoanAddBorrowAccount.Text.Trim(); loanInfo.BorrowORLoanType = Convert.ToInt32(this.RadioLoanAddLoanType.SelectedValue); loanInfo.Amount = Convert.ToSingle(this.txtLoanAddLoanAmount.Text.Trim()); loanInfo.HappenedDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtLoanAddLoanDate.Text.Trim())); if (!string.IsNullOrEmpty(this.txtLoanAddReturnDate.Text.Trim())) { loanInfo.ReturnDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtLoanAddReturnDate.Text.Trim())); } loanInfo.Status = Convert.ToInt32(this.dropLoanAddStatus.SelectedValue); loanInfo.Content = this.txtLoanAddContent.Text.Trim(); int iSuccess = LoanMethods.InsertOrUpdatetoLoan(loanInfo); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddLoandiv();", true); if (iSuccess == 1) { Alert.Show(this, "新增一条收入成功!"); } else if (iSuccess == 2) { Alert.Show(this, "修改成功!"); } else { Alert.Show(this, "操作失败!"); } queryList = new List <QueryElement>(); BindLoanListDataGrid(queryList); }
private void BindLoanListDataGrid(List <QueryElement> list) { BorrowORLoanCollection coll = LoanMethods.GetLoanList(list); this.LoanListDataGrid.DataSource = coll; this.LoanListDataGrid.DataBind(); for (int i = 0; i < coll.Count; i++) { CardInfo cardInfo = CardMethods.GetCardById(coll[i].BorrowORLoanAccountId); string bank = StaticRescourse.DisplayBank(cardInfo.BankId); this.LoanListDataGrid.Items[i].Cells[2].Text = StaticRescourse.DisplayBorrowORLoanType(coll[i].BorrowORLoanType); this.LoanListDataGrid.Items[i].Cells[4].Text = coll[i].LoanAccount + " " + bank; this.LoanListDataGrid.Items[i].Cells[8].Text = coll[i].HappenedDate.ToString("yyyy-MM-dd"); bool dateFlag = HelperCommon.CompareAccordToRequired(coll[i].ReturnDate); if (dateFlag) { this.LoanListDataGrid.Items[i].Cells[9].Text = coll[i].ReturnDate.ToString("yyyy-MM-dd"); } else { this.LoanListDataGrid.Items[i].Cells[9].Text = string.Empty; } } }