本文整理汇总了C#中IShow.ChooseDishes.Data.ChooseDishesEntities类的典型用法代码示例。如果您正苦于以下问题:C# ChooseDishesEntities类的具体用法?C# ChooseDishesEntities怎么用?C# ChooseDishesEntities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChooseDishesEntities类属于IShow.ChooseDishes.Data命名空间,在下文中一共展示了ChooseDishesEntities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateRawUnitDeletedStatusById
public bool UpdateRawUnitDeletedStatusById(int Id, int DeletedStatus)
{
if (Id < 0)
{
return false;
}
//修改 直接修改
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
try
{
var type = entities.RawUnit.SingleOrDefault(bt => bt.UnitId == Id);
if (type != null)
{
type.Deleted = DeletedStatus;
entities.SaveChanges();
return true;
}
}
catch (Exception e)
{
e.ToString();
return false;
}
return false;
}
}
示例2: QueryAll
/// <summary>
///
/// </summary>
/// <returns></returns>
public List<DishesMenu> QueryAll() {
using (ChooseDishesEntities entities = new ChooseDishesEntities()) {
return entities.DishesMenu.Where(bt=>bt.Deleted == 0 ).ToList();
}
}
示例3: GetAll
public List<TableItem> GetAll()
{
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
return entities.TableItem.Include(typeof(Table).Name).Where(t => t.Deleted == 0).ToList();
}
}
示例4: addLocation
//0添加失败,-1添加重复
public int addLocation(Location location)
{
int flag = 0;
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
//查询编码是否存在
var type = entities.Location.SingleOrDefault(bt => bt.Code == location.Code && bt.Deleted == 0);
if (type == null)
{
//实体绑定数据
entities.Location.Add(location);
try
{
//操作数据库
flag = entities.SaveChanges();
}
catch (Exception ex)
{
ex.ToString();
}
}
else
{
flag = -1;
}
}
return flag;
}
示例5: QueryByDomain
/// <summary>
/// 按参数所在模块查询
/// </summary>
/// <param name="domain"></param>
public List<Config> QueryByDomain(string domain)
{
using (ChooseDishesEntities entities = new ChooseDishesEntities()) {
return entities.Config.Where(c => c.Domain.Equals(domain)).ToList();
}
}
示例6: UpdateRawUnit
public bool UpdateRawUnit(RawUnit rw)
{
if (rw == null)
{
return false;
}
//修改 直接修改
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
try
{
var type = entities.RawUnit.SingleOrDefault(bt => bt.UnitId == rw.UnitId);
if (type != null)
{
type.Deleted = rw.Deleted;
type.Name = rw.Name;
type.Status = rw.Status;
type.UpdateBy = rw.UpdateBy;
type.UpdateDatetime = rw.UpdateDatetime;
entities.SaveChanges();
return true;
}
}
catch (Exception e)
{
e.ToString();
return false;
}
return false;
}
}
示例7: UpdateTakeoutClientInfo
//根据外卖客户id修改外卖客户信息
public bool UpdateTakeoutClientInfo(TakeoutClientInfo info)
{
if (info == null)
{
return false;
}
//修改 直接修改
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
try
{
var type = entities.TakeoutClientInfo.SingleOrDefault(bt => bt.OrderPeopleId == info.OrderPeopleId);
if (type != null)
{
type.Order_people = info.Order_people;
type.Mobile = info.Mobile;
type.Status = info.Status;
type.Telephone = info.Telephone;
type.Update_by = info.Update_by;
type.Update_datetime = info.Update_datetime;
type.Address = info.Address;
type.Deleted = info.Deleted;
entities.SaveChanges();
return true;
}
}
catch (Exception e)
{
e.ToString();
return false;
}
return false;
}
}
示例8: UpdateTakeoutClientDeletedById
//根据外卖客户id修改外卖客户Deleted状态
public bool UpdateTakeoutClientDeletedById(int id,int DeletedStatas)
{
if (id <0)
{
return false;
}
//修改 直接修改
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
try
{
var type = entities.TakeoutClientInfo.SingleOrDefault(bt => bt.OrderPeopleId == id);
if (type != null)
{
type.Deleted = DeletedStatas;
entities.SaveChanges();
return true;
}
}
catch (Exception e)
{
e.ToString();
return false;
}
return false;
}
}
示例9: LoadParentId
//根据ID查询大类
public DishType LoadParentId(int? id)
{
try
{
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
DishType type = new DishType(); ;
if (id != null)
{
type = (DishType)entities.DishType.Where(info => info.DishTypeId == id && info.Deleted == 0 && info.Status == 0).Single();
if (type == null)
{
type = new DishType();
}
}
return type;
};
}
catch (Exception e)
{
throw e;
}
}
示例10: QueryAll
/// <summary>
///
/// </summary>
/// <returns></returns>
public List<DishesMenu> QueryAll() {
using (ChooseDishesEntities entities = new ChooseDishesEntities()) {
return entities.DishesMenu.ToList();
}
}
示例11: SaveTableType
//新增桌类
public int SaveTableType(TableType type)
{
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
try
{
Hashtable hash = new Hashtable();//返回结果
List<TableType> types;
//检查类型编号或者类型名称是否重复
types = entities.TableType.Where(info => info.Name == type.Name || info.Code == type.Code).ToList();
if (types != null && types.Count > 0)
{
hash.Add("code", 1);
if (types[0].Name == type.Name)
{
throw new ServiceException("类型名称已经存在,请重新命名!");
}
else if (types[0].Code == type.Code)
{
throw new ServiceException("类型编号已经存在!");
}
}
entities.TableType.Add(type);
entities.SaveChanges();
return type.TableTypeId;
}
catch (Exception e)
{
throw new ServiceException(e.Message);
}
};
}
示例12: Add
/// <summary>
/// 添加用户
/// </summary>
/// <param name="employeeId"></param>
public int Add(int employeeId,string username,string passwd) {
using (ChooseDishesEntities entities = new ChooseDishesEntities()) {
Employee employee = entities.Employee.Find(employeeId);
if (null == employee) {
throw new ServiceException("无法找到对应的员工,编号为:【"+employeeId+"】");
}
int authorId=SubjectUtils.GetAuthenticationId();
UserInfo _UserInfo = new UserInfo();
_UserInfo.EmployeeId = employeeId;
if (null != username || null!=passwd) {
_UserInfo.Username = username;
_UserInfo.Salt = CryptoUtils.GetSalt();
_UserInfo.Password = CryptoUtils.MD5Encrypt(passwd);
_UserInfo.CreateBy = SubjectUtils.GetAuthenticationId();
}
_UserInfo.CreateDatetime = DateTime.Now;
entities.UserInfo.Add(_UserInfo);
try
{
entities.SaveChanges();
Log.A(Loggers.USER_NEW, authorId, _UserInfo.UserId);
}catch(DbEntityValidationException e){
throw new ServiceException(e.Message);
}
return _UserInfo.UserId;
}
}
示例13: QueryUsers
/// <summary>
/// 查询所有用户
/// </summary>
/// <returns></returns>
public List<UserInfo> QueryUsers() {
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
//查询所有非删除的
return entities.UserInfo.Where(t => t.Deleted == 0).ToList();
}
}
示例14: queryByLocation
public List<Location> queryByLocation()
{
List<Location> local;
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
local = entities.Location.Where(Location => Location.Deleted == 0).ToList();
}
return local;
}
示例15: queryById
//查询所有折扣方案
public DiscountProgram queryById(int id)
{
DiscountProgram program;
using (ChooseDishesEntities entities = new ChooseDishesEntities())
{
program = entities.DiscountProgram.Where(Program => Program.Deleted == 0 && Program.Status == 0&& Program.DiscountId == id).Single();
}
return program;
}