private void cmbKhoaFormChuyenLop_SelectedIndexChanged(object sender, EventArgs e) { if (HelperCommon.getListKhoa(cmbKhoaFormChuyenLop)) { this.initDataForCmbClass(); } }
public IActionResult EditDefault(string cusID, string cardID) { var result = RestAPI.SendPostRequest($"api/Transaction/DefaultCard?cusID=" + cusID + "&cardID=" + cardID, null); var customerEditItems = HelperCommon.DeserializeObject <Stripe.Customer>(result.Content); return(PartialView("~/Views/Card/_Default.cshtml", customerEditItems)); }
/// <summary> /// Client 의 Ip Address 를 반환합니다. /// </summary> /// <returns></returns> public static string GetClientIpAddress() { string returnResult = string.Empty; try { System.Web.HttpContext context = System.Web.HttpContext.Current; string ipAddress = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (!string.IsNullOrEmpty(ipAddress)) { string[] addresses = ipAddress.Split(','); if (addresses.Length != 0) { returnResult = addresses[0]; } } else { returnResult = context.Request.ServerVariables["REMOTE_ADDR"]; } } catch (Exception ex) { HelperCommon.RegisterLogForHelperSecurity(ex.ToString()); } return(returnResult); }
private void BindBorrowListDataGrid(List<QueryElement> list) { BorrowORLoanCollection coll = BorrowedMethods.GetBorrowList(list); this.BorrowListDataGrid.DataSource = coll; this.BorrowListDataGrid.DataBind(); for (int i = 0; i < coll.Count; i++) { CardInfo cardInfo = CardMethods.GetCardById(coll[i].BorrowORLoanAccountId); string bank = StaticRescourse.DisplayBank(cardInfo.BankId); this.BorrowListDataGrid.Items[i].Cells[4].Text = coll[i].BorrowedAccount + " " + bank; this.BorrowListDataGrid.Items[i].Cells[8].Text = coll[i].HappenedDate.ToString("yyyy-MM-dd"); this.BorrowListDataGrid.Items[i].Cells[2].Text = StaticRescourse.DisplayBorrowORLoanType(coll[i].BorrowORLoanType); bool dateFlag = HelperCommon.CompareAccordToRequired(coll[i].ReturnDate); if (dateFlag) { this.BorrowListDataGrid.Items[i].Cells[9].Text = coll[i].ReturnDate.ToString("yyyy-MM-dd"); } else { this.BorrowListDataGrid.Items[i].Cells[9].Text = string.Empty; } if (coll[i].Status == 2) { this.BorrowListDataGrid.Items[i].Cells[10].Text = "已还"; } else { this.BorrowListDataGrid.Items[i].Cells[10].Text = "未还"; } } }
private void searchHocPhiCuaSinhVien(string maSV) { try { DataTable dtStudent = HelperCommon.queryDataByOneCondition("SINHVIEN", "MASV", maSV); BindingSource bdsStudent = new BindingSource(); bdsStudent.DataSource = dtStudent; string maLop = studentService.getClassId(bdsStudent); string hoTen = studentService.getFullname(bdsStudent); string gender = studentService.getGender(bdsStudent) == true ? "Nam" : "Nữ"; initStudentInfo(maSV, hoTen, maLop, gender); txtMaSV.Text = maSV; searchResult = true; if (maLop == "" || hoTen == "") { searchResult = false; } } catch (Exception ex) { MessageBox.Show("Không tìm thấy kết quả phù hợp.", "", MessageBoxButtons.OK); Debug.Print(ex.StackTrace); searchResult = false; return; } }
private void cmbKhoa_SelectedIndexChanged(object sender, EventArgs e) { if (HelperCommon.getListKhoa(cmbKhoa)) { this.refreshDataGridViewStudent(); } }
public ActionResult EmployeeAdd() { ViewBag.Message = "Your application description page."; List <SelectListItem> authorities = HelperCommon.convertToListItem(DataBaseCommon.getAuthority()); List <SelectListItem> managers = HelperCommon.convertToListItem(DataBaseCommon.getManager()); List <SelectListItem> customers = HelperCommon.convertToListItem(DataBaseCommon.getCustomer()); TempData["authorities"] = authorities; TempData["managers"] = managers; TempData["customers"] = customers; if (TempData["ViewData"] != null) { ViewData = (ViewDataDictionary)TempData["ViewData"]; } if (TempData["SuccessMessage"] != null) { ViewData["SuccessMessage"] = (string)TempData["SuccessMessage"]; TempData["SuccessMessage"] = null; } if (TempData["EmployeeAddInput"] != null) { var model = TempData["EmployeeAddInput"]; return(View("~/Views/Admin/EmployeeAdd.cshtml")); } return(View("~/Views/Admin/EmployeeAdd.cshtml")); }
protected void btnLoanAddSubmit_Click(object sender, EventArgs e) { BorrowORLoanInfo loanInfo = new BorrowORLoanInfo(); if (!string.IsNullOrEmpty(this.HiddenField1.Value.Trim())) { loanInfo.Id = Convert.ToInt32(this.HiddenField1.Value.Trim()); } else { loanInfo.Id = 0; } #region 验证 if (!CheckLoanAddForm()) { string type = this.RadioLoanAddLoanType.SelectedValue; string temp = this.HidderField2.Value; this.ClientScript.RegisterStartupScript(this.GetType(), "fillForm", "DisplayAddLoandiv('" + type + "');fillFormField({loanAccount:'" + temp + "'});", true); return; } #endregion loanInfo.Borrower = this.txtLoanAddBorrower.Text.Trim(); if (this.RadioLoanAddLoanType.SelectedValue == "2" && !string.IsNullOrEmpty(this.HidderField2.Value.Trim())) { string[] s = this.HidderField2.Value.Split(','); CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(s[0])); loanInfo.LoanAccount = cardInfo.CardNumber; loanInfo.BorrowORLoanAccountId = cardInfo.Id; } loanInfo.Lender = this.txtLoanAddLender.Text.Trim(); loanInfo.BorrowedAccount = this.txtLoanAddBorrowAccount.Text.Trim(); loanInfo.BorrowORLoanType = Convert.ToInt32(this.RadioLoanAddLoanType.SelectedValue); loanInfo.Amount = Convert.ToSingle(this.txtLoanAddLoanAmount.Text.Trim()); loanInfo.HappenedDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtLoanAddLoanDate.Text.Trim())); if (!string.IsNullOrEmpty(this.txtLoanAddReturnDate.Text.Trim())) { loanInfo.ReturnDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtLoanAddReturnDate.Text.Trim())); } loanInfo.Status = Convert.ToInt32(this.dropLoanAddStatus.SelectedValue); loanInfo.Content = this.txtLoanAddContent.Text.Trim(); int iSuccess = LoanMethods.InsertOrUpdatetoLoan(loanInfo); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddLoandiv();", true); if (iSuccess == 1) { Alert.Show(this, "新增一条收入成功!"); } else if (iSuccess == 2) { Alert.Show(this, "修改成功!"); } else { Alert.Show(this, "操作失败!"); } queryList = new List <QueryElement>(); BindLoanListDataGrid(queryList); }
public IActionResult Index(string cusID) { cusID = "cus_Eue2iFwuOLZHmJ"; var result = RestAPI.SendPostRequest($"api/Transaction/GetCardByCustomer?cusID=" + cusID, null); var customerItems = HelperCommon.DeserializeObject <Stripe.Customer>(result.Content); return(View(customerItems)); }
public IActionResult CreateTokenCard(string tokenCard, string cusID) { //tokenCard = "tok_1EZx3JDA5slZiHRBUi7BcAa8"; //cusID = "cus_Eue2iFwuOLZHmJ"; var result = RestAPI.SendPostRequest($"api/Transaction/CreateCard?tokenCard=" + tokenCard + "&cusID=" + cusID, null); var createCard = HelperCommon.DeserializeObject <Stripe.Customer>(result.Content); return(Json("Create Card Success")); }
public EmployeeLoginOutput Login(EmployeeLoginInput employeeLoginInput) { EmployeeLoginOutput employeeLoginOutput = new EmployeeLoginOutput(); try { string passWord = HelperCommon.hashPassword(employeeLoginInput.PassWord); using (sys_employeeEntities db = new sys_employeeEntities()) { var query = (from e in db.employee join c in db.customer on e.customerId equals c.customerId into ecGroup from ec in ecGroup.DefaultIfEmpty() where e.userName.Equals(employeeLoginInput.UserName) && e.passWord.Equals(passWord) select new { e.employeeId, e.name, e.kataName, e.mailAddress, e.telephoneNumber, e.entryDate, customerName = ec.name, e.address, e.accountBankInfo, e.personalNumber, e.dateOfBirth, e.authorityId, e.avatarFilePath }).FirstOrDefault(); if (query == null) { throw new Exception("ユーザネームまたパスワードが違います"); } employeeLoginOutput.Id = query.employeeId; employeeLoginOutput.Name = query.name; employeeLoginOutput.KataName = query.kataName; employeeLoginOutput.Email = query.mailAddress; employeeLoginOutput.TelephoneNumber = query.telephoneNumber; employeeLoginOutput.EntryDate = query.entryDate; employeeLoginOutput.CustomerName = query.customerName; employeeLoginOutput.Address = query.address; employeeLoginOutput.AccountBankInfo = query.accountBankInfo; employeeLoginOutput.PersonalNunber = query.personalNumber; employeeLoginOutput.DateOfBirth = query.dateOfBirth.GetValueOrDefault().ToString("yyyy/MM/dd"); employeeLoginOutput.AuthorityId = query.authorityId; employeeLoginOutput.AvatarFilePath = query.avatarFilePath; } } catch (Exception e) { throw e; } return(employeeLoginOutput); }
protected void btnBorrowQuerySubmit_Click(object sender, EventArgs e) { queryList = new List<QueryElement>(); #region 查询条件验证 if (!string.IsNullOrEmpty(this.txtBorrowQueryBBorrowDate.Text.Trim()) || !string.IsNullOrEmpty(this.txtBorrowQueryEBorrowDate.Text.Trim())) { if (!string.IsNullOrEmpty(this.txtBorrowQueryBBorrowDate.Text.Trim()) && string.IsNullOrEmpty(this.txtBorrowQueryEBorrowDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtBorrowQueryEBorrowDate.Focus(); return; } else if (string.IsNullOrEmpty(this.txtBorrowQueryBBorrowDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtBorrowQueryEBorrowDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtBorrowQueryBBorrowDate.Focus(); return; } else { bool flag = HelperCommon.ValidDateTime(this.txtBorrowQueryBBorrowDate.Text.Trim(), this.txtBorrowQueryEBorrowDate.Text.Trim()); if (!flag) { Alert.Show(this, "开始日期不能大于结束日期!"); this.txtBorrowQueryEBorrowDate.Focus(); return; } } } #endregion if (!string.IsNullOrEmpty(this.txtBorrowQueryBorrower.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "Borrower", QueryElementType = MySqlDbType.String, Queryvalue = this.txtBorrowQueryBorrower.Text.Trim(), QueryOperation = "like" }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.dropBorrowQueryStatus.SelectedValue)) { QueryElement query = new QueryElement { Queryname = "Status", QueryElementType = MySqlDbType.Int32, Queryvalue = Convert.ToInt32(this.dropBorrowQueryStatus.SelectedValue) }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.txtBorrowQueryBBorrowDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtBorrowQueryEBorrowDate.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "HappenedDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtBorrowQueryBBorrowDate.Text.Trim(), QueryOperation = ">=" }; queryList.Add(query); query = new QueryElement { Queryname = "HappenedDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtBorrowQueryEBorrowDate.Text.Trim(), QueryOperation = "<" }; queryList.Add(query); } BindBorrowListDataGrid(queryList); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayQueryBorrowdiv();", true); InitializeBorrowQuery(); }
public Dictionary <string, string> getPersonalDocument(string id) { try { return(HelperCommon.getPersonalDocuments(id)); } catch (Exception e) { throw e; } }
public void setUp() { StepDefinationInitialise(); ob = new Objects(browser.driver, browser.iWait); ob.ObjectInitialisation(); Navigate("https://www.thehotelcollection.co.uk/"); HelperCommon.IsJqueryActive(browser.driver); }
public void SelectYearInDatePicker(int requiredYear) { // Retreiving Year from Date picker int yearFromDatePicker = Convert.ToInt32(driver.FindElement(By.ClassName("ui-datepicker-year")).Text.Trim()); // Iterating till Year of Date picker is equal our required year. while (yearFromDatePicker != requiredYear) { driver.FindElement(By.ClassName("ui-icon-circle-triangle-e")).Click(); HelperCommon.IsJqueryActive(driver); yearFromDatePicker = Convert.ToInt32(driver.FindElement(By.ClassName("ui-datepicker-year")).Text.Trim()); } }
public IActionResult Delete(string cusID, string cardID) { var result = RestAPI.SendPostRequest($"api/Transaction/DeleteCard?cusID=" + cusID + "&cardID=" + cardID, null); var customerRemoveItems = HelperCommon.DeserializeObject <Stripe.Card>(result.Content); if (customerRemoveItems.Deleted == true) { var resultCus = RestAPI.SendPostRequest($"api/Transaction/GetCardByCustomer?cusID=" + cusID, null); var customerItems = HelperCommon.DeserializeObject <Stripe.Customer>(resultCus.Content); return(PartialView("~/Views/Card/_Default.cshtml", customerItems)); } return(PartialView("~/Views/Card/_Default.cshtml", new Stripe.Customer())); }
// 社員追加 public void addEmployee(EmployeeAddInput employee) { try { using (sys_employeeEntities db = new sys_employeeEntities()) { if (DataBaseCommon.isDuplicateEmployee(employee.Id, db)) { throw new Exception("社員Idが重複発生です"); } if (DataBaseCommon.isDuplicateUsername(employee.UserName, db)) { throw new Exception("社員Usernameが重複発生です"); } var path = ""; var avatarFile = employee.AvatarFile; if (avatarFile != null && avatarFile.ContentLength > 0) { path = HelperCommon.saveAvatarFile(avatarFile, employee.Id); } employee employeeEntity = new employee(); employeeEntity.employeeId = employee.Id; employeeEntity.managerId = employee.ManagerId; employeeEntity.userName = employee.UserName; employeeEntity.passWord = HelperCommon.hashPassword(employee.PassWord); employeeEntity.authorityId = employee.AuthorityId; employeeEntity.dateOfBirth = DateTime.Parse(employee.DateOfBirth); employeeEntity.address = employee.Address; employeeEntity.personalNumber = employee.PersonalNumber; employeeEntity.name = employee.Name; employeeEntity.kataName = employee.KataName; employeeEntity.telephoneNumber = employee.TelephoneNumber; employeeEntity.mailAddress = employee.MailAddress; employeeEntity.customerId = employee.CustomerId; employeeEntity.accountBankInfo = employee.AccountBankInfo; employeeEntity.avatarFilePath = path; employeeEntity.depentdentFamily = employee.DepentdentFamily; employeeEntity.entryDate = employee.EntryDate; employeeEntity.description = employee.Description; db.employee.Add(employeeEntity); db.SaveChanges(); } } catch (Exception e) { throw e; } }
public void SelectMonthInDatePicker(Dictionary <int, String> requiredMonth) { // Retreiving month from Date picker String monthFromDatePicker = driver.FindElement(By.ClassName("ui-datepicker-month")).Text.Trim(); // Iterating till month of Date picker is equal our required month. while (!monthFromDatePicker.Equals(requiredMonth.ElementAt(0).Value)) { Thread.Sleep(1000); driver.FindElement(By.ClassName("ui-icon-circle-triangle-e")).Click(); HelperCommon.IsJqueryActive(driver); monthFromDatePicker = driver.FindElement(By.ClassName("ui-datepicker-month")).Text.Trim(); } Console.WriteLine("MOnth from Date Picker :: " + monthFromDatePicker + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber()); }
public string uploadSalaryDetailFile(string salaryMonth, HttpPostedFileBase salaryDetailFileStream) { try { string salaryFileName = ""; using (sys_employeeEntities db = new sys_employeeEntities()) { FileStream salaryFileStream = HelperCommon.saveSalaryDetail(salaryMonth, salaryDetailFileStream); salaryFileName = updateSalary(salaryMonth, salaryFileStream, db); } return(salaryFileName); } catch (Exception e) { throw e; } }
/// <summary> /// 현재 Assembly 가 존재하는 물리적 폴더명을 반환합니다. /// </summary> /// <returns></returns> internal static string GetEntryAssemblyFolderName() { string returnResult = string.Empty; try { string entryAssemblyName = "Nameless"; string[] tmpArray = null; if (System.Reflection.Assembly.GetEntryAssembly() != null) { // EntryAssembly 가 .exe 일 경우 entryAssemblyName = System.Reflection.Assembly.GetEntryAssembly().CodeBase; } else { // System.Reflection.Assembly.GetEntryAssembly() 가 null 일 경우는 Web 으로 가정 entryAssemblyName = System.Web.HttpContext.Current.Server.MapPath("~"); // + _EXECUTING_ASSEMBLY_NAME; } // .exe 가 아닐 경우 다른 방법으로 구하기 위함 tmpArray = entryAssemblyName.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); // exe 파일의 경우 실행 파일 명을 구하고, 그 외의 경우( WEB ) /bin 한 단계 위 폴더명을 구함 if (tmpArray != null && tmpArray[tmpArray.Length - 1] == "exe") { string[] tmp = entryAssemblyName.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries); entryAssemblyName = tmp[tmp.Length - 1]; } else { string[] tmp = entryAssemblyName.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries); entryAssemblyName = tmp[tmp.Length - 1]; } returnResult = entryAssemblyName; } catch (Exception ex) { HelperCommon.RegisterLogForHelperCommon(ex.ToString()); } return(returnResult); }
public void ChangePassword(string employeeId, string password, string newPassword) { string hashPassword = HelperCommon.hashPassword(password); using (sys_employeeEntities db = new sys_employeeEntities()) { var query = (from e in db.employee where e.employeeId.Equals(employeeId) && e.passWord.Equals(hashPassword) select e).FirstOrDefault(); if (query == null) { throw new Exception("パスワードが間違いで、再入力ください"); } query.passWord = HelperCommon.hashPassword(newPassword); db.SaveChanges(); } }
public override string CreateOSD(OSDConfiguration OSD) { OSDConfigurationOptions OSDOpt = this.GetOSDOptions(OSD.VideoSourceConfigurationToken.Value); var OSDList = ONVIFMedia2Configuration.OSDConfigurationList.FindAll(C => C.VideoSourceConfigurationToken.Value == OSD.VideoSourceConfigurationToken.Value); ONVIFMedia2Configuration.OSDParametersCheck(OSD, OSDOpt, OSDList); while (ONVIFMedia2Configuration.OSDConfigurationList.Any(C => C.token == OSD.token)) { OSD.token = HelperCommon.RandomStr(); } ONVIFMedia2Configuration.OSDConfigurationList.Add(OSD); return(OSD.token); }
private void BindIncomeListDataGrid(List <QueryElement> list) { CashIncomeCollection coll = CashIncomeMethods.GetCashIncome(list); this.IncomeListDataGrid.DataSource = coll; this.IncomeListDataGrid.DataBind(); for (int i = 0; i < coll.Count; i++) { CashIncomeInfo cashInfo = coll[i]; CardInfo cardInfo = CardMethods.GetCardByCardNumber(cashInfo.CardNumber, cashInfo.OwnerId); string bank = StaticRescourse.DisplayBank(cardInfo.BankId); this.IncomeListDataGrid.Items[i].Cells[1].Text = StaticRescourse.DisplayIncomeStatus(cashInfo.Status); this.IncomeListDataGrid.Items[i].Cells[4].Text = StaticRescourse.DisplayIncomeType(cashInfo.IncomeType); this.IncomeListDataGrid.Items[i].Cells[6].Text = StaticRescourse.DisplayMode(cashInfo.Mode); this.IncomeListDataGrid.Items[i].Cells[7].Text = StaticRescourse.DisplayRate(cashInfo.Rate); this.IncomeListDataGrid.Items[i].Cells[8].Text = cashInfo.DepositDate.ToString("yyyy-MM-dd"); if (cashInfo.AutoSave == 1) { this.IncomeListDataGrid.Items[i].Cells[12].Text = "是"; } else { this.IncomeListDataGrid.Items[i].Cells[12].Text = "否"; } if (HelperCommon.CompareAccordToRequired(cashInfo.BDate)) { this.IncomeListDataGrid.Items[i].Cells[9].Text = cashInfo.BDate.ToString("yyyy-MM-dd"); } else { this.IncomeListDataGrid.Items[i].Cells[9].Text = string.Empty; } if (HelperCommon.CompareAccordToRequired(cashInfo.EDate)) { this.IncomeListDataGrid.Items[i].Cells[10].Text = cashInfo.EDate.ToString("yyyy-MM-dd"); } else { this.IncomeListDataGrid.Items[i].Cells[10].Text = string.Empty; } this.IncomeListDataGrid.Items[i].Cells[13].Text = StaticRescourse.DisplayIncomeDepositMode(cashInfo.DepositMode); } }
public bool uploadSalaryDetailZipFiles(string salaryMonth, HttpPostedFileBase salaryDetailFolderStream) { string salaryFolderName = salaryMonth.Substring(0, 7).Replace("/", ""); MemoryStream ms = new MemoryStream(); salaryDetailFolderStream.InputStream.CopyTo(ms); string salaryDetailFolderPath = Path.Combine(ConstantCommon.SALARYFOLDERROOTPATH, salaryFolderName); List <FileStream> salaryDetailFileStreams = HelperCommon.extractZipfileToFileStream(ms, salaryDetailFolderPath); using (sys_employeeEntities db = new sys_employeeEntities()) { foreach (FileStream salaryDetailFileStream in salaryDetailFileStreams) { updateSalary(salaryMonth, salaryDetailFileStream, db); } } return(false); }
/// <summary> /// 파일 물리적인 정보를 읽어와 yyyyMMddHHmmss 형태의 Version 정보를 반환합니다. ( Full Url 일 경우 현재 시각 기준으로 마킹 ) /// </summary> /// <param name="fileName"></param> /// <param name="isFullUrl"></param> /// <returns></returns> private static string GetFileVersion(string filePhysicalPathOrUrl, bool isFullUrl) { string returnReulst = string.Empty; if (isFullUrl == false) { // 파일 존재 체크 if (File.Exists(filePhysicalPathOrUrl)) { returnReulst = new System.IO.FileInfo(filePhysicalPathOrUrl).LastWriteTime.ToString("yyyyMMddHHmmss"); } } else { returnReulst = HelperCommon.GenerateRandomString(14); } return(returnReulst); }
public ActionResult EmployeeDetail(string id) { ViewBag.Message = "Your contact page."; List <SelectListItem> authorities = HelperCommon.convertToListItem(DataBaseCommon.getAuthority()); List <SelectListItem> managers = HelperCommon.convertToListItem(DataBaseCommon.getManager()); List <SelectListItem> customers = HelperCommon.convertToListItem(DataBaseCommon.getCustomer()); TempData["authorities"] = authorities; TempData["managers"] = managers; TempData["customers"] = customers; EmployeeUpdateInput employee; if (TempData["ViewData"] != null) { ViewData = (ViewDataDictionary)TempData["ViewData"]; } if (TempData["SuccesMessage"] != null) { ViewData["SuccesMessage"] = (string)TempData["SuccesMessage"]; } if (TempData["EmployeeUpdateInput"] != null) { employee = (EmployeeUpdateInput)TempData["EmployeeUpdateInput"]; } else { EmployeeService employeeService = new EmployeeService(); employee = employeeService.getEmployeeUpdate(id); } HelperCommon.setSelected(authorities, employee.AuthorityId); HelperCommon.setSelected(managers, employee.ManagerId); HelperCommon.setSelected(customers, employee.CustomerId); return(View("~/Views/Admin/EmployeeDetail.cshtml", employee)); }
public ActionResult Index() { EmployeeService employeeService = new EmployeeService(); List <SelectListItem> customers = HelperCommon.convertToListItem(DataBaseCommon.getCustomer()); List <SelectListItem> authorities = HelperCommon.convertToListItem(DataBaseCommon.getAuthority()); authorities.Insert(0, new SelectListItem { Text = "", Value = "" }); ViewBag.authorities = authorities; ViewBag.customers = customers; if (TempData["ViewData"] != null) { ViewData = (ViewDataDictionary)TempData["ViewData"]; } if (TempData["employees"] != null) { ViewData["employees"] = TempData["employees"]; } else { List <EmployeeSearchOutput> employees = employeeService.getEmployees(); ViewData["employees"] = employees; } if (TempData["employeeSearchInput"] != null) { var model = TempData["employeeSearchInput"]; return(View("~/Views/Admin/Index.cshtml", model)); } return(View("~/Views/Admin/Index.cshtml")); }
public BrowserInit() { try { string rootPath = AppDomain.CurrentDomain.BaseDirectory; //Environment.CurrentDirectory; if (Convert.ToBoolean(browser.SelectBrowser(BrowserCollection.firefox.ToString(), "BrowserSelection.xml")) == true) { // driver = new FirefoxDriver(new FirefoxBinary(@"C:\Program Files\Mozilla Firefox\firefox.exe"), new FirefoxProfile()); driver = new FirefoxDriver(); String BrowserName = BrowserCollection.firefox.ToString(); screenHeight = HelperCommon.GetScreenHeight(driver); screenWidth = HelperCommon.GetScreenWidth(driver); HelperCommon.SetWindowPosition(driver, 0, 0); HelperCommon.SetWindowSize(driver, screenWidth, screenHeight); } else if (Convert.ToBoolean(browser.SelectBrowser(BrowserCollection.chrome.ToString(), "BrowserSelection.xml")) == true) { // driverPath = rootPath + "\\chromedriver.exe"; driverPath = rootPath; driverName = "webdriver.chrome.driver"; ChromeOptions options = new ChromeOptions(); options.AddArgument("--disable-extensions"); //System.Environment.SetEnvironmentVariable(driverName, driverPath); driver = new ChromeDriver(driverPath, options); //driver = new ChromeDriver(baseDir + "\\DLLs"); HelperCommon.EventFire ef = new HelperCommon.EventFire(driver); driver = ef; String BrowserName = BrowserCollection.chrome.ToString(); screenHeight = HelperCommon.GetScreenHeight(driver); screenWidth = HelperCommon.GetScreenWidth(driver); HelperCommon.SetWindowPosition(driver, 0, 0); HelperCommon.SetWindowSize(driver, screenWidth, screenHeight); Console.WriteLine("Is Driver null :: " + (driver == null)); iWait = new WebDriverWait(driver, TimeSpan.FromSeconds(120)); } else if (Convert.ToBoolean(browser.SelectBrowser(BrowserCollection.ie.ToString(), "BrowserSelection.xml")) == true) { InternetExplorerOptions options = new InternetExplorerOptions(); options.EnsureCleanSession = true; options.EnableNativeEvents = true; options.IgnoreZoomLevel = true; options.IntroduceInstabilityByIgnoringProtectedModeSettings = true; driverName = "webdriver.ie.driver"; driverPath = rootPath + "/IEDriverServer.exe"; driver = new InternetExplorerDriver(options); screenHeight = HelperCommon.GetScreenHeight(driver); screenWidth = HelperCommon.GetScreenWidth(driver); HelperCommon.SetWindowPosition(driver, 0, 0); HelperCommon.SetWindowSize(driver, screenWidth, screenHeight); String BrowserName = BrowserCollection.ie.ToString(); // Add code to add Registry in IE 11 String IEVersion = HelperCommon.GetIEVersion(driver, driver.FindElement(By.TagName("html"))); if (IEVersion.Equals("IE11")) { HelperCommon.CheckIE11RegistryPresence(); } } else if (Convert.ToBoolean(browser.SelectBrowser(BrowserCollection.phantom.ToString(), "BrowserSelection.xml")) == true) { driver = new PhantomJSDriver(); String BrowserName = BrowserCollection.phantom.ToString(); screenHeight = HelperCommon.GetScreenHeight(driver); screenWidth = HelperCommon.GetScreenWidth(driver); HelperCommon.SetWindowPosition(driver, 0, 0); HelperCommon.SetWindowSize(driver, screenWidth, screenHeight); } else { throw new NoBrowserSelectedException(); } iWait = new OpenQA.Selenium.Support.UI.WebDriverWait(driver, TimeSpan.FromSeconds(60.00)); } catch (NoBrowserSelectedException ex) { Logger.log.Error("Error In Browser Selection."); Logger.log.Error(ex); } catch (Exception ex) { Logger.log.Error("Error In Browser Initialization."); Logger.log.Error(ex); } }
/// <summary> /// XSS Injection 공격에 사용되는 Single quotation, Dobule quotation 을 제거한 값을 리턴합니다. /// </summary> /// <returns></returns> public static string WithoutInjectionCharacters(string plainString, out bool hasInjectionCharacters) { bool isIncludedCharacter = false; string returnValue = plainString; try { // String 정제 if (!string.IsNullOrEmpty(plainString)) { //string[] invalidCharacters = { "\"", "'", "%22", "%27", "<", ">", "%3C", "%3E", "%253C", "%253E", ";", "%3B" }; string[] invalidCharacters = HelperCommon._INJECTION_CHARACTERS.Split(','); foreach (string n in invalidCharacters) { string replaceCharacter = ""; if (returnValue.ToUpper().Contains(n)) { isIncludedCharacter = true; } switch (n) { case "<": case "%3C": replaceCharacter = "<"; break; case ">": case "%3E": replaceCharacter = ">"; break; default: break; } // 대/소문자 각각 치환 returnValue = returnValue.Replace(n, replaceCharacter); returnValue = returnValue.Replace(n.ToLower(), replaceCharacter); } // Injection 문자가 있으면 로그 if (isIncludedCharacter) { string requestUrl = string.Empty; string referrerUrl = string.Empty; string clientIpAddr = string.Empty; requestUrl = HttpContext.Current.Request.Url.AbsoluteUri; clientIpAddr = HelperNetwork.GetClientIpAddress(); // ReferrerUrl 이 있을 경우 조회 try { if (HttpContext.Current.Request.UrlReferrer != null) { referrerUrl = HttpContext.Current.Request.UrlReferrer.AbsoluteUri; } else { referrerUrl = "Referrer URL not exist"; } } catch (Exception ex) { referrerUrl = "Failed Get Referrer URL (Exception)"; } // Exception 상황이 아닌, Injection 의심 건을 기록하기 위함 string logMessage = string.Format(@" < Secure Warning > [DESC] : {0} [URL] : {1} [REFERRER URL] : {2} [IP] : {3}" , "Maybe XSS, SQL Injection", requestUrl, referrerUrl, clientIpAddr); HelperCommon.RegisterLogForHelperSecurity(logMessage); } } } catch (Exception ex) { HelperCommon.RegisterLogForHelperSecurity(ex.ToString()); } hasInjectionCharacters = isIncludedCharacter; return(returnValue); }
/// <summary> /// 查询提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnExpensesQuerySubmit_Click(object sender, EventArgs e) { #region 验证 if (!string.IsNullOrEmpty(this.txtExpensesQueryBSpendDate.Text.Trim()) || !string.IsNullOrEmpty(this.txtExpensesQueryESpendDate.Text.Trim())) { if (!string.IsNullOrEmpty(this.txtExpensesQueryBSpendDate.Text.Trim()) && string.IsNullOrEmpty(this.txtExpensesQueryESpendDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtExpensesQueryESpendDate.Focus(); return; } else if (string.IsNullOrEmpty(this.txtExpensesQueryBSpendDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtExpensesQueryESpendDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtExpensesQueryBSpendDate.Focus(); return; } else { bool flag = HelperCommon.ValidDateTime(this.txtExpensesQueryBSpendDate.Text.Trim(), this.txtExpensesQueryESpendDate.Text.Trim()); if (!flag) { Alert.Show(this, "开始日期不能大于结束日期!"); this.txtExpensesQueryESpendDate.Focus(); return; } } } #endregion queryList = new List <QueryElement>(); if (!string.IsNullOrEmpty(this.txtExpensesQueryCardNumber.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "CardNumber", QueryElementType = MySqlDbType.String, Queryvalue = this.txtExpensesQueryCardNumber.Text.Trim() }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.dropExpensesQuerySpendType.SelectedValue)) { QueryElement query = new QueryElement { Queryname = "SpendType", QueryElementType = MySqlDbType.Int32, Queryvalue = Convert.ToInt32(this.dropExpensesQuerySpendType.SelectedValue) }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.dropExpensesQuerySpendMode.SelectedValue)) { QueryElement query = new QueryElement { Queryname = "SpendMode", QueryElementType = MySqlDbType.Int32, Queryvalue = Convert.ToInt32(this.dropExpensesQuerySpendMode.SelectedValue) }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.txtExpensesQueryConsumerName.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "ConsumerName", QueryElementType = MySqlDbType.String, Queryvalue = this.txtExpensesQueryConsumerName.Text.Trim(), QueryOperation = "like" }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.txtExpensesQueryBSpendDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtExpensesQueryESpendDate.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "SpendDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtExpensesQueryBSpendDate.Text.Trim(), QueryOperation = ">=" }; queryList.Add(query); query = new QueryElement { Queryname = "SpendDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtExpensesQueryESpendDate.Text.Trim(), QueryOperation = "<" }; queryList.Add(query); } BindExpensesListDataGrid(queryList); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayExpensesQuerydiv();", true); InitializeExpensesQuery(); }