private void SearchOne(bool err = false) { string Stearch = ""; if (!PubFunc.StrIsEmpty(ddlHis.SelectedValue)) { Stearch += string.Format(" AND A.CUSTID = '{0}'", ddlHis.SelectedValue); } //if (!PubFunc.StrIsEmpty(tgbExlBill.Text)) //{ // Stearch += string.Format(" AND A.SEQNO LIKE '%{0}%'", tgbExlBill.Text); //} if (!PubFunc.StrIsEmpty(tgbExlGoods.Text)) { Stearch += string.Format(" AND A.HISNAME LIKE '%{0}%'", tgbExlGoods.Text); } Stearch += " ORDER BY HISCODE"; int total = 0; string mysql = ""; if (!err) { GridColumn MEMO = GridExcel.FindColumn("MEMO"); MEMO.Hidden = true; mysql = @"SELECT A.*,B.NAME HOSNAME FROM DAT_UPLOAD_GOODS A,DOC_CUSTOMER B WHERE A.CUSTID = B.CODE(+) AND A.FLAG = 'N' "; } else { GridColumn MEMO = GridExcel.FindColumn("MEMO"); MEMO.Hidden = false; mysql = @"SELECT A.*,B.NAME HOSNAME FROM DAT_UPLOAD_GOODS A,DOC_CUSTOMER B WHERE A.CUSTID = B.CODE(+) AND A.FLAG = 'C' "; } DataTable dtData = PubFunc.DbGetPage(GridExcel.PageIndex, GridExcel.PageSize, mysql + Stearch, ref total); GridExcel.RecordCount = total; GridExcel.DataSource = dtData; GridExcel.DataBind(); }
public void LoadGridByRoleShow(string RoleId, string Underchk) { try { FindRoleId(); string Sql = " SELECT distinct(MobileNo),UserMaster.usrAutoId,UserMaster.usrFirstName,UserMaster.usrLastName,AdminSubMarketingSubUser.rolename,UDISE_TotalByRole.TotalReporty,TotalRegBoys,TotalRegGirls,TotalPresent_B,TotlalPresent_G" + " FROM UDISE_TotalByRole inner join UserMaster on UDISE_TotalByRole.UserId=UserMaster.usrUserId join AdminSubMarketingSubUser on " + " UDISE_TotalByRole.ReportId=AdminSubMarketingSubUser.userid " + " where AdminSubMarketingSubUser." + ReferenceId + "='" + Convert.ToString(Session["MarketingUser"]) + "' and AdminSubMarketingSubUser." + ReferenceIdChk + "='" + Underchk + "' and AdminSubMarketingSubUser.roleid=" + RoleId + ""; DataSet ds = cc.ExecuteDataset(Sql); if (ds.Tables[0].Rows.Count > 0) { gvItem.DataSource = ds.Tables[0]; gvItem.DataBind(); for (int i = 0; i < gvItem.Rows.Count; i++) { Label lblPerb = (Label)gvItem.Rows[i].Cells[0].FindControl("lblPerBoy"); Label lblPerg = (Label)gvItem.Rows[i].Cells[0].FindControl("lblPerGirls"); Label lblAllStud = (Label)gvItem.Rows[i].Cells[0].FindControl("lblAllStud"); { double RegisterBoy = Convert.ToDouble(gvItem.Rows[i].Cells[7].Text); double RegisterGirls = Convert.ToDouble(gvItem.Rows[i].Cells[8].Text); double PresentBoy = Convert.ToDouble(gvItem.Rows[i].Cells[9].Text); double PresentGirls = Convert.ToDouble(gvItem.Rows[i].Cells[10].Text); if (RegisterBoy == 0.0 && RegisterGirls == 0.0) { lblPerb.Text = "0%"; lblPerg.Text = "0%"; lblAllStud.Text = "0%"; } else if (RegisterBoy == 0.0 && RegisterGirls != 0.0) { double k = 0.0; double j = PresentGirls / RegisterGirls; j = j * 100; double m = (PresentBoy + PresentGirls) / (RegisterBoy + RegisterGirls); m = m * 100; lblPerb.Text = Convert.ToInt16(k) + "%"; lblPerg.Text = Convert.ToInt16(j) + "%"; lblAllStud.Text = Convert.ToInt16(m) + "%"; } else if (RegisterBoy != 0.0 && RegisterGirls == 0.0) { double k = PresentBoy / RegisterBoy; k = k * 100; double j = 0.0; double m = (PresentBoy + PresentGirls) / (RegisterBoy + RegisterGirls); m = m * 100; lblPerb.Text = Convert.ToInt16(k) + "%"; lblPerg.Text = Convert.ToInt16(j) + "%"; lblAllStud.Text = Convert.ToInt16(m) + "%"; } else { double k = PresentBoy / RegisterBoy; k = k * 100; double j = PresentGirls / RegisterGirls; j = j * 100; double m = (PresentBoy + PresentGirls) / (RegisterBoy + RegisterGirls); m = m * 100; lblPerb.Text = Convert.ToInt16(k) + "%"; lblPerg.Text = Convert.ToInt16(j) + "%"; lblAllStud.Text = Convert.ToInt16(m) + "%"; } } } GridExcel.DataSource = ds.Tables[0]; GridExcel.DataBind(); for (int i = 0; i < GridExcel.Rows.Count; i++) { Label lblPerb1 = (Label)GridExcel.Rows[i].Cells[0].FindControl("lblPerBoy1"); Label lblPerg1 = (Label)GridExcel.Rows[i].Cells[0].FindControl("lblPerGirls1"); Label lblAllStud1 = (Label)GridExcel.Rows[i].Cells[0].FindControl("lblAllStud1"); { double RegisterBoy = Convert.ToDouble(GridExcel.Rows[i].Cells[7].Text); double RegisterGirls = Convert.ToDouble(GridExcel.Rows[i].Cells[8].Text); double PresentBoy = Convert.ToDouble(GridExcel.Rows[i].Cells[9].Text); double PresentGirls = Convert.ToDouble(GridExcel.Rows[i].Cells[10].Text); if (RegisterBoy == 0.0 && RegisterGirls == 0.0) { lblPerb1.Text = "0%"; lblPerg1.Text = "0%"; lblAllStud1.Text = "0%"; } else if (RegisterBoy == 0.0 && RegisterGirls != 0.0) { double k = 0.0; double j = PresentGirls / RegisterGirls; j = j * 100; double m = (PresentBoy + PresentGirls) / (RegisterBoy + RegisterGirls); m = m * 100; lblPerb1.Text = Convert.ToInt16(k) + "%"; lblPerg1.Text = Convert.ToInt16(j) + "%"; lblAllStud1.Text = Convert.ToInt16(m) + "%"; } else if (RegisterBoy != 0.0 && RegisterGirls == 0.0) { double k = PresentBoy / RegisterBoy; k = k * 100; double j = 0.0; double m = (PresentBoy + PresentGirls) / (RegisterBoy + RegisterGirls); m = m * 100; lblPerb1.Text = Convert.ToInt16(k) + "%"; lblPerg1.Text = Convert.ToInt16(j) + "%"; lblAllStud1.Text = Convert.ToInt16(m) + "%"; } else { double k = PresentBoy / RegisterBoy; k = k * 100; double j = PresentGirls / RegisterGirls; j = j * 100; double m = (PresentBoy + PresentGirls) / (RegisterBoy + RegisterGirls); m = m * 100; lblPerb1.Text = Convert.ToInt16(k) + "%"; lblPerg1.Text = Convert.ToInt16(j) + "%"; lblAllStud1.Text = Convert.ToInt16(m) + "%"; } } } } } catch (Exception ex) { } }
//绑定表格 private void RefreshGrid() { string str = " and s_Pro_Type='企业类'"; if (s_xiangMuJL.Text != "") { str += " and s_xiangMuJL like '%" + this.s_xiangMuJL.Text.Replace("'", "''").Replace("_", "\\_").Replace("%", "\\%") + "%'"; } if (s_xiangMuMC.Text != "") { str += " and s_xiangMuMC like '%" + this.s_xiangMuMC.Text.Replace("'", "''").Replace("_", "\\_").Replace("%", "\\%") + "%'"; } if (s_xiangMuGSQC.Text != "") { str += " and s_xiangMuGSQC like '%" + this.s_xiangMuGSQC.Text.Replace("'", "''").Replace("_", "\\_").Replace("%", "\\%") + "%'"; } if (this.s_xiangmuBH.Text.Trim() != "") { str += " and s_xiangmuBH like '%" + this.s_xiangmuBH.Text.Trim().Replace("'", "''").Replace("_", "\\_").Replace("%", "\\%") + "%'"; } if (s_LiXiangSQR.Text != "") { str += " and s_LiXiangSQR like '%" + this.s_LiXiangSQR.Text.Replace("'", "''").Replace("_", "\\_").Replace("%", "\\%") + "%'"; } if (s_dengJiR.Text != "") { str += " and s_dengJiR like '%" + this.s_dengJiR.Text.Replace("'", "''").Replace("_", "\\_").Replace("%", "\\%") + "%'"; } if (this.d_dengJiRQ.FromText.ToString() != "") { str += " and d_dengJiRQ>'" + DateTime.Parse(this.d_dengJiRQ.FromText.ToString()).AddDays(-1) + "'"; } if (this.d_dengJiRQ.ToText.ToString() != "") { str += " and d_dengJiRQ<'" + DateTime.Parse(this.d_dengJiRQ.ToText.ToString()).AddDays(1) + "'"; } //决策时间 if (this.d_TouZiJCSJ.FromText.ToString() != "") { str += " and d_TouZiJCSJ>'" + DateTime.Parse(this.d_TouZiJCSJ.FromText.ToString()).AddHours(-2) + "'"; } if (this.d_TouZiJCSJ.ToText.ToString() != "") { str += " and d_TouZiJCSJ<'" + DateTime.Parse(this.d_TouZiJCSJ.ToText.ToString()).AddHours(23) + "'"; } if (this.s_suoShuHY.Text.ToString() != "") { str += " and s_suoShuHY='" + this.s_suoShuHY.Text.ToString() + "'"; } if (this.s_xiangMuLY.SelectedValue.ToString() != "") { str += " and s_xiangMuLY_Drop=" + this.s_xiangMuLY.SelectedValue.ToString(); } if (this.s_GuanLiPT.SelectedValue.ToString() != "") { string GuanLiPT = rtn_GuanLiPT(); str += " and s_guanLiPT in (" + GuanLiPT + ")"; } if (this.s_xiangMuZT.SelectedValue.ToString() != "") { string xiangMuZTList = rtn_xiangMuZT(); str += " and s_xiangMuZT in (" + xiangMuZTList + ")"; } str += " and (s_del_TrueOrFalse is Null or s_del_TrueOrFalse='')"; string GuanLiPT_All = rtn_GuanLiPT_ForAll(); str += " and s_guanLiPT in (" + GuanLiPT_All + ")"; str += " and DWGuid>'' "; oListPage.OtherCondition = str; oListPage.TableDetail.SQL_TableName = "VIEW_CurrentVersion";//找到最新版本的视图 oListPage.SortExpression = "d_dengJiRQ desc"; //oListPage.SortExpression = "Row_ID"; oListPage.GenerateSearchResult(); string strSql = string.Format(" select * from VIEW_CurrentVersion where 1=1 {0} order by {1}", str, "d_dengJiRQ desc"); GridExcel.DataSource = Epoint.MisBizLogic2.DB.ExecuteDataView(strSql); GridExcel.DataBind(); }