private static yny_003.Model.BMember DataRowToModel(DataRow row) { if (row != null) { yny_003.Model.BMember model = new yny_003.Model.BMember(); if (row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } model.AMID = row["AMID"].ToString(); model.AMember = DAL.Member.GetModel(model.AMID); model.BMID = row["BMID"].ToString(); model.BMBD = row["BMBD"].ToString(); if (row["BMCreateDate"].ToString() != "") { model.BMCreateDate = DateTime.Parse(row["BMCreateDate"].ToString()); } if (row["BMDate"].ToString() != "") { model.BMDate = DateTime.Parse(row["BMDate"].ToString()); } if (row["BMState"].ToString() != "") { model.BMState = bool.Parse(row["BMState"].ToString()); } if (row["BIsClock"].ToString() != "") { model.BIsClock = bool.Parse(row["BIsClock"].ToString()); } if (row["YJCount"].ToString() != "") { model.YJCount = decimal.Parse(row["YJCount"].ToString()); } if (row["YJMoney"].ToString() != "") { model.YJMoney = decimal.Parse(row["YJMoney"].ToString()); } if (row["BCount"].ToString() != "") { model.BCount = decimal.Parse(row["BCount"].ToString()); } if (row["sort"].ToString() != "") { model.sort = int.Parse(row["sort"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public static Hashtable Update(yny_003.Model.BMember model, Hashtable MyHs) { string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("update BMember set "); strSql.Append(" AMID = @AMID , "); strSql.Append(" BMID = @BMID , "); strSql.Append(" BMBD = @BMBD , "); strSql.Append(" BMCreateDate = @BMCreateDate , "); strSql.Append(" BMDate = @BMDate , "); strSql.Append(" BMState = @BMState , "); strSql.Append(" YJCount = @YJCount , "); strSql.Append(" YJMoney = @YJMoney , "); strSql.Append(" BCount = @BCount , "); strSql.Append(" sort = @sort , "); strSql.Append(" BIsClock = @BIsClock "); strSql.Append(" where BMID=@BMID"); strSql.AppendFormat(" ;select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@AMID", SqlDbType.VarChar, 20), new SqlParameter("@BMID", SqlDbType.VarChar, 20), new SqlParameter("@BMBD", SqlDbType.VarChar, 20), new SqlParameter("@BMCreateDate", SqlDbType.DateTime), new SqlParameter("@BMDate", SqlDbType.DateTime), new SqlParameter("@BMState", SqlDbType.Bit, 1), new SqlParameter("@YJCount", SqlDbType.Decimal), new SqlParameter("@YJMoney", SqlDbType.Decimal), new SqlParameter("@BCount", SqlDbType.Decimal), new SqlParameter("@BIsClock", SqlDbType.Bit, 1), new SqlParameter("@sort", SqlDbType.Int, 4) }; parameters[0].Value = model.AMID; parameters[1].Value = model.BMID; parameters[2].Value = model.BMBD; parameters[3].Value = model.BMCreateDate; parameters[4].Value = model.BMDate; parameters[5].Value = model.BMState; parameters[6].Value = model.YJCount; parameters[7].Value = model.YJMoney; parameters[8].Value = model.BCount; parameters[9].Value = model.BIsClock; parameters[10].Value = model.sort; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
public static bool Insert(yny_003.Model.BMember model) { lock (obj) { obj = new Random().Next(1, 100); Hashtable MyHs = new Hashtable(); Insert(model, MyHs); BLL.ChangeMoney.HBChangeTran(model.BCount, model.AMember.MID, BLL.Member.ManageMember.TModel.MID, "GW", model.AMember, "MJB", "", MyHs); if (BLL.CommonBase.RunHashtable(MyHs)) { return(true); } return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public static Hashtable Insert(yny_003.Model.BMember model, Hashtable MyHs) { StringBuilder strSql = new StringBuilder(); string guid = Guid.NewGuid().ToString(); strSql.Append("insert into BMember("); strSql.Append("AMID,BMID,BMBD,BMCreateDate,BMDate,BMState,BIsClock,YJCount,YJMoney,BCount,sort"); strSql.Append(") values ("); strSql.Append("@AMID,@BMID,@BMBD,@BMCreateDate,@BMDate,@BMState,@BIsClock,@YJCount,@YJMoney,@BCount,@sort"); strSql.Append(") "); strSql.AppendFormat("; select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@AMID", SqlDbType.VarChar, 20), new SqlParameter("@BMID", SqlDbType.VarChar, 20), new SqlParameter("@BMBD", SqlDbType.VarChar, 20), new SqlParameter("@BMCreateDate", SqlDbType.DateTime), new SqlParameter("@BMDate", SqlDbType.DateTime), new SqlParameter("@BMState", SqlDbType.Bit, 1), new SqlParameter("@BIsClock", SqlDbType.Bit, 1), new SqlParameter("@YJCount", SqlDbType.Decimal), new SqlParameter("@YJMoney", SqlDbType.Decimal), new SqlParameter("@BCount", SqlDbType.Decimal), new SqlParameter("@sort", SqlDbType.Int, 4) }; parameters[0].Value = model.AMID; parameters[1].Value = model.BMID; parameters[2].Value = model.BMBD; parameters[3].Value = model.BMCreateDate; parameters[4].Value = model.BMDate; parameters[5].Value = model.BMState; parameters[6].Value = model.BIsClock; parameters[7].Value = model.YJCount; parameters[8].Value = model.YJMoney; parameters[9].Value = model.BCount; parameters[10].Value = model.sort; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
public static bool Insert(yny_003.Model.BMember model) { return(DAL.CommonBase.RunHashtable(Insert(model, new System.Collections.Hashtable()))); }
public static System.Collections.Hashtable Insert(yny_003.Model.BMember model, System.Collections.Hashtable MyHs) { DAL.BMember.tempBMemberList.Add(model); return(yny_003.DAL.BMember.Insert(model, MyHs)); }
public static bool Update(yny_003.Model.BMember model) { return(yny_003.DAL.BMember.Update(model)); }
public static System.Collections.Hashtable Update(yny_003.Model.BMember model, System.Collections.Hashtable MyHs) { return(yny_003.DAL.BMember.Update(model, MyHs)); }