protected override string btnAdd_Click() { Sys_BankInfo obj = null; IList <Sys_BankInfo> list = GetDetailModelList(); IList <Sys_BankInfo> listNew = new List <Sys_BankInfo>(); foreach (Sys_BankInfo objNew in list) { Sys_BankInfo sq = objNew; if (objNew.Id == 0) { sq.CreatedBy = TModel.MID; sq.CreatedTime = DateTime.Now; sq.IsDeleted = false; sq.Status = true; } else { sq = new Sys_BankInfoBLL().GetModel(objNew.Id); sq.Code = objNew.Code; sq.LinkUrl = objNew.LinkUrl; sq.Name = objNew.Name; sq.PicUrl = objNew.PicUrl; sq.Remark = objNew.Remark; sq.UpdatedBy = TModel.MID; sq.UpdatedTime = DateTime.Now; } listNew.Add(sq); } //删除需要删除的 string deleteId = Request.Form["hidDelIds"]; if (!string.IsNullOrEmpty(deleteId)) { string[] arr = deleteId.Split(','); foreach (string str in arr) { if (!string.IsNullOrEmpty(str)) { Sys_BankInfo sq = new Sys_BankInfoBLL().GetModel(str); sq.IsDeleted = true; sq.UpdatedBy = TModel.MID; sq.UpdatedTime = DateTime.Now; // new BLL.Sys_SecurityQuestion().Delete(str); listNew.Add(sq); //new Sys_BankInfoBLL().Delete(str); } } } //更新或新增 if (new Sys_BankInfoBLL().SaveOrUpdate(listNew)) { return("操作成功"); } else { return("操作失败"); } }
protected IList <Sys_BankInfo> AddToTotalModel(IList <Sys_BankInfo> toAdd, IList <Sys_BankInfo> origin) { foreach (Sys_BankInfo obj in origin) { Sys_BankInfo newObj = obj; toAdd.Add(newObj); } return(toAdd); }
protected Sys_BankInfo GetBank(string id) { Sys_BankInfoBLL BLL = new Sys_BankInfoBLL(); Sys_BankInfo model = BLL.GetModel(id); if (model != null) { return(model); } return(new Sys_BankInfo()); }
private Sys_BankInfo NewEntity(object id, string code, string name, string picUrl, string link, string remark) { Sys_BankInfo obj = null; if (!string.IsNullOrEmpty(name)) { obj = new Sys_BankInfo { Id = ToNullLong(id), Name = name, Code = code, PicUrl = picUrl, LinkUrl = link, Remark = remark }; } return(obj); }
/// <summary> /// 更新一条数据 /// </summary> public static Hashtable Update(Sys_BankInfo model, Hashtable MyHs) { string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Sys_BankInfo set "); strSql.Append(" Status = @Status , "); strSql.Append(" Code = @Code , "); strSql.Append(" Name = @Name , "); strSql.Append(" PicUrl = @PicUrl , "); strSql.Append(" CreatedTime = @CreatedTime , "); strSql.Append(" CreatedBy = @CreatedBy , "); strSql.Append(" UpdatedTime = @UpdatedTime , "); strSql.Append(" UpdatedBy = @UpdatedBy , "); strSql.Append(" IsDeleted = @IsDeleted, "); strSql.Append(" LinkUrl = @LinkUrl , "); strSql.Append(" Remark = @Remark "); strSql.Append(" where Id=@Id "); strSql.AppendFormat(" ;select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.BigInt, 8), new SqlParameter("@Status", SqlDbType.Bit, 1), new SqlParameter("@Code", SqlDbType.VarChar, 40), new SqlParameter("@Name", SqlDbType.VarChar, 40), new SqlParameter("@PicUrl", SqlDbType.VarChar, 100), new SqlParameter("@CreatedTime", SqlDbType.DateTime), new SqlParameter("@CreatedBy", SqlDbType.VarChar, 40), new SqlParameter("@UpdatedTime", SqlDbType.DateTime), new SqlParameter("@UpdatedBy", SqlDbType.VarChar, 40), new SqlParameter("@IsDeleted", SqlDbType.Bit, 1), new SqlParameter("@LinkUrl", SqlDbType.VarChar, 100), new SqlParameter("@Remark", SqlDbType.VarChar, 1000) }; parameters[0].Value = model.Id; parameters[1].Value = model.Status; parameters[2].Value = model.Code; parameters[3].Value = model.Name; parameters[4].Value = model.PicUrl; parameters[5].Value = model.CreatedTime; parameters[6].Value = model.CreatedBy; parameters[7].Value = model.UpdatedTime; parameters[8].Value = model.UpdatedBy; parameters[9].Value = model.IsDeleted; parameters[10].Value = model.LinkUrl; parameters[11].Value = model.Remark; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
/// <summary> /// 实体转换 /// <summary> private static Sys_BankInfo TranEntity(DataRow dr) { if (dr != null) { Sys_BankInfo model = new Sys_BankInfo(); if (!string.IsNullOrEmpty(dr["Id"].ToString())) { model.Id = long.Parse(dr["Id"].ToString()); } if (!string.IsNullOrEmpty(dr["Status"].ToString())) { model.Status = bool.Parse(dr["Status"].ToString()); } model.Code = dr["Code"].ToString(); model.Name = dr["Name"].ToString(); model.PicUrl = dr["PicUrl"].ToString(); model.LinkUrl = dr["LinkUrl"].ToString(); model.Remark = dr["Remark"].ToString(); if (!string.IsNullOrEmpty(dr["CreatedTime"].ToString())) { model.CreatedTime = DateTime.Parse(dr["CreatedTime"].ToString()); } model.CreatedBy = dr["CreatedBy"].ToString(); if (!string.IsNullOrEmpty(dr["UpdatedTime"].ToString())) { model.UpdatedTime = DateTime.Parse(dr["UpdatedTime"].ToString()); } model.UpdatedBy = dr["UpdatedBy"].ToString(); if (!string.IsNullOrEmpty(dr["IsDeleted"].ToString())) { model.IsDeleted = bool.Parse(dr["IsDeleted"].ToString()); } return(model); } else { return(null); } }
public bool SaveOrUpdate(IList <Sys_BankInfo> list) { Hashtable MyHs = new Hashtable();//以事务方式 foreach (Sys_BankInfo obj in list) { if (obj.Id == 0) //需要插入的 { Sys_BankInfoDAL.Insert(obj, MyHs); } else { //需要更新的 Sys_BankInfo objUpdate = obj; Sys_BankInfoDAL.Update(obj, MyHs); } } return(CommonBase.RunHashtable(MyHs)); }
/// <summary> /// 增加一条数据 /// </summary> public static Hashtable Insert(Sys_BankInfo model, Hashtable MyHs) { string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Sys_BankInfo("); strSql.Append("Status,Code,Name,PicUrl,CreatedTime,CreatedBy,UpdatedTime,UpdatedBy,IsDeleted,LinkUrl,Remark"); strSql.Append(") values ("); strSql.Append("@Status,@Code,@Name,@PicUrl,@CreatedTime,@CreatedBy,@UpdatedTime,@UpdatedBy,@IsDeleted,@LinkUrl,@Remark"); strSql.Append(") "); strSql.AppendFormat(";select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@Status", SqlDbType.Bit, 1), new SqlParameter("@Code", SqlDbType.VarChar, 40), new SqlParameter("@Name", SqlDbType.VarChar, 40), new SqlParameter("@PicUrl", SqlDbType.VarChar, 100), new SqlParameter("@CreatedTime", SqlDbType.DateTime), new SqlParameter("@CreatedBy", SqlDbType.VarChar, 40), new SqlParameter("@UpdatedTime", SqlDbType.DateTime), new SqlParameter("@UpdatedBy", SqlDbType.VarChar, 40), new SqlParameter("@IsDeleted", SqlDbType.Bit, 1), new SqlParameter("@LinkUrl", SqlDbType.VarChar, 100), new SqlParameter("@Remark", SqlDbType.VarChar, 1000) }; parameters[0].Value = model.Status; parameters[1].Value = model.Code; parameters[2].Value = model.Name; parameters[3].Value = model.PicUrl; parameters[4].Value = model.CreatedTime; parameters[5].Value = model.CreatedBy; parameters[6].Value = model.UpdatedTime; parameters[7].Value = model.UpdatedBy; parameters[8].Value = model.IsDeleted; parameters[9].Value = model.LinkUrl; parameters[10].Value = model.Remark; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
/// <summary> /// 增加一条数据 /// </summary> public static bool Insert(Sys_BankInfo model) { return(CommonBase.RunHashtable(Insert(model, new Hashtable()))); }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(Sys_BankInfo model) { return(CommonBase.RunHashtable(Update(model, new Hashtable()))); }
public bool Update(Sys_BankInfo model) { return(Sys_BankInfoDAL.Update(model)); }
public Hashtable Update(Sys_BankInfo model, Hashtable MyHs) { return(Sys_BankInfoDAL.Update(model, MyHs)); }
public bool Insert(Sys_BankInfo model) { return(Sys_BankInfoDAL.Insert(model)); }
public Hashtable Insert(Sys_BankInfo model, Hashtable MyHs) { return(Sys_BankInfoDAL.Insert(model, MyHs)); }