//通过名称分页得到客户页面 public List<Customer> GetCustomerByNameByPage(MyPage page,string CustomerName) { CustomerName="%"+CustomerName+"%"; page.CountPerPage = 10; page.WholePage = (int)data.getCustomerByNamePageCount(page.CountPerPage,CustomerName); var table = data.getCustomerByNameByPage(page.CurrentPage, page.CountPerPage,CustomerName); List<Customer> customers = new List<Customer>(); foreach (var col in table) { Customer customer = new Customer(); customer.CustomerId = col.customer_id; customer.Email=col.email; customer.NickName = col.nick_name; if (col.credit == null) { customer.Credit = 0; } else{ customer.Credit = (int)col.credit; } customers.Add(customer); } return customers; }
//通过描述分页得到客户页面 public List<Backup> GetBackupByDescriptionByPage(MyPage page, string BackupDescription) { BackupDescription = "%" + BackupDescription + "%"; page.CountPerPage = 10; page.WholePage = (int)data.getBackupByDescriptionPageCount(page.CountPerPage, BackupDescription); var table = data.getBackupByDescriptionByPage(page.CurrentPage, page.CountPerPage, BackupDescription); List<Backup> backups = new List<Backup>(); foreach (var col in table) { Backup backup = new Backup(); backup.BackupId = col.backup_set_id; backup.BackupSize = (decimal)col.backup_size; backup.BackupTime = (DateTime)col.backup_finish_date; backup.Description = col.description; backup.Name = col.name; backup.Version = (int)col.database_version; backup.CreationTime = (DateTime)col.database_creation_date; backups.Add(backup); } return backups; }
//分页得到经理页面 public List<Firm> GetFirmViewByPage(MyPage page) { page.CountPerPage = 10; page.WholePage = (int)data.getFirmViewPageCount(page.CountPerPage); var table = data.getFirmViewByPage(page.CurrentPage, page.CountPerPage); List<Firm> firms = new List<Firm>(); foreach (var col in table) { Firm firm = new Firm(); firm.FirmAddress = col.firm_address; firm.FirmID = col.firm_id; firm.FirmName = col.firm_name; firm.HostCount = (int)col.host_count; firm.TaxiCount = (int)col.taxi_count; firm.PhoneNumber = col.phone_number; firm.DriverCount = (int)col.driver_count; firms.Add(firm); } return firms; }
//跟据客户id得到发票的分页页面 public List<Invoice> GetCustomerInvoiceByPage(int CustomerId,MyPage page) { List<Invoice> invoices = new List<Invoice>(); try { page.CountPerPage = 10; page.WholePage = (int)data.getCustomerInvoicePageCount(page.CountPerPage, CustomerId); var table = data.getCustomerInvoiceByPage(page.CurrentPage, page.CountPerPage, CustomerId); foreach (var col in table) { Invoice invoice = new Invoice(); invoice.Amount = (int)col.amount; invoice.CustomerId = col.customer_id; invoice.RegisterTime = (DateTime)col.regist_time; invoice.InvoiceId = col.invoice_id; invoices.Add(invoice); } return invoices; } catch { return invoices; } }
//分页得到经理页面 public List<News> GetNewsByPage(MyPage page) { page.CountPerPage = 4; page.WholePage = (int)db.getNewsPageCount(page.CountPerPage); var table = db.getNewsByPage(page.CurrentPage, page.CountPerPage); List<News> newses = new List<News>(); foreach (var col in table) { News news = new News(); news.Title = col.title; news.publish_time = col.publish_time; news.employee_id = col.empolyee_id; news.NewsId = col.news_id; news.content = col.news_content; news.picture_path = col.picture_path; news.author = col.name; newses.Add(news); } return newses; }
//分页得到搜索的工号页面 public List<Employee> GetEmployeeByNameByPage(MyPage page, string name) { name = "%" + name + "%"; page.CountPerPage = 10; page.WholePage = (int)data.getEmployeeByNamePageCount(page.CountPerPage, name); var table = data.getEmployeeByNameByPage(page.CurrentPage, page.CountPerPage, name); List<Employee> employees = new List<Employee>(); foreach (var col in table) { Employee employee = new Employee(); employee.EmployId = col.empolyee_id; employee.Address = col.empolyee_address; employee.Birthday = (DateTime)col.birthday; employee.FirmID = (int)col.firm_id; employee.IdCard = col.id_card; employee.Name = col.name; employee.Telephone = col.telephone; employee.firm = new TaxiFirm.Models.Firm.Firm(employee.FirmID); ; employee.EmployId = col.empolyee_id; if (col.gender == null) { employee.Gender = "未知"; } else if ((bool)col.gender) { employee.Gender = "男"; } else { employee.Gender = "女"; } employees.Add(employee); } return employees; }
protected override void Init() { services = new ServiceCollection() .AddSingleton <IMyService, MyService>() .BuildServiceProvider(); using (var api = new Api(GetDb(), new ContentServiceFactory(services), storage, cache)) { Piranha.App.Init(); Piranha.App.Fields.Register <MyFourthField>(); var builder = new PageTypeBuilder(api) .AddType(typeof(MissingPage)) .AddType(typeof(MyBlogPage)) .AddType(typeof(MyPage)) .AddType(typeof(MyCollectionPage)) .AddType(typeof(MyDIPage)); builder.Build(); var site = new Data.Site { Id = SITE_ID, Title = "Default Site", InternalId = "DefaultSite", IsDefault = true }; var emptysite = new Data.Site { Id = SITE_ID, Title = "Empty Site", InternalId = "EmptySite", IsDefault = false }; api.Sites.Save(site); api.Sites.Save(emptysite); var page1 = MyPage.Create(api); page1.Id = PAGE_1_ID; page1.SiteId = SITE_ID; page1.Title = "My first page"; page1.Ingress = "My first ingress"; page1.Body = "My first body"; page1.Blocks.Add(new Extend.Blocks.TextBlock { Body = "Sollicitudin Aenean" }); page1.Blocks.Add(new Extend.Blocks.TextBlock { Body = "Ipsum Elit" }); api.Pages.Save(page1); var page2 = MyPage.Create(api); page2.Id = PAGE_2_ID; page2.SiteId = SITE_ID; page2.Title = "My second page"; page2.Ingress = "My second ingress"; page2.Body = "My second body"; api.Pages.Save(page2); var page3 = MyPage.Create(api); page3.Id = PAGE_3_ID; page3.SiteId = SITE_ID; page3.Title = "My third page"; page3.Ingress = "My third ingress"; page3.Body = "My third body"; api.Pages.Save(page3); var page4 = MyCollectionPage.Create(api); page4.SiteId = SITE_ID; page4.Title = "My collection page"; page4.SortOrder = 1; page4.Texts.Add(new TextField { Value = "First text" }); page4.Texts.Add(new TextField { Value = "Second text" }); page4.Texts.Add(new TextField { Value = "Third text" }); api.Pages.Save(page4); var page5 = MyBlogPage.Create(api); page5.SiteId = SITE_ID; page5.Title = "Blog Archive"; api.Pages.Save(page5); var page6 = MyDIPage.Create(api); page6.Id = PAGE_DI_ID; page6.SiteId = SITE_ID; page6.Title = "My Injection Page"; api.Pages.Save(page6); var page7 = MyPage.Create(api); page7.Id = PAGE_7_ID; page7.SiteId = SITE_ID; page7.Title = "My base page"; page7.Ingress = "My base ingress"; page7.Body = "My base body"; page7.ParentId = PAGE_1_ID; page7.SortOrder = 1; api.Pages.Save(page7); var page8 = MyPage.Create(api); page8.OriginalPageId = PAGE_7_ID; page8.Id = PAGE_8_ID; page8.SiteId = SITE_ID; page8.Title = "My copied page"; page8.ParentId = PAGE_1_ID; page8.SortOrder = 2; page8.IsHidden = true; page8.Route = "test-route"; api.Pages.Save(page8); } }
public ActionResult CustomerLoginHandle(string username, string psword) { try { if (Session["CurrentManager"] != null) { Session.Remove("CurrentManager"); Session.Remove("Identity"); } if (new DataClasses1DataContext().checkCustomerLoginPasswordByEmail(username, psword) != 0) { if (Session["CurrentCustomer"] != null) { Session.Remove("CurrentCustomer"); } Session["Identity"] = Identity.custemer; Customer customer = new CustomerHandle().GetCustomerByEmail(username); Session["CurrentCustomer"] = customer; //MyPage page2 = new MyPage(); //page2.CurrentPage = 1; // List<Invoice> invoices=new InvoiceHandle().GetCustomerInvoiceByPage(customer.CustomerId, page2); // if (invoices != null && invoices.Count > 0) // { // Session["invoices"] = new InvoiceHandle().GetCustomerInvoiceByPage(customer.CustomerId, page2); // } Session["CustomerLoginSuccess"] = "success"; } else { int userid = int.Parse(username); if (new DataClasses1DataContext().checkCustomerLoginPassword(userid, psword) != 0) { Session["Identity"] = Identity.custemer; Customer customer = new CustomerHandle().getCustomerById(userid); Session["CurrentCustomer"] = customer; MyPage page2 = new MyPage(); page2.CurrentPage = 1; //Session["invoices"] = new InvoiceHandle().GetCustomerInvoiceByPage(customer.CustomerId, page2); Session["CustomerLoginSuccess"] = "success"; } else { Session["CustomerLoginSuccess"] = "failed"; } } } catch { Session["CustomerLoginSuccess"] = "failed"; } // Response.Redirect("/FrontPage/Elements"); return RedirectToAction("Elements","FrontPage"); }
protected override void Init() { using (var api = new Api(GetDb(), storage, cache)) { Piranha.App.Init(api); var builder = new PageTypeBuilder(api) .AddType(typeof(MyPage)) .AddType(typeof(MyCollectionPage)); builder.Build(); var site = new Data.Site() { Id = SITE_ID, Title = "Default Site", InternalId = "DefaultSite", IsDefault = true }; api.Sites.Save(site); var page1 = MyPage.Create(api); page1.Id = PAGE_1_ID; page1.SiteId = SITE_ID; page1.Title = "My first page"; page1.Ingress = "My first ingress"; page1.Body = "My first body"; api.Pages.Save(page1); var page2 = MyPage.Create(api); page2.Id = PAGE_2_ID; page2.SiteId = SITE_ID; page2.Title = "My second page"; page2.Ingress = "My second ingress"; page2.Body = "My second body"; api.Pages.Save(page2); var page3 = MyPage.Create(api); page3.Id = PAGE_3_ID; page3.SiteId = SITE_ID; page3.Title = "My third page"; page3.Ingress = "My third ingress"; page3.Body = "My third body"; api.Pages.Save(page3); var page4 = MyCollectionPage.Create(api); page4.SiteId = SITE_ID; page4.Title = "My collection page"; page4.SortOrder = 1; page4.Texts.Add(new TextField() { Value = "First text" }); page4.Texts.Add(new TextField() { Value = "Second text" }); page4.Texts.Add(new TextField() { Value = "Third text" }); api.Pages.Save(page4); } }
private void ViewData(string key) { string src = ""; try { DataTable dt = conn.GetDataTable("select * from slik_resultmatch where appid = @1", new object[] { key }, dbtimeout); listvaluestring.Value = ""; for (i = 0; i <= dt.Rows.Count - 1; i++) { string nik = dt.Rows[i]["nik"].ToString(); string detailid = dt.Rows[i]["trn_ideb_detail_id"].ToString(); string idebid = dt.Rows[i]["trn_ideb_id"].ToString(); //string pdfviewsite = ConfigurationSettings.AppSettings["pdfviewsite"]; string pdfviewsite = "ViewPDF.aspx?"; TB_SIDLIST.Rows.Add(new TableRow()); TB_SIDLIST.Rows[i].Cells.Add(new TableCell()); //checkbox System.Web.UI.WebControls.CheckBox ck = new CheckBox(); ck.ID = "CK_" + i.ToString(); ck.Attributes.Add("onclick", "ceknik('" + dt.Rows[i]["nik"].ToString() + "',this);"); if ((bool)dt.Rows[i]["selected"]) { ck.Checked = true; listvaluestring.Value += dt.Rows[i]["nik"].ToString() + ":1,"; } else { ck.Checked = false; listvaluestring.Value += dt.Rows[i]["nik"].ToString() + ":0,"; } TB_SIDLIST.Rows[i].Cells[0].Controls.Add(ck); System.Web.UI.WebControls.HyperLink h = new HyperLink(); h.ID = "HL_" + i.ToString(); h.Target = "IFR_TEXT"; h.Text = dt.Rows[i]["linkname"].ToString(); h.Attributes.Add("style", "cursor:hand"); string urlnavigate = "notyetuploaded.html"; if (!String.IsNullOrEmpty(idebid) && !String.IsNullOrEmpty(detailid)) { urlnavigate = pdfviewsite + "idebid=" + idebid + "&detailid=" + detailid; } h.Attributes.Add("onclick", "javascript:kliklink('HL_" + i.ToString() + "','" + urlnavigate + "')"); if (dt.Rows[i]["POLRES"].ToString() != "1") { h.ForeColor = System.Drawing.Color.Red; } h.ToolTip = dt.Rows[i]["result_name"].ToString(); TB_SIDLIST.Rows[i].Cells[0].Controls.Add(h); if (i == 0) { src = urlnavigate; urlframe.Value = urlnavigate; } //hyperlink matching score System.Web.UI.WebControls.HyperLink h2 = new HyperLink(); h2.ID = "HLmatch_" + i.ToString(); h2.Text = " (" + dt.Rows[i]["match_level"].ToString() + ")"; //h2.Font.Underline = true; h2.Attributes.Add("style", "cursor:hand"); h2.Attributes.Add("onclick", "javascript:PopupPage('DetailValidation.aspx?id=" + dt.Rows[i]["resultid"].ToString() + "',800,600)"); TB_SIDLIST.Rows[i].Cells[0].Controls.Add(h2); } } catch (Exception ex) { MyPage.popMessage(this, ex.Message); } nikcount.Value = i.ToString(); if (i == 0) { dv_found.Attributes.Add("style", "display:none"); } else { TR_MSG.Visible = false; TR_FRAME.Visible = true; IFR_TEXT.Attributes.Add("src", src); btnpdf.Style.Add("display", "none"); dv_found.Attributes.Remove("style"); } }
public ActionResult DriverList() { if (Session["Identity"] == null) { return RedirectToAction("login"); } int page1 = int.Parse(Request.QueryString.Get("page")); string type = Request.QueryString.Get("type"); MyPage page = new MyPage(); if (type.Equals("search")) //搜索类型 { string NameID = Request.QueryString.Get("NameID"); try { int id = int.Parse(NameID); Driver driver = new DriverHandle().GetDriverByEmployeeID(id); List<Driver> drivers = new List<Driver>(); if (driver.name != null && !driver.Equals("")) { drivers.Add(driver); } ViewData["type"] = "search"; ViewData["drivers"] = drivers; page.CurrentPage = page1; page.CountPerPage = 10; page.WholePage = 1; ViewData["page"] = page; ViewData["NameID"] = NameID; } catch { page.CurrentPage = page1; List<Employee> employees = new EmployeeHandle().GetEmployeeByNameByPage(page, NameID); List<Driver> drivers = new List<Driver>(); ViewData["type"] = "search"; drivers = new DriverHandle().EmployeesToDrivers(employees); ViewData["drivers"] = drivers; ViewData["page"] = page; ViewData["NameID"] = NameID; } } else { page.CurrentPage = page1; page.PageWidth = 10; page.WholePage = (int)context.getDriverPageCount(10); List<Driver> drivers = new DriverHandle().getDriverByPage(page); ViewData["type"] = "common"; ViewData["drivers"] = drivers; ViewData["page"] = page; } return View(); }
protected override void Init() { using (var api = new Api(GetDb(), storage)) { Piranha.App.Init(api); var pageBuilder = new PageTypeBuilder(api) .AddType(typeof(MyPage)); pageBuilder.Build(); var postBuilder = new PostTypeBuilder(api) .AddType(typeof(MyPost)); postBuilder.Build(); // Add site var site1 = new Data.Site() { Id = SITE1_ID, Title = "Page Site", InternalId = "PostSite", IsDefault = true }; api.Sites.Save(site1); var site2 = new Data.Site() { Id = SITE2_ID, Title = "Page Site 2", InternalId = "PostSite2", Hostnames = "www.myothersite.com", IsDefault = false }; api.Sites.Save(site2); // Add pages var page1 = MyPage.Create(api); page1.Id = PAGE1_ID; page1.SiteId = SITE1_ID; page1.Title = "Blog"; page1.Published = DateTime.Now; api.Pages.Save(page1); var page2 = MyPage.Create(api); page2.Id = PAGE2_ID; page2.SiteId = SITE2_ID; page2.Title = "News"; page2.Published = DateTime.Now; api.Pages.Save(page2); // Add categories var category1 = new Data.Category() { Id = CATEGORY1_ID, BlogId = PAGE1_ID, Title = "Default category" }; api.Categories.Save(category1); var category2 = new Data.Category() { Id = CATEGORY2_ID, BlogId = PAGE2_ID, Title = "Default category" }; api.Categories.Save(category2); // Add tags var tag = new Data.Tag() { Id = TAG1_ID, BlogId = PAGE1_ID, Title = "My tag" }; api.Tags.Save(tag); tag = new Data.Tag() { Id = TAG2_ID, BlogId = PAGE2_ID, Title = "My other tag" }; api.Tags.Save(tag); // Add posts var post1 = MyPost.Create(api); post1.Id = POST1_ID; post1.BlogId = page1.Id; post1.Category = category1; post1.Title = "My first post"; post1.Body = "My first body"; post1.Tags.Add("My tag"); post1.Published = DateTime.Now; api.Posts.Save(post1); var post2 = MyPost.Create(api); post2.Id = POST2_ID; post2.BlogId = page2.Id; post2.Category = category2; post2.Title = "My second post"; post2.Body = "My second body"; post2.Tags.Add("My other tag"); post2.Published = DateTime.Now; api.Posts.Save(post2); } }
protected void DatGrd_ItemCommand(object source, DataGridCommandEventArgs e) { conn = new DbConnection(Session["ConnStringLogin"].ToString()); ClearEntries(); switch (e.CommandName) { case "menuAccess": Response.Write("<script language='javascript'>window.open('GroupMenuAccess.aspx?GroupID=" + e.Item.Cells[0].Text + "&ModuleID=61','MenuAccess','status=no,scrollbars=yes,width=500,height=400');</script>"); break; case "edit": EnableFields(true); BTN_NEW.Visible = false; BTN_CANCEL.Visible = true; BTN_SAVE.Visible = true; LBL_SAVEMODE.Text = "0"; TXT_GROUPID.ReadOnly = true; TXT_GROUPID.Text = e.Item.Cells[0].Text; TXT_SG_GRPNAME.Text = e.Item.Cells[1].Text; CHK_SG_APPRSTA.Checked = false; CHK_SG_CALCULATOR.Checked = false; FLAG_SUPERVISOR.Checked = false; if (e.Item.Cells[3].Text == "True") { CHK_SG_APPRSTA.Checked = true; } if (e.Item.Cells[4].Text == "True") { CHK_SG_CALCULATOR.Checked = true; } if (e.Item.Cells[5].Text == "True") { FLAG_SUPERVISOR.Checked = true; } conn.ExecReader("select moduleid from VW_GRPACCESSMODULE where groupid = '" + TXT_GROUPID.Text + "'", null, dbtimeout); while (conn.hasRow()) { try { CHK_MODULEID.Items.FindByValue(conn.GetFieldValue("moduleid")).Selected = true; } catch { } } //MEMBEROF_AD.Text = conn.GetFieldValue("memberof_ad").ToString(); SG_ROLEDESC.Text = e.Item.Cells[2].Text; try { DDL_SG_GRPUPLINER.SelectedValue = e.Item.Cells[8].Text; } catch { } try { CHK_MODULEID_SelectedIndexChanged(null, null); } catch { } MyPage.SetFocus(this, BTN_CANCEL); break; case "delete": object[] pardel = new object[5] { e.Item.Cells[0].Text, e.Item.Cells[1].Text, "2", "1", Session["UserID"] }; try { conn.ExecuteNonQuery(SP_DELETE, pardel, dbtimeout); LBL_RESULT.Text = "Request Submitted! Awaiting Approval ... "; LBL_RESULT.ForeColor = System.Drawing.Color.Green; } catch (Exception ex) { ClearEntries(); if (ex.Message.IndexOf("Last Query:") > 0) { LBL_RESULT.Text = ex.Message.Substring(0, ex.Message.IndexOf("Last Query:")); } else { LBL_RESULT.Text = ex.Message; } LBL_RESULT.ForeColor = System.Drawing.Color.Red; } break; } conn.Dispose(); }
public void fillRefList(string schtitle, string schfldidtext, string schflddesctext, string tblname, string fldid, string flddesc, string cond, string orderby, bool withRefCode, bool FrameMode) { _frmmode = FrameMode; dbtimeout = (int)Session["dbTimeOut"]; ConnString = (string)ConfigurationSettings.AppSettings["connString"].ToString(); string query = "select " + fldid + ", " + flddesc + " from " + tblname; if (cond != null && cond.Trim() != "") { query += " where " + cond; } if (orderby != null && orderby.Trim() != "") { query += " order by " + orderby; } using (conn = new DbConnection(ConnString)) { MyPage.fillRefListINA(DDL.Items, query, null, dbtimeout, withRefCode, conn); } if (DDL.Items.Count <= _maxItems) { _ddlmode = true; d1.Visible = false; d2.Visible = false; CODE.EnableViewState = false; DESC.EnableViewState = false; } else { _ddlmode = false; DDL.Items.Clear(); DDL.EnableViewState = false; DDL.Visible = false; if (_frmmode) { d1.Visible = true; d2.Visible = false; CODE.EnableViewState = false; DESC.EnableViewState = false; if (schtitle != null && schtitle.Trim() != "") { _frsrc += "&fT=" + schtitle.Replace(" ", "_"); } if (schfldidtext != null && schfldidtext.Trim() != "") { _frsrc += "&idTx=" + schfldidtext; } if (schflddesctext != null && schflddesctext.Trim() != "") { _frsrc += "&deTx=" + schflddesctext; } _frsrc += "&tbl=" + tblname; _frsrc += "&fid=" + fldid; _frsrc += "&fdesc=" + flddesc; if (cond != null && cond.Trim() != "") { _frsrc += "&cond=" + HttpUtility.UrlEncode(cond.Replace("'", "|:|")); } if (orderby != null && orderby.Trim() != "") { _frsrc += "&sort=" + HttpUtility.UrlEncode(orderby); } } else { d1.Visible = false; d2.Visible = true; CODE.EnableViewState = true; DESC.EnableViewState = true; _tblname = tblname; _fldid = fldid; _flddesc = flddesc; _cond = cond; _orderby = orderby; string qrystr = "CtrlID=" + CODE.ClientID + "&CtrlDesc=" + DESC.ClientID; if (schfldidtext != null && schfldidtext.Trim() != "") { qrystr += "&idTx=" + schfldidtext; } if (schflddesctext != null && schflddesctext.Trim() != "") { qrystr += "&deTx=" + schflddesctext; } if (schtitle == null) { schtitle = ""; } qrystr += "&tbl=" + tblname; qrystr += "&fid=" + fldid; qrystr += "&fdesc=" + flddesc; if (cond != null && cond.Trim() != "") { qrystr += "&cond=" + HttpUtility.UrlEncode(cond.Replace("'", "|:|")); } if (orderby != null && orderby.Trim() != "") { qrystr += "&sort=" + HttpUtility.UrlEncode(orderby); } SearchBtnAttribute(qrystr, schtitle.Replace(" ", "_")); } } Enabled = _Enabled; if (_Width != 0) { Width = _Width; } if (_TabIndex != 0) { TabIndex = _TabIndex; } if (_CssClass != null) { CssClass = _CssClass; } }
protected void CODE_TextChanged(object sender, System.EventArgs e) { if (CODE.Text.Trim() == "") { CODE.Text = ""; DESC.Text = ""; if (AutoPostBack && _oldvalue != CODE.Text) { _oldvalue = CODE.Text; OnSelectedIndexChanged(e); } return; } dbtimeout = (int)Session["dbTimeOut"]; ConnString = (string)ConfigurationSettings.AppSettings["connString"].ToString(); //WebControl ctrl; using (conn = new DbConnection(ConnString)) { if (_query == null || _query.Trim() == "") { string qry = "select " + _fldid + ", " + _flddesc + " from " + _tblname; if (_cond != null && _cond.Trim() != "") { qry += " where (" + _cond + ") and " + _fldid + " = '" + CODE.Text + "'"; } else { qry += " where " + _fldid + " = '" + CODE.Text + "'"; } conn.ExecReader(qry, null, dbtimeout); if (conn.hasRow()) { DESC.Text = conn.GetFieldValue(1); //ctrl = CommonForm.ModuleSupport.NextCtrl(this.Parent.Page, CODE); //if (ctrl != null) // MyPage.SetFocus(this.Parent.Page, ctrl); } else { CODE.Text = ""; DESC.Text = ""; MyPage.popMessage(this.Parent.Page, "Kode tidak ditemukan"); MyPage.SetFocus(this.Parent.Page, CODE); } } else { ListItemCollection items = new ListItemCollection(); MyPage.fillRefListINA(items, _query, null, dbtimeout, false, conn); try { int i = 0; for (i = 0; i < items.Count; i++) { if (items[i].Value.ToLower() == CODE.Text.ToLower()) //found { CODE.Text = items[i].Value; DESC.Text = items[i].Text; break; } } //ctrl = CommonForm.ModuleSupport.NextCtrl(this.Parent.Page, CODE); //if (ctrl != null) // MyPage.SetFocus(this.Parent.Page, ctrl); if (i == items.Count) // not found { CODE.Text = ""; DESC.Text = ""; MyPage.popMessage(this.Parent.Page, "Kode tidak ditemukan"); MyPage.SetFocus(this.Parent.Page, CODE); } } catch { CODE.Text = ""; DESC.Text = ""; MyPage.popMessage(this.Parent.Page, "Kode tidak ditemukan"); MyPage.SetFocus(this.Parent.Page, CODE); } } } if (AutoPostBack && _oldvalue != CODE.Text) { _oldvalue = CODE.Text; OnSelectedIndexChanged(e); } }
protected override void Init() { services = new ServiceCollection() .AddSingleton <IMyService, MyService>() .BuildServiceProvider(); using (var api = new Api(services, GetDb(), storage, cache)) { Piranha.App.Init(api); Piranha.App.Fields.Register <MyFourthField>(); var builder = new PageTypeBuilder(api) .AddType(typeof(MissingPage)) .AddType(typeof(MyBlogPage)) .AddType(typeof(MyPage)) .AddType(typeof(MyCollectionPage)) .AddType(typeof(MyDIPage)); builder.Build(); var site = new Data.Site() { Id = SITE_ID, Title = "Default Site", InternalId = "DefaultSite", IsDefault = true }; var emptysite = new Data.Site() { Id = SITE_ID, Title = "Empty Site", InternalId = "EmptySite", IsDefault = false }; api.Sites.Save(site); api.Sites.Save(emptysite); var page1 = MyPage.Create(api); page1.Id = PAGE_1_ID; page1.SiteId = SITE_ID; page1.Title = "My first page"; page1.Ingress = "My first ingress"; page1.Body = "My first body"; api.Pages.Save(page1); var page2 = MyPage.Create(api); page2.Id = PAGE_2_ID; page2.SiteId = SITE_ID; page2.Title = "My second page"; page2.Ingress = "My second ingress"; page2.Body = "My second body"; api.Pages.Save(page2); var page3 = MyPage.Create(api); page3.Id = PAGE_3_ID; page3.SiteId = SITE_ID; page3.Title = "My third page"; page3.Ingress = "My third ingress"; page3.Body = "My third body"; api.Pages.Save(page3); var page4 = MyCollectionPage.Create(api); page4.SiteId = SITE_ID; page4.Title = "My collection page"; page4.SortOrder = 1; page4.Texts.Add(new TextField() { Value = "First text" }); page4.Texts.Add(new TextField() { Value = "Second text" }); page4.Texts.Add(new TextField() { Value = "Third text" }); api.Pages.Save(page4); var page5 = MyBlogPage.Create(api); page5.SiteId = SITE_ID; page5.Title = "Blog Archive"; api.Pages.Save(page5); var page6 = MyDIPage.Create(api); page6.Id = PAGE_DI_ID; page6.SiteId = SITE_ID; page6.Title = "My Injection Page"; api.Pages.Save(page6); } }
protected void btnSubmit_Click(object sender, EventArgs e) { bool flag_sameuser = false; string[] keyREJCT = hREJCT.Value.Split(','); string[] keyAPPRV = hAPPRV.Value.Split(','); for (int i = 0; i < keyREJCT.Length; i++) { if (keyREJCT[i] != "") { conn.ExecNonQuery(U_DELPARAMTMP, new object[] { keyREJCT[i] }, dbtimeout); } } for (int i = 0; i < keyAPPRV.Length; i++) { if (keyAPPRV[i] != "") { conn.ExecReader(Q_PARAMTMP, new object[] { keyAPPRV[i] }, dbtimeout); if (conn.hasRow()) { switch (conn.GetFieldValue("Status")) { case "Insert": case "Update": if (conn.GetFieldValue("CreatedBy") == Session["USERID"].ToString()) { flag_sameuser = true; } else { save(keyAPPRV[i]); } break; case "Delete": if (conn.GetFieldValue("CreatedBy") == Session["USERID"].ToString()) { flag_sameuser = true; } else { delete(keyAPPRV[i]); } break; } } } } dtbindpending(gridpending); if (gridpending.GroupCount > 0) { funcpendCss = ""; } hAPPRV.Value = ""; hREJCT.Value = ""; hCANCL.Value = ""; if (flag_sameuser) { MyPage.popMessage(this, "Update failed, Checker maker must be done by different ID ..."); } }
public async Task Page() { var page = new MyPage(); await Verify(page); }
public MyChaseLightController( IMyGridTerminalSystem GridTerminalSystem, string textPanelName, bool mirrored, int operatingMode, int movementSpeed, MySprite[] ChaseLightShapeFrames ) { // Sanity check if (textPanelName == null || textPanelName.Length == 0) { throw new ArgumentException("The name of the text panel must not be at least one character long"); } if (ChaseLightShapeFrames == null || ChaseLightShapeFrames.Length == 0) { throw new ArgumentException("The ChaseLightShapeFrames array must have at least one element"); } if (operatingMode < OP_MODE_LEFT_TO_RIGHT || operatingMode > OP_MODE_BOUNCE_START_FROM_RIGHT) { throw new ArgumentException("The operating mode must have one of the following values: OP_MODE_LEFT_TO_RIGHT, OP_MODE_RIGHT_TO_LEFT, OP_MODE_BOUNCE_START_FROM_LEFT, OP_MODE_BOUNCE_START_FROM_RIGHT"); } if (movementSpeed < 1 || movementSpeed > 10) { throw new ArgumentException("The movement speed must be between 1 and 10"); } // Set up the text panel TerminalUtils.SetupTextSurfaceForMatrixDisplay(GridTerminalSystem, textPanelName, 0, FONT_SIZE); // Initialize the application OnScreenApplication = UiFrameworkUtils.InitSingleScreenApplication( GridTerminalSystem, textPanelName, 0, // Reference to the target text panel RES_X, RES_Y, // The target display resolution mirrored // The screen image might have to be mirrored ); // Create the main page and add it to the application MyPage MainPage = new MyPage(); OnScreenApplication.AddPage(MainPage); // Create the ChaseLightShape with only one state, named "Default", // having the referenced frames array as its animation ChaseLightShape = new MyStatefulAnimatedSprite(0, 0) .WithState("Default", new MyStatefulAnimatedSpriteState(ChaseLightShapeFrames)); // Add the ChaseLightShape to the main page MainPage.AddChild(ChaseLightShape); // Set the movement vector if (operatingMode == OP_MODE_RIGHT_TO_LEFT || operatingMode == OP_MODE_BOUNCE_START_FROM_RIGHT) { movementVector = -movementSpeed; } else { movementVector = movementSpeed; } // Set the client cycle method to the chase light shape according to the referenced operating mode ChaseLightShape.WithClientCycleMethod((MyOnScreenObject Obj, int currFrameIndex) => { // Center vertically (each frame might have a different height, // so this is required to run on every frame) Obj.y = (RES_Y - Obj.GetHeight()) / 2; // Move Obj.x += movementVector; // Apply the proper action for when the object goes off-screen, // according to the set operating mode if (operatingMode == OP_MODE_RIGHT_TO_LEFT) { // If it's right to left, then the objects exits through the // left side and enters through the right side of the screen. if (Obj.x < 0) { Obj.x = RES_X - 1 - Obj.GetWidth(); } } else if ( operatingMode == OP_MODE_BOUNCE_START_FROM_LEFT || operatingMode == OP_MODE_BOUNCE_START_FROM_RIGHT ) { // If it's bouncing, then the object's vector has to be switched // whenever it reches one side or the other. if (Obj.x < 0 || Obj.x + Obj.GetWidth() > RES_X - 1) { movementVector = -movementVector; } } else { // The default is OP_MODE_LEFT_TO_RIGHT. // In this case, the objects exits the screen through the right side // and enters through the left side. if (Obj.x + Obj.GetWidth() > RES_X - 1) { Obj.x = 0; } } }); }
protected void Page_Load(object sender, EventArgs e) { MyPage.SetFocus(this, this.TXT_USERNAME); }
private bool CreatePDF(string HTMLContent, string OutputFilePath, out string ErrorIfAny) { bool IsSuccess = false; ErrorIfAny = string.Empty; Document document = new Document(); try { StringWriter SW = new StringWriter(); SW.Write(HTMLContent); MyPage tmpPage = new MyPage(); HtmlForm form = new HtmlForm(); form.Controls.Add(new LiteralControl("")); tmpPage.Controls.Add(form); HtmlTextWriter htmlWriter = new HtmlTextWriter(SW); form.Controls[0].RenderControl(htmlWriter); string htmlContent = SW.ToString(); PdfWriter.GetInstance(document, new FileStream(OutputFilePath, FileMode.Create)); HTMLWorker worker = new HTMLWorker(document); document.Open(); using (TextReader sReader = new StringReader(htmlContent)) { FontFactory.Register(@"[Your font file location].ttf", "OpenSans-Regular"); string fontpath = @"[Your font file location].ttf"; //"simsun.ttf" file was downloaded from web and placed in the folder BaseFont bf = BaseFont.CreateFont(fontpath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); //create new font based on BaseFont Font fontContent = new Font(bf, 11); Font fontHeader = new Font(bf, 12); // step 4.2: create a style sheet and set the encoding to Identity-H iTextSharp.text.html.simpleparser.StyleSheet ST = new iTextSharp.text.html.simpleparser.StyleSheet(); ST.LoadTagStyle("body", "encoding", "Identity-H"); worker.SetStyleSheet(ST); worker.StartDocument(); worker.Parse(sReader); worker.EndDocument(); worker.Close(); document.Close(); } IsSuccess = true; } catch (Exception eX) { IsSuccess = false; ErrorIfAny = eX.Message; } finally { try { if (document != null && document.IsOpen()) { document.Close(); } } catch { } } return(IsSuccess); }
public void SetUp() { page = new MyPage(); mpa = new MyPageAdapter (page); }
public void GoToLoginPage() { loginPage = new LoginPage(); mainFrame.Navigate(loginPage); }
public ActionResult TaxiList() { if (Session["Identity"] == null) { return RedirectToAction("login"); } string type = Request.QueryString.Get("type"); if (type.Equals("search")) //搜索类型 { int page1 = int.Parse(Request.QueryString.Get("page")); string NameID = Request.QueryString.Get("NameID"); MyPage page = new MyPage(); page.CurrentPage = page1; List<Taxi> Taxis = new TaxiHandle().GetTaxiByPlateNumberByPage(page, NameID); ViewData["type"] = "search"; ViewData["Taxis"] = Taxis; ViewData["page"] = page; ViewData["NameID"] = NameID; } else { int page1 = int.Parse(Request.QueryString.Get("page")); MyPage page = new MyPage(); page.CurrentPage = page1; List<Taxi> taxis = new TaxiHandle().GetTaxiByPage(page); ViewData["type"] = "common"; ViewData["taxis"] = taxis; ViewData["page"] = page; } return View(); }
public App() { // The root page of your application MainPage = new MyPage(); }
protected void DatGrd_ItemCommand(object source, DataGridCommandEventArgs e) { ClearEntries(); conn = new DbConnection(ConnString); switch (e.CommandName) { case "edit": BTN_NEW.Visible = false; BTN_NEW_AD.Visible = false; BTN_SAVE.Visible = true; BTN_CANCEL.Visible = true; LBL_SAVEMODE.Text = "0"; SetEnable(true); TXT_USERID.ReadOnly = true; object[] paruser = new object[1] { e.Item.Cells[2].Text }; conn.ExecReader(Q_USERDATA, paruser, dbtimeout); if (conn.hasRow()) { if (conn.GetFieldValue("SU_REVOKE") == "1") { cb_revoke.Checked = true; cb_revoke.Text = "(clear to reset)"; } else { cb_revoke.Checked = false; } if (conn.GetFieldValue("SU_LOGON") == "1") { cb_logon.Checked = true; } else { cb_logon.Checked = false; } if (conn.GetFieldValue("SU_ACTIVE") == "1") { CHK_SU_ACTIVE.Checked = true; } else { CHK_SU_ACTIVE.Checked = false; } TXT_USERID.Text = conn.GetFieldValue("USERID"); TXT_SU_FULLNAME.Text = conn.GetFieldValue("SU_FULLNAME"); TXT_SU_HPNUM.Text = conn.GetFieldValue("SU_HPNUM"); TXT_SU_EMAIL.Text = conn.GetFieldValue("SU_EMAIL"); uREF_BRANCHID.SelectedValue = conn.GetFieldValue("BRANCHID"); uREF_AREAID.SelectedValue = conn.GetFieldValue("AREAID"); ddl_JenisUser.SelectedValue = conn.GetFieldValue("JenisUser"); if (conn.GetFieldValue("JenisUser") == "1") { //userAD tidak bisa reset password SetADMode(true); btn_cekAD.Visible = false; } else { SetADMode(false); } try { DDL_GROUPID.SelectedValue = conn.GetFieldValue("GROUPID"); string spv = conn.GetFieldValue("SU_UPLINER"); string spv2 = conn.GetFieldValue("SU_UPLINER2"); string spv3 = conn.GetFieldValue("SU_UPLINER3"); string spv4 = conn.GetFieldValue("SU_UPLINER4"); string spv5 = conn.GetFieldValue("SU_UPLINER5"); FillUpliner(DDL_GROUPID.SelectedValue, uREF_BRANCHID.SelectedValue); try { uREF_UPLINER.SelectedValue = spv; } catch { } try { uREF_UPLINER2.SelectedValue = spv2; } catch { } try { uREF_UPLINER3.SelectedValue = spv3; } catch { } try { uREF_UPLINER4.SelectedValue = spv4; } catch { } try { uREF_UPLINER5.SelectedValue = spv5; } catch { } InitializeModule(true); } catch (Exception ex) { MyPage.popMessage(this, "Error initializing group/module screen"); Response.Write("<!-- " + ex.Message.Replace("-->", "--)") + " -->\n"); MNTTools.LogError(this, (string)Session["UserID"], ex); } } pwdmsg.Value = "Leave password blank to use old password!"; MyPage.SetFocus(this, BTN_CANCEL); break; case "delete": object[] pardel = new object[5] { e.Item.Cells[2].Text, e.Item.Cells[4].Text, "1", e.Item.Cells[3].Text, Session["USerID"] }; try { conn.ExecuteNonQuery(SP_DELETE, pardel, dbtimeout); LBL_RESULT.Text = "Request Submitted! Awaiting Approval ... "; LBL_RESULT.ForeColor = System.Drawing.Color.Green; } catch (Exception ex) { if (ex.Message.IndexOf("Last Query:") > 0) { LBL_RESULT.Text = ex.Message.Substring(0, ex.Message.IndexOf("Last Query:")); } else { LBL_RESULT.Text = ex.Message; } LBL_RESULT.ForeColor = System.Drawing.Color.Red; } break; case "undelete": object[] parundel = new object[5] { e.Item.Cells[2].Text, e.Item.Cells[4].Text, "1", e.Item.Cells[3].Text, Session["UserID"] }; try { conn.ExecuteNonQuery(SP_UNDELETE, parundel, dbtimeout); LBL_RESULT.Text = "Request Submitted! Awaiting Approval ... "; LBL_RESULT.ForeColor = System.Drawing.Color.Green; } catch (Exception ex) { if (ex.Message.IndexOf("Last Query:") > 0) { LBL_RESULT.Text = ex.Message.Substring(0, ex.Message.IndexOf("Last Query:")); } else { LBL_RESULT.Text = ex.Message; } LBL_RESULT.ForeColor = System.Drawing.Color.Red; } break; } BindData(); conn.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { //dbtimeout = int.Parse(ConfigurationSettings.AppSettings["dbTimeOut"]);//1200;// if (!IsPostBack) { FormsAuthentication.SignOut(); TXT_USERNAME.Text = (string)Session["UserID"]; hash_password = (string)Session["sha1"]; RemoveSession(); if (Request.QueryString.Count != 0 && Request.QueryString[0] == "logon") { if (hash_password != null) { logon = true; BTN_SUBMIT_Click(null, null); return; } } if ((TXT_USERNAME.Text == null) || (TXT_USERNAME.Text == "")) { MyPage.SetFocus(this, TXT_USERNAME); } else { MyPage.SetFocus(this, TXT_PASSWORD); } } if (Request.QueryString.Count > 0) { if (!String.IsNullOrEmpty(Request.QueryString["callback"])) { callback.Value = Request.QueryString["callback"]; } if (Request.QueryString["msg"] != null && Request.QueryString["msg"] != "") { MyPage.popMessage(this, Request.QueryString["msg"]); } else if (Request.QueryString["menu"] == "0") { LogonMessage(loginResult.logNoMenuAccess); } else if (Request.QueryString[0] == "logon") { LogonMessage(loginResult.logReLogin); } else if (Request.QueryString[0] == "lost") { LogonMessage(loginResult.logSessionLost); } else if (Request.QueryString[0] == "new") { LogonMessage(loginResult.logNewLogin); } else if (Request.QueryString["tkn"] != null && Request.QueryString["tkn"] != "") { using (DbConnection conn = new DbConnection(getConnString())) { try { object[] token = new object[1] { new Guid(Request.QueryString["tkn"]) }; conn.ExecuteNonQuery(SP_TOKENDELETE, token, dbtimeout); LogonMessage(loginResult.logAuthFail); } catch (Exception ex) { Response.Write("<!-- ex msg: " + ex.Message.Replace("-->", "--)") + " -->\n"); LogonMessage(loginResult.logAuthFail); } } } else { LogonMessage(loginResult.logSessionLost); } } //BTN_SUBMIT.Attributes.Add("onclick","return proceeding();"); }
public override async Task InitializeAsync() { using (var api = CreateApi()) { Piranha.App.Init(api); new ContentTypeBuilder(api) .AddType(typeof(MyPage)) .AddType(typeof(MySiteContent)) .Build(); await api.Sites.SaveAsync(new Site { Id = SITE_1_ID, SiteTypeId = "MySiteContent", InternalId = SITE_1, Title = SITE_1, Hostnames = SITE_1_HOSTS, IsDefault = true }); await api.Sites.SaveAsync(new Site { InternalId = SITE_4, Title = SITE_4 }); await api.Sites.SaveAsync(new Site { InternalId = SITE_5, Title = SITE_5 }); await api.Sites.SaveAsync(new Site { InternalId = SITE_6, Title = SITE_6 }); // Sites for testing hostname routing await api.Sites.SaveAsync(new Site { InternalId = "RoutingTest1", Title = "RoutingTest1", Hostnames = "mydomain.com,localhost" }); await api.Sites.SaveAsync(new Site { InternalId = "RoutingTest2", Title = "RoutingTest2", Hostnames = " mydomain.com/en" }); await api.Sites.SaveAsync(new Site { InternalId = "RoutingTest3", Title = "RoutingTest3", Hostnames = "sub.mydomain.com , sub2.localhost" }); var content = await MySiteContent.CreateAsync(api); content.Header = "<p>Lorem ipsum</p>"; content.Footer = "<p>Tellus Ligula</p>"; await api.Sites.SaveContentAsync(SITE_1_ID, content); var page1 = await MyPage.CreateAsync(api); page1.SiteId = SITE_1_ID; page1.Title = "Startpage"; page1.Text = "Welcome"; page1.IsHidden = true; page1.Published = DateTime.Now; await api.Pages.SaveAsync(page1); var page2 = await MyPage.CreateAsync(api); page2.SiteId = SITE_1_ID; page2.SortOrder = 1; page2.Title = "Second page"; page2.Text = "The second page"; await api.Pages.SaveAsync(page2); var page3 = await MyPage.CreateAsync(api); page3.SiteId = SITE_1_ID; page3.ParentId = page2.Id; page3.Title = "Subpage"; page3.Text = "The subpage"; page3.Published = DateTime.Now; await api.Pages.SaveAsync(page3); } }
public override async Task InitializeAsync() { using (var api = CreateApi()) { Piranha.App.Init(api); var builder = new PageTypeBuilder(api) .AddType(typeof(MyPage)); builder.Build(); // Add site var site1 = new Site { Id = SITE1_ID, Title = "Page Site", InternalId = "PageSite", IsDefault = true }; await api.Sites.SaveAsync(site1); var site2 = new Site { Id = SITE2_ID, Title = "Page Site 2", InternalId = "PageSite2", Hostnames = "www.myothersite.com", IsDefault = false }; await api.Sites.SaveAsync(site2); // Add pages var page1 = await MyPage.CreateAsync(api); page1.Id = PAGE1_ID; page1.SiteId = SITE1_ID; page1.Title = "My first page"; page1.Body = "My first body"; page1.Published = DateTime.Now; await api.Pages.SaveAsync(page1); var page2 = await MyPage.CreateAsync(api); page2.Id = PAGE2_ID; page2.SiteId = SITE2_ID; page2.Title = "My second page"; page2.Body = "My second body"; page2.Published = DateTime.Now; await api.Pages.SaveAsync(page2); var page3 = await MyPage.CreateAsync(api); page3.Id = PAGE3_ID; page3.SiteId = SITE1_ID; page3.SortOrder = 1; page3.Title = "My third page"; page3.Published = DateTime.Now; page3.RedirectUrl = "http://www.redirect.com"; page3.RedirectType = Models.RedirectType.Temporary; await api.Pages.SaveAsync(page3); } }
protected override void Init() { using (var api = new Api(GetDb(), new ContentServiceFactory(services), storage, cache)) { Piranha.App.Init(); var builder = new PageTypeBuilder(api) .AddType(typeof(MyPage)); builder.Build(); var siteBuilder = new SiteTypeBuilder(api) .AddType(typeof(MySiteContent)); siteBuilder.Build(); api.Sites.Save(new Data.Site() { Id = SITE_1_ID, SiteTypeId = "MySiteContent", InternalId = SITE_1, Title = SITE_1, Hostnames = SITE_1_HOSTS, IsDefault = true }); api.Sites.Save(new Data.Site() { InternalId = SITE_4, Title = SITE_4 }); api.Sites.Save(new Data.Site() { InternalId = SITE_5, Title = SITE_5 }); api.Sites.Save(new Data.Site() { InternalId = SITE_6, Title = SITE_6 }); // Sites for testing hostname routing api.Sites.Save(new Data.Site { InternalId = "RoutingTest1", Title = "RoutingTest1", Hostnames = "mydomain.com,localhost" }); api.Sites.Save(new Data.Site { InternalId = "RoutingTest2", Title = "RoutingTest2", Hostnames = " mydomain.com/en" }); api.Sites.Save(new Data.Site { InternalId = "RoutingTest3", Title = "RoutingTest3", Hostnames = "sub.mydomain.com , sub2.localhost" }); var content = MySiteContent.Create(api); content.Header = "<p>Lorem ipsum</p>"; content.Footer = "<p>Tellus Ligula</p>"; api.Sites.SaveContent(SITE_1_ID, content); var page1 = MyPage.Create(api); page1.SiteId = SITE_1_ID; page1.Title = "Startpage"; page1.Text = "Welcome"; page1.IsHidden = true; page1.Published = DateTime.Now; api.Pages.Save(page1); var page2 = MyPage.Create(api); page2.SiteId = SITE_1_ID; page2.SortOrder = 1; page2.Title = "Second page"; page2.Text = "The second page"; api.Pages.Save(page2); var page3 = MyPage.Create(api); page3.SiteId = SITE_1_ID; page3.ParentId = page2.Id; page3.Title = "Subpage"; page3.Text = "The subpage"; page3.Published = DateTime.Now; api.Pages.Save(page3); } }
protected void CODE_TextChanged(object sender, System.EventArgs e) { if (CODE.Text.Trim() == "") { CODE.Text = ""; DESC.Text = ""; return; } dbtimeout = (int)Session["dbTimeOut"]; ConnString = (string)ConfigurationSettings.AppSettings["connString"].ToString(); //WebControl ctrl; using (conn = new DbConnection(ConnString)) { if (_query == null || _query.Trim() == "") { string qry = "select " + _fldid + ", " + _flddesc + " from " + _tblname; if (_cond != null && _cond.Trim() != "") { qry += " where (" + _cond + ") and " + _fldid + " = '" + CODE.Text + "'"; } else { qry += " where " + _fldid + " = '" + CODE.Text + "'"; } conn.ExecReader(qry, null, dbtimeout); if (conn.hasRow()) { DESC.Text = conn.GetFieldValue(1); //ctrl = CommonForm.ModuleSupport.NextCtrl(this.Parent.Page, CODE); //if (ctrl != null) // MyPage.SetFocus(this, ctrl); } else { CODE.Text = ""; DESC.Text = ""; clientmsg = "Kode tidak ditemukan"; MyPage.SetFocus(this, CODE); } } else { DropDownList DDL = new DropDownList(); MyPage.fillRefList(DDL.Items, _query, null, dbtimeout, false, conn); try { DDL.SelectedValue = CODE.Text; DESC.Text = DDL.SelectedItem.Text; //ctrl = CommonForm.ModuleSupport.NextCtrl(this.Parent.Page, CODE); //if (ctrl != null) // MyPage.SetFocus(this, ctrl); } catch { CODE.Text = ""; DESC.Text = ""; clientmsg = "Kode tidak ditemukan"; MyPage.SetFocus(this, CODE); } } } }
public override async Task InitializeAsync() { _services = CreateServiceCollection() .AddSingleton <IMyService, MyService>() .BuildServiceProvider(); using (var api = CreateApi()) { Piranha.App.Init(api); Piranha.App.Fields.Register <MyFourthField>(); new ContentTypeBuilder(api) .AddType(typeof(MissingPage)) .AddType(typeof(MyBlogPage)) .AddType(typeof(MyPage)) .AddType(typeof(MyCollectionPage)) .AddType(typeof(MyDIPage)) .Build(); var site = new Site { Id = SITE_ID, Title = "My Test Site", InternalId = "MyTestSite", IsDefault = true }; await api.Sites.SaveAsync(site); var page1 = await MyPage.CreateAsync(api); page1.Id = PAGE_1_ID; page1.SiteId = SITE_ID; page1.Title = "My first page"; page1.MetaKeywords = "Keywords"; page1.MetaDescription = "Description"; page1.OgTitle = "Og Title"; page1.OgDescription = "Og Description"; page1.Ingress = "My first ingress"; page1.Body = "My first body"; page1.Blocks.Add(new Extend.Blocks.TextBlock { Body = "Sollicitudin Aenean" }); page1.Blocks.Add(new Extend.Blocks.TextBlock { Body = "Ipsum Elit" }); page1.Published = DateTime.Now; await api.Pages.SaveAsync(page1); var page2 = await MyPage.CreateAsync(api); page2.Id = PAGE_2_ID; page2.SiteId = SITE_ID; page2.Title = "My second page"; page2.MetaFollow = false; page2.MetaIndex = false; page2.Ingress = "My second ingress"; page2.Body = "My second body"; await api.Pages.SaveAsync(page2); var page3 = await MyPage.CreateAsync(api); page3.Id = PAGE_3_ID; page3.SiteId = SITE_ID; page3.Title = "My third page"; page3.Ingress = "My third ingress"; page3.Body = "My third body"; await api.Pages.SaveAsync(page3); var page4 = await MyCollectionPage.CreateAsync(api); page4.SiteId = SITE_ID; page4.Title = "My collection page"; page4.SortOrder = 1; page4.Texts.Add(new TextField { Value = "First text" }); page4.Texts.Add(new TextField { Value = "Second text" }); page4.Texts.Add(new TextField { Value = "Third text" }); await api.Pages.SaveAsync(page4); var page5 = await MyBlogPage.CreateAsync(api); page5.SiteId = SITE_ID; page5.Title = "Blog Archive"; await api.Pages.SaveAsync(page5); var page6 = await MyDIPage.CreateAsync(api); page6.Id = PAGE_DI_ID; page6.SiteId = SITE_ID; page6.Title = "My Injection Page"; await api.Pages.SaveAsync(page6); var page7 = await MyPage.CreateAsync(api); page7.Id = PAGE_7_ID; page7.SiteId = SITE_ID; page7.Title = "My base page"; page7.Ingress = "My base ingress"; page7.Body = "My base body"; page7.ParentId = PAGE_1_ID; page7.SortOrder = 1; await api.Pages.SaveAsync(page7); var page8 = await MyPage.CreateAsync(api); page8.OriginalPageId = PAGE_7_ID; page8.Id = PAGE_8_ID; page8.SiteId = SITE_ID; page8.Title = "My copied page"; page8.ParentId = PAGE_1_ID; page8.SortOrder = 2; page8.IsHidden = true; page8.Route = "test-route"; await api.Pages.SaveAsync(page8); } }
protected void signin_Click(object sender, EventArgs e) { if (TXT_USERNAME.Text.ToString().Equals("")) { Response.Write("<script>alert('User Id Tidak Boleh Kosong')</script>"); MyPage.SetFocus(this, this.TXT_USERNAME); return; } else if (TXT_PASSWORD.Text.ToString().Equals("")) { Response.Write("<script>alert('Password Tidak Boleh Kosong')</script>"); MyPage.SetFocus(this, this.TXT_PASSWORD); return; } string nexturl = ""; if (!this.logon) { this.hash_password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(TXT_PASSWORD.Text, "sha1"); } this.connectionString = Login1.decryptConnStr(ConfigurationSettings.AppSettings["MRSDATALOGIN"]); using (DbConnection conn = new DbConnection(this.connectionString)) { try { Login1.loginResult flag = Login1.ValidateLogin(this.TXT_USERNAME.Text, this.TXT_PASSWORD.Text, conn, this.dbtimeout, this.logon, base.Request.UserHostAddress); Login1.loginResult loginResult = flag; if (loginResult != Login1.loginResult.logSuccess) { if (loginResult != Login1.loginResult.logPwdExpired) { if (loginResult != Login1.loginResult.logPwdDefault) { this.LogonMessage(flag); } else { System.Web.Security.FormsAuthentication.SetAuthCookie(this.TXT_USERNAME.Text, false); this.Session.Add("UserID", this.TXT_USERNAME.Text); nexturl = "Change_Password.aspx?initial"; } } else { System.Web.Security.FormsAuthentication.SetAuthCookie(this.TXT_USERNAME.Text, false); this.Session.Add("sha1", this.hash_password); this.Session.Add("UserID", this.TXT_USERNAME.Text); nexturl = "Change_Password.aspx?expired"; } } else { object[] lgparam = new object[] { this.TXT_USERNAME.Text, base.Request.UserHostAddress }; conn.ExecuteNonQuery(Login1.SP_LOGINSTARTED, lgparam, this.dbtimeout); System.Web.Security.FormsAuthentication.SetAuthCookie(this.TXT_USERNAME.Text, false); nexturl = this.AuthenticateUser(conn); } } catch (Exception ex) { string errmsg = ex.Message; if (errmsg.IndexOf("Last Query: exec SU_USERLOGINGIN") > 0) { errmsg = errmsg.Substring(0, errmsg.IndexOf("Last Query:")); this.Label1.Text = errmsg; } else { Response.Write("<!-- ex msg: " + ex.Message.Replace("-->", "--)") + " -->\n"); this.LogonMessage(Login1.loginResult.logUnknown); } } } if (nexturl != "") { Session.Add("ConnString", _conn); Session.Add("DbTimeOut", dbtimeout); Response.Redirect(nexturl); } }
public override void Load() { CurrentPage = MyPage.HomePage; }
//public ActionResult ChangeNews() //{ // if (Session["Identity"] == null) { return RedirectToAction("login"); } // return View(); //} public ActionResult BackupList() { if (Session["Identity"] == null) { return RedirectToAction("login"); } string type = Request.QueryString.Get("type"); if (type.Equals("search")) //搜索类型 { int page1 = int.Parse(Request.QueryString.Get("page")); string NameID = Request.QueryString.Get("NameID"); MyPage page = new MyPage(); page.CurrentPage = page1; List<Backup> backups = new BackupHandle().GetBackupByDescriptionByPage(page, NameID); ViewData["type"] = "search"; ViewData["backups"] = backups; ViewData["page"] = page; ViewData["NameID"] = NameID; } else { MyPage page = new MyPage(); page.CurrentPage = int.Parse(Request.QueryString.Get("page")); ViewData["backups"] = new BackupHandle().GetbackupByPage(page); ViewData["page"] = page; ViewData["type"] = "common"; } return View(); }
public ActionResult Notification() { string type = Request.QueryString.Get("type"); MyPage page = new MyPage(); if (type == null) { type = "common"; } if (type.Equals("search")) //搜索类型 { int page1 = int.Parse(Request.QueryString.Get("page")); string NameID = Request.QueryString.Get("NameID"); try { int id = int.Parse(NameID); Notice notice = new NoticeHandle().getNoticeByID(id); List<Notice> notices = new List<Notice>(); if (notice.notice_title != null && !notice.Equals("")) { notices.Add(notice); } ViewData["type"] = "search"; ViewData["notices"] = notices; page.CurrentPage = page1; page.CountPerPage = 10; page.WholePage = 1; ViewData["page"] = page; ViewData["NameID"] = NameID; } catch { page.CurrentPage = page1; List<Notice> notices = new NoticeHandle().GetNoticeByNameByPage(page, NameID); ViewData["type"] = "search"; ViewData["notices"] = notices; ViewData["page"] = page; ViewData["NameID"] = NameID; } } else { int page1; if (Request.QueryString.Get("page") == null) { page1 = 1; page.CurrentPage = page1; List<Notice> notices = new NoticeHandle().GetNoticeByPage(page); ViewData["type"] = "common"; ViewData["notices"] = notices; ViewData["page"] = page; } else { page1 = int.Parse(Request.QueryString.Get("page")); page.CurrentPage = page1; List<Notice> notices = new NoticeHandle().GetNoticeByPage(page); ViewData["type"] = "common"; ViewData["notices"] = notices; ViewData["page"] = page; } } try { return View(); } catch { return RedirectToAction("ErrorPage"); } }
public ActionResult FirmList() { if (Session["Identity"] == null) { return RedirectToAction("login"); } MyPage page = new MyPage(); page.CurrentPage = int.Parse(Request.QueryString.Get("page")); List<Firm> firms = new FirmHandle().GetFirmViewByPage(page); ViewData["firms"] = firms; ViewData["CurrentPage"] = page; return View(); }
internal MyPageAdapter (MyPage p) : base (p) { }
public ActionResult EmployeeList() { if (Session["Identity"] == null) { return RedirectToAction("login"); } string type = Request.QueryString.Get("type"); if (Request.QueryString.Get("subtype") != null) { Session["subtype"] = Request.QueryString.Get("subtype"); if (Request.QueryString.Get("subtype").Equals("AddDriver")) { Driver driver = new Driver(); DriverHandle driverHandler = new DriverHandle(); ViewData["EM_DriverHandler"] = driverHandler; } } MyPage page = new MyPage(); if (type.Equals("search")) //搜索类型 { int page1 = int.Parse(Request.QueryString.Get("page")); string NameID = Request.QueryString.Get("NameID"); try { int id = int.Parse(NameID); Employee employee = new EmployeeHandle().getEmployeeById(id); List<Employee> employees = new List<Employee>(); if (employee.Name != null && !employee.Equals("")) { employees.Add(employee); } ViewData["type"] = "search"; ViewData["employees"] = employees; page.CurrentPage = page1; page.CountPerPage = 10; page.WholePage = 1; ViewData["page"] = page; ViewData["NameID"] = NameID; } catch { page.CurrentPage = page1; List<Employee> employees = new EmployeeHandle().GetEmployeeByNameByPage(page, NameID); ViewData["type"] = "search"; ViewData["employees"] = employees; ViewData["page"] = page; ViewData["NameID"] = NameID; } } else { int page1 = int.Parse(Request.QueryString.Get("page")); page.CurrentPage = page1; List<Employee> employees = new EmployeeHandle().GetEmployeeByPage(page); ViewData["type"] = "common"; ViewData["employees"] = employees; ViewData["page"] = page; } return View(); }
public Handler() { repo = RepoFactory.GetRepo(MyPage.ChangeDB()); }
public void fillRefList(string schtitle, string schfldidtext, string schflddesctext, string query, bool withRefCode, bool FrameMode) { _frmmode = FrameMode; dbtimeout = (int)Session["dbTimeOut"]; ConnString = (string)Session["ConnStringLogin"]; using (conn = new DbConnection(ConnString)) { MyPage.fillRefListINA(DDL.Items, query, null, dbtimeout, withRefCode, conn); } if (DDL.Items.Count <= _maxItems) { _ddlmode = true; d1.Visible = false; d2.Visible = false; CODE.EnableViewState = false; DESC.EnableViewState = false; } else { _ddlmode = false; DDL.Items.Clear(); DDL.EnableViewState = false; DDL.Visible = false; if (_frmmode) { d1.Visible = true; d2.Visible = false; CODE.EnableViewState = false; DESC.EnableViewState = false; if (schtitle != null && schtitle.Trim() != "") { _frsrc += "&fT=" + schtitle.Replace(" ", "_"); } if (schfldidtext != null && schfldidtext.Trim() != "") { _frsrc += "&idTx=" + schfldidtext; } if (schflddesctext != null && schflddesctext.Trim() != "") { _frsrc += "&deTx=" + schflddesctext; } _frsrc += "&qry=" + HttpUtility.UrlEncode(query.Replace("'", "|:|")); } else { d1.Visible = false; d2.Visible = true; CODE.EnableViewState = true; DESC.EnableViewState = true; _query = query; string qrystr = "CtrlID=" + CODE.ClientID + "&CtrlDesc=" + DESC.ClientID; if (schfldidtext != null && schfldidtext.Trim() != "") { qrystr += "&idTx=" + schfldidtext; } if (schflddesctext != null && schflddesctext.Trim() != "") { qrystr += "&deTx=" + schflddesctext; } if (schtitle == null) { schtitle = ""; } qrystr += "&qry=" + HttpUtility.UrlEncode(query.Replace("'", "|:|")); SearchBtnAttribute(qrystr, schtitle.Replace(" ", "_")); } } Enabled = _Enabled; if (_Width != 0) { Width = _Width; } if (_TabIndex != 0) { TabIndex = _TabIndex; } if (_CssClass != null) { CssClass = _CssClass; } }
protected void save_data() { try { if (base.Request.QueryString["ID"].ToString().Equals("")) { System.Data.DataTable dt = this.conn.GetDataTable("select * FROM [MRSDATA].[dbo].[LOGINPARAM]", null, this.dbtimeout, true, true); if (dt.Rows.Count > 0) { PWDEXPDAY = int.Parse(dt.Rows[0]["PWDEXPDAY"].ToString()); } object[] param = new object[] { NIK.Value.ToString().ToUpper() }; System.Data.DataTable dataTableSms = this.conn.GetDataTable(Q_USER, param, this.dbtimeout, true, true); if (dataTableSms.Rows.Count > 0) { if (dataTableSms.Rows[0]["USERID"].ToString().ToUpper().Equals(NIK.Value.ToString().ToUpper())) { var page1 = HttpContext.Current.CurrentHandler as Page; ScriptManager.RegisterStartupScript(page1, page1.GetType(), "alert", "alert('User id atau NIK : " + NIK.Value.ToString() + " sudah terdaftar');", true); MyPage.SetFocus(this, this.NIK); } else { hash_password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("bankmantap1", "sha1"); NameValueCollection nameValueCollectionKey = new NameValueCollection(); NameValueCollection nameValueCollection = new NameValueCollection(); StaticFramework.SaveNvc(nameValueCollectionKey, "USERID", NIK); StaticFramework.SaveNvc(nameValueCollection, "GROUPID", GROUP); StaticFramework.SaveNvc(nameValueCollection, "SU_FULLNAME", FULLNAME); StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL", email); StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL_2", email2); StaticFramework.SaveNvc(nameValueCollection, "SU_REGISTERBY", Session["UserID"].ToString()); StaticFramework.SaveNvc(nameValueCollection, "SU_HPNUM", NOUSER.Value.Replace("-", "").Replace(" ", "")); StaticFramework.SaveNvc(nameValueCollection, "SU_PWD", hash_password); StaticFramework.SaveNvc(nameValueCollection, "SU_REGISTERDATE", DateTime.Now); StaticFramework.SaveNvc(nameValueCollection, "SU_PWDEXPDATE", DateTime.Now.AddDays(PWDEXPDAY)); StaticFramework.SaveNvc(nameValueCollection, "SU_ACTIVE", "1"); StaticFramework.SaveNvc(nameValueCollection, "UNIT", UNIT); if (GROUP.SelectedValue.Equals("003HEAD")) { //StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL_KADIV", emailDivisi); //StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL_DEPHEAD", emailDevHead); StaticFramework.SaveNvc(nameValueCollection, "SU_UPLINER", SU_UPLINER); //StaticFramework.SaveNvc(nameValueCollection, "SU_HPNUM_DEPHEAD", NODEVHEAD.Value.Replace("-", "").Replace(" ", "")); //StaticFramework.SaveNvc(nameValueCollection, "SU_HPNUM_KADIV", NOKADIV.Value.Replace("-", "")); } else if (GROUP.SelectedValue.Equals("002PEN")) { StaticFramework.SaveNvc(nameValueCollection, "USER_DELEGATE", PIC2); StaticFramework.SaveNvc(nameValueCollection, "SU_UPLINER", SU_UPLINER); } else if (GROUP.SelectedValue.Equals("004KADIV")) { StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL_DIREKTUR", emailDirektur); StaticFramework.SaveNvc(nameValueCollection, "SU_HPNUM_DIREKTUR", NODIREKTUR.Value.Replace("-", "").Replace(" ", "")); } StaticFramework.Save(nameValueCollection, nameValueCollectionKey, "SCALLUSER", this.conn); var page = HttpContext.Current.CurrentHandler as Page; ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "alert('Save Data Success');", true); NameValueCollection nameValueCollectionKeyflag = new NameValueCollection(); NameValueCollection nameValueCollectionflag = new NameValueCollection(); StaticFramework.SaveNvc(nameValueCollectionKeyflag, "USERID", NIK); StaticFramework.SaveNvc(nameValueCollectionflag, "SU_LOGON", "0"); StaticFramework.SaveNvc(nameValueCollectionflag, "SU_REVOKE", "0"); StaticFramework.SaveNvc(nameValueCollectionflag, "SU_FALSEPWDCOUNT", "0"); StaticFramework.Save(nameValueCollectionflag, nameValueCollectionKeyflag, "scalluserflag", this.conn); clear(); } } else { hash_password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("bankmantap1", "sha1"); NameValueCollection nameValueCollectionKey = new NameValueCollection(); NameValueCollection nameValueCollection = new NameValueCollection(); StaticFramework.SaveNvc(nameValueCollectionKey, "USERID", NIK); StaticFramework.SaveNvc(nameValueCollection, "GROUPID", GROUP); StaticFramework.SaveNvc(nameValueCollection, "SU_FULLNAME", FULLNAME); StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL", email); StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL_2", email2); StaticFramework.SaveNvc(nameValueCollection, "SU_REGISTERBY", Session["UserID"].ToString()); StaticFramework.SaveNvc(nameValueCollection, "SU_HPNUM", NOUSER.Value.Replace("-", "").Replace(" ", "")); StaticFramework.SaveNvc(nameValueCollection, "SU_PWD", hash_password); StaticFramework.SaveNvc(nameValueCollection, "SU_REGISTERDATE", DateTime.Now); StaticFramework.SaveNvc(nameValueCollection, "SU_PWDEXPDATE", DateTime.Now.AddDays(PWDEXPDAY)); StaticFramework.SaveNvc(nameValueCollection, "SU_ACTIVE", "1"); StaticFramework.SaveNvc(nameValueCollection, "UNIT", UNIT); if (GROUP.SelectedValue.Equals("003HEAD")) { //StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL_KADIV", emailDivisi); //StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL_DEPHEAD", emailDevHead); StaticFramework.SaveNvc(nameValueCollection, "SU_UPLINER", SU_UPLINER); //StaticFramework.SaveNvc(nameValueCollection, "SU_HPNUM_DEPHEAD", NODEVHEAD.Value.Replace("-", "").Replace(" ", "")); //StaticFramework.SaveNvc(nameValueCollection, "SU_HPNUM_KADIV", NOKADIV.Value.Replace("-", "")); } else if (GROUP.SelectedValue.Equals("002PEN")) { StaticFramework.SaveNvc(nameValueCollection, "USER_DELEGATE", PIC2); StaticFramework.SaveNvc(nameValueCollection, "SU_UPLINER", SU_UPLINER); } else if (GROUP.SelectedValue.Equals("004KADIV")) { StaticFramework.SaveNvc(nameValueCollection, "SU_EMAIL_DIREKTUR", emailDirektur); StaticFramework.SaveNvc(nameValueCollection, "SU_HPNUM_DIREKTUR", NODIREKTUR.Value.Replace("-", "").Replace(" ", "")); } StaticFramework.Save(nameValueCollection, nameValueCollectionKey, "SCALLUSER", this.conn); var page = HttpContext.Current.CurrentHandler as Page; ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "alert('Save Data Success');", true); NameValueCollection nameValueCollectionKeyflag = new NameValueCollection(); NameValueCollection nameValueCollectionflag = new NameValueCollection(); StaticFramework.SaveNvc(nameValueCollectionKeyflag, "USERID", NIK); StaticFramework.SaveNvc(nameValueCollectionflag, "SU_LOGON", "0"); StaticFramework.SaveNvc(nameValueCollectionflag, "SU_REVOKE", "0"); StaticFramework.SaveNvc(nameValueCollectionflag, "SU_FALSEPWDCOUNT", "0"); StaticFramework.Save(nameValueCollectionflag, nameValueCollectionKeyflag, "scalluserflag", this.conn); clear(); } } } catch (Exception e) { var page = HttpContext.Current.CurrentHandler as Page; ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "alert('error save');", true); } }
//分页转到经理页面 public void GoManagerList(int pagecount) { MyPage page = new MyPage(); page.CurrentPage = pagecount; List<Manager> managers = new ManagerHandle().GetManagerByPage(page); ViewData["managers"] = managers; ViewData["page"] = page; }
public ActionResult ManagerList() { if (Session["Identity"] == null) { return RedirectToAction("login"); } string type = Request.QueryString.Get("type"); if (type.Equals("search")) //搜索类型 { int page1 = int.Parse(Request.QueryString.Get("page")); string NameID = Request.QueryString.Get("NameID"); try { int id = int.Parse(NameID); Manager manager = new Manager(id); List<Manager> managers = new List<Manager>(); if (manager.Name != null && !manager.Equals("")) { managers.Add(manager); } ViewData["type"] = "search"; ViewData["managers"] = managers; MyPage page = new MyPage(); page.CurrentPage = page1; page.CountPerPage = 10; page.WholePage = 1; ViewData["page"] = page; ViewData["NameID"] = NameID; } catch { MyPage page = new MyPage(); page.CurrentPage = page1; List<Manager> managers = new ManagerHandle().GetManagerByNameByPage(page, NameID); ViewData["type"] = "search"; ViewData["managers"] = managers; ViewData["page"] = page; ViewData["NameID"] = NameID; } } else { int page = int.Parse(Request.QueryString.Get("page")); this.GoManagerList(page); } return View(); }
public override void DataBind() { if (!this.Visible) { return; } if (PageDetails == null) { //If the article is not found or it's status is set to no display //this.Page.Response.TrySkipIisCustomErrors = true; this.Page.Response.StatusCode = 404; this.Page.Response.StatusDescription = "404 Not Found"; this.Page.Response.End(); return; //throw new HttpException(404, "Page not found"); // return; } if (Bound) { return; } Bound = true; DataItem = PageDetails; if (MyPage.Editable) { MyPage.RegisterLoadScript("PageId", "document.__MyPageId = " + PageDetails.PageId.ToString() + ";"); MyPage.RegisterLoadScript("PageRoles", "document.__MyPageEditingRoles = " + (PageDetails.EditingRoles != null ? PageDetails.EditingRoles.ToString() : "0") + ";"); } base.DataBind(); if (OverridePageTitle) { Config cfg = new Config(); string secureDomain = WebTools.Config.GetFromWebConfig(lw.CTE.parameters.SecureDomain); if (MyPage != null) { if (!String.IsNullOrEmpty(PageDetails.Title)) { MyPage.CustomTitle = string.Format("{0} - {1}", StringUtils.StripOutHtmlTags(PageDetails.Title), cfg.GetKey("SiteName")); } if (!String.IsNullOrEmpty(PageDetails.SmallDescription)) { MyPage.Description = string.Format("{0}", StringUtils.StripOutHtmlTags(PageDetails.SmallDescription)); } if (!String.IsNullOrEmpty(PageDetails.Image)) { MyPage.Image = string.Format("{0}://{1}{2}/{3}/Page_{4}/{5}", !string.IsNullOrEmpty(secureDomain) ? "https" : "http", WebContext.ServerName, WebContext.Root, lw.CTE.Folders.PagesFolder, PageDetails.PageId, PageDetails.Image.Replace(".", "-l.")); } if (!String.IsNullOrEmpty(PageDetails.FullURL)) { MyPage.Url = !string.IsNullOrEmpty(secureDomain) ? WebContext.Request.Url.AbsoluteUri.Replace("http://", "https://") : WebContext.Request.Url.AbsoluteUri; } if (PageDetails.IsSecure != null) { MyPage.isSecure = (bool)PageDetails.IsSecure; } if (!String.IsNullOrEmpty(PageDetails.Keywords)) { MyPage.Keywords = string.Format("{0}", StringUtils.StripOutHtmlTags(PageDetails.Keywords)); } } } }
public void GoManagerList(int pagecount) { if (Session["Identity"] == null) { RedirectToAction("login"); return; } MyPage page = new MyPage(); page.CurrentPage = pagecount; List<Manager> managers = new ManagerHandle().GetManagerByPage(page); ViewData["type"] = "common"; ViewData["managers"] = managers; ViewData["page"] = page; }
/// <summary> /// Builds the select command for the data source /// </summary> public void BuildQuery() { if (String.IsNullOrWhiteSpace(SelectCommand)) { StringBuilder cond = new StringBuilder(); PagesManager pMgr = new PagesManager(); if (ParentId != null && !_getFromParent) { if (!Recursive) { cond.AppendFormat(" And ParentId={0}", _parentId); } else { string tempSql = string.Format("select * from dbo.Pages_GetDescendants({0})", _parentId); DataSet tempDs = DBUtils.GetDataSet(tempSql, cte.lib); string sep = ""; StringBuilder tempSB = new StringBuilder(); foreach (DataRow newsType in tempDs.Tables[0].Rows) { if (_recursiveLevel != null && _recursiveLevel != (int)newsType["Level"]) { continue; } tempSB.Append(sep); tempSB.Append(newsType["PageId"].ToString()); sep = ","; } string typeIds = tempSB.ToString(); if (!String.IsNullOrWhiteSpace(typeIds)) { cond.Append(string.Format(" And ParentId in ({0})", typeIds)); } } } else { if (!String.IsNullOrWhiteSpace(ParentURL)) { if (!Recursive) { cond.AppendFormat(" And ParentId in (select PageId from Pages where URL=N'{0}' or Title=N'{0}')", StringUtils.SQLEncode(ParentURL)); } else { //TODO: fix database connection _parentId = pMgr.GetPage(ParentURL).PageId; string tempSql = string.Format("select * from dbo.Pages_GetDescendants({0})", _parentId); DataSet tempDs = DBUtils.GetDataSet(tempSql, cte.lib); string sep = ""; StringBuilder tempSB = new StringBuilder(); foreach (DataRow newsType in tempDs.Tables[0].Rows) { if (_recursiveLevel != null && _recursiveLevel != (int)newsType["Level"]) { continue; } tempSB.Append(sep); tempSB.Append(newsType["PageId"].ToString()); sep = ","; } string typeIds = tempSB.ToString(); if (!String.IsNullOrWhiteSpace(typeIds)) { cond.Append(string.Format(" And ParentId in ({0})", typeIds)); } } } } if (month != null && month != "") { DateTime d = DateTime.Parse(month); DateTime d1 = d.AddMonths(1); cond.Append(string.Format(" And PublishDate Between '{0:M}' and '{1:M}'", d, d1)); } if (!String.IsNullOrEmpty(Year)) { cond.Append(string.Format(" And datepart(yyyy, PublishDate) = '{0}'", Year)); } if (!MyPage.Editable && !CMSMode.Value) { cond.AppendFormat(" and Status in ({0}, {1}, {2}, {3})", (byte)PageStatus.Published, (byte)PageStatus.Dynamic, (byte)PageStatus.Important, (byte)PageStatus.Menu); cond.Append(" And (PublishDate is Null Or PublishDate <= getDate())"); } else { cond.AppendFormat(" and Status not in ({0})", (byte)PageStatus.Deleted); } if (!String.IsNullOrWhiteSpace(_customCondition)) { cond.Append(_customCondition); } string _source = WebContext.Request["source"]; if (_source != null && _source.ToLower() == "categories") { string _typeId = WebContext.Request["TypeId"]; if (!String.IsNullOrWhiteSpace(_typeId)) { cond.Append(string.Format(" AND PageType={0}", StringUtils.SQLEncode(_typeId))); } } else if (_source != null && _source.ToLower() == "templates") { string templateId = WebContext.Request["TemplateId"]; if (!String.IsNullOrWhiteSpace(templateId)) { cond.Append(string.Format(" AND PageTemplate={0}", StringUtils.SQLEncode(templateId))); } } //string pId = WebContext.Request["ParentId"]; //if (!String.IsNullOrWhiteSpace(pId)) //{ // cond.Append(string.Format(" And ParentId={0}", StringUtils.SQLEncode(pId))); //} string _q = WebContext.Request["q"]; if (!String.IsNullOrWhiteSpace(_q)) { cond.Append(string.Format(" And (Title like N'%{0}%' or URL like N'%{0}%' or Header like N'%{0}%')", StringUtils.SQLEncode(_q))); } string _status = WebContext.Request["Status"]; if (!String.IsNullOrWhiteSpace(_status)) { cond.Append(string.Format(" And Status={0}", StringUtils.SQLEncode(_status))); } string sql = ""; if (cond.Length > 0) { sql = cond.ToString().Substring(5); } string _max = ""; if (Max != null) { _max = string.Format(" Top {0}", Max); } else if (_getPageProperties) { _max = " Top 100 PERCENT"; } this.SelectCommand = string.Format("select {1}* from " + SQLSource + " where {0}", sql, _max); } if (!EnablePaging) { this.SelectCommand += " Order By " + this.OrderBy; } if (_getPageProperties) { string tempSql = "select * from PageDataProrpertiesView where PageId in (select PageId from (" + this.SelectCommand + ") P)"; DataTable properties = DBUtils.GetDataSet(tempSql, cte.lib).Tables[0]; MyPage.AddContext(cte.PageProperties + "-" + this.ID, properties, true); } //WebContext.Response.Write(this.SelectCommand); //WebContext.Response.End(); }
public ActionResult Customer() { if (Session["Identity"] == null) { return RedirectToAction("login"); } string type = Request.QueryString.Get("type"); if (type.Equals("search")) //搜索类型 { int page1 = int.Parse(Request.QueryString.Get("page")); string NameID = Request.QueryString.Get("NameID"); try { int id = int.Parse(NameID); Customer customer = new CustomerHandle().getCustomerById(id); List<Customer> customers = new List<Customer>(); if (customer.NickName != null && !customer.Equals("")) { customers.Add(customer); } ViewData["type"] = "search"; ViewData["customers"] = customers; MyPage page = new MyPage(); page.CurrentPage = page1; page.CountPerPage = 10; page.WholePage = 1; ViewData["page"] = page; ViewData["NameID"] = NameID; } catch { MyPage page = new MyPage(); page.CurrentPage = page1; List<Customer> customers = new CustomerHandle().GetCustomerByNameByPage(page, NameID); ViewData["type"] = "search"; ViewData["customers"] = customers; ViewData["page"] = page; ViewData["NameID"] = NameID; } } else if ("common".Equals(type)) { MyPage page = new MyPage(); page.CurrentPage = int.Parse(Request.QueryString.Get("page")); ViewData["customers"] = new CustomerHandle().GetcustomerByPage(page); ViewData["page"] = page; ViewData["type"] = "common"; } return View(); }
public App() { InitializeComponent(); MainPage = new MyPage(); }
public ActionResult InvoiceList() { if (Session["Identity"] == null) { return RedirectToAction("login"); } string type = Request.QueryString.Get("type"); if (type.Equals("search")) //搜索类型 { string NameID = Request.QueryString.Get("NameID"); int id = int.Parse(NameID); Invoice invoice = new InvoiceHandle().GetInvoiceByID(id); List<Invoice> invoices = new List<Invoice>(); if (invoice.CustomerId != null && !invoice.CustomerId.Equals("")) { invoices.Add(invoice); } ViewData["invoices"] = invoices; ViewData["type"] = "search"; MyPage page = new MyPage(); page.CurrentPage = 1; page.CountPerPage = 10; page.WholePage = 1; ViewData["page"] = page; } else { MyPage page = new MyPage(); page.CurrentPage = int.Parse(Request.QueryString.Get("page")); int CustomerId = int.Parse(Request.QueryString.Get("id")); ViewData["invoices"] = new InvoiceHandle().GetCustomerInvoiceByPage(CustomerId, page); ViewData["page"] = page; ViewData["customer"] = new CustomerHandle().getCustomerById(CustomerId); ViewData["type"] = "common"; } return View(); }
public App() { var content = new MyPage(); MainPage = new NavigationPage(content); }
public static void GotoPage (MyPage page) { AwesomeWrappanel.CleanAll (); DetailPage.ShowPage (page); }
//... protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { myPage = (MyPage)e.NewElement; //... }