private void BindBorrowListDataGrid(List<QueryElement> list)
        {
            BorrowORLoanCollection coll = BorrowedMethods.GetBorrowList(list);
            this.BorrowListDataGrid.DataSource = coll;
            this.BorrowListDataGrid.DataBind();
            for (int i = 0; i < coll.Count; i++)
            {
                CardInfo cardInfo = CardMethods.GetCardById(coll[i].BorrowORLoanAccountId);
                string bank = StaticRescourse.DisplayBank(cardInfo.BankId);
                this.BorrowListDataGrid.Items[i].Cells[4].Text = coll[i].BorrowedAccount + " " + bank;

                this.BorrowListDataGrid.Items[i].Cells[8].Text = coll[i].HappenedDate.ToString("yyyy-MM-dd");
                this.BorrowListDataGrid.Items[i].Cells[2].Text = StaticRescourse.DisplayBorrowORLoanType(coll[i].BorrowORLoanType);
                bool dateFlag = HelperCommon.CompareAccordToRequired(coll[i].ReturnDate);
                if (dateFlag)
                {
                    this.BorrowListDataGrid.Items[i].Cells[9].Text = coll[i].ReturnDate.ToString("yyyy-MM-dd");
                }
                else
                {
                    this.BorrowListDataGrid.Items[i].Cells[9].Text = string.Empty;
                }
                if (coll[i].Status == 2)
                {
                    this.BorrowListDataGrid.Items[i].Cells[10].Text = "已还";
                }
                else
                {
                    this.BorrowListDataGrid.Items[i].Cells[10].Text = "未还";
                }
            }
        }
        //protected void btnBorrowQueryCanel_Click(object sender, EventArgs e)
        //{
        //    this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplaySysdiv();", true);
        //}

        protected void BorrowListDataGrid_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            string id = string.Empty;
            if (e.CommandName == "BorrowImageDelete")
            {
                int selectindex = e.Item.ItemIndex;
                id = this.BorrowListDataGrid.Items[selectindex].Cells[0].Text;
            }
            if (!string.IsNullOrEmpty(id) && this.deleteflag == true)
            {
                int iSuccess = BorrowedMethods.DeleteBorrowedById(Convert.ToInt32(id));
                if (iSuccess > 0)
                {
                    Alert.Show(this, "删除成功!");
                }
                else
                {
                    Alert.Show(this, "删除失败!");
                }
                if (queryList == null)
                {
                    queryList = new List<QueryElement>();
                }
                BindBorrowListDataGrid(queryList);
            }
        }
示例#3
0
        public static BorrowORLoanViewInfo GetBorrowInfo(string Id)
        {
            BorrowORLoanInfo     info     = BorrowedMethods.GetBorrowById(Convert.ToInt32(Id));
            BorrowORLoanViewInfo viewInfo = ViewInfoUtils.BuildBorrowORLoanViewInfo(info);

            viewInfo.BorrowedAccountList = getLoanAccountByPerson(viewInfo.Borrower);
            return(viewInfo);
        }
        protected void btnBorrowAddSubmit_Click(object sender, EventArgs e)
        {
            #region 验证

            BorrowORLoanInfo borrowInfo = new BorrowORLoanInfo();
            if (!string.IsNullOrEmpty(this.HiddenField1.Value.Trim()))
            {
                borrowInfo.Id = Convert.ToInt32(this.HiddenField1.Value.Trim());
            }
            else
            {
                borrowInfo.Id = 0;
            }

            if (!CheckBorrowAddForm())
            {
                string temp = this.HiddenField2.Value;
                string type = this.RadioBorrowAddBorrowType.SelectedValue;
                this.ClientScript.RegisterStartupScript(this.GetType(), "fillForm", "DisplayAddBorrowdiv('" + type + "');fillFormField({borrowAccount:'" + temp + "'});", true);
                return;
            }

            #endregion
            borrowInfo.BorrowORLoanType = Convert.ToInt32(this.RadioBorrowAddBorrowType.SelectedValue);
            borrowInfo.Borrower = this.txtBorrowAddBorrower.Text.Trim();
            //borrowInfo.BorrowedAccount = this.txtBorrowAddBorrowAccount.Text.Trim();
            if (this.RadioBorrowAddBorrowType.SelectedValue == "2" && !string.IsNullOrEmpty(this.HiddenField2.Value))
            {
                string[] s = this.HiddenField2.Value.Split(',');
                CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(s[0]));
                borrowInfo.BorrowedAccount = cardInfo.CardNumber;
                borrowInfo.BorrowORLoanAccountId = cardInfo.Id;
            }
            borrowInfo.Lender = this.txtBorrowAddLender.Text.Trim();
            borrowInfo.LoanAccount = this.txtBorrowAddLoanAccount.Text.Trim();
            borrowInfo.Amount = Convert.ToSingle(this.txtBorrowAddBorrowAmount.Text.Trim());
            borrowInfo.HappenedDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtBorrowAddBorrowDate.Text.Trim()));
            if (!string.IsNullOrEmpty(this.txtBorrowAddReturnDate.Text.Trim()))
            {
                borrowInfo.ReturnDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtBorrowAddReturnDate.Text.Trim()));
            }
            borrowInfo.Content = this.txtBorrowAddContent.Text.Trim();
            borrowInfo.Status = Convert.ToInt32(this.dropBorrowAddStatus.SelectedValue);
            int iSuccess = BorrowedMethods.InsertOrUpdatetoBorrowed(borrowInfo);
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddBorrowdiv();", true);
            if (iSuccess == 1)
            {
                Alert.Show(this, "新增一条收入成功!");
            }
            else if (iSuccess == 2)
            {
                Alert.Show(this, "修改成功!");
            }
            else
            {
                Alert.Show(this, "操作失败!");
            }
            InitializeBorrowAdd();
            queryList = new List<QueryElement>();
            BindBorrowListDataGrid(queryList);
        }