private void loadMenu() { try { if (Session["menu"] == null) { ManagerDAO a = new ManagerDAO(); int code = 0; listMenu = a.MenuModel.GetMenuUser(userData.AccountId, ref code); //string list_menuId = ""; //string list_menuRule = ""; //if (a.MenuModel.GetRuleUser(userData.AccountId, ref list_menuId, ref list_menuRule) == 0) { // Entity.MenuRule r = new Entity.MenuRule() // { // menuId = list_menuId != "" ? JsonConvert.DeserializeObject<List<int>>(list_menuId) : new List<int>(), // menuRule = list_menuRule != "" ? JsonConvert.DeserializeObject<List<List<int>>>(list_menuRule) : new List<List<int>>() // }; // Session["rule"] = r; //} if (code == 0) { var menuIds = listMenu.Select(x => x.MenuId).ToList(); StringBuilder strMenu = new StringBuilder(); strMenu.Append("<ul class='page-sidebar-menu page-header-fixed page-sidebar-menu-hover-submenu' data-keep-expanded='false' data-auto-scroll='true' data-slide-speed='200'>"); var menuParent = listMenu.Where(x => x.ParentID == 0).OrderByDescending(x => x.DisplayIndex); foreach (var item in menuParent) { listMenu.Remove(item); string subMenu = GetSubMenu(item.MenuId); string link = item.Onclick == "" ? "Page.aspx?m=" + item.MenuId : item.Onclick; strMenu.Append("<li class='nav-item' id='m_" + item.MenuId + "'>" + "<a href='" + (subMenu != "" ? "javascript:;" : link) + "' class='nav-link nav-toggle'>" + (item.Icon != "" ? "<i class='" + item.Icon + "'></i>" : "") + "<span class='title'>" + item.MenuName + "</span><span class='arrow'></span></a>" + subMenu + "</li>"); } strMenu.Append("</ul>"); this.menuPage.InnerHtml = strMenu.ToString(); Session["menu"] = strMenu; } else { Response.Redirect("login.aspx"); } } else { this.menuPage.InnerHtml = Session["menu"].ToString(); } } catch (ThreadAbortException) { } catch (Exception) { } }
public void GetData(string id) { ManagerDAO dao = new ManagerDAO(); manageDTO dto = dao.getManageDTO(id); lbFNames.Text = dto.FullName; lbCars.Text = dto.numberOfCars.ToString(); lbParked.Text = dto.numberOfParked.ToString(); lbTimes.Text = dto.numberOfTimes; dgvHistory.DataSource = dto.HistoryLists; }
public ActionResult EditMemberInfo(MemberModels model) { model.IsChangedPassword = true; ManagerDAO.SetPersonalItem(model); ViewBag.Exit = true; ViewBag.RefreshLoginInfo = true; ViewBag.UploadUrl = uploadUrl; var group = GroupDAO.GetItems(); ViewBag.group = group; return(View(model)); }
private void CheckIp(object o) { IPChecked iPChecked = o as IPChecked; if (iPChecked != null) { if (iPChecked.CountReqvest > 20) { ManagerDAO.AddNewIp(iPChecked.Ip); Loger.WriteLog("Info", "CheckIp", DateTime.Now.ToLongDateString(), iPChecked.Ip, "Ban", "Blocked for many requests"); } iPCheckeds.Remove(iPChecked); } }
// GET: Backend/Manager public ActionResult Manager(int?index, MemberSearch search, long siteId = 0) { IEnumerable <GroupModels> groups = GroupDAO.GetItems(); foreach (GroupModels group in groups) { group.SetPermissionsForAllSites(1); } Pagination pagination = new Pagination { PageIndex = index ?? 1, PageSize = WebInfo.PageSize }; if (Request.HttpMethod == "GET") { if (index == null) { Utility.ClearSearchValue(); Session[$"ExportSearch"] = null; } else { MemberSearch prevSearch = Utility.GetSearchValue <MemberSearch>(); if (prevSearch != null) { search = prevSearch; } } } else if (Request.HttpMethod == "POST") { Utility.SetSearchValue(search); Session[$"ExportSearch"] = search; } int totalRecord; List <MemberModels> items = ManagerDAO.GetItems(pagination.PageSize, pagination.PageIndex, out totalRecord, search); pagination.TotalRecord = totalRecord; ViewBag.Pagination = pagination; ViewBag.SiteID = siteId; ViewBag.Groups = groups; ViewBag.Search = search; return(View(items)); }
private void Process(object o) { string responseSt = ""; List <IpOrWebSite> ipOrWebSites = ManagerDAO.GetIpOrWebSites(); var context = o as HttpListenerContext; HttpListenerResponse response = context.Response; HttpListenerRequest request = context.Request; string ipReqvesr = request.RemoteEndPoint.Address.ToString(); IpOrWebSite ipOrWebSite = ipOrWebSites.FirstOrDefault(ip => ip.IpSourse == ipReqvesr); if (ipOrWebSite != null) { if (ipOrWebSite.Status) { responseSt = "Ok"; } else { responseSt = "Ban"; } } else { responseSt = "Ok"; IPChecked iPChecked = iPCheckeds.FirstOrDefault(ip => ip.Ip == ipReqvesr); if (iPChecked != null) { iPChecked.CountReqvest++; } else { TimerCallback tm = new TimerCallback(CheckIp); iPChecked = new IPChecked(); iPChecked.CountReqvest = 1; iPChecked.Ip = ipReqvesr; iPChecked.timer = new Timer(tm, iPChecked, 1000, Timeout.Infinite); iPCheckeds.Add(iPChecked); } } Loger.WriteLog("Info", "Process", DateTime.Now.ToLongDateString(), ipReqvesr, responseSt, "Reqvest"); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseSt); response.ContentLength64 = buffer.Length; Stream output = response.OutputStream; output.Write(buffer, 0, buffer.Length); output.Close(); }
private void btnDelete_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Sure u wanna delete this manager?", "Confirm!", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { Manager m = (Manager)dataGridViewManager.CurrentRow.DataBoundItem; Account a = AccountDAO.GetAccountByUsername(m.Username); ManagerDAO.Delete(m.MaID); AccountDAO.Delete(a); } else { return; } LoadData(); }
public void GetMoneyPerMonth() { this.chart1.Series.Clear(); chart1.Series.Add("Money(vnd)"); // Set title chart1.Titles.Clear(); this.chart1.Titles.Add("Money per Month"); // Add series. ManagerDAO dao = new ManagerDAO(); Hashtable Htable = dao.GetDataMoney(cbUser.SelectedValue.ToString()); ICollection table = Htable.Keys; foreach (var item in table) { chart1.Series["Money(vnd)"].Points.AddXY(item, (int)Htable[item]); } }
public FileResult Export(bool?privacy) { MemberSearch search = Session[$"ExportSearch"] as MemberSearch; if (search == null) { search = new MemberSearch(); } ViewData["Info"] = ManagerDAO.GetAll(search); ViewData["Privacy"] = privacy ?? false; string html = Utility.GetViewHtml(this, "Export", null); string title = $"管理者名單{DateTime.Now.ToString("yyyyMMdd")}.xls"; return(File(System.Text.Encoding.UTF8.GetBytes(html), "application/vnd.ms-excel", title)); }
public ManagerStudentRequestGUI(string user) { InitializeComponent(); m = ManagerDAO.getManagerByUsername(user); DataTable dt = RequestDAO.GetDataTable(); DataView dv = new DataView(dt); string filter = "maID is null"; dv.RowFilter = filter; dataGridView1.DataSource = dv; List <string> l = new List <string>(); l.Add("No Response yet"); l.Add("responded"); comboBox1.DataSource = l; comboBox1.SelectedIndex = 0; btnSave.Enabled = false; txtReplyContent.Enabled = false; btnCancel.Enabled = false; }
public ActionResult Edit(MemberModels model, IEnumerable <MemberToCompanyModel> companyItems, long siteId = 0) { ////密碼 //string hidpassword = Request["hidpassword"]; //string hashKey = uRandom.GetRandomCode(10); //if (!string.IsNullOrEmpty(hidpassword)) //{ // model.HashKey = hashKey; // model.HashPwd = HashWord.EncryptSHA256(hidpassword, hashKey); //} ViewBag.Exit = true; HttpPostedFileBase imgFile = model.imgFile; if (imgFile != null && imgFile.ContentLength > 0) { string Path = string.Format("{0}/{1}", GetItem.UpdPath(), "Manager"); if (!System.IO.Directory.Exists(Path)) { System.IO.Directory.CreateDirectory(Path); } string saveName = WorkV3.Golbal.UpdFileInfo.SaveFiles(imgFile, Path); model.Img = saveName; } ManagerDAO.SetItem(model); //ManagerDAO.SetMemberToCompany(model.Id, companyItems); 20190912 Joe 問題單,目前尚無MemberToCompany這張表,故先註解 var group = GroupDAO.GetItems(); ViewBag.group = group; ViewBag.UploadUrl = Golbal.UpdFileInfo.GetVPathBySiteID(siteId).TrimEnd('/') + "/"; ViewBag.SiteID = siteId; return(View(model)); }
public ActionResult Edit(long?ID, long siteId = 0) { MemberModels m = new MemberModels(); if (ID.HasValue) { m = ManagerDAO.GetItem((long)ID); ViewBag.IsNew = false; } else { ViewBag.IsNew = true; } var group = GroupDAO.GetItems(); ViewBag.group = group; ViewBag.ID = ID ?? 0; ViewBag.UploadUrl = GetItem.ViewUpdUrl().TrimEnd('/') + "/"; ViewBag.SiteID = siteId; return(View(m)); }
public ActionResult EditMemberInfo(long?ID) { ViewBag.UploadUrl = uploadUrl; MemberModels m = new MemberModels(); if (ID.HasValue) { m = ManagerDAO.GetItem((long)ID); ViewBag.IsNew = false; } else { ViewBag.IsNew = true; } var group = GroupDAO.GetItems(); ViewBag.group = group; ViewBag.ID = ID ?? 0; return(View(m)); }
private ManagerService() { // _daoManager = ServiceConfig.GetInstance().DaoManager; // _managerDao = _daoManager.GetDao(typeof(IManager)) as IManager; _managerDao = new ManagerDAO(); }
private void btnSave_Click(object sender, EventArgs e) { if (choice.Equals("ADD")) { // Check if (string.IsNullOrEmpty(txtMaId.Text) || string.IsNullOrEmpty(txtUsername.Text) || string.IsNullOrEmpty(txtPassword.Text) || string.IsNullOrEmpty(txtFullName.Text) || string.IsNullOrEmpty(txtMail.Text) || string.IsNullOrEmpty(txtPhoneNo.Text)) { MessageBox.Show("Must fill all information to add!"); return; } if (ManagerDAO.getManagerByMaID(txtMaId.Text) != null) { lblError.Text = "ID of manager already existed!"; return; } if (ManagerDAO.getManagerByUsername(txtUsername.Text) != null) { lblError.Text = "Username already existed!"; return; } //------------ // Add acount Account a = new Account(txtUsername.Text, txtPassword.Text, 1); AccountDAO.Insert(a); // ----------- // Add manager int gender = 1; if (rbtnFemale.Checked == true) { gender = 0; } Manager m = new Manager(txtMaId.Text, txtUsername.Text, dateDOB.Value, gender, txtMail.Text, txtPhoneNo.Text, txtFullName.Text); ManagerDAO.Insert(m); } if (choice.Equals("EDIT")) { // Check if (string.IsNullOrEmpty(txtFullName.Text) || string.IsNullOrEmpty(txtMail.Text) || string.IsNullOrEmpty(txtPhoneNo.Text)) { MessageBox.Show("Must fill all information to add!"); return; } int gender = 1; if (rbtnFemale.Checked == true) { gender = 0; } if (chkChangePass.Checked == true) { if (string.IsNullOrEmpty(txtPassword.Text)) { MessageBox.Show("Must fill all information to add!"); return; } Account a = new Account(txtUsername.Text, txtPassword.Text, 1); AccountDAO.Update(a); } Manager m = new Manager(txtMaId.Text, txtUsername.Text, dateDOB.Value, gender, txtMail.Text, txtPhoneNo.Text, txtFullName.Text); ManagerDAO.Update(m); } LoadData(); choice = "SAVE"; AdjustGUI(choice); }
public ManagerBUS() { mngDao = new ManagerDAO(); }
public DAL() { this.PlayerDAL = new PlayerDAO(BaseballConnectionString, playerTabName); this.SalaryDAL = new SalaryDAO(BaseballConnectionString, salaryTabName); this.ManagerDAL = new ManagerDAO(BaseballConnectionString, managerTabName); }
public void DeleteManager(IEnumerable <long> ids) { ManagerDAO.DeleteManager(ids); }