void Bind() { leica_geosystemsVoteProjectWorksManager Workbll = new leica_geosystemsVoteProjectWorksManager(); //StringBuilder strWhere = new StringBuilder(); //if (txtUsername.Text.Trim() != "") //{ // strWhere.AppendFormat("WorksName like '%{0}%'", txtUsername.Text.Trim()); //} //AspNetPager1.AlwaysShow = true; //AspNetPager1.RecordCount = Workbll.getcounts(strWhere.ToString()); //Workbll.GetsetdatesRPT(AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, strWhere.ToString(), rptProduct); StringBuilder strWhere = new StringBuilder(); rptProduct.DataSource = Workbll.GetList(strWhere.ToString()); //rept.DataKeyNames = new string[] { "id" }; rptProduct.DataBind(); //rptProduct.DataSource = Workbll.GetList(""); ////rept.DataKeyNames = new string[] { "id" }; //rptProduct.DataBind(); }
//单击行 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex != -1) //添加序号 { int id = e.Row.RowIndex + 1; e.Row.Cells[2].Text = id.ToString(); } if (e.Row.RowType == DataControlRowType.DataRow) { //for (int i = 2; i < e.Row.Cells.Count; i++) //{ //e.Row.Attributes.Add("onMouseOver", "Color=this.style.backgroundColor;this.style.backgroundColor='lightBlue'"); e.Row.Attributes.Add("onMouseOver", "Color=this.style.backgroundColor;this.style.backgroundColor='#d2e8fc'"); e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;"); //e.Row.Cells[i].Attributes["style"] = "Cursor:hand"; //e.Row.Cells[i].Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex); //} HyperLink xiangxihy = (HyperLink)e.Row.FindControl("HyperLink1"); xiangxihy.NavigateUrl = "SFVoteWorksManager.aspx?id=" + GridView1.DataKeys[e.Row.RowIndex].Value; leica_geosystemsVoteProjectWorksManager bll = new leica_geosystemsVoteProjectWorksManager(); leica_geosystemsVoteProjectWorks voteModel = bll.GetModel(int.Parse(GridView1.DataKeys[e.Row.RowIndex].Value.ToString())); HyperLink xiangxihy2 = (HyperLink)e.Row.FindControl("HyperLink2"); xiangxihy2.NavigateUrl = "voteUserShow.aspx?id=" + voteModel.AuthorId; } }
private void ShowInfo(int id) { leica_geosystemsVoteProjectWorksManager bllWorks = new leica_geosystemsVoteProjectWorksManager(); leica_geosystemsVoteProjectWorks model = bllWorks.GetModelAdmin(id); this.Label1.Text = model.ProjectName; this.Label2.Text = model.ProjectOverview; this.Label3.Text = model.UseProcess; this.Label4.Text = model.UseExperience; }
int Storage() { int f = 0; leica_geosystemsVoteProjectWorksManager bll = new leica_geosystemsVoteProjectWorksManager(); bool b = false; int AuthorId = int.Parse(Session["VPId"].ToString()); StringBuilder strWhere = new StringBuilder(); strWhere.AppendFormat("leica_geosystemsVoteProjectWorks.AuthorId='{0}'", AuthorId); strWhere.AppendFormat(" and leica_geosystemsVoteProjectWorks.Id!='{0}'", getid()); //Response.Write(bll.GetListAdmin(strWhere.ToString()).Tables[0].Rows.Count); //Response.End(); //if (bll.GetList(strWhere.ToString()).Tables[0].Rows.Count == 0) //{ string ProjectName = this.txtProjectName.Text; string ProjectOverview = this.txtProjectOverview.Text; string UseProcess = this.txtUseProcess.Text; string UseExperience = this.txtUseExperience.Text; string Copyright = getCopyright().ToString(); leica_geosystemsVoteProjectWorks model = new leica_geosystemsVoteProjectWorks(); model.AuthorId = AuthorId; model.ProjectName = ProjectName; model.ProjectOverview = ProjectOverview; model.UseProcess = UseProcess; model.UseExperience = UseExperience; model.Copyright = Copyright; model.WorksExamine = "0"; model.Copyright = Copyright; StringBuilder strWheres = new StringBuilder(); string username = Session["VPId"].ToString(); if (username != "") { strWheres.AppendFormat("AuthorId='{0}'", username); } if (Label4.Text != "") { model.Id = int.Parse(Label4.Text); f = bll.Update(model) == false ? 0 : 1000; } else { if (bll.GetListAdmin(strWhere.ToString()).Tables[0].Rows.Count == 0) { f = bll.Add(model); } } //Response.Write(strWhere.ToString()); //Response.End(); if (f > 0) { toemail(); } //Maticsoft.Common.MessageBox.ShowAndRedirect(this, "提交成功!", "VoteWorksManager.aspx"); //Maticsoft.Common.MessageBox.ShowAndRedirect(this, "提交成功!", "MyWorks.aspx"); //} //else //{ // f = -1; // //Maticsoft.Common.MessageBox.ShowAndRedirect(this, "提交失败!", "VoteWorksInfo.aspx"); // //Maticsoft.Common.MessageBox.ShowAndRedirect(this, "提交失败!", "VoteWorksManager.aspx"); //} return f; }