public MainWindow() { printer = new ReceiptPrinter(); orderPage = new OrderPage(printer); managePage = new ManagePage(printer); statsPage = new StatisticsPage(); }
public void Can_Delete_Account() { // Arrange AtPage <HomePage>( (homepage) => { ManagePage page = homepage .SignIn() .SignInWithAmazon() .Manage(); // Act page.DeleteAccount() .Close(); // Assert page.IsAuthenticated().ShouldBeTrue(); // Act page.DeleteAccount() .Confirm(); // Assert page.IsAuthenticated().ShouldBeFalse(); }); }
public void successfulChangeAndThenReturningTheOriginalPassword() { changePasswordPage.changePassword("Admin1*", "Admin1!", "Admin1!"); managePage = new ManagePage(driver); string message = managePage.getSuccessMessage(); Assert.AreEqual("Your password has been changed.", message); managePage.clickOnLogOutBtn(); string url = "http://*****:*****@yahoo.com", "Admin1*"); loginPage.waitForError(); string loginError = loginPage.getError(); Assert.AreEqual("Invalid login attempt.", loginError); loginPage.login("*****@*****.**", "Admin1!"); wait.Until(wt => wt.FindElement(By.LinkText("*****@*****.**"))); driver.FindElement(By.LinkText("*****@*****.**")).Click(); managePage = new ManagePage(driver); managePage.goToChangePasswordPage(); changePasswordPage = new ChangePasswordPage(driver); changePasswordPage.changePassword("Admin1!", "Admin1*", "Admin1*"); managePage = new ManagePage(driver); message = managePage.getSuccessMessage(); Assert.AreEqual("Your password has been changed.", message); }
public void CheckIfCreateButtonIsWorkingManagePage() { var managePage = new ManagePage(driver); managePage.ClickCreateButton(); managePage.AssertIAmOnCreatePage(); }
public void CheckIfSoftUniBlogButtonIsWorkingManagePage() { var managePage = new ManagePage(driver); managePage.NavigateToAndClickSoftUniBlogButton(); managePage.AssertYouAreOnHomePage(); }
public void CheckIfCopyrightoftUniBlogTextIsPresentManagePage() { var managePage = new ManagePage(driver); managePage.NavigateTo(); managePage.AssertCopyrightIsPresent(); }
private void deleteOrderFile(HttpContext context) { //检查是否允许匿名上传 if (!new ManagePage().IsAdminLogin()) { context.Response.Write("{\"status\": 0, \"msg\": \"禁止匿名非法删除!\"}"); return; } BLL.Order bll = new BLL.Order(); Model.manager manager = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 int id = DTRequest.GetQueryInt("id"); Model.Files file = bll.GetFileModel(id); Model.Order order = bll.GetModel(file.f_oid); if (order.o_lockStatus == 1) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已锁定,不能再删除!\"}"); context.Response.End(); } if (bll.deleteOrderFile(file, manager)) { context.Response.Write("{\"status\": 1, \"msg\": \"删除成功!\"}"); context.Response.End(); } context.Response.Write("{\"status\": 0, \"msg\": \"删除失败!\"}"); context.Response.End(); }
private void get_navigation_list(HttpContext context) { string navtype = DTRequest.GetQueryString("navtype").ToLower(); switch (navtype) { case "users": navtype = DTEnums.NavigationEnum.Users.ToString(); break; case "website": navtype = DTEnums.NavigationEnum.WebSite.ToString(); break; case "oa": navtype = DTEnums.NavigationEnum.OA.ToString(); break; case "dingtalk": navtype = DTEnums.NavigationEnum.DingTalk.ToString(); break; default: navtype = DTEnums.NavigationEnum.System.ToString(); break; } Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 if (adminModel == null) { return; } Model.manager_role roleModel = new BLL.manager_role().GetModel(adminModel.role_id);//获得管理角色信息 if (roleModel == null) { return; } DataTable dt = new BLL.navigation().GetList(0, navtype); this.get_navigation_childs(context, dt, 0, roleModel.role_type, roleModel.manager_role_values); }
public void CheckIfLogOffButtonIsWorkingManagePage() { var managePage = new ManagePage(driver); managePage.NavigateTo(); managePage.ClickLogOffButton(); managePage.AssertIAmLoggedOff(); }
public void Initialized() { this.driver = BrowserHost.Instance.Application.Browser; this.ManagePage = new ManagePage(this.driver); ManagePage.NavigateTo(); var user = AccessExcelData.GetTestData <ManagePageUserModel>("RegisterPageData.xlsx", "DataSet2", "ValidLogin"); ManagePage.FillLoginForm(user); }
protected void Page_Load(object sender, EventArgs e) { //判断是否登录 ManagePage mym = new ManagePage(); if (!mym.IsAdminLogin()) { Response.Write("<script>parent.location.href='index.aspx'</script>"); Response.End(); } }
private void UpLoadPayFile(HttpContext context) { Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig(); //检查是否允许匿名上传 if (!new ManagePage().IsAdminLogin()) { context.Response.Write("{\"status\": 0, \"msg\": \"禁止匿名非法上传!\"}"); return; } string fileName = DTRequest.GetString("name"); //文件名 int pid = DTRequest.GetQueryInt("pid"); string ftype = DTRequest.GetQueryString("ftype");; //文件类别 bool _isthumbnail = false; //默认不生成缩略图 byte[] byteData = FileHelper.ConvertStreamToByteBuffer(context.Request.InputStream); //获取文件流 if (byteData.Length == 0) { context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}"); return; } if (DTRequest.GetQueryString("IsThumbnail") == "1") { _isthumbnail = true; } UpLoad upLoad = new UpLoad(); fileName = fileName.Replace(" ", "");//去掉空格 string msg = upLoad.PayFileSaveAs(byteData, fileName, _isthumbnail, pid, ftype); msg = Regex.Replace(msg, @"(\\[^bfrnt\\/'\""])", "\\$1");//利用正则表达式先把待解析的字符串中的带“\”特殊字符处理,再进行解析操作 JObject jo = JObject.Parse(msg); if (jo["status"].ToString() == "1") { Model.manager manager = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 Model.payPic file = new Model.payPic(); file.pp_rid = pid; file.pp_type = Utils.ObjToByte(ftype); file.pp_fileName = fileName; file.pp_filePath = jo["path"].ToString(); file.pp_thumbFilePath = jo["thumb"].ToString(); file.pp_size = Utils.ObjToDecimal(jo["size"].ToString(), 0); file.pp_addDate = DateTime.Now; file.pp_addName = manager.real_name; file.pp_addPerson = manager.user_name; new BLL.payPic().insertPayFile(file, manager); } //返回成功信息 context.Response.Write(msg); context.Response.End(); }
/// <summary> /// 检查是否为管理员登陆 /// </summary> /// <returns></returns> public bool Isadminlogin() { ManagePage mana = new ManagePage(); if (mana.GetAdminInfo() == null) { return(true); } else { return(false); } }
public string mapToJson(string jsonName, string areacode, string keywords, int page, int pageSize) { ManagePage pg = new ManagePage(); var model = pg.GetAdminInfo(); string strwhere = " 1=1 "; StringBuilder strTemp = new StringBuilder(); keywords = keywords.Replace("'", ""); if (model.role_type != 1) { strwhere += $" and user_id={model.id} "; } if (!string.IsNullOrEmpty(areacode)) { strwhere += $" and area_code='{areacode.Replace("'", "")}' "; } if (!string.IsNullOrEmpty(keywords)) { strwhere += $" and (name like '%{keywords}%' or onenetnum='{keywords}')"; } BLL.dt_item bll = new BLL.dt_item(); var itemlist = bll.GetModelList(strwhere + " order by addtime desc "); string jsonstr = string.Empty; if (itemlist != null && itemlist.Count > 0) { itemlist = itemlist.Skip((page - 1) * pageSize).Take(pageSize).ToList(); jsonstr = JsonHelper2.Serialize(itemlist.Select(p => new { id = p.id, sbid = p.onenetnum, title = p.name, gps = p.position, online = p.online?1:0 })); //for (int i = 0; i < itemlist.Count; i++) //{ // Json.Append("{"); // Json.Append("id:\"" + itemlist[i].id + "\""); // Json.Append(","); // Json.Append("sbid:\"" + itemlist[i].onenetnum + "\""); // Json.Append(","); // Json.Append("title:\"" + itemlist[i].name + "\""); // Json.Append(","); // Json.Append("gps:\"" + itemlist[i].position + "\""); // Json.Append(","); // Json.Append("online:\"" + itemlist[i].online + "\""); // Json.Append("}"); // if (i != itemlist.Count - 1) // { // Json.Append(","); // } //} } return(jsonstr); }
private void self_MessageOnline(HttpContext context) { Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 messageEntity message = new messageEntity(); var model = message.GetData(adminModel.user_name, adminModel.real_name); if (model != null) { context.Response.Write(JArray.FromObject(model)); context.Response.End(); } context.Response.Write("[]"); context.Response.End(); }
private void self_Message(HttpContext context) { Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 BLL.selfMessage bll = new BLL.selfMessage(); DataSet ds = bll.getUnReadMessage(adminModel.user_name, adminModel.real_name); if (ds != null && ds.Tables.Count > 0) { context.Response.Write(JArray.FromObject(ds.Tables[0])); context.Response.End(); } context.Response.Write("[]"); context.Response.End(); }
private void sys_channel_load(HttpContext context) { StringBuilder strTxt = new StringBuilder(); BLL.sys_channel bll = new BLL.sys_channel(); DataTable dt = bll.GetList("").Tables[0]; strTxt.Append("["); int i = 1; foreach (DataRow dr in dt.Rows) { Model.manager admin_info = new ManagePage().GetAdminInfo(); if (!new BLL.manager_role().Exists(admin_info.role_id, Convert.ToInt32(dr["id"]), ManagePage.ActionEnum.View.ToString())) { continue; } BLL.sys_model bll2 = new BLL.sys_model(); Model.sys_model model2 = bll2.GetModel(Convert.ToInt32(dr["model_id"])); strTxt.Append("{"); strTxt.Append("\"text\":\"" + dr["title"] + "\","); strTxt.Append("\"isexpand\":\"false\","); strTxt.Append("\"children\":["); if (model2.sys_model_navs != null) { int j = 1; foreach (Model.sys_model_nav nav in model2.sys_model_navs) { strTxt.Append("{"); strTxt.Append("\"text\":\"" + nav.title + "\","); strTxt.Append("\"url\":\"" + nav.nav_url + "?channel_id=" + dr["id"] + "\""); //此处要优化,加上nav.nav_url网站目录标签替换 strTxt.Append("}"); if (j < model2.sys_model_navs.Count) { strTxt.Append(","); } j++; } } strTxt.Append("]"); strTxt.Append("}"); strTxt.Append(","); i++; } string newTxt = Utils.DelLastChar(strTxt.ToString(), ",") + "]"; context.Response.Write(newTxt); return; }
protected void Page_Load(object sender, EventArgs e) { //判断是否登录 ManagePage mym = new ManagePage(); if (!mym.IsAdminLogin()) { Response.Write("<script>parent.location.href='login.aspx'</script>"); Response.End(); } if (!IsPostBack) { Lit_Name.Text = Session["RealName"].ToString(); } }
public void testInit() { string url = "http://*****:*****@yahoo.com", "Admin1*"); wait.Until(wt => wt.FindElement(By.LinkText("*****@*****.**"))); driver.FindElement(By.LinkText("*****@*****.**")).Click(); //Go to Manage/Index managePage = new ManagePage(driver); managePage.goToChangePasswordPage(); //Go to Manage/ChangePassword changePasswordPage = new ChangePasswordPage(driver); }
private void check_Status(HttpContext context) { Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 //string ids = DTRequest.GetFormString("ids"); //string ctype = DTRequest.GetFormString("ctype"); //string cstatus = DTRequest.GetFormString("cstatus"); //string remark = DTRequest.GetFormString("remark"); //BLL.unBusinessApply bll = new BLL.unBusinessApply(); //string[] idlist = ids.Split(','); //int success = 0, error = 0; //StringBuilder sb = new StringBuilder(); //string reason = ""; //foreach (string id in idlist) //{ // reason = bll.checkStatus(Convert.ToInt32(id), Utils.ObjToByte(ctype), Utils.ObjToByte(cstatus), remark, adminModel); // if (string.IsNullOrEmpty(reason)) // { // success++; // } // else // { // error++; // sb.Append(reason + "<br/>"); // } //} //context.Response.Write("{ \"msg\":\"共选择" + idlist.Length + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString() + "\", \"status\":" + (error > 0 ? "1" : "0") + " }"); //context.Response.End(); int id = DTRequest.GetFormInt("id"); string ctype = DTRequest.GetFormString("ctype"); string cstatus = DTRequest.GetFormString("cstatus"); string checkMoney = DTRequest.GetFormString("checkMoney"); string remark = DTRequest.GetFormString("remark"); BLL.unBusinessApply bll = new BLL.unBusinessApply(); StringBuilder sb = new StringBuilder(); string reason = bll.checkStatus(id, Utils.ObjToByte(ctype), Utils.ObjToByte(cstatus), checkMoney, remark, adminModel); if (string.IsNullOrEmpty(reason)) { context.Response.Write("{ \"msg\":\"操作成功\", \"status\":0 }"); context.Response.End(); } else { context.Response.Write("{ \"msg\":\"" + reason + "\", \"status\":1 }"); context.Response.End(); } }
private void confirm_Status(HttpContext context) { Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 //string ids = DTRequest.GetFormString("ids"); //string status = DTRequest.GetFormString("status"); //string date = DTRequest.GetFormString("date"); //int method = Utils.StrToInt(DTRequest.GetFormString("method"), 0); //string methodName = DTRequest.GetFormString("methodName"); //BLL.unBusinessApply bll = new BLL.unBusinessApply(); //string[] idlist = ids.Split(','); //int success = 0, error = 0; //StringBuilder sb = new StringBuilder(); //string reason = ""; //foreach (string id in idlist) //{ // reason = bll.confirmStatus(Convert.ToInt32(id), status, date, method, methodName, adminModel); // if (string.IsNullOrEmpty(reason)) // { // success++; // } // else // { // error++; // sb.Append(reason + "<br/>"); // } //} //context.Response.Write("{ \"msg\":\"共选择" + idlist.Length + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString() + "\", \"status\":" + (error > 0 ? "1" : "0") + " }"); //context.Response.End(); int id = DTRequest.GetFormInt("id"); string status = DTRequest.GetFormString("status"); string date = DTRequest.GetFormString("date"); int method = Utils.StrToInt(DTRequest.GetFormString("method"), 0); string methodName = DTRequest.GetFormString("methodName"); BLL.unBusinessApply bll = new BLL.unBusinessApply(); string reason = bll.confirmStatus(id, status, date, method, methodName, adminModel); if (string.IsNullOrEmpty(reason)) { context.Response.Write("{ \"msg\":\"操作成功\", \"status\":0 }"); context.Response.End(); } else { context.Response.Write("{ \"msg\":\"" + reason + "\", \"status\":1 }"); context.Response.End(); } }
private void get_navigation_list(HttpContext context) { LingLong.Admin.Model.manager adminModel = new ManagePage().GetAdminInfo(); //获得当前登录管理员信息 if (adminModel == null) { return; } LingLong.Admin.Model.manager_role roleModel = new LingLong.Admin.BLL.manager_role().GetModel(adminModel.role_id); //获得管理角色信息 if (roleModel == null) { return; } DataTable dt = new LingLong.Admin.BLL.navigation().GetList(0, DTEnums.NavigationEnum.System.ToString()); this.get_navigation_childs(context, dt, 0, roleModel.role_type, roleModel.manager_role_values); }
private void change_OrderStatus(HttpContext context) { int tag = DTRequest.GetFormInt("tag", 0); string oID = DTRequest.GetFormString("oID"); int status = DTRequest.GetFormInt("status", 0); int flag = DTRequest.GetFormInt("flag", 0); byte? lockstatus = Utils.ObjToByte(DTRequest.GetFormString("lockstatus")); decimal cost = DTRequest.GetFormDecimal("cost", 0); string finRemark = DTRequest.GetFormString("finRemark"); if (tag == 0) { context.Response.Write("{ \"msg\":\"参数错误\", \"status\":\"1\" }"); return; } BLL.Order bll = new BLL.Order(); Model.manager manager = new ManagePage().GetAdminInfo(); string result = string.Empty; if (tag == 1) { result = bll.updateDstatus(oID, (byte)status, manager); } else if (tag == 2) { result = bll.updateFlag(oID, (byte)flag, manager); } else if (tag == 3) { result = bll.updateLockStatus(oID, lockstatus, manager); } else if (tag == 4) { result = bll.updateCost(oID, cost, manager); } else { result = bll.updateFinRemark(oID, finRemark, manager); } if (string.IsNullOrEmpty(result)) { context.Response.Write("{ \"msg\":\"" + oID + "\", \"status\":\"0\" }"); return; } context.Response.Write("{ \"msg\":\"" + result + "\", \"status\":\"1\" }"); return; }
private void UpLoadOrderFile(HttpContext context) { Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig(); //检查是否允许匿名上传 if (!new ManagePage().IsAdminLogin()) { context.Response.Write("{\"status\": 0, \"msg\": \"禁止匿名非法上传!\"}"); return; } string fileName = DTRequest.GetString("name"); //文件名 string oID = DTRequest.GetQueryString("oID");; //订单号 string ftype = DTRequest.GetQueryString("ftype");; //文件类别 byte[] byteData = FileHelper.ConvertStreamToByteBuffer(context.Request.InputStream); //获取文件流 if (byteData.Length == 0) { context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}"); return; } UpLoad upLoad = new UpLoad(); fileName = fileName.Replace(" ", "");//去掉空格 string msg = upLoad.OrderFileSaveAs(byteData, fileName, oID, ftype); msg = Regex.Replace(msg, @"(\\[^bfrnt\\/'\""])", "\\$1");//利用正则表达式先把待解析的字符串中的带“\”特殊字符处理,再进行解析操作 JObject jo = JObject.Parse(msg); if (jo["status"].ToString() == "1") { Model.manager manager = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 Model.Files file = new Model.Files(); file.f_oid = oID; file.f_type = Utils.ObjToByte(ftype); file.f_fileName = fileName; file.f_filePath = jo["path"].ToString(); file.f_size = Utils.ObjToDecimal(jo["size"].ToString(), 0); file.f_addDate = DateTime.Now; file.f_addName = manager.real_name; file.f_addPerson = manager.user_name; new BLL.Order().insertOrderFile(file, manager); } //返回成功信息 context.Response.Write(msg); context.Response.End(); }
public void SetUp() { driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); driver.Manage().Window.Maximize(); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); basePage = new BasePage(driver); driver.Navigate().GoToUrl(basePage.BaseUrl); homePage = new HomePage(driver); loginPage = new LoginPage(driver); regPage = new RegistrationPage(driver); articleDetailsPage = new ArticleDetailsPage(driver); createArticlePage = new CreateArticlePage(driver); deleteArticlePage = new DeleteArticlePage(driver); editArticlePage = new EditArticlePage(driver); changePasswordPage = new ChangePasswordPage(driver); managePage = new ManagePage(driver); }
protected void Page_Load(object sender, EventArgs e) { //判断是否登录 ManagePage mym = new ManagePage(); if (!mym.IsAdminLogin()) { Response.Write("<script>parent.location.href='index.aspx'</script>"); Response.End(); } if (!IsPostBack) { noticeBind(); //通知公告 salesTopBind(); //销售周排行 } }
protected void Page_Load(object sender, EventArgs e) { //判断是否登录 ManagePage mym = new ManagePage(); if (!mym.IsAdminLogin()) { Response.Write("<script>parent.location.href='login.aspx'</script>"); Response.End(); } if (!IsPostBack) { Bind(); //待发货订单 noticeBind(); //售后服务 /* * //更新短信条数 * ax_syssetting mySysSetting = new ax_syssetting(); * mySysSetting.GetModel(1); * * string user = mySysSetting.MsgName; * string pass = FormsAuthentication.HashPasswordForStoringInConfigFile(FormsAuthentication.HashPasswordForStoringInConfigFile(mySysSetting.MsgPwd, "MD5").ToLower(), "MD5").ToLower(); * string sms_url = "http://210.5.152.50:7100/balance?userName="******"&body= {'passWord':'******'}&isEncrypt=0"; * * SMS mysms = new SMS(); * try * { * string[] ArrayVid = mysms.GetHtmlFromUrl(sms_url).Split(':'); * if (ArrayVid.Length == 2) * { * mySysSetting.MsgNum = Convert.ToInt64(ArrayVid[1].Substring(0, ArrayVid[1].Length - 2)); * mySysSetting.UpdateMsgNum(); * } * } * catch (Exception ex) * { * * } */ } }
private int get_builder_status() { //取得管理员登录信息 LingLong.Admin.Model.manager adminInfo = new ManagePage().GetAdminInfo(); if (adminInfo == null) { return(-1); } else if (!new LingLong.Admin.BLL.manager_role().Exists(adminInfo.role_id, "sys_builder_html", DTEnums.ActionEnum.Build.ToString())) { return(-2); } else if (siteConfig.staticstatus != 2) { return(-3); } else { return(1); } }
private void deletePayFile(HttpContext context) { //检查是否允许匿名上传 if (!new ManagePage().IsAdminLogin()) { context.Response.Write("{\"status\": 0, \"msg\": \"禁止匿名非法删除!\"}"); return; } BLL.payPic bll = new BLL.payPic(); Model.manager manager = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 int id = DTRequest.GetQueryInt("id"); Model.payPic file = bll.GetModel(id); if (bll.deletePayFile(file, manager)) { context.Response.Write("{\"status\": 1, \"msg\": \"删除成功!\"}"); context.Response.End(); } context.Response.Write("{\"status\": 0, \"msg\": \"删除失败!\"}"); context.Response.End(); }
private void delete_Unbusiness(HttpContext context) { Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息 int id = DTRequest.GetFormInt("id"); BLL.unBusinessApply bll = new BLL.unBusinessApply(); string result = bll.Delete(id, adminModel); if (!string.IsNullOrEmpty(result)) { context.Response.Write("{ \"msg\":\"" + result + "\", \"status\":1 }"); context.Response.End(); } //删除文件 if (Directory.Exists(context.Server.MapPath("~/uploadPay/2/" + id + "/"))) { Directory.Delete(context.Server.MapPath("~/uploadPay/2/" + id + "/"), true); } context.Response.Write("{ \"msg\":\"操作成功\", \"status\":0 }"); context.Response.End(); }