public ActionResult Delete(long id) { t_goods model = new t_goods(); var vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_unit> >(); vmResult.TData = new VMGDataGrid <t_unit>(); try { //删除 int t1 = UnitDAL.Delete(id); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData.data = null; vmResult.TData.dataCount = 0; vmResult.Msg = string.Format("删除系列成功。"); return(Json(vmResult)); } catch (Exception ex) { vmResult.BFlag = CommonResponseBFlag.LogicError; vmResult.TData.data = null; vmResult.TData.dataCount = 0; vmResult.Msg = "编辑报错" + ex.Message; } return(Json(vmResult)); }
public ActionResult Create(int id) { List <t_unit_goods> list = new List <t_unit_goods>(); string code = ""; var vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_unit> >(); vmResult.TData = new VMGDataGrid <t_unit>(); try { //创建 list = UnitDAL.GetGoodsByUnitID(id, ref code); RandomGoodsListSerives.getList(list, code, id); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData.data = null; vmResult.TData.dataCount = 0; vmResult.Msg = string.Format("生成系列成功."); return(Json(vmResult)); } catch (Exception ex) { vmResult.BFlag = CommonResponseBFlag.LogicError; vmResult.TData.data = null; vmResult.TData.dataCount = 0; vmResult.Msg = "生成系列失败" + ex.Message; } return(Json(vmResult)); }
public void AddUnitTest() { UnitDAL unitDAL = new UnitDAL(connectionString); Unit unit = new Unit() { PropertyID = 1, MonthlyRent = 999, SquareFeet = 999, NumberOfBeds = 9, NumberOfBaths = 9, Description = "9 Testing Rooms", Tagline = "Never enough tests", ApplicationFee = 99, SecurityDeposit = 999, PetDeposit = 99, AddressLine1 = "99 Test Lane", City = "Testville", State = "Ohio", ZipCode = 99999, WasherDryer = false, AllowCats = false, AllowDogs = false, ParkingSpots = "9 Car Garage", Gym = false, Pool = false }; bool result = unitDAL.AddUnit(unit); Assert.IsTrue(result); }
/** * Método para obtener la lista de datos realizando el mapeo desde la capa de datos */ public static List <User> fetchAll() { try { return(UserDAL.fetchAll().Select(x => new User { id = long.Parse(x.id + ""), name = x.name, email = x.email, rol = x.rol_id == null ? null : RolDAL.fetchAll().Where(y => y.id == x.rol_id).Select(z => new Rol() { id = long.Parse(z.id + ""), name = z.name, state = int.Parse(z.state + "") }).FirstOrDefault(), unit = x.unit_id == null ? null : UnitDAL.fetchAll().Where(y => y.id == x.unit_id).Select(z => new Unit() { id = long.Parse(z.id + ""), name = z.name, state = int.Parse(z.state + "") }).FirstOrDefault(), rol_id = long.Parse(x.rol_id + ""), unit_id = long.Parse(x.unit_id + ""), state = int.Parse(x.state + ""), token_session = x.token_session }).ToList()); } catch (Exception e) { throw e; } }
public ActionResult GetUnitGoodsList(int?id) { UnitGoodsDetailVM list = new UnitGoodsDetailVM(); var vmResult = new CommonAjaxResponseModel <VMGDataGrid <UnitGoodsDetailVM> >(); vmResult.TData = new VMGDataGrid <UnitGoodsDetailVM>(); if (id == null) { Response.Redirect(Url.Action("Index", "Unit")); return(View()); } else { int newId = (int)id; try { list = UnitDAL.GetUnitGoodsList(newId); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData.singleData = list; } catch (Exception ex) { vmResult.BFlag = CommonResponseBFlag.LogicError; vmResult.TData.data = null; vmResult.Msg = ex.Message; } } return(Json(vmResult)); }
public ActionResult GetList(int pageIndex, int pageSize, string code, string unit_kind, string unit_name, string price, string status_code) { int total = 0; List <t_unit> list = new List <t_unit>(); var vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_unit> >(); vmResult.TData = new VMGDataGrid <t_unit>(); try { list = UnitDAL.GetList(pageIndex, pageSize, code, unit_kind, unit_name, price, status_code, ref total); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData.data = list; vmResult.TData.dataCount = total; vmResult.TData.currentPage = pageIndex; } catch (Exception ex) { vmResult.BFlag = CommonResponseBFlag.SysError; vmResult.TData.data = null; vmResult.TData.dataCount = 0; vmResult.Msg = ex.Message; } return(Json(vmResult)); }
public void GetAllUnitsAtPropertyTest() { UnitDAL unitDAL = new UnitDAL(connectionString); List <Unit> units = unitDAL.GetAvailableUnitsAtProperty(999); Assert.IsNotNull(units); }
//copy复制 public ActionResult Copy(string formVals = "{}") { var vmResult = new CommonAjaxResponseModel <bool>(); try { t_unit model = formVals.ToModel <t_unit>(); // t_unit model2 = UnitDAL.GetModel(model.id); int unit_id = UnitDAL.CopyUnit(model); //List<t_unit_goods> uglist = UnitDAL.GetUnitGoodsListById(model.id); if (unit_id != 0 && unit_id != model.id) { UnitDAL.CopyUnitGoods(model.id, unit_id); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData = true; } } catch (Exception ex) { vmResult.BFlag = CommonResponseBFlag.SysError; vmResult.Msg = ex.Message; } return(Json(vmResult)); }
//添加系列 -编辑 public ActionResult Add(string formVals = "{}") { var vmResult = new CommonAjaxResponseModel <bool>(); try { t_unit model = formVals.ToModel <t_unit>(); if (model.id != 0) { UnitDAL.Update(model); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData = true; } else { //插入 model.status_code = 1; UnitDAL.Add(model); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData = true; } } catch (Exception ex) { vmResult.BFlag = CommonResponseBFlag.SysError; vmResult.Msg = ex.Message; } return(Json(vmResult)); }
public static UserLogin signInMovil(String email, String password) { try { String token = randomString(); var x = UserDAL.signInMovil(email, encodeTo64(password), token); UserLogin user = new UserLogin(); user.id = long.Parse(x.id + ""); user.name = x.name; user.email = x.email; user.rol = x.rol_id == null ? null : RolDAL.fetchAll().Where(y => y.id == x.rol_id).Select(z => new Rol() { id = long.Parse(z.id + ""), name = z.name, state = int.Parse(z.state + "") }).FirstOrDefault(); user.unit = x.unit_id == null ? null : UnitDAL.fetchAll().Where(y => y.id == x.unit_id).Select(z => new Unit() { id = long.Parse(z.id + ""), name = z.name, state = int.Parse(z.state + "") }).FirstOrDefault(); user.state = int.Parse(x.state + ""); user.token_session = x.token_session; return(user); } catch (Exception e) { throw e; } }
/** * Método para actualizar un nuevo registro */ public static void update(Unit unit) { try { UnitDAL.update(unit.id, unit.name, unit.state, unit.boss_id, unit.enterprise_id); } catch (Exception e) { throw e; } }
public static List <ListReportUnit> getReportUnit(decimal id) { try { List <ListReportUnit> processList = new List <ListReportUnit>(); var dUnit = UnitDAL.fetchAll().Where(x => x.id == id).FirstOrDefault(); var dUnits = UnitDAL.fetchAll().Where(x => x.enterprise_id == dUnit.enterprise_id).ToList(); foreach (units u in dUnits) { ListReportUnit response = new ListReportUnit(); response.unitId = int.Parse(u.id + ""); response.unitName = u.name; var list = TaskDAL.fetchAllByUnit(u.id).Select(x => new Task { id = long.Parse(x.id + ""), name = x.name, taskStatusId = x.task_status, }).ToList(); int ready = 0; int working = 0; int pending = 0; foreach (Task task in list) { if (task.taskStatusId == "0") { pending++; } else if (task.taskStatusId == "2") { ready++; } else if (task.taskStatusId == "4") { working++; } } response.done = ready; response.working = working; response.pending = pending; processList.Add(response); } return(processList); } catch (Exception e) { throw e; } }
protected void btnSubmit_Click(object sender, EventArgs e) { UnitModel unitM = new UnitModel(); unitM.PropertyID = Sess.ActivePropertyID; unitM.UnitLotNum = int.Parse(txtLotNum.Value); unitM.Address1 = txtAddress1.Value; unitM.Address2 = txtAddress2.Value; unitM.Zip = txtZip.Value; UnitDAL unitStore = new UnitDAL(); unitStore.AddNewUnit(unitM); }
/** * Método para crear un nuevo registro */ public static void insert(Unit unit) { try { if (UnitDAL.exists(unit.name)) { throw new ExistsException(); } else { UnitDAL.insert(unit.name, unit.boss_id, unit.enterprise_id); } } catch (Exception e) { throw e; } }
public static UserLogin signIn(String email, String password) { try { String token = randomString(); var x = UserDAL.signIn(email, encodeTo64(password), token); UserLogin user = new UserLogin(); user.id = long.Parse(x.id + ""); user.name = x.name; user.email = x.email; user.rol = x.rol_id == null ? null : RolDAL.fetchAll().Where(y => y.id == x.rol_id).Select(z => new Rol() { id = long.Parse(z.id + ""), name = z.name, state = int.Parse(z.state + "") }).FirstOrDefault(); user.unit = x.unit_id == null ? null : UnitDAL.fetchAll().Where(y => y.id == x.unit_id).Select(z => new Unit() { id = long.Parse(z.id + ""), name = z.name, state = int.Parse(z.state + "") }).FirstOrDefault(); user.state = int.Parse(x.state + ""); user.token_session = x.token_session; List <Module> modulesDomain = new List <Module>(); var modules = RolModuleDAL.fetchAll().Where(rm => rm.rol_id == user.rol.id).ToList(); foreach (roles_modules rm in modules) { var md = ModuleDAL.fetchAll().Where(mo => mo.id == rm.module_id).Select(y => new Module() { id = long.Parse(y.id + ""), name = y.name, state = int.Parse(y.state + ""), code = y.code }).FirstOrDefault(); modulesDomain.Add(md); } user.rol.modules = modulesDomain; return(user); } catch (Exception e) { throw e; } }
public ActionResult AddUnitGoods(string formVals = "{}") { var vmResult = new CommonAjaxResponseModel <bool>(); try { t_unit_goods model = formVals.ToModel <t_unit_goods>(); if (!string.IsNullOrWhiteSpace(model.goods_name)) { model.goods_id = int.Parse(model.goods_name.Split('(', ')')[1]); model.goods_name = model.goods_name.Split('(', ')')[0]; } else { vmResult.BFlag = CommonResponseBFlag.SysError; vmResult.Msg = "商品id解析出错"; return(Json(vmResult)); } if (model.id != 0) { UnitDAL.UpdateUnitGoods(model); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData = true; } else { //插入 UnitDAL.AddUnitGoods(model); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData = true; } } catch (Exception ex) { vmResult.BFlag = CommonResponseBFlag.SysError; vmResult.Msg = ex.Message; } return(Json(vmResult)); }
private void sendAlarm(IDAO.Models.t_AlarmTable_en alarm) { int pid = (int)alarm.PID; //List<t_CM_UserInfo> userList = bll.ExecuteStoreQuery<t_CM_UserInfo>("SELECT * FROM t_CM_UserInfo WHERE (PDRList LIKE '" + pid + ",%' OR PDRList = '%," + pid + "' OR PDRList LIKE '%," + pid + ",%' OR PDRList = '" + pid + "')").ToList(); IList <IDAO.Models.t_CM_Unit> unitlist = UnitDAL.getInstance().GetUnitListByPID(pid); if (unitlist.Count() > 0) { string uids = string.Empty; foreach (var item in unitlist) { uids += item.UnitID + ","; } if (!string.IsNullOrEmpty(uids)) { uids = uids.Substring(0, uids.Length - 1); IList <IDAO.Models.t_CM_UserInfo> userList = UserInfoDAL.getInstance().GetUsersByUnits(uids); if (userList == null || userList.Count <= 0) { return; } for (int i = 0; i < userList.Count; i++) { if (userList[i].OpenAlarmMsg == 1) { //根据手机号查询该报警是否发过短信; List <t_Alarm_SMS> sendedList = bll.ExecuteStoreQuery <t_Alarm_SMS>("SELECT * FROM t_Alarm_SMS WHERE mobilephone='" + userList[i].Mobilephone + "' AND alarmId=" + alarm.AlarmID).ToList(); if (sendedList == null || sendedList.Count <= 0) { UtilsSms.smsAlarm(userList[i].Mobilephone, alarm); //INSERT INTO t_Alarm_SMS (alarmTime,alarmId,sendTime,mobilephone) VALUES ('2018-03-20 16:53:11',1522,'2018-03-20 16:53:11','15210091230') string insert = "INSERT INTO t_Alarm_SMS (alarmTime,alarmId,sendTime,mobilephone) VALUES ('" + alarm.AlarmDateTime + "'," + alarm.AlarmID + ",'" + DateTime.Now.ToString() + "','" + userList[i].Mobilephone + "')"; bll.ExecuteStoreCommand(insert); } } } } } //Debug.WriteLine(DateTime.Now.ToString() + ",alarm.PID=" + alarm.PID);//c#打印输出信息 }
public ActionResult UnitGoodsList(long?id) { if (id == null) { Response.Redirect(Url.Action("Index", "Unit")); return(View()); } long newId = (long)id; t_unit model = UnitDAL.GetModel(newId); //List<t_unit_goods> goods_list = new List<t_unit_goods>(); //if(UnitDAL.GetUnitGoodsList(newId)!=null) // goods_list = UnitDAL.GetUnitGoodsList(newId); ViewBag.unit_model = model; //ViewBag.goods_list = goods_list; return(View()); }
/** * Método para obtener la lista de datos realizando el mapeo desde la capa de datos */ public static List <Unit> fetchAll() { try { return(UnitDAL.fetchAll().Select(x => new Unit { id = long.Parse(x.id + ""), name = x.name, state = int.Parse(x.state + ""), boss_id = x.boss == null ? null : x.boss, boss = x.boss == null ? null : UserDAL.fetchAll().Where(y => y.id == x.boss).Select(z => new User() { id = long.Parse(z.id + ""), name = z.name, }).FirstOrDefault(), enterprise = x.enterprise_id == null ? null : EnterpriseDAL.fetchAll().Where(y => y.id == x.enterprise_id).Select(z => new Enterprise() { id = long.Parse(z.id + ""), name = z.name, }).FirstOrDefault(), enterprise_id = long.Parse(x.enterprise_id + "") }).ToList()); } catch (Exception e) { throw e; } }
public ActionResult GetUnitGoodsListData(string unit_id, string goods_type, string goods_name, string MD5, decimal?min_price, decimal?max_price, int pageIndex = 1, int pageSize = 15) { int total = 0; List <t_unit_goods_list> list = new List <t_unit_goods_list>(); var vmResult = new CommonAjaxResponseModel <VMGDataGrid <t_unit_goods_list> >(); vmResult.TData = new VMGDataGrid <t_unit_goods_list>(); try { list = UnitDAL.GetUnitGoodsListData(unit_id, goods_type, goods_name, MD5, min_price, max_price, pageIndex, pageSize, ref total); vmResult.BFlag = CommonResponseBFlag.Success; vmResult.TData.data = list; vmResult.TData.dataCount = total; vmResult.TData.currentPage = pageIndex; } catch (Exception ex) { vmResult.BFlag = CommonResponseBFlag.SysError; vmResult.TData.data = null; vmResult.Msg = ex.Message; } return(Json(vmResult)); }
public static int updataUnit(Unit u) { return(UnitDAL.updataUnit(u)); }
public static IQueryable UnitByid(int id) { return(UnitDAL.UnitByid(id)); }
public static int UnitDele(int id) { return(UnitDAL.UnitDele(id)); }
//添加单位名称 public static int UnitAdd(Unit unit) { return(UnitDAL.UnitAdd(unit)); }
public static IQueryable Unitquery(string SName) { return(UnitDAL.Unitquery(SName)); }
public static IQueryable UnitGetAll() { return(UnitDAL.UnitGetAll()); }
public UnitBLL(DBHelper _dbHelper) : base(_dbHelper) { unitDAL = new UnitDAL(_dbHelper); }
public void AddUnit(UnitModel unitInfoIn) { UnitDAL unitSav = new UnitDAL(); unitSav.AddNewUnit(unitInfoIn); }
public int DeleteJob(int UnitTypeID, int UserID) { return(UnitDAL.DeleteJob(UnitTypeID, UserID)); }
public int AddEditUnit(IUnit Units, int CompanyId, string Mode) { return(UnitDAL.AddEditUnit(Units, CompanyId, Mode)); }