/// <summary> /// 更新一条数据 /// </summary> public bool Update(SmsServer.Model.SmsManager model) { try { //清空权限 MyDataBase.db.Update(SmsPlatForm.SmsManager) .AddColumn(SmsPlatForm.SmsManager.Power, "") .Where(SmsPlatForm.SmsManager.ManagerID == model.ManagerID && SmsPlatForm.SmsManager.ManagerType != model.ManagerType).Execute(); //修改其他数据 MyDataBase.db.Update(SmsPlatForm.SmsManager) .AddColumn(SmsPlatForm.SmsManager.UserName, model.UserName) .AddColumn(SmsPlatForm.SmsManager.ManagerType, model.ManagerType) .AddColumn(SmsPlatForm.SmsManager.CompanyName, model.CompanyName) .AddColumn(SmsPlatForm.SmsManager.Phone, model.Phone) .AddColumn(SmsPlatForm.SmsManager.Address, model.Address) .AddColumn(SmsPlatForm.SmsManager.ExtraInfo, model.ExtraInfo) .Where(SmsPlatForm.SmsManager.ManagerID == model.ManagerID).Execute(); return(true); } catch (System.Exception e) { //记录日志 return(false); } }
/// <summary> /// 是否存在该记录,判断密码是否正确 /// </summary> public bool Exists(SmsServer.Model.SmsManager model) { int iRowCount = MyDataBase.db.Select(SmsPlatForm.SmsManager) .Where(SmsPlatForm.SmsManager.ManagerID == model.ManagerID && SmsPlatForm.SmsManager.ManagerPwd == model.ManagerPwd).ToDataSet().Tables[0].Rows.Count; return(iRowCount > 0 ? true : false); }
/// <summary> /// 修改密码数据库操作 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool ModifyPwd(SmsServer.Model.SmsManager model) { try { //修改密码 MyDataBase.db.Update(SmsPlatForm.SmsManager) .AddColumn(SmsPlatForm.SmsManager.ManagerPwd, model.NewManagerPwd) .Where(SmsPlatForm.SmsManager.ManagerID == model.ManagerID).Execute(); return(true); } catch (System.Exception e) { //记录日志 return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(SmsServer.Model.SmsManager model) { try { MyDataBase.db.Insert(SmsPlatForm.SmsManager) .AddColumn(SmsPlatForm.SmsManager.ManagerID, model.ManagerID) .AddColumn(SmsPlatForm.SmsManager.ManagerPwd, model.ManagerPwd) .AddColumn(SmsPlatForm.SmsManager.UserName, model.UserName) .AddColumn(SmsPlatForm.SmsManager.CreatTime, DateTime.Now) .AddColumn(SmsPlatForm.SmsManager.ManagerType, model.ManagerType) .AddColumn(SmsPlatForm.SmsManager.CompanyName, model.CompanyName) .AddColumn(SmsPlatForm.SmsManager.Phone, model.Phone) .AddColumn(SmsPlatForm.SmsManager.Address, model.Address) .AddColumn(SmsPlatForm.SmsManager.ExtraInfo, model.ExtraInfo).Execute(); return(true); } catch (System.Exception e) { //记录日志 } return(false); }