コード例 #1
0
        protected void IncomeListDataGrid_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            string id = string.Empty;

            if (e.CommandName == "IncomeImageDelete")
            {
                int selectindex = e.Item.ItemIndex;
                id = this.IncomeListDataGrid.Items[selectindex].Cells[0].Text;
            }
            if (!string.IsNullOrEmpty(id) && this.deleteflag == true)
            {
                int iSuccess = CashIncomeMethods.DeleteCashIncome(Convert.ToInt32(id));
                if (iSuccess > 0)
                {
                    Alert.Show(this, "删除成功!");
                }
                else
                {
                    Alert.Show(this, "删除失败!");
                }
                if (queryList == null)
                {
                    queryList = new List <QueryElement>();
                }
                BindIncomeListDataGrid(queryList);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //if (Application["user"] != null)
                //{
                if (!string.IsNullOrEmpty(Request.QueryString["IncomeId"]))     //带参数访问为编辑状态
                {
                    Session["editFlag"] = "true";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayEditIncomediv();", true);
                    CashIncomeInfo cashInfo = CashIncomeMethods.GetCashIncomeById(Convert.ToInt32(Request.QueryString["IncomeId"]));
                    InitializeIncomeAdd(cashInfo);
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplaySysdiv();", true);
                }

                queryList = new List <QueryElement>();
                BindIncomeListDataGrid(queryList);
                //}
                //else
                //{
                //    Response.Redirect("~/Views/Login.aspx");
                //    Alert.Show(this, "请先登录!");
                //}
            }
        }
コード例 #3
0
        private void BindIncomeListDataGrid(List <QueryElement> list)
        {
            CashIncomeCollection coll = CashIncomeMethods.GetCashIncome(list);

            this.IncomeListDataGrid.DataSource = coll;
            this.IncomeListDataGrid.DataBind();
            for (int i = 0; i < coll.Count; i++)
            {
                CashIncomeInfo cashInfo = coll[i];
                CardInfo       cardInfo = CardMethods.GetCardByCardNumber(cashInfo.CardNumber, cashInfo.OwnerId);
                string         bank     = StaticRescourse.DisplayBank(cardInfo.BankId);
                this.IncomeListDataGrid.Items[i].Cells[1].Text = StaticRescourse.DisplayIncomeStatus(cashInfo.Status);
                this.IncomeListDataGrid.Items[i].Cells[4].Text = StaticRescourse.DisplayIncomeType(cashInfo.IncomeType);
                this.IncomeListDataGrid.Items[i].Cells[6].Text = StaticRescourse.DisplayMode(cashInfo.Mode);
                this.IncomeListDataGrid.Items[i].Cells[7].Text = StaticRescourse.DisplayRate(cashInfo.Rate);
                this.IncomeListDataGrid.Items[i].Cells[8].Text = cashInfo.DepositDate.ToString("yyyy-MM-dd");
                if (cashInfo.AutoSave == 1)
                {
                    this.IncomeListDataGrid.Items[i].Cells[12].Text = "是";
                }
                else
                {
                    this.IncomeListDataGrid.Items[i].Cells[12].Text = "否";
                }
                if (HelperCommon.CompareAccordToRequired(cashInfo.BDate))
                {
                    this.IncomeListDataGrid.Items[i].Cells[9].Text = cashInfo.BDate.ToString("yyyy-MM-dd");
                }
                else
                {
                    this.IncomeListDataGrid.Items[i].Cells[9].Text = string.Empty;
                }
                if (HelperCommon.CompareAccordToRequired(cashInfo.EDate))
                {
                    this.IncomeListDataGrid.Items[i].Cells[10].Text = cashInfo.EDate.ToString("yyyy-MM-dd");
                }
                else
                {
                    this.IncomeListDataGrid.Items[i].Cells[10].Text = string.Empty;
                }

                this.IncomeListDataGrid.Items[i].Cells[13].Text = StaticRescourse.DisplayIncomeDepositMode(cashInfo.DepositMode);
            }
        }
コード例 #4
0
        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);
        }