/// <summary> /// 添加基础数据 /// </summary> /// <param name="basic">基础数据实体对象</param> /// <returns></returns> public int Insert(BookBasicData basic) { string cmdText = "insert into T_BookBasicData(bookNum,ISBN,bookName,supplier,publishTime,price,catalog,author,remarks,dentification,remarksOne,remarksTwo,remarksThree) values(@bookNum,@ISBN,@bookName,@supplier,@publishTime,@price,@catalog,@author,@remarks,@dentification,@remarksOne,@remarksTwo,@remarksThree)"; String[] param = { "@bookNum", "@ISBN", "@bookName", "@supplier", "@publishTime", "@price", "@catalog", "@author", "@remarks", "@dentification", "@remarksOne", "@remarksTwo", "@remarksThree" }; object[] values = { basic.BookNum, basic.Isbn, basic.BookName, basic.Publisher, basic.PublishTime, basic.Price, basic.Catalog, basic.Author, basic.Remarks, basic.Dentification, basic.Remarks1, basic.Remarks2, basic.Remarks3 }; return(db.ExecuteNoneQuery(cmdText, param, values)); }
/// <summary> /// 货架删除 /// </summary> /// <param name="goodsShelvesId">货架id</param> /// <returns>受影响行数</returns> public int Delete(string goodsShelvesId) { string cmdText = "update T_GoodsShelves set deleteState = 1 where goodsShelvesId=@goodsShelvesId"; String[] param = { "@goodsShelvesId" }; String[] values = { goodsShelvesId.ToString() }; return(db.ExecuteNoneQuery(cmdText, param, values)); }
/// <summary> /// replace批量导入数据库 /// </summary> /// <param name="strSql">导入数据字符串</param> /// <returns></returns> public int Replace(string strSql) { int row = 0; string cmdText = "replace into T_LibraryCollection(ISBN,bookName,price,collectionNum,customerId) SELECT ISBN,bookName,price values" + strSql; row = db.ExecuteNoneQuery(cmdText, null, null); return(row); }
/// <summary> /// 添加客户 /// </summary> /// <param name="customer">客户实体</param> /// <returns></returns> public int Insert(Customer customer) { string cmdText = "insert into T_Customer(customerID,customerName) values(@customerID,@customerName)"; String[] param = { "@customerID", "@customerName" }; object[] values = { customer.CustomerId.ToString(), customer.CustomerName }; return(db.ExecuteNoneQuery(cmdText, param, values)); }
/// <summary> /// 添加功能 /// </summary> /// <param name="function">功能实体</param> /// <returns>受影响行数</returns> public int Insert(Function function) { string cmdText = "insert into T_Function(functionName) values(@functionName)"; String[] param = { "@functionName" }; String[] values = { function.FunctionName }; return(db.ExecuteNoneQuery(cmdText, param, values)); }
/// <summary> /// 添加销售单头 /// </summary> /// <param name="task">销售单头实体</param> /// <returns>受影响行数</returns> public int Insert(SaleHead salehead) { string cmdText = "insert into T_SaleHead(saleHeadId,saleTaskId,kindsNum,number,allTotalPrice,allRealPrice,userId,regionId,dateTime,state,remarks) values(@saleHeadId,@saleTaskId,@kindsNum,@number,@allTotalPrice,@allRealPrice,@userId,@regionId,@dateTime,@state,@remarks)"; string[] param = { "@saleHeadId", "@saleTaskId", "@kindsNum", "@number", "@allTotalPrice", "@allRealPrice", "@userId", "@regionId", "@dateTime", "@state", "@remarks" }; object[] values = { salehead.SaleHeadId, salehead.SaleTaskId, salehead.KindsNum, salehead.Number, salehead.AllTotalPrice, salehead.AllRealPrice, salehead.UserId, salehead.RegionId, salehead.DateTime, salehead.State, salehead.Remarks }; int row = db.ExecuteNoneQuery(cmdText, param, values); return(row); }
/// <summary> /// 添加销退单头 /// </summary> /// <param name="sellOffHead"></param> /// <returns></returns> public int Insert(SellOffHead sellOffHead) { string cmdText = "insert into T_SellOffHead(sellOffHeadID, saleTaskId, userID, makingTime) VALUES(@sellOffHeadID,@saleTaskId,@userID,@makingTime)"; string[] param = { "@sellOffHeadID", "@saleTaskId", "@userID", "@makingTime" }; object[] values = { sellOffHead.SellOffHeadId, sellOffHead.SaleTaskId.SaleTaskId, sellOffHead.User.UserId, sellOffHead.MakingTime }; int row = db.ExecuteNoneQuery(cmdText, param, values); return(row); }
/// <summary> /// 添加零售单头信息 /// </summary> /// <param name="salehead"></param> /// <returns></returns> public int InsertRetail(SaleHead salehead) { string cmdText = "insert into T_RetailHead(state,retailHeadId,userId,regionId,dateTime,kindsNum,number,allTotalPrice,allRealPrice,payment) values(@state,@retailHeadId,@userId,@regionId,@dateTime,@kindsNum,@number,@allTotalPrice,@allRealPrice,@payment)"; string[] param = { "@state", "@retailHeadId", "@userId", "@regionId", "@dateTime", "@kindsNum", "@number", "@allTotalPrice", "@allRealPrice", "@payment" }; object[] values = { salehead.State, salehead.SaleHeadId, salehead.UserId, salehead.RegionId, salehead.DateTime, salehead.KindsNum, salehead.Number, salehead.AllTotalPrice, salehead.AllRealPrice, salehead.PayType }; int row = db.ExecuteNoneQuery(cmdText, param, values); return(row); }
/// <summary> /// 插入补货单体 /// </summary> /// <param name="rm">补货单体实体</param> /// <returns></returns> public int Insert(replenishMentMonomer rm) { string sql = "insert into T_ReplenishmentMonomer(rsMononerID,bookNum,ISBN,author,count,supplier,dateTime,saleTaskId,saleHeadId,saleIdMonomerId) VALUES(@rsMononerID,@bookNum,@ISBN,@author,@count,@supplier,@dateTime,@saleTaskId,@saleHeadId,@saleIdMonomerId)"; string[] param = { "@rsMononerID", "@bookNum", "@ISBN", "@author", "@count", "@supplier", "@dateTime", "@saleTaskId", "@saleHeadId", "@saleIdMonomerId" }; object[] values = { rm.RsMonomerID, rm.BookNum, rm.Isbn, rm.Author, rm.Count, rm.Supplier, rm.DateTime, rm.SaleTaskId, rm.SaleHeadId, rm.SaleIdMonomerId }; int row = db.ExecuteNoneQuery(sql, param, values); return(row); }
/// <summary> /// 添加分公司 /// </summary> /// <param name="regionName">分公司名称</param> /// <returns></returns> public int insert(string regionName) { string cmdText = "insert into T_Region(regionName) values(@regionName)"; string[] param = { "@regionName" }; object[] values = { regionName }; int row = db.ExecuteNoneQuery(cmdText, param, values); return(row); }
/// <summary> /// 添加客户的销售任务总计 /// </summary> /// <param name="customerId">客户id</param> /// <param name="allNumber">总数量</param> /// <param name="allPrice">总码洋</param> /// <param name="allKinds">品种数</param> /// <returns>受影响行数</returns> public int insertSaleStatistics(string customerId, int allNumber, double allPrice, int allKinds) { string cmdText = "insert into T_SaleStatistics(customerId,allNumber,allPrice,allKinds) values(@customerId,@allNumber,@allPrice,@allKinds)"; string[] param = { "@customerId", "@allNumber", "@allPrice", "@allKinds" }; object[] values = { customerId, allNumber, allPrice, allKinds }; int row = db.ExecuteNoneQuery(cmdText, param, values); return(row); }
/// <summary> /// 添加库存信息 /// </summary> /// <param name="stock">库存实体对象</param> /// <returns></returns> public int insert(Stock stock) { string cmdText = "insert into T_Stock(stockNum,bookNum,ISBN,regionId,goodsShelvesId) values(@stockNum,@bookNum,@ISBN,@regionId,@goodsShelvesId)"; string[] param = { "@stockNum", "@bookNum", "@ISBN", "@regionId", "@goodsShelvesId" }; object[] values = { stock.StockNum, stock.BookNum.BookNum, stock.ISBN.Isbn, stock.RegionId.RegionId, stock.GoodsShelvesId.GoodsShelvesId }; int row = db.ExecuteNoneQuery(cmdText, param, values); return(row); }
/// <summary> /// 添加销退单头 /// </summary> /// <param name="sm"></param> /// <returns></returns> public int Insert(SellOffMonomer sm) { string cmdText = "insert into T_SellOffMonomer(sellOffMonomerId,sellOffHead,bookNum,isbn,price,count,totalPrice,realPrice,dateTime,realDiscount) values(@sellOffMonomerId,@sellOffHeadID,@bookNum,@isbn,@price,@count,@totalPrice,@realPrice,@dateTime,@realDiscount)"; string[] param = { "@sellOffMonomerId", "@sellOffHeadID", "@bookNum", "@isbn", "@price", "@count", "@totalPrice", "@realPrice", "@dateTime", "@realDiscount" }; object[] values = { sm.SellOffMonomerId, sm.SellOffHeadId, sm.BookNum, sm.ISBN1, sm.Price, sm.Count, sm.TotalPrice, sm.RealPrice, sm.Time, sm.Discount }; int row = db.ExecuteNoneQuery(cmdText, param, values); return(row); }
public int Insert(DateTime startTime, DateTime endTime, string regionName, string type) { //string cmdText; //if (regionName != "" || regionName != null) //{ string cmdText = "insert into t_configuration(startTime,endTime,regionName,type) value(@startTime,@endTime,@regionName,@type)"; string[] param = { "@startTime", "@endTime", "@regionName", "@type" }; object[] values = { startTime, endTime, regionName, type }; int row = db.ExecuteNoneQuery(cmdText, param, values); return(row); //} //else //{ // cmdText = "insert into t_configuration(startTime,endTime) value(@startTime,@endTime)"; // string[] param = { "@startTime", "@endTime" }; // object[] values = { startTime, endTime }; // int row = db.ExecuteNoneQuery(cmdText, param, values); // return row; //} }
/// <summary> /// 添加用户信息 /// </summary> /// <param name="user">用户实体对象</param> /// <returns>受影响行数</returns> public int Insert(User user) { int row; string userId = user.UserId; string cmd = "select count(userId) from T_User where userId=@userId"; string[] param1 = { "@userId" }; object[] values1 = { userId }; row = Convert.ToInt32(db.ExecuteScalar(cmd, param1, values1)); if (row > 0) { return(row = 0); } else { string comText = "insert into T_User(userID,userPwd,userName,regionId,roleId) values(@userID, @userPwd,@userName,@regionId,@roleId)"; string[] param = { "@userID", "@userName", "@regionId", "@roleId", "@userPwd" }; object[] values = { user.UserId, user.UserName, user.ReginId.RegionId, user.RoleId.RoleId, user.Pwd }; row = db.ExecuteNoneQuery(comText, param, values); return(row); } }
/// <summary> /// 添加单头信息 /// </summary> /// <param name="single">单头实体对象</param> /// <returns></returns> public int insertHead(SingleHead single) { string cmdText = "insert into T_SingleHead(singleHeadId,time,regionId,userId,type,remarks) values(@singleHeadId,@time,@regionId,@userId,@type,@remarks)"; string[] param = { "@singleHeadId", "@time", "@regionId", "@userId", "@type", "@remarks" }; object[] values = { single.SingleHeadId, single.Time, single.Region.RegionId, single.User.UserId, single.Type, single.Remarks }; int row = db.ExecuteNoneQuery(cmdText, param, values); return(row); }
/// <summary> /// 添加角色 /// </summary> /// <param name="role">角色实体</param> /// <returns>返回受影响的行数</returns> public int Insert(Role role) { string cmdText = "insert into T_Role(roleName) values(@roleName)"; string[] param = { "@roleName" }; object[] values = { role.RoleName }; int row = db.ExecuteNoneQuery(cmdText, param, values); if (row > 0) { return(row); } else { return(0); } }