/// <summary> /// 增加一条数据 /// </summary> public static bool Add(EtNet_Models.FirmAccountInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into FirmAccountInfo("); strSql.Append("firmid,bankname,account,amount,ystime,remark)"); strSql.Append(" values ("); strSql.Append("@firmid,@bankname,@account,@amount,@ystime,@remark)"); SqlParameter[] parameters = { new SqlParameter("@firmid", SqlDbType.Int, 4), new SqlParameter("@bankname", SqlDbType.VarChar, 100), new SqlParameter("@account", SqlDbType.VarChar, 40), new SqlParameter("@remark", SqlDbType.VarChar, 200), new SqlParameter("@amount", SqlDbType.Decimal, 18), new SqlParameter("@ystime", SqlDbType.DateTime) }; parameters[0].Value = model.firmid; parameters[1].Value = model.bankname; parameters[2].Value = model.account; parameters[3].Value = model.remark; parameters[4].Value = model.amount; parameters[5].Value = model.ystime; int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }
//保存银行账号资料 private void SaveAccount(int firmid) { string str = this.hidfirm.Value; if (str != "") { string[] list = null; if (str.IndexOf('|') != -1) { list = str.Split('|'); } else { list = new string[1] { str }; } EtNet_Models.FirmAccountInfo model = null; string[] alist = null; for (int i = 0; i < list.Length; i++) { model = new EtNet_Models.FirmAccountInfo(); alist = list[i].Split(','); model.bankname = alist[0]; model.account = alist[1]; model.ystime = DateTime.Parse(alist[2]); model.amount = alist[3] != "" ? decimal.Parse(alist[3]) : 0; model.remark = ""; model.firmid = firmid; EtNet_BLL.FirmAccountInfoManager.Add(model); } } }
/// <summary> /// 得到一个对象实体 /// </summary> public static EtNet_Models.FirmAccountInfo GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from FirmAccountInfo "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; EtNet_Models.FirmAccountInfo model = new EtNet_Models.FirmAccountInfo(); DataTable ds = EtNet_DAL.DBHelper.GetDataSet(strSql.ToString(), parameters); if (ds.Rows.Count > 0) { model.id = int.Parse(ds.Rows[0]["id"].ToString()); model.firmid = int.Parse(ds.Rows[0]["firmid"].ToString()); model.bankname = ds.Rows[0]["bankname"].ToString(); model.account = ds.Rows[0]["account"].ToString(); model.remark = ds.Rows[0]["remark"].ToString(); model.amount = Convert.ToDecimal(ds.Rows[0]["amount"].ToString()); model.ystime = Convert.ToDateTime(ds.Rows[0]["ystime"].ToString()); return(model); } else { return(null); } }
//修改银行账号资料 private void ModifyAccount(int firmid) { //string strdel = " firmid=" + firmid.ToString(); //EtNet_BLL.FirmAccountInfoManager.Del(strdel); string str = this.hidfirm.Value; if (str != "") { string[] list = null; if (str.IndexOf('|') != -1) { list = str.Split('|'); } else { list = new string[1] { str }; } EtNet_Models.FirmAccountInfo model = null; string[] alist = null; for (int i = 0; i < list.Length; i++) { alist = list[i].Split(','); model = EtNet_BLL.FirmAccountInfoManager.GetModel(int.Parse(alist[4])); if (model == null) { model = new EtNet_Models.FirmAccountInfo(); model.bankname = alist[0]; model.account = alist[1]; model.ystime = DateTime.Parse(alist[2]); model.amount = alist[3] != "" ? decimal.Parse(alist[3]) : 0; model.remark = ""; model.firmid = firmid; EtNet_BLL.FirmAccountInfoManager.Add(model); } else { model.bankname = alist[0]; model.account = alist[1]; model.ystime = DateTime.Parse(alist[2]); model.amount = alist[3] != "" ? decimal.Parse(alist[3]) : 0; model.remark = ""; model.firmid = firmid; EtNet_BLL.FirmAccountInfoManager.Update(model); } } } string ids = this.hiddetailidlist.Value.TrimEnd(','); if (ids != "") { string sql = " id in (" + ids + ")"; EtNet_BLL.FirmAccountInfoManager.Del(sql); } }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(EtNet_Models.FirmAccountInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update FirmAccountInfo set "); strSql.Append("firmid=@firmid,"); strSql.Append("bankname=@bankname,"); strSql.Append("account=@account,"); strSql.Append("remark=@remark,"); strSql.Append("amount=@amount,"); strSql.Append("ystime=@ystime"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@firmid", SqlDbType.Int, 4), new SqlParameter("@bankname", SqlDbType.VarChar, 100), new SqlParameter("@account", SqlDbType.VarChar, 40), new SqlParameter("@remark", SqlDbType.VarChar, 200), new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@amount", SqlDbType.Decimal, 18), new SqlParameter("@ystime", SqlDbType.DateTime) }; parameters[0].Value = model.firmid; parameters[1].Value = model.bankname; parameters[2].Value = model.account; parameters[3].Value = model.remark; parameters[4].Value = model.id; parameters[5].Value = model.amount; parameters[6].Value = model.ystime; int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(EtNet_Models.FirmAccountInfo model) { return(EtNet_DAL.FirmAccountInfoService.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public static bool Add(EtNet_Models.FirmAccountInfo model) { return(EtNet_DAL.FirmAccountInfoService.Add(model)); }