Beispiel #1
0
 /// <summary>
 /// 卡号选择SelectedIndexChanged事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void dropExpensesAddCardNumber_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.dropExpensesAddCardNumber.SelectedValue))
     {
         this.dropExpensesAddOwner.Enabled = true;
         List <DropItem> list = new List <DropItem>();
         list.Add(new DropItem {
             ValueField = "", DisplayField = " "
         });
         CardInfo       cardInfo = CardMethods.GetCardById(Convert.ToInt32(this.dropExpensesAddCardNumber.SelectedValue));
         UserCollection coll     = ExpensesMethods.GetOwnerByCardNumber(cardInfo.CardNumber);
         if (coll != null && coll.Count > 0)
         {
             for (int i = 0; i < coll.Count; i++)
             {
                 list.Add(new DropItem {
                     ValueField = coll[i].Id.ToString(), DisplayField = coll[i].Name
                 });
             }
             this.dropExpensesAddOwner.DataSource = list;
             Helper.SetDropDownList(this.dropExpensesAddOwner);
         }
     }
     else
     {
         this.dropExpensesAddOwner.Enabled       = false;
         this.dropExpensesAddOwner.DataSource    = new List <DropItem>();
         this.dropExpensesAddOwner.SelectedValue = string.Empty;
     }
 }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //if (Application["user"] != null)
         //{
         if (!string.IsNullOrEmpty(Request.QueryString["CardSettingId"]))
         {
             this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayCardEditdiv();", true);
             CardInfo info = CardMethods.GetCardById(Convert.ToInt32(Request.QueryString["CardSettingId"]));
             Initialize(info);
         }
         else
         {
             this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplaySysdiv();", true);
         }
         BindDataGrid(queryList);
         //}
         //else
         //{
         //    Response.Redirect("~/Views/Login.aspx");
         //    Alert.Show(this, "请先登录!");
         //}
     }
 }
        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 = "未还";
                }
            }
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        /// <summary>
        /// 新增提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnExpensesAddSubmit_Click(object sender, EventArgs e)
        {
            #region 验证
            ExpensesInfo expensesInfo = new ExpensesInfo();
            if (Session["expensensEditFlag"].Equals("true"))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayExpensesEditdiv();", true);
                expensesInfo.Id = Convert.ToInt32(Request.QueryString["ExpensesId"]);
            }
            else
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayExpensesAdddiv();", true);
            }
            if (string.IsNullOrEmpty(this.dropExpensesAddCardNumber.SelectedValue))
            {
                Alert.Show(this, "请输入卡号!");
                this.dropExpensesAddCardNumber.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtExpensesAddAmount.Text.Trim()))
            {
                Alert.Show(this, "请输入支出金额!");
                this.txtExpensesAddAmount.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtExpensesAddSpendDate.Text.Trim()))
            {
                Alert.Show(this, "请输入支出日期!");
                this.txtExpensesAddSpendDate.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.dropExpensesAddOwner.SelectedValue))
            {
                Alert.Show(this, "请输入资产所有者!");
                this.dropExpensesAddOwner.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.dropExpensesAddSpendType.SelectedValue))
            {
                Alert.Show(this, "请输入消费方式!");
                this.dropExpensesAddSpendType.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtExpensesAddConsumerName.Text.Trim()))
            {
                Alert.Show(this, "请输入消费者!");
                this.txtExpensesAddConsumerName.Focus();
                return;
            }
            #endregion

            #region 赋值

            expensesInfo.OwnerId   = Convert.ToInt32(this.dropExpensesAddOwner.SelectedValue);
            expensesInfo.OwnerName = this.dropExpensesAddOwner.SelectedItem.Text;
            CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(this.dropExpensesAddCardNumber.SelectedValue));
            expensesInfo.CardId         = Convert.ToInt32(this.dropExpensesAddCardNumber.SelectedValue);
            expensesInfo.CardNumber     = cardInfo.CardNumber;
            expensesInfo.BankCardNumber = this.dropExpensesAddCardNumber.SelectedItem.Text;
            expensesInfo.SpendType      = Convert.ToInt32(this.dropExpensesAddSpendType.SelectedValue);
            expensesInfo.HowToUse       = this.txtExpensesAddHowToUse.Text.Trim();
            if (string.IsNullOrEmpty(this.txtExpensesAddPrice.Text.Trim()))
            {
                expensesInfo.Price = 0;
            }
            else
            {
                expensesInfo.Price = Convert.ToSingle(this.txtExpensesAddPrice.Text.Trim());
            }

            if (string.IsNullOrEmpty(this.txtExpensesAddNumber.Text.Trim()))
            {
                expensesInfo.Number = 0;
            }
            else
            {
                expensesInfo.Number = Convert.ToInt32(this.txtExpensesAddNumber.Text.Trim());
            }
            expensesInfo.Amount    = Convert.ToSingle(this.txtExpensesAddAmount.Text.Trim());
            expensesInfo.SpendDate = Convert.ToDateTime(this.txtExpensesAddSpendDate.Text.Trim());
            expensesInfo.SpendMode = Convert.ToInt32(this.dropExpensesAddSpendMode.SelectedValue);
            UserInfo userInfo = UserMethods.GetUserByName(this.txtExpensesAddConsumerName.Text.Trim());
            if (userInfo.Id > 0)
            {
                expensesInfo.ConsumerId = userInfo.Id;
            }
            else
            {
                expensesInfo.ConsumerId = 0;
            }
            expensesInfo.ConsumerName = this.txtExpensesAddConsumerName.Text.Trim();
            expensesInfo.Content      = this.txtExpensesAddContent.Text.Trim();
            #endregion
            int iSuccess = ExpensesMethods.InsertOrUpdatetoExpenses(expensesInfo);
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayExpensesAdddiv();", true);
            if (iSuccess > 0)
            {
                Alert.Show(this, "新增一条收入成功!");
            }
            else if (iSuccess == -1)
            {
                Alert.Show(this, "修改成功!");
            }
            else
            {
                Alert.Show(this, "操作失败!");
            }
            InitializeExpensesAdd(new ExpensesInfo());
            queryList = new List <QueryElement>();
            BindExpensesListDataGrid(queryList);
        }
        protected void btnIncomeEditSave_Click(object sender, EventArgs e)
        {
            CashIncomeInfo info = new CashIncomeInfo();

            #region 验证
            if (Session["editFlag"].Equals("true"))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayEditIncomediv();", true);
                info.Id = Convert.ToInt32(Request.QueryString["IncomeId"]);
            }
            else
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddIncomediv();", true);
            }
            if (string.IsNullOrEmpty(this.dropIncomeAddCardNumber.SelectedValue))
            {
                Alert.Show(this, "请选择卡号!");
                this.dropIncomeAddCardNumber.Focus();
                return;
            }
            if (string.IsNullOrEmpty(this.dropIncomeAddInComeType.SelectedValue))
            {
                Alert.Show(this, "请输入收入类型!");
                this.dropIncomeAddInComeType.Focus();
                return;
            }
            if (string.IsNullOrEmpty(this.dropIncomeAddMode.SelectedValue))
            {
                Alert.Show(this, "请输入存款状态!");
                this.dropIncomeAddMode.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtIncomeAddAmount.Text.Trim()))
            {
                Alert.Show(this, "请输入收入金额!");
                this.txtIncomeAddAmount.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.dropIncomeAddRate.SelectedValue))
            {
                Alert.Show(this, "请输入利率!");
                this.dropIncomeAddRate.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtIncomeAddDepositDate.Text.Trim()))
            {
                Alert.Show(this, "请输入存款日期!");
                this.txtIncomeAddDepositDate.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtIncomeAddDepositorName.Text.Trim()))
            {
                Alert.Show(this, "请输入存款人!");
                this.txtIncomeAddDepositDate.Focus();
                return;
            }

            if (!string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()) || !string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim()))
            {
                if (!string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()) && string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim()))
                {
                    Alert.Show(this, "请输入到期日期!");
                    this.txtIncomeAddEDate.Focus();
                    return;
                }
                else if (string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim()))
                {
                    Alert.Show(this, "请输入定存开始日期!");
                    this.txtIncomeAddBDate.Focus();
                    return;
                }
                else
                {
                    bool comparflag = true;
                    comparflag = HelperCommon.ValidDateTime(string.Format("{0:d}", this.txtIncomeAddBDate.Text.Trim()), string.Format("{0:d}", this.txtIncomeAddEDate.Text.Trim()));
                    if (!comparflag)
                    {
                        Alert.Show(this, "到期日期不能小于开始日期");
                        this.txtIncomeAddEDate.Focus();
                        return;
                    }

                    comparflag = HelperCommon.ComparDay(string.Format("{0:d}", this.txtIncomeAddBDate.Text.Trim()), string.Format("{0:d}", this.txtIncomeAddEDate.Text.Trim()));
                    if (!comparflag)
                    {
                        Alert.Show(this, "定存日期必须大于等于三个月!");
                        this.txtIncomeAddEDate.Focus();
                        return;
                    }
                }
            }
            if (string.IsNullOrEmpty(this.dropIncomeAddStatus.SelectedValue))
            {
                Alert.Show(this, "请选择收入状态!");
                this.dropIncomeAddStatus.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.dropIncomeAddDepositMode.SelectedValue))
            {
                Alert.Show(this, "请选存款方式!");
                this.dropIncomeAddDepositMode.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtIncomeAddOwner.Text.Trim()))
            {
                Alert.Show(this, "请输入资产所有者!");
                this.txtIncomeAddOwner.Focus();
                return;
            }

            #endregion

            #region 赋值
            UserInfo userInfo = UserMethods.GetUserByName(this.txtIncomeAddOwner.Text.Trim());
            info.OwnerName = this.txtIncomeAddOwner.Text.Trim();
            userInfo       = UserMethods.GetUserByName(this.txtIncomeAddOwner.Text.Trim());
            if (userInfo.Id > 0)
            {
                info.OwnerId = userInfo.Id;
            }
            else
            {
                info.OwnerId = 0;
            }
            CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(this.dropIncomeAddCardNumber.SelectedValue));
            info.CardNumber     = cardInfo.CardNumber;
            info.BankCardNumber = cardInfo.CardNumber + " " + StaticRescourse.DisplayBank(cardInfo.BankId);
            info.CardId         = Convert.ToInt32(this.dropIncomeAddCardNumber.SelectedItem.Value);
            info.IncomeAmount   = Convert.ToSingle(this.txtIncomeAddAmount.Text.Trim());
            info.PreMode        = Convert.ToInt32(this.dropIncomeAddPreMode.SelectedValue);
            info.Mode           = Convert.ToInt32(this.dropIncomeAddMode.SelectedValue);
            info.PreRate        = Convert.ToInt32(this.dropIncomeAddPreRate.SelectedValue);
            info.Rate           = Convert.ToInt32(this.dropIncomeAddRate.SelectedValue);
            info.DepositDate    = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtIncomeAddDepositDate.Text.Trim()));
            if (!string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()))
            {
                info.BDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtIncomeAddBDate.Text.Trim()));
            }

            if (!string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim()))
            {
                info.EDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtIncomeAddEDate.Text.Trim()));
            }

            if (this.checkIncomeAddAutoSave.Checked)
            {
                info.AutoSave = 1;
            }
            else
            {
                info.AutoSave = 0;
            }

            userInfo = UserMethods.GetUserByName(this.txtIncomeAddDepositorName.Text.Trim());
            if (userInfo.Id > 0)
            {
                info.DepositorId = userInfo.Id;
            }
            else
            {
                info.DepositorId = 0;
            }

            info.DepositorName = this.txtIncomeAddDepositorName.Text.Trim();
            info.DepositMode   = Convert.ToInt32(this.dropIncomeAddDepositMode.SelectedValue);
            info.Status        = Convert.ToInt32(this.dropIncomeAddStatus.SelectedValue);
            info.IncomeType    = Convert.ToInt32(this.dropIncomeAddInComeType.SelectedValue);
            info.TAmount       = info.IncomeAmount;
            info.Content       = !string.IsNullOrEmpty(this.txtIncomeAddContent.Text.Trim()) ? this.txtIncomeAddContent.Text.Trim() : string.Empty;
            #endregion
            int iSuccess = CashIncomeMethods.InsertOrUpdatetocashincome(info);
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddIncomediv();", true);
            if (iSuccess > 0)
            {
                Alert.Show(this, "新增一条收入成功!");
            }
            else if (iSuccess == -1)
            {
                Alert.Show(this, "修改成功!");
            }
            else
            {
                Alert.Show(this, "操作失败!");
            }
            InitializeIncomeAdd(new CashIncomeInfo());
            queryList = new List <QueryElement>();
            BindIncomeListDataGrid(queryList);
        }