/// <summary> /// 获取任务完成情况数据统计 /// </summary> /// <returns></returns> public async Task <HomeInfo> GetHomeInfo() { var homeInfo = new HomeInfo(); //var aa = await _scheduledetailRepository.GetAll().ToListAsync(); //区县权限 var area = await GetCurrentUserAreaCodeAsync(); var query = from sd in _scheduledetailRepository.GetAll() join s in _scheduleRepository.GetAll().Where(s => s.Status == ScheduleMasterStatusEnum.已发布) on sd.ScheduleId equals s.Id join g in _growerRepository.GetAll().WhereIf(area.HasValue, q => q.AreaCode == area) on sd.GrowerId equals g.Id select sd; var totalCount = query.Sum(s => s.VisitNum); homeInfo.Total = totalCount.HasValue ? totalCount.Value : 0; var compCount = query.Sum(s => s.CompleteNum); homeInfo.Completed = compCount.HasValue ? compCount.Value : 0; if (homeInfo.Total == 0) { homeInfo.CompletedRate = "0%"; } else { homeInfo.CompletedRate = (Math.Round((double)homeInfo.Completed / homeInfo.Total, 2) * 100).ToString() + "%"; } var expirCount = query.Where(s => s.Status == ScheduleStatusEnum.已逾期).Sum(s => s.VisitNum - s.CompleteNum); homeInfo.Expired = expirCount.HasValue ? expirCount.Value : 0; return(homeInfo); }
public EditHomeInfoViewModel(Building home, ForbiddenElement rule, HomeInfo homeInfo) { Home = home; ForbiddenElement = rule; HomeInfo = homeInfo; SetTabCount(home, homeInfo); Aggresive = CompressArray(ForbiddenElement.Aggressive); NoVisit = CompressArray(ForbiddenElement.NoVisit); NoWorried = CompressArray(ForbiddenElement.NoWorried); Comments = ForbiddenElement.Comments; Begin = homeInfo.Begin; SaveCommand = new ActionCommand(OnSave); var number = new HouseNumber(home.HouseNumber); if (number.Housing > 1) { CountingAlgorythm = Begin == 1 ? CountingTypes.Regular : CountingTypes.Custom; } // Для сравнения _sourceAlgorythm = CountingAlgorythm; _sourceNumber = Begin; }
protected void Update_Click(object sender, EventArgs e) { if (Page.IsValid) { HomeInfo obj = new HomeInfo(); //obj. //Data.Brands obj = new Data.Brands(); //obj.Id = Id; //obj.Name = txtName.Text; //obj.Logo = txtLogo.Text; //obj.Ord = txtOrd.Text; //obj.Lang = Lang; //if (Insert == true) //{ // BrandsService.Brands_Insert(obj); //} //else //{ // BrandsService.Brands_Update(obj); //} BindGrid(); //pnView.Visible = true; //pnUpdate.Visible = false; Insert = false; } }
public ActionResult EditBanner() { if (User.IsInRole("Admin")) { var myHome = db.homeInfos.Select(h => h).FirstOrDefault(); if (myHome != null) { ViewBag.Picture1 = myHome.SliderPic1; ViewBag.Picture2 = myHome.SliderPic2; ViewBag.Picture3 = myHome.SliderPic3; } else { HomeInfo myHomeNew = new HomeInfo(); db.homeInfos.Add(myHomeNew); db.SaveChanges(); } return(View()); // after successfully uploading redirect the user } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult DeleteConfirmed(int id) { HomeInfo homeInfo = db.HomeInfos.Find(id); db.HomeInfos.Remove(homeInfo); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Text")] HomeInfo homeInfo) { if (ModelState.IsValid) { db.Entry(homeInfo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(homeInfo)); }
//[ValidateInput(false)] <------------------------------------------------------------- public ActionResult Create([Bind(Include = "Id,Text")] HomeInfo homeInfo) { if (ModelState.IsValid) { db.HomeInfos.Add(homeInfo); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(homeInfo)); }
protected void btnPostNewRE_Click(object sender, ImageClickEventArgs e) { //var objRealEstateOwner = new RealEstateOwnersInfo //{ // RealEstateOwnersName = txtRealEstateOwner1.Text, // CLUR = rdCLUR1.SelectedValue, // RealEstateOwnersType = rdRealEstateOwnerType1.SelectedItem.ToString(), // Gender = rdGender1.SelectedValue, // Address = txtAddress2.Text, // IdentityCard = txtIdentyCard1.Text, // MobilePhone = txtMobilePhone1.Text, // Email = txtEmail1.Text, //}; //int realEstateOwnerID = RealEstateOwnersService.RealEstateOwnersInfo_Insert(objRealEstateOwner, _reOwnerId); var obj = new HomeInfo { HomeTypeID = ddlHomeType1.SelectedValue, Name = txtTenNha1.Text, RealEstateOwnersID = "1", RealEstateID = ddlRealEstate1.SelectedValue, Title = "chưa có", TransactionType = "sale", Tag = "", CreateBy = txtTenChuSoHuu1.Text, CreateDate = "", RealEstateOwnersName = txtTenChuSoHuu1.Text, CityID = ddlCity1.SelectedValue, LocationID = "", DistrictID = ddlDistrict1.SelectedValue, Address = txtAddress1.Text + ddlDistrict1.SelectedItem + ddlCity1.SelectedItem, Description = "N" + txtDescription1.Text, BedroomNumber = txtBetroomNum1.Text, TotalArea = txtArea1.Text, FloorArea = txtFloorArea1.Text, GargenArea = "", HomeArea = txtFloorArea1.Text, Price = txtPrice1.Text, TierNumber = txtTierNumber1.Text, Image1 = lbImages1.Text, Image2 = lbImages2.Text, Image3 = lbImages3.Text, Image4 = lbImages4.Text, Image5 = lbImages5.Text, Image6 = lbImages6.Text }; //HomeService.HomeInfo_Insert(obj); int homeID = HomeService.HomeInfo_InsertGetID(obj, _homeId); Response.Redirect("~/ViewPostNewRE.aspx?PageView=1" + "&homeID=" + homeID); }
// GET: HomeInfos/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HomeInfo homeInfo = db.HomeInfos.Find(id); if (homeInfo == null) { return(HttpNotFound()); } return(View(homeInfo)); }
protected void btnRentHouse_Click(object sender, ImageClickEventArgs e) { var objRealEstateOwner = new RealEstateOwnersInfo { RealEstateOwnersName = txtRealEstateOwner2.Text, CLUR = rdCLUR2.SelectedValue, RealEstateOwnersType = rdRealEstateOwnerType2.SelectedItem.ToString(), Gender = rdGender2.SelectedValue, Address = txtAddress22.Text, IdentityCard = txtIdentyCard2.Text, MobilePhone = txtMobilePhone2.Text, Email = txtEmail2.Text, }; int realEstateOwnerID = RealEstateOwnersService.RealEstateOwnersInfo_Insert(objRealEstateOwner, _reOwnerId); var obj = new HomeInfo { HomeTypeID = ddlHomeType2.SelectedValue, Name = txtTenNha2.Text, RealEstateOwnersID = "1", RealEstateID = ddlRealEstate2.SelectedValue, Title = "", TransactionType = "rent", Tag = "", CreateBy = txtTenChuSoHuu2.Text, CreateDate = DateTime.Now.ToShortDateString(), RealEstateOwnersName = txtTenChuSoHuu2.Text, CityID = ddlCity2.SelectedValue, LocationID = "", DistrictID = ddlDistrict2.SelectedValue, //Address = txtAddress2.Text + ddlDistrict2.SelectedItem + ddlCity2.SelectedItem, Description = "N" + txtDescription2.Text, BedroomNumber = txtBetroomNum2.Text, TotalArea = txtArea2.Text, FloorArea = txtFloorArea2.Text, GargenArea = "", HomeArea = txtFloorArea2.Text, Price = txtPrice2.Text, TierNumber = txtTierNumber2.Text, Image1 = lbImages1.Text, Image2 = lbImages2.Text, Image3 = lbImages3.Text, Image4 = lbImages4.Text, Image5 = lbImages5.Text, Image6 = lbImages6.Text }; int homeID = HomeService.HomeInfo_InsertGetID(obj, _houseId); Response.Redirect("~/ViewPostNewRE.aspx?reOwnerID=" + realEstateOwnerID + "&homeID=" + homeID); }
public ActionResult EditBanner3(HomeInfo info, HttpPostedFileBase file3) { var homePage = db.homeInfos.Select(h => h).FirstOrDefault(); if (file3 != null) { string pic = System.IO.Path.GetFileName(file3.FileName); string path = System.IO.Path.Combine( Server.MapPath("~/Content"), pic); file3.SaveAs(path); homePage.SliderPic3 = "/Content/" + pic; } db.SaveChanges(); return(RedirectToAction("EditBanner")); }
public infos HomeInfosById(int id) { HomeInfo homeInfo = bll.ShowById(id); infos info = new infos { id = homeInfo.HomeInfo_Id, title = homeInfo.HomeInfo_Xq_Name, district = homeInfo.HomeInfo_PosiTion, payment_method = homeInfo.HomeInfo_Area, wages = homeInfo.HomeInfo_InfoType == 1 ? homeInfo.HomeInfo_Price : homeInfo.HomeInfo_AvgPrice, category = homeInfo.HomeInfo_PhotoPath, created_at = homeInfo.HomeInfo_CreateTime, home_details = homeInfo.HomeInfo_IntroDuce, contact_Name = homeInfo.HomeInfo_Contact, contact_Phone = homeInfo.HomeInfo_Phone }; return(info); }
public async Task <ActionResult <HomeInfo> > GetHomeInfo(string username) { HomeInfo homeInfo = new HomeInfo(); try { User user = _context.User.Where(u => u.Username.Equals(username)).FirstOrDefault <User>(); if (user == null) { return(null); } //get all withdrawal details homeInfo.Withdrawals = new WithdrawalsController(_context).GetSafeWithdrawals(user.Id).Result.Value.ToList <Withdrawal>(); homeInfo.WithdrawalMonth = homeInfo.Withdrawals.Where(ws => ws.DateTime.Month == DateTime.Now.Month).ToList <Withdrawal>().Sum(w => w.Value); homeInfo.WithdrawalDay = homeInfo.Withdrawals.Where(ws => ws.DateTime.Day == DateTime.Now.Day).ToList <Withdrawal>().Sum(w => w.Value); homeInfo.WithdrawalTotal = homeInfo.Withdrawals.Sum(w => w.Value); //ge all deposits details homeInfo.Deposits = new CreditsController(_context).GetSafeCredits(user.Id).Result.Value.ToList <Credit>(); homeInfo.DepositsMonth = homeInfo.Deposits.Where(ws => ws.DateTime.Month == DateTime.Now.Month).ToList <Credit>().Sum(s => s.Value); homeInfo.DepositsDay = homeInfo.Deposits.Where(ws => ws.DateTime.Day == DateTime.Now.Day).ToList <Credit>().Sum(s => s.Value); homeInfo.DepositsTotal = homeInfo.Deposits.Sum(c => c.Value); //calculate balance homeInfo.Balance = homeInfo.WithdrawalTotal - homeInfo.DepositsTotal; //get Dispensor remaining bills Safe dispensorDetails = _context.Safe.FirstOrDefault <Safe>(); if (dispensorDetails != null) { homeInfo.Bill100 = dispensorDetails.Bill100; homeInfo.Bill50 = dispensorDetails.Bill50; homeInfo.Bill20 = dispensorDetails.Bill20; homeInfo.Bill10 = dispensorDetails.Bill10; } return(homeInfo); } catch (Exception e) { return(homeInfo); } }
protected void Button1_Click(object sender, EventArgs e) { var obj = new HomeInfo { HomeTypeID = ddlHomeType.SelectedValue, Name = txtTenNha.Text, RealEstateOwnersName = txtTenChuSoHuu.Text, CityID = ddlCity.SelectedValue, DistrictID = ddlDistrict.SelectedValue, Address = txtAddress.Text + ddlDistrict.SelectedItem + ddlCity.SelectedItem, Description = txtDescription.Text, BedroomNumber = txtBetroomNum.Text, TotalArea = txtArea.Text, FloorArea = txtFloorArea.Text, Price = txtPrice.Text, TierNumber = txtTierNumber.Text }; HomeService.HomeInfo_Insert(obj); Response.Redirect("~/Default2.aspx?mod=ViewPostNewRE"); }
public IActionResult Init() { HomeInfo home = new HomeInfo() { Title = "主页", Icon = "layui-icon layui-icon-home", Href = Url.Action("Dashboard") }; LogoInfo logo = new LogoInfo() { Title = "OSHARP", Image = "/images/logo.png", Href = Url.Action("Index") }; List <MenuInfo> menus = GetMenuInfos(); InitModel model = new InitModel() { HomeInfo = home, LogoInfo = logo, MenuInfo = menus }; return(Json(model, new JsonSerializerSettings() { ContractResolver = new CamelCasePropertyNamesContractResolver() })); }
public HomeInfo GetHome() { HomeInfo homeInfo = null; StringBuilder builder = new StringBuilder(); builder.AppendFormat(MallSqls.SELECT_HOME_BY_USE_THEME); string sql = builder.ToString(); DataTable dt = DatabaseOperationWeb.ExecuteSelectDS(sql, "T").Tables[0]; if (dt != null && dt.Rows.Count == 1) { homeInfo = new HomeInfo { homeId = dt.Rows[0]["HOME_ID"].ToString(), backgroundImg = dt.Rows[0]["BACKGROUND_IMG"].ToString(), titleMaster = dt.Rows[0]["TITLE_MASTER"].ToString(), titleSlaver = dt.Rows[0]["TITLE_SLAVER"].ToString(), titleTagImg = dt.Rows[0]["TITLE_TAG_IMG"].ToString(), }; } return(homeInfo); }
public async Task <IActionResult> captchaexample([FromForm] HomeInfo homeInfo) { var parameters = new Dictionary <string, string>(); parameters.Add("SecretKey", "ss"); parameters.Add("SiteKey", "sk"); parameters.Add("CaptchaResponse", homeInfo.cbuildercaptcharesponse); parameters.Add("CaptchaAnswer", homeInfo.CaptchaAnswer); var data = new StringContent(JsonConvert.SerializeObject(parameters), Encoding.UTF8, "application/json"); var url = CaptchaServer + "/api/v1/Captcha/EnsureCaptcha"; var client = new HttpClient(); var response = await client.PostAsync(url, data); string result = response.Content.ReadAsStringAsync().Result; // Console.WriteLine(result); homeInfo.CaptchaServer = CaptchaServer; return(View(homeInfo)); }
protected void btnPostNewRE_Click(object sender, ImageClickEventArgs e) { var obj = new HomeInfo { HomeTypeID = ddlHomeType.SelectedValue, Name = txtTenNha.Text, RealEstateOwnersID = "1", RealEstateID = ddlRealEstate.SelectedValue, Title = "", TransactionType = "sale", Tag = "", CreateBy = txtTenChuSoHuu.Text, CreateDate = "", RealEstateOwnersName = txtTenChuSoHuu.Text, CityID = ddlCity.SelectedValue, LocationID = "", DistrictID = ddlDistrict.SelectedValue, Address = txtAddress.Text + ddlDistrict.SelectedItem + ddlCity.SelectedItem, Description = "N" + txtDescription.Text, BedroomNumber = txtBetroomNum.Text, TotalArea = txtArea.Text, FloorArea = txtFloorArea.Text, GargenArea = "", HomeArea = txtFloorArea.Text, Price = txtPrice.Text, TierNumber = txtTierNumber.Text, Image1 = lbImages1.Text, Image2 = lbImages2.Text, Image3 = lbImages3.Text, Image4 = lbImages4.Text, Image5 = lbImages5.Text, Image6 = lbImages6.Text }; HomeService.HomeInfo_Insert(obj); Response.Redirect("~/Default2.aspx?mod=ViewPostNewRE"); }
public void TestCodesJson() { var codes = new HomeInfo(); for (var i = 0; i < 7; i++) { var tempCodes = new List <string>(); for (var j = 0; j < 3; j++) { tempCodes.Add(j * i * 357 + ""); } codes.AllCodes.Add(i, tempCodes); } var json = JsonConvert.SerializeObject(codes, Formatting.Indented); var newHomeInfo = JsonConvert.DeserializeObject <HomeInfo>(json); var equals = newHomeInfo == codes; if (!equals) { throw new Exception(); } }
override public DataInfo load(string json) { HomeInfo data = HomeInfo.Load(json); return(data); }
public static bool HomeInfo_Update(HomeInfo data) { return(db.HomeInfo_Update(data)); }
public static int HomeInfo_InsertGetID(HomeInfo data, int ID) { return(db.HomeInfo_InsertGetID(data, ID)); }
public static bool HomeInfo_Insert(HomeInfo data) { return(db.HomeInfo_Insert(data)); }
public bool ProcessCharge(string userID, int money) { EnvInfo envInfo = Database.GetInstance().GetEnviroment(); UserInfo manager = Database.GetInstance().GetManager(UserKind.Manager)[0]; int cash = money * envInfo.CashRate; int serviceCash = cash * envInfo.ChargeGivePercent / 100; // 수수료를 관리자에게서 제한다. if (GiveCash(manager.Id, -serviceCash) == false) { return(false); } if (GiveCash(userID, cash) == false) { return(false); } // 고객 충전기록 ChargeHistoryInfo chargeHistoryInfo = new ChargeHistoryInfo(); chargeHistoryInfo.Kind = (int)ChargeKind.Charge; chargeHistoryInfo.Cash = cash; chargeHistoryInfo.StartTime = DateTime.Now; chargeHistoryInfo.EndTime = DateTime.Now; chargeHistoryInfo.OwnId = userID; chargeHistoryInfo.ApproveId = Users.ManagerInfo.Id; chargeHistoryInfo.BankAccount = string.Format("收费 {0}", money - money * envInfo.ChargeGivePercent / 100); if (Database.GetInstance().AddChargeHistory(chargeHistoryInfo) == false) { return(false); } // 관리자 수수료기록 chargeHistoryInfo = new ChargeHistoryInfo(); chargeHistoryInfo.Kind = (int)ChargeKind.Commission; chargeHistoryInfo.Cash = -serviceCash; chargeHistoryInfo.StartTime = DateTime.Now; chargeHistoryInfo.EndTime = DateTime.Now; chargeHistoryInfo.OwnId = manager.Id; chargeHistoryInfo.ApproveId = Users.ManagerInfo.Id; chargeHistoryInfo.BankAccount = string.Format("佣金 {0}", money * envInfo.ChargeGivePercent / 100); if (Database.GetInstance().AddChargeHistory(chargeHistoryInfo) == false) { return(false); } // 2014-02-05: GreenRose // 사용자가에 충전상태를 알린다. UserInfo userInfo = Database.GetInstance().FindUser(userID); Server.GetInstance().Send(userInfo.Socket, NotifyType.Reply_UserInfo, userInfo); // 충전상태를 메세지로 보낸다. BoardInfo chargeBoardInfo = new BoardInfo(); chargeBoardInfo.UserId = Users.ManagerInfo.Id; chargeBoardInfo.SendId = userInfo.Id; chargeBoardInfo.Title = "通知"; chargeBoardInfo.Content = string.Format("{0}缓冲填充. 您当前的缓存是{1}", cash, userInfo.Cash); chargeBoardInfo.Kind = (int)BoardKind.Letter; if (Database.GetInstance().AddBoard(chargeBoardInfo) == false) { return(false); } List <BoardInfo> letters = Database.GetInstance().GetLetters(Users.ManagerInfo.Id); if (letters == null) { return(false); } HomeInfo homeInfo = new HomeInfo(); homeInfo.Letters = letters; for (int i = 0; i < homeInfo.Letters.Count; i++) { if (homeInfo.Letters[i].Readed != 1) { if (homeInfo.Letters[i].SendId == Users.ManagerInfo.Id) { break; } else { UserInfo liveUser = Users.GetInstance().FindUser(homeInfo.Letters[i].SendId); if (liveUser != null) { homeInfo.Notices = Database.GetInstance().GetNotices(liveUser.Id); Server.GetInstance().Send(liveUser.Socket, NotifyType.Reply_NoticeList, homeInfo); } } } } return(true); }
public int Create(HomeInfo homeInfo) { return(bll.Create(homeInfo)); }
public int Update(HomeInfo homeInfo) { return(bll.Update(homeInfo)); }
private void buttonOk_Click(object sender, EventArgs e) { string Title = textTitle.Text.Trim(); if (Title.Length == 0) { MessageBox.Show("请输入标题."); return; } string Content = textContent.Text.Trim(); if (Content.Length == 0) { MessageBox.Show("请输入内容."); return; } _NoticeInfo.Kind = (int)BoardKind.Notice; _NoticeInfo.Title = Title; _NoticeInfo.Content = Content; _NoticeInfo.UserId = Users.ManagerInfo.Id; _NoticeInfo.SendId = "alluser"; if (_IsEditMode == false) { List <UserInfo> userList = null; switch (comboKind.SelectedIndex) { case 0: userList = Database.GetInstance().GetAllUsers(); _NoticeInfo.UserKind = 0; break; case 1: userList = Database.GetInstance().GetRecommenders(); _NoticeInfo.UserKind = 1; break; case 2: userList = Database.GetInstance().GetServicemans(); _NoticeInfo.UserKind = 2; break; } // send message to all users from admin // 2014-02-14: GreenRose _NoticeInfo.Kind = (int)BoardKind.AdminNotice; if (userList == null) { ErrorInfo errorInfo = BaseInfo.GetError(); MessageBox.Show(errorInfo.ErrorString); return; } if (comboKind.SelectedIndex > 0) { userList.Add(Users.ManagerInfo); } HomeInfo homeInfo = new HomeInfo(); Database.GetInstance().AddBoard(_NoticeInfo); //foreach( UserInfo userInfo in userList ) //{ // if (userInfo.Auto == 1) // continue; // _NoticeInfo.SendId = userInfo.Id; // bool ret = Database.GetInstance().AddBoard(_NoticeInfo); // if (ret == true) // { // homeInfo.Notices = Database.GetInstance().GetNotices(userInfo.Id); // if (homeInfo.Notices != null) // { // UserInfo liveUser = Users.GetInstance().FindUser(userInfo.Id); // if (liveUser != null) // Server.GetInstance().Send(liveUser.Socket, NotifyType.Reply_NoticeList, homeInfo); // } // } //} } this.DialogResult = DialogResult.OK; }