public CashIncomeInfo(CashIncomeInfo cashIncomeInfo) { this.id = cashIncomeInfo.Id; this.ownerId = cashIncomeInfo.OwnerId; this.ownerName = cashIncomeInfo.OwnerName; this.cardId = cashIncomeInfo.CardId; this.cardNumber = cashIncomeInfo.CardNumber; this.bankCardNumber = cashIncomeInfo.BankCardNumber; this.incomeAmount = cashIncomeInfo.IncomeAmount; this.preMode = cashIncomeInfo.PreMode; this.mode = cashIncomeInfo.Mode; this.preRate = cashIncomeInfo.PreRate; this.rate = cashIncomeInfo.Rate; this.depositDate = cashIncomeInfo.DepositDate; this.bDate = cashIncomeInfo.BDate; this.eDate = cashIncomeInfo.EDate; this.autoSave = cashIncomeInfo.AutoSave; this.depositorId = cashIncomeInfo.DepositorId; this.depositorName = cashIncomeInfo.DepositorName; this.depositMode = cashIncomeInfo.DepositMode; this.status = cashIncomeInfo.Status; this.incomeType = cashIncomeInfo.IncomeType; this.tAmount = cashIncomeInfo.TAmount; this.content = cashIncomeInfo.Content; }
public static void AddTableRow(DataTable table, CashIncomeInfo cashIncomeInfo) { System.Data.DataRow dr = table.NewRow(); dr["Id"] = cashIncomeInfo.id; dr["OwnerId"] = cashIncomeInfo.ownerId; dr["OwnerName"] = cashIncomeInfo.ownerName; dr["CardId"] = cashIncomeInfo.cardId; dr["CardNumber"] = cashIncomeInfo.cardNumber; dr["BankCardNumber"] = cashIncomeInfo.bankCardNumber; dr["IncomeAmount"] = cashIncomeInfo.incomeAmount; dr["PreMode"] = cashIncomeInfo.preMode; dr["Mode"] = cashIncomeInfo.mode; dr["PreRate"] = cashIncomeInfo.preRate; dr["Rate"] = cashIncomeInfo.rate; dr["DepositDate"] = cashIncomeInfo.depositDate; dr["BDate"] = cashIncomeInfo.bDate; dr["EDate"] = cashIncomeInfo.eDate; dr["AutoSave"] = cashIncomeInfo.autoSave; dr["DepositorId"] = cashIncomeInfo.depositorId; dr["DepositorName"] = cashIncomeInfo.depositorName; dr["DepositMode"] = cashIncomeInfo.depositMode; dr["Status"] = cashIncomeInfo.status; dr["IncomeType"] = cashIncomeInfo.incomeType; dr["TAmount"] = cashIncomeInfo.tAmount; dr["Content"] = cashIncomeInfo.content; table.Rows.Add(dr); }
public CashIncomeInfo Get(long id) { if (indexerForPrimaryKeys == null || innerListChanged) { innerListChanged = false; indexerForPrimaryKeys = new Dictionary <string, int>(); for (int i = 0, count = this.List.Count; i < count; i++) { CashIncomeInfo cashIncomeInfo = this.List[i] as CashIncomeInfo; indexerForPrimaryKeys.Add(string.Concat(cashIncomeInfo.Id.ToString()), i); } } int index; if (indexerForPrimaryKeys.TryGetValue(string.Concat(id.ToString()), out index)) { return(this.List[index] as CashIncomeInfo); } else { return(null); } }
public bool Contains(CashIncomeInfo value) { if (IndexOf(value) > -1) { return(true); } return(false); }
public int IndexOf(CashIncomeInfo value) { for (int i = 0, count = this.List.Count; i < count; i++) { if (value.Equals(this.List[i] as CashIncomeInfo)) { return(i); } } return(-1); }
public static CashIncomeInfo GetCashIncomeById(int id) { CashIncomeInfo cashIncomeInfo = new CashIncomeInfo(); StringBuilder sb = new StringBuilder(); sb.Append(" select * from cashincome where Id=@Id"); MySqlParameter par = new MySqlParameter("@Id", MySqlDbType.Int32); par.Value = id; using (MySqlDataReader reader = MySqlDBHelper.GetReader(sb.ToString(), par)) { while (reader.Read()) { cashIncomeInfo = new CashIncomeInfo(reader); } } return cashIncomeInfo; }
public override bool Equals(object obj) { if (!base.Equals(obj)) { return(false); } if (obj == null) { return(false); } if (this.GetType() != obj.GetType()) { return(false); } CashIncomeInfo cashIncomeInfo = obj as CashIncomeInfo; return(this.id.Equals(cashIncomeInfo.Id)); }
public static int InsertOrUpdatetocashincome(CashIncomeInfo info) { int iSuccess = 0; int uSuccess = 0; CashIncomeInfo cashIncomeInfo = new CashIncomeInfo(); if (info.Id > 0) { cashIncomeInfo = CashInComeDAL.GetCashIncomeById(info.Id); } CashInComeDAL.InsertOrUpdatetocashincome(info,out iSuccess); if (iSuccess > 0 || iSuccess==-1) { CardInfo cardInfo = CardDAL.GetCardById(info.CardId); float amount = 0; float incomeamount = 0; if (info.Id > 0) { amount =cardInfo.Amount+(info.IncomeAmount - cashIncomeInfo.IncomeAmount); incomeamount = cardInfo.IncomeAmount + (info.IncomeAmount - cashIncomeInfo.IncomeAmount); } else { amount = cardInfo.Amount+ info.IncomeAmount; incomeamount = cardInfo.IncomeAmount + info.IncomeAmount; } CardDAL.UpdateCardAmount(amount,incomeamount,info.CardId,1,out uSuccess); } if (iSuccess > 0 && uSuccess>0) { return 1; } else if (iSuccess == -1 && uSuccess>0) { return -1; } else { return 0; } }
/// <summary> /// Constructor using CcZlCzBillInfo array. /// </summary> /// <param name="value" /> public CashIncomeCollection(CashIncomeInfo[] value) { this.AddRange(value); }
public void Remove(CashIncomeInfo value) { List.Remove(value); innerListChanged = true; }
public void Insert(int index, CashIncomeInfo value) { List.Insert(index, value); innerListChanged = true; }
public int IndexOf(CashIncomeInfo value) { for (int i = 0, count = this.List.Count; i < count; i++) { if (value.Equals(this.List[i] as CashIncomeInfo)) return i; } return -1; }
public void CopyTo(CashIncomeInfo[] array, int index) { this.List.CopyTo(array, index); }
public bool Contains(CashIncomeInfo value) { if (IndexOf(value) > -1) return true; return false; }
public void AddRange(CashIncomeInfo[] value) { for (int i = 0; (i < value.Length); i++) { this.Add(value[i]); } }
public int Add(CashIncomeInfo value) { return this.List.Add(value); }
protected void btnIncomeAdd_Click(object sender, EventArgs e) { Session["editFlag"] = "false"; CashIncomeInfo info = new CashIncomeInfo(); InitializeIncomeAdd(info); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddIncomediv();", true); }
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); }
/// <summary> ///编辑时初始化dropdownlist /// </summary> private void InitializeEditDropControl(CashIncomeInfo info) { this.dropIncomeAddInComeType.DataSource = StaticRescourse.GetIncomeType(); Helper.SetDropDownList(this.dropIncomeAddInComeType); this.dropIncomeAddPreRate.DataSource = StaticRescourse.GetRateType(); Helper.SetDropDownList(this.dropIncomeAddPreRate); this.dropIncomeAddRate.DataSource = StaticRescourse.GetRate(this.dropIncomeAddPreRate.SelectedItem.Text); Helper.SetDropDownList(this.dropIncomeAddRate); this.dropIncomeAddStatus.DataSource = StaticRescourse.GetIncomeStatus(); Helper.SetDropDownList(this.dropIncomeAddStatus); this.dropIncomeAddDepositMode.DataSource = StaticRescourse.GetIncomDepositMode(); Helper.SetDropDownList(this.dropIncomeAddDepositMode); this.dropIncomeAddPreMode.DataSource = StaticRescourse.GetRateType(); Helper.SetDropDownList(this.dropIncomeAddPreMode); this.dropIncomeAddMode.DataSource = StaticRescourse.GetMode(this.dropIncomeAddPreMode.SelectedItem.Text); Helper.SetDropDownList(this.dropIncomeAddMode); if (info.Id>0) { this.dropIncomeAddInComeType.SelectedValue = info.IncomeType.ToString(); this.dropIncomeAddPreRate.SelectedValue = info.PreRate.ToString(); this.dropIncomeAddRate.SelectedValue = info.Rate.ToString(); this.dropIncomeAddStatus.SelectedValue = info.Status.ToString(); this.dropIncomeAddDepositMode.SelectedValue = info.DepositMode.ToString(); this.dropIncomeAddPreMode.SelectedValue = info.PreMode.ToString(); this.dropIncomeAddMode.SelectedValue = info.Mode.ToString(); } else { this.dropIncomeAddInComeType.SelectedValue = "1"; this.dropIncomeAddPreRate.SelectedValue = "1"; this.dropIncomeAddRate.SelectedValue = "1"; this.dropIncomeAddStatus.SelectedValue = "1"; this.dropIncomeAddDepositMode.SelectedValue = "1"; this.dropIncomeAddPreMode.SelectedValue = "1"; this.dropIncomeAddMode.SelectedValue = "1"; } }
/// <summary> ///新增初始化 /// </summary> /// <param name="info"></param> private void InitializeIncomeAdd(CashIncomeInfo info) { if (info.Id > 0) { #region 编辑时初始化 this.dropIncomeAddCardNumber.Enabled = false; List<DropItem> card = new List<DropItem>(); card.Add(new DropItem { DisplayField = info.CardNumber, ValueField = info.CardId.ToString() }); this.dropIncomeAddCardNumber.DataSource = card; Helper.SetDropDownList(this.dropIncomeAddCardNumber); this.dropIncomeAddCardNumber.SelectedValue = info.CardId.ToString(); #endregion } else { this.dropIncomeAddCardNumber.Enabled = true; InitializeDropIncomeCardNumber(); } DateTime date = new DateTime(2000, 1, 1); this.txtIncomeAddAmount.Text = info.IncomeAmount > 0 ? info.IncomeAmount.ToString() : string.Empty; this.txtIncomeAddDepositDate.Text = info.DepositDate > date ? info.DepositDate.ToString("yyyy-MM-dd") : DateTime.Now.ToString("yyyy-MM-dd"); this.txtIncomeAddDepositorName.Text = !string.IsNullOrEmpty(info.DepositorName) ? info.DepositorName : string.Empty; this.txtIncomeAddBDate.Text = info.BDate > date ? info.BDate.ToString("yyyy-MM-dd") : string.Empty; this.txtIncomeAddContent.Text = !string.IsNullOrEmpty(info.Content) ? info.Content : string.Empty; this.txtIncomeAddOwner.Text = !string.IsNullOrEmpty(info.OwnerName) ? info.OwnerName : string.Empty; if (info.AutoSave == 1) { this.checkIncomeAddAutoSave.Checked = true; } else { this.checkIncomeAddAutoSave.Checked = false; } InitializeEditDropControl(info); }
public static int InsertOrUpdatetocashincome(CashIncomeInfo info) { return CashIncomeProxy.InsertOrUpdatetocashincome(info); }
public static void InsertOrUpdatetocashincome(CashIncomeInfo info, out int iSuccess) { StringBuilder sb = new StringBuilder(); CashIncomeInfo cashIncomeInfo = GetCashIncomeById(info.Id); if (cashIncomeInfo.Id > 0) { sb.Append(" update cashincome set OwnerId=@OwnerId,OwnerName=@OwnerName,IncomeAmount = @IncomeAmount,PreMode = @PreMode,Mode = @Mode,PreRate=@PreRate,Rate=@Rate, "); sb.Append(" DepositDate = @DepositDate,BDate = @BDate,EDate=@EDate,AutoSave=@AutoSave,DepositorId=@DepositorId,DepositorName=@DepositorName,DepositMode=@DepositMode,"); sb.Append(" Status=@Status,IncomeType=@IncomeType,TAmount=@TAmount,Content=@Content where Id=@Id"); } else { sb.Append(" insert into cashincome (OwnerId,OwnerName,CardId,CardNumber,BankCardNumber,IncomeAmount,PreMode,Mode,PreRate,Rate,DepositDate,BDate,EDate,AutoSave,DepositorId, "); sb.Append(" DepositorName,DepositMode,Status,IncomeType,TAmount,Content) "); sb.Append(" Values(@OwnerId,@OwnerName,@CardId,@CardNumber,@BankCardNumber, @IncomeAmount,@PreMode,@Mode,@PreRate,@Rate,@DepositDate,@BDate,@EDate,@AutoSave,@DepositorId,"); sb.Append(" @DepositorName,@DepositMode,@Status,@IncomeType,@TAmount,@Content)"); } MySqlParameter[] pars = new MySqlParameter[] { new MySqlParameter("@Id",MySqlDbType.Int32), new MySqlParameter("@OwnerId",MySqlDbType.Int32), new MySqlParameter("@OwnerName",MySqlDbType.String), new MySqlParameter("@CardId",MySqlDbType.Int32), new MySqlParameter("@CardNumber",MySqlDbType.String), new MySqlParameter("@BankCardNumber",MySqlDbType.String), new MySqlParameter("@IncomeAmount",MySqlDbType.Float), new MySqlParameter("@PreMode",MySqlDbType.Int32), new MySqlParameter("@Mode",MySqlDbType.Int32), new MySqlParameter("@PreRate",MySqlDbType.Int32), new MySqlParameter("@Rate",MySqlDbType.Int32), new MySqlParameter("@DepositDate",MySqlDbType.DateTime), new MySqlParameter("@BDate",MySqlDbType.DateTime), new MySqlParameter("@EDate",MySqlDbType.DateTime), new MySqlParameter("@AutoSave",MySqlDbType.Int32), new MySqlParameter("@DepositorId",MySqlDbType.Int32), new MySqlParameter("@DepositorName",MySqlDbType.String), new MySqlParameter("@DepositMode",MySqlDbType.Int32), new MySqlParameter("@Status",MySqlDbType.Int32), new MySqlParameter("@IncomeType",MySqlDbType.Int32), new MySqlParameter("@TAmount",MySqlDbType.Float), new MySqlParameter("@Content",MySqlDbType.String) }; pars[0].Value = info.Id; pars[1].Value = info.OwnerId; pars[2].Value = info.OwnerName; pars[3].Value = info.CardId; pars[4].Value = info.CardNumber; pars[5].Value = info.BankCardNumber; pars[6].Value = info.IncomeAmount; pars[7].Value = info.PreMode; pars[8].Value = info.Mode; pars[9].Value = info.PreRate; pars[10].Value = info.Rate; pars[11].Value = info.DepositDate; pars[12].Value = info.BDate; pars[13].Value = info.EDate; pars[14].Value = info.AutoSave; pars[15].Value = info.DepositorId; pars[16].Value = info.DepositorName; pars[17].Value = info.DepositMode; pars[18].Value = info.Status; pars[19].Value = info.IncomeType; pars[20].Value = info.TAmount; pars[21].Value = info.Content; iSuccess = MySqlDBHelper.ExecuteCommand(sb.ToString(), pars); if (cashIncomeInfo.Id > 0) { iSuccess = -1; } }
public int Add(CashIncomeInfo value) { return(this.List.Add(value)); }