/// <summary> /// 数据绑定方法 /// </summary> public void Bind() { int num = 0; DataTable dt = baseDataManage.GetBasePagerDataTable("V_Sms_UserManage", out num, AspNetPager1.PageSize, Curr, "*", Con, "SmsSendCount desc"); AspNetPager1.RecordCount = num; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; RptShow.DataSource = dt; RptShow.DataBind(); }
protected void Bindrplist() { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); List <Tb_Sms_SendInfo> list = baseDataManage.CallMethod("Tb_Sms_SendInfo", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", Con, ViewState["orderBy"].ToString() }) as List <Tb_Sms_SendInfo>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; RptShow.DataSource = list; RptShow.DataBind(); }
protected void btnCalculate_Click(object sender, EventArgs e) { try { List <int> lstVal = new List <int>(); List <double> lstDiv = new List <double>(); List <double> lstSub = new List <double>(); List <double> lstMR = new List <double>(); foreach (RepeaterItem item in rptSells.Items) { TextBox txtVal = (TextBox)item.FindControl("txtRequired"); lstVal.Add(Convert.ToInt32(txtVal.Text.Trim())); } int sum = 0; foreach (var item in lstVal) { sum = sum + item; } lblManDays.Text = sum.ToString() + " Man Days"; foreach (var item in lstVal) { lstDiv.Add(sum / item); } for (int i = 0; i < lstDiv.Count; i++) { lstSub.Add(lstDiv[i] - lstVal[i]); } foreach (var item in lstSub) { lstMR.Add(item / 20); } SqlConnection SqlConn = new SqlConnection(); SqlConn.ConnectionString = GetConnectionString(); string SqlString = "select RoleName from [dbo].[CPT_RoleMaster] where isactive=1 and rolemasterid in(6,7,9,13,14,21,23)"; using (SqlCommand SqlCom = new SqlCommand(SqlString, SqlConn)) { SqlConn.Open(); SqlDataReader reader = SqlCom.ExecuteReader(); while (reader.Read()) { lstRole.Add(reader["RoleName"].ToString()); } } DataTable table = new DataTable(); table.Columns.Add("RoleName", typeof(string)); table.Columns.Add("Percentage", typeof(double)); for (int i = 0; i < lstMR.Count; i++) { DataRow dr = table.NewRow(); dr["RoleName"] = lstRole[i]; dr["Percentage"] = lstMR[i]; table.Rows.Add(dr); } myDIV.Style.Add("display", "none"); Div.Style.Add("display", "block"); btnCalculate.Visible = false; RptShow.DataSource = table; RptShow.DataBind(); //Response.Write("<script>alert('sum= "+sum+"')</script>"); } catch (Exception ex) { var message = new JavaScriptSerializer().Serialize(ex.Message.ToString()); var script = string.Format("alert({0});", message); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", script, true); //ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "", script, true); } }