Exemplo n.º 1
0
        private void BindGrid()
        {
            IQueryable <Infobasis.Data.DataEntity.BudgetTemplate> q = DB.BudgetTemplates; //.Include(u => u.Dept);

            // 在名称中搜索
            string searchText = ttbSearchMessage.Text.Trim();

            if (!String.IsNullOrEmpty(searchText))
            {
                q = q.Where(u => u.Name.Contains(searchText) || u.Code.Contains(searchText));
            }

            // 过滤启用状态
            Infobasis.Data.DataEntity.BudgetTemplateStatus budgetSatus = BudgetTemplateStatus.Enabled;
            if (rblEnableStatus.SelectedValue != "all")
            {
                if (rblEnableStatus.SelectedValue == "enabled")
                {
                    budgetSatus = BudgetTemplateStatus.Enabled;
                }
                else if (rblEnableStatus.SelectedValue == "disabled")
                {
                    budgetSatus = BudgetTemplateStatus.Disabled;
                }

                q = q.Where(u => u.BudgetTemplateStatus == budgetSatus);
            }

            // 在查询添加之后,排序和分页之前获取总记录数
            Grid1.RecordCount = q.Count();

            // 排列和数据库分页
            q = SortAndPage <Infobasis.Data.DataEntity.BudgetTemplate>(q, Grid1);

            Grid1.DataSource = q;
            Grid1.DataBind();
        }
        private void BindGrid()
        {
            var     cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            var     ticket = FormsAuthentication.Decrypt(cookie.Value);
            string  uid    = ticket.UserData;
            DataSet ds;
            string  searchText = ttbSearchMessage.Text.Trim();
            string  strWhere   = "";

            if (uid == "4")
            {
                strWhere = "审批状态 = '待生产部审批'";
            }
            else if (uid == "7")
            {
                strWhere = "审批状态 = '待公司领导审批'";
            }
            else
            {
                strWhere = "审批状态 = '爱咋咋反正没有'";
            }

            if (!String.IsNullOrEmpty(searchText))
            {
                strWhere = "批次名称 = '" + searchText + "'";
            }

            ds = m_bllpms_Product_Batch.GetListApp(strWhere);
            // 在查询添加之后,排序和分页之前获取总记录数
            // Grid1总共有多少条记录
            Grid1.RecordCount = ds.Tables[0].Rows.Count;

            ds = m_bllpms_Product_Batch.GetListApp(Grid1.PageSize, Grid1.PageIndex + 1, strWhere);

            Grid1.DataSource = ds.Tables[0];
            Grid1.DataBind();
        }
Exemplo n.º 3
0
        private void BindGrid()
        {
            using (var appdb = new AppContext())
            {
                DateTime now = DateTime.Now;
                DateTime d1  = new DateTime(now.Year, now.Month, 1);
                DateTime d2  = d1.AddDays(-1);
                //d1是本月的第一天,d2本月的最后一天,
                DateTime dtstart = datePickerFrom.SelectedDate == null ? d2 : datePickerFrom.SelectedDate.Value;
                DateTime dtend   = datePickerTo.SelectedDate == null?now.AddDays(2) : datePickerTo.SelectedDate.Value.AddDays(1);

                var qqq = from a in appdb.orderheader
                          select a;

                //在产品名称中搜索
                string searchText = ttbSearchMessage.Text;
                if (!String.IsNullOrEmpty(searchText))
                {
                    qqq = qqq.Where(u => u.OrderNo.Contains(searchText) || u.LotNo.Contains(searchText) || u.Inputer.Contains(searchText) || u.ClientCode.Contains(searchText));
                }
                //searchText为空或者选择“全部”,则列出全部
                else
                {
                }
                qqq = qqq.Where(u => u.RecOrderDate >= dtstart && u.RecOrderDate <= dtend);


                // 在查询添加之后,排序和分页之前获取总记录数
                Grid1.RecordCount = qqq.Count();// q.Count();

                // 排列和数据库分页
                qqq = SortAndPage <OrderHeader>(qqq, Grid1);

                Grid1.DataSource = qqq;// itemq.Take(2);// q;
                Grid1.DataBind();
            }
        }
Exemplo n.º 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string stepId = getStepId(RadioButtonList1.SelectedValue);//获取步骤id
                string sqlCmd = "insert into OA_UseStamp_Main ([reqMan],[reqDte],[useFor],[FlowId],[CurrentStepID],[stampType]) values ";
                sqlCmd += "('" + GetUser() + "','" + DateTime.Now + "',";
                sqlCmd += "'" + TextArea_desc.Text.Trim() + "','" + RadioButtonList1.SelectedValue + "','" + stepId + "','" + RadioButtonList1.SelectedValue + "')";
                int exeCount = SqlSel.ExeSql(sqlCmd);
                if (exeCount > 0)
                {
                    //取当前单据id
                    sqlCmd = "select max(id) from OA_UseStamp_Main";
                    string formId = SqlSel.GetSqlScale(sqlCmd).ToString();
                    //插入附件信息表
                    InsertFiles(formId);

                    Alert.Show("提交成功!");

                    //表单重置
                    SimpleForm1.Reset();
                    Grid1.DataSource = null;
                    Grid1.DataBind();
                    //推送信息至相关审批人
                    pushMessage(stepId, "OA_UseStamp_Main", formId, "用印申请");
                }
                else
                {
                    Alert.Show("提交失败!");
                    return;
                }
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
 protected void Grid1_OnRebind(object sender, EventArgs e)
 {
     BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
     try
     {
         Grid1.DataSource = null;
         Grid1.DataBind();
         CustomProfile profile = CustomProfile.GetProfile();
         HiddenField   hdn     = (HiddenField)UCProductSearchWTW.FindControl("hdnProductSearchSelectedRec");
         List <BrilliantWMS.WMSOutbound.WMS_SP_GetPartDetail_ForTransfer_Result> TRPartList = new List <WMSOutbound.WMS_SP_GetPartDetail_ForTransfer_Result>();
         if (hdn.Value == "")
         {
             TRPartList = Outbound.GetExistingTempDataBySessionIDObjectNameTR(Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr).ToList();
         }
         else if (hdn.Value != "")
         {
             TRPartList = Outbound.AddPartIntoTransfer_TempDataTR(hdn.Value, Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, Convert.ToInt32(hdnFrmWarehouse.Value), profile.DBConnection._constr).ToList();
         }
         Grid1.DataSource = TRPartList;
         Grid1.DataBind();
     }
     catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "WToWTransferDetail.aspx", "Grid1_OnRebind"); }
     finally { Outbound.Close(); }
 }
Exemplo n.º 6
0
        private void BindGrid()
        {
            IList <ICriterion> qryList = new List <ICriterion>();
            string             qryName = ttbSearchMessage.Text.Trim();

            if (!string.IsNullOrEmpty(qryName))
            {
                qryList.Add(Expression.Disjunction()
                            .Add(Expression.Like("CarNO", qryName, MatchMode.Anywhere))
                            .Add(Expression.Like("DriverName", qryName, MatchMode.Anywhere))
                            .Add(Expression.Like("ContractPhone", qryName, MatchMode.Anywhere))
                            );
            }
            Order[] orderList = new Order[1];
            Order   orderli   = new Order(Grid1.SortField, Grid1.SortDirection == "ASC" ? true : false);

            orderList[0] = orderli;
            int             count = 0;
            IList <CarInfo> list  = Core.Container.Instance.Resolve <IServiceCarInfo>().GetPaged(qryList, orderList, Grid1.PageIndex, Grid1.PageSize, out count);

            Grid1.RecordCount = count;
            Grid1.DataSource  = list;
            Grid1.DataBind();
        }
    protected void PopulateGrid()
    {
        DataTable dt = new DataTable();

        for (int i = 1; i <= 10; i++)
        {
            dt.Columns.Add("Col" + i.ToString());
        }

        for (int i = 1; i <= 25000; i++)
        {
            DataRow row = dt.NewRow();

            for (int j = 0; j < dt.Columns.Count; j++)
            {
                row[dt.Columns[j].ColumnName] = "Item " + i.ToString() + "-" + (j + 1).ToString();
            }

            dt.Rows.Add(row);
        }

        Grid1.DataSource = dt;
        Grid1.DataBind();
    }
Exemplo n.º 8
0
        private void Grid1Bind2(string loadType)
        {
            string    sqlcmd = "";
            DataTable dt     = new DataTable();

            if (loadType == "0")
            {
                sqlcmd  = "select (select Gh_id +'/'+ Name from View_Rs_employeeinfo where Gh_id = WorkNo)as name,";
                sqlcmd += "CONVERT(varchar(100), WorkDte, 23) as dte,* from T_DailyWork ";
                sqlcmd += "where exists (select Gh_id from View_Rs_employeeinfo where Gh_id=T_DailyWork.WorkNo and rz_ParentID='" + workNo + "') ";
                sqlcmd += "and Stat='11' and leadergrade is null order by WorkDte desc";
            }
            if (loadType == "1")
            {
                sqlcmd  = "select (select Gh_id +'/'+ Name from View_Rs_employeeinfo where Gh_id = WorkNo)as name,";
                sqlcmd += "CONVERT(varchar(100), WorkDte, 23) as dte,* from T_DailyWork ";
                sqlcmd += "where exists (select Gh_id from View_Rs_employeeinfo where Gh_id=T_DailyWork.WorkNo and rz_ParentID='" + workNo + "') ";
                sqlcmd += "and workdte>'" + DateTime.Now.AddDays(-3).ToShortDateString() + "' ";
                sqlcmd += "and Stat='11' and leadergrade is not null order by WorkDte desc";
            }
            SqlSel.GetSqlSel(ref dt, sqlcmd);
            Grid1.DataSource = dt;
            Grid1.DataBind();
        }
Exemplo n.º 9
0
    protected void Grid1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int R, T;

        R = Convert.ToInt32(ddlReports.SelectedValue);
        T = Convert.ToInt32(ddlTypes.SelectedValue);

        Grid1.DataSource = GroupMaster.GetReportTypesTasksList(R, T);
        Grid1.DataBind();

        if (Grid1.Rows.Count > 1)
        {
            btnSort.Visible = true;
        }
        else
        {
            btnSort.Visible = false;
        }

        Grid2.DataSource = GroupMaster.GetReportTypesTasksList2(R, T);
        Grid2.DataBind();

        Grid1.EditIndex = -1;
    }
Exemplo n.º 10
0
        private void bindGrid(string userId, string dt1, string dt2)
        {
            string sqlCmd = "";

            if (userId == "all")
            {
                sqlCmd  = "select A.*,c.chineseName,d.deptName,t.flowName from OA_Leave_Main A";
                sqlCmd += " left join OA_Sys_EmployeeInfo c on c.id=a.reqMan left join OA_sys_department d on d.id=c.deptId";
                sqlCmd += " left join OA_sys_flow t on t.id=A.flowId where A.CurrentStepID='0' and reqMan in (select id from OA_Sys_EmployeeInfo";
                sqlCmd += " where deptId like '" + ddl_dept.SelectedValue + "') and convert(nvarchar(20),strTime,23)>='" + dt1 + "' and convert(nvarchar(20),strTime,23)<='" + dt2 + "' order by reqMan,reqDte,flowId";
            }
            else
            {
                sqlCmd  = "select A.*,c.chineseName,d.deptName,t.flowName from OA_Leave_Main A";
                sqlCmd += " left join OA_Sys_EmployeeInfo c on c.id=a.reqMan left join OA_sys_department d on d.id=c.deptId";
                sqlCmd += " left join OA_sys_flow t on t.id=A.flowId where A.CurrentStepID='0' and reqMan='" + userId + "'";
                sqlCmd += " and convert(nvarchar(20),strTime,23)>='" + dt1 + "' and convert(nvarchar(20),strTime,23)<='" + dt2 + "' order by reqMan,reqDte,flowId";
            }
            DataTable dt = new DataTable();

            SqlSel.GetSqlSel(ref dt, sqlCmd);
            Grid1.DataSource = dt;
            Grid1.DataBind();
        }
        private void bindEvaluatedToGrid()
        {
            string    exception = "";
            DataTable table     = new DataTable();

            if (DropDownList1.SelectedValue == "0")
            {
                if (EvaluationManagementCtrl.GetEvaluatedThisYear(ref table, ref exception))
                {
                    Grid1.DataSource = table;
                    Grid1.DataBind();
                }
                else
                {
                    table.Clear();
                    Grid1.DataSource = table;
                    Grid1.DataBind();
                    //Alert.ShowInTop("查询被考评人信息失败!\n原因:" + exception, MessageBoxIcon.Error);
                }
            }
            else
            {
                if (EvaluationManagementCtrl.GetEvaluatedAll(ref table, ref exception))
                {
                    Grid1.DataSource = table;
                    Grid1.DataBind();
                }
                else
                {
                    table.Clear();
                    Grid1.DataSource = table;
                    Grid1.DataBind();
                    //Alert.ShowInTop("查询被考评人信息失败!\n原因:" + exception, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 12
0
        private void BindGrid()
        {
            IList <ICriterion> qryList = new List <ICriterion>();

            qryList.Add(Expression.Eq("VipID", _id));
            if (!string.IsNullOrEmpty(dpkSatrt.Text.Trim()))
            {
                qryList.Add(Expression.Ge("PrepaidDate", DateTime.Parse(dpkSatrt.Text.Trim())));
            }
            if (!string.IsNullOrEmpty(dpkEnd.Text.Trim()))
            {
                qryList.Add(Expression.Lt("PrepaidDate", DateTime.Parse(dpkEnd.Text.Trim()).AddDays(1)));
            }
            Order[] orderList = new Order[1];
            Order   orderli   = new Order(Grid1.SortField, Grid1.SortDirection == "DESC" ? true : false);

            orderList[0] = orderli;
            int count = 0;
            IList <tm_VIPPrepaid> list = Core.Container.Instance.Resolve <IServiceVIPPrepaid>().GetPaged(qryList, orderList, Grid1.PageIndex, Grid1.PageSize, out count);

            Grid1.RecordCount = count;
            Grid1.DataSource  = list;
            Grid1.DataBind();
        }
Exemplo n.º 13
0
    protected void ddlGroups_ItemSelected(object sender, DropDownListEventArgs e)
    {
        string sGroup = ddlGroups.SelectedValue.ToString();

        Grid1.DataSource = mtVendor.GetUsedVendors(sGroup);
        Grid1.DataBind();

        Grid2.DataSource = mtVendor.GetNotUsedVendors(sGroup);
        Grid2.DataBind();

        //if (Grid1.Rows.Count > 1)
        //{
        //    btnSort.Visible = true;
        //}
        //else
        //{
        //    btnSort.Visible = false;
        //}

        //Grid2.DataSource = GroupMaster.GetReportTypesTasksList2(R, T);
        //Grid2.DataBind();

        pnlSort.Visible = false;
    }
Exemplo n.º 14
0
        private void BindGrid()
        {
            //获取调拨仓库信息
            IList <ICriterion> qryListWH = new List <ICriterion>();

            qryListWH.Add(Expression.Eq("OrderNO", OrderNO));
            tm_GoodsAllocationBill orderInfo = Core.Container.Instance.Resolve <IServiceGoodsAllocationBill>().GetEntityByFields(qryListWH);

            if (orderInfo != null && orderInfo.CKWareHouseID > 0)
            {
                IList <ICriterion> qryList = new List <ICriterion>();
                string             qryName = ttbSearchMessage.Text.Trim();
                if (!string.IsNullOrEmpty(qryName))
                {
                    qryList.Add(Expression.Like("GoodsName", qryName, MatchMode.Anywhere) ||
                                Expression.Like("GoodsPY", qryName.ToUpper(), MatchMode.Anywhere));
                }
                if (ddlCostType.SelectedValue != "0")
                {
                    qryList.Add(Expression.Eq("GoodsTypeID", int.Parse(ddlCostType.SelectedValue)));
                }
                qryList.Add(Expression.Eq("WareHouseID", orderInfo.CKWareHouseID));
                Order[] orderList = new Order[1];
                Order   orderli   = new Order("ID", true);
                orderList[0] = orderli;
                int count = 0;
                IList <WHGoodsDetail> list = Core.Container.Instance.Resolve <IServiceWHGoodsDetail>().GetAllByKeys(qryList, orderList);
                //Grid1.RecordCount = count;
                Grid1.DataSource = list;
                Grid1.DataBind();
            }
            else
            {
                Alert.Show("调拨单调拨出库仓库没有指定!");
            }
        }
Exemplo n.º 15
0
 protected void btTimKiem_Click(object sender, EventArgs e)
 {
     if (Validate())
     {
         var pageSize = 200;
         var sps      = new SearchProjectSetting();
         sps.MaDuAn             = txtMaDuAn.Text;
         sps.LoaiDuAn           = ddlLoaiDuAn.SelectedValue;
         sps.NhomDuAn           = (NhomDuAn)Enum.Parse(typeof(NhomDuAn), ddlNhomDuAn.SelectedValue);
         sps.LoaiNguonVon       = (LoaiNguonVon)Enum.Parse(typeof(LoaiNguonVon), ddlLoaiNguonVon.SelectedValue);
         sps.PhanCap            = (LoaiPhanCap)Enum.Parse(typeof(LoaiPhanCap), ddlPhanCap.SelectedValue);
         sps.MaDonViQuanLy      = ddlDonViQuanLyDT.SelectedValue;
         sps.MaDonViThucHien    = ddlDonViChuDT.SelectedValue;
         sps.TongVonDauTuToanTu = ddlTTTongVonDT.SelectedValue;
         sps.TongVonDauTu       = Int64.Parse(txtTongVonDT.Text == "" ? "0" : txtTongVonDT.Text);
         sps.NamBatDauToanTu    = ddlTTThoiGianPhatSinh.SelectedValue;
         sps.NamBatDau          = Int32.Parse(ddlThoiGianPhatSinh.SelectedValue);// Int32.Parse(txtThoiGianPhatSinh.Text == "" ? "0" : txtThoiGianPhatSinh.Text);
         sps.NamKetThucToanTu   = ddlTTThoiGianKetThuc.SelectedValue;
         sps.NamKetThuc         = Int32.Parse(ddlThoiGianKetThuc.SelectedValue);
         ListDuAnModelGridView result = giamsatService.TimKiemDuAn("", "", "", sps, pageSize, 1);
         Grid1.DataSource = result.DuAnModelsGridView;
         Grid1.DataBind();
     }
 }
Exemplo n.º 16
0
        /// <summary>
        ///     绑定数据表格
        /// </summary>
        private void BindDataGrid()
        {
            var parms = new Dictionary <string, object>();

            parms.Clear();
            string strWhere = string.Empty;

            if (!string.IsNullOrWhiteSpace(txtFName.Text.Trim()))
            {
                strWhere += " and c.FName like '%" + txtFName.Text.Trim() + "%'";
            }
            if (!string.IsNullOrWhiteSpace(this.txtFItemName.Text.Trim()))
            {
                strWhere += " and d.FName like '%" + txtFItemName.Text.Trim() + "%'";
            }
            if (!string.IsNullOrWhiteSpace(this.txtminPrice.Text.Trim()))
            {
                strWhere += " and b.FPrice >=" + this.txtminPrice.Text.Trim();
            }
            if (!string.IsNullOrWhiteSpace(this.txtMaxPrice.Text.Trim()))
            {
                strWhere += " and b.FPrice <=" + this.txtMaxPrice.Text.Trim();
            }
            //strWhere += " and a.FCreatedon>='"++"'";
            //parms.Add("@Customer", txtFName.Text.Trim());
            ////parms.Add("@beginDate", Convert.ToDateTime(dpkFDateBegin.SelectedDate).ToString("yyyy-MM-dd 00:00:00"));
            ////parms.Add("@endDate", Convert.ToDateTime(dpkFDateEnd.SelectedDate).ToString("yyyy-MM-dd 23:59:59"));
            //parms.Add("@ProductName", this.txtFItemName.Text.Trim());
            //parms.Add("@minPrice", this.txtminPrice.Text.Trim());
            parms.Add("@strSQL", strWhere);
            var list = SqlService.ExecuteProcedureCommand("proc_GetContractList", parms).Tables[0];

            //绑定数据源
            Grid1.DataSource = list;
            Grid1.DataBind();
        }
Exemplo n.º 17
0
        private void BindGrid()
        {
            IList <ICriterion> qryList = new List <ICriterion>();
            string             qryName = ttbSearchMessage.Text.Trim();

            if (!string.IsNullOrEmpty(qryName))
            {
                qryList.Add(Expression.Like("PrinterName", qryName, MatchMode.Anywhere));
            }
            if (ddlPrinterType.SelectedValue != "0")
            {
                qryList.Add(Expression.Eq("PrinterType", ddlPrinterType.SelectedValue));
            }
            Order[] orderList = new Order[1];
            Order   orderli   = new Order(Grid1.SortField, Grid1.SortDirection == "ASC" ? true : false);

            orderList[0] = orderli;
            int count = 0;
            IList <tm_Printer> list = Core.Container.Instance.Resolve <IServicePrinter>().GetPaged(qryList, orderList, Grid1.PageIndex, Grid1.PageSize, out count);

            Grid1.RecordCount = count;
            Grid1.DataSource  = list;
            Grid1.DataBind();
        }
Exemplo n.º 18
0
        private void BindGrid()
        {
            using (var appdb = new AppContext())
            {
                IQueryable <RLItems> q = appdb.allitems;

                // 在职务名称中搜索
                string searchText = ttbSearchMessage.Text.Trim();

                if (!String.IsNullOrEmpty(searchText))
                {
                    q = q.Where(t => t.ItemName.Contains(searchText) || t.Sclass.Contains(searchText) || t.Material.Contains(searchText) || t.ItemNo.Contains(searchText));
                }

                // 在查询添加之后,排序和分页之前获取总记录数
                Grid1.RecordCount = q.Count();

                // 排列和分页
                q = SortAndPage <RLItems>(q, Grid1);

                Grid1.DataSource = q;
                Grid1.DataBind();
            }
        }
        protected void btnAddTrainClass_Click(object sender, EventArgs e)
        {
            if (Grid1.EditIndex != -1 && Grid1.Rows.Count > 0)
            {
                SessionSet.PageMessage = "请先保存您正在编辑的项!";
                return;
            }

            DataTable dataTable = null;

            dataTable = BindGrid();
            DataRow newRow = dataTable.NewRow();

            newRow["RandomExamTrainClassID"] = 0;
            newRow["RandomExamID"]           = 0;
            newRow["TrainClassID"]           = 0;
            newRow["TrainClassName"]         = "";
            newRow["TrainClassSubjectID"]    = 0;
            newRow["TrainClassSubjectName"]  = "";

            dataTable.Rows.InsertAt(newRow, 0);

            Grid1.EditIndex  = 0;
            Grid1.DataSource = dataTable;
            Grid1.DataBind();

            ViewState["IsNewGoods"] = true;

            DropDownList ddlTrainClass = (DropDownList)Grid1.Rows[0].FindControl("ddlTrainClass");

            BindTrainClass(ddlTrainClass, PrjPub.CurrentLoginUser.StationOrgID.ToString());

            DropDownList ddlTrainClassSubject = (DropDownList)Grid1.Rows[0].FindControl("ddlTrainClassSubject");

            BindSubject(ddlTrainClassSubject, "0");
        }
Exemplo n.º 20
0
        private void BindGrid()
        {
            string strIDPath = Request.QueryString["idpath"];

            EmployeeBLL employeeBLL = new EmployeeBLL();
            IList <RailExam.Model.Employee> employees = new List <RailExam.Model.Employee>();

            if (Request.QueryString.Get("type") == "Org")
            {
                if (strIDPath == "/1")
                {
                    employees = employeeBLL.GetEmployees(1, "");
                }
                else
                {
                    employees = employeeBLL.GetEmployeesByOrgIDPath(strIDPath);
                }
            }
            else
            {
                if (PrjPub.CurrentLoginUser.SuitRange == 1)
                {
                    employees = employeeBLL.GetEmployees(-1, strIDPath);
                }
                else
                {
                    employees = employeeBLL.GetEmployees(PrjPub.CurrentLoginUser.StationOrgID, strIDPath);
                }
            }

            if (employees != null)
            {
                Grid1.DataSource = employees;
                Grid1.DataBind();
            }
        }
Exemplo n.º 21
0
        private void BindGrid()
        {
            IQueryable <User> q    = DB.Users.Include(u => u.Dept);
            string            dept = rbtDept.SelectedValue;

            q = q.Where(u => u.Dept.Name == dept);
            // 在用户名称中搜索
            string searchText = ttbSearchMessage.Text.Trim();

            if (!String.IsNullOrEmpty(searchText))
            {
                q = q.Where(u => u.Name.Contains(searchText) || u.ChineseName.Contains(searchText) || u.EnglishName.Contains(searchText));
            }


            // 在查询添加之后,排序和分页之前获取总记录数
            Grid1.RecordCount = q.Count();

            // 排列和数据库分页
            q = SortAndPage <User>(q, Grid1);

            Grid1.DataSource = q;
            Grid1.DataBind();
        }
Exemplo n.º 22
0
        /// <summary>
        /// 列表绑定
        /// </summary>
        private void BindGrid()
        {
            string strSql = @"SELECT *,(CASE WHEN IsAgree =1 THEN '同意' WHEN IsAgree =0 THEN '不同意' ELSE '' END) AS IsAgreeName"
                            + @" ,(CASE WHEN IsRatified =1 THEN '同意' WHEN IsRatified =0 THEN '不同意' ELSE '' END) AS IsRatifiedName"
                            + @" FROM dbo.CostGoods_HSSECostUnitManageItem"
                            + @" WHERE HSSECostUnitManageId=@HSSECostUnitManageId AND Type =@Type";
            List <SqlParameter> listStr = new List <SqlParameter>
            {
                new SqlParameter("@HSSECostUnitManageId", this.HSSECostUnitManageId),
                new SqlParameter("@Type", this.Type),
            };

            SqlParameter[] parameter = listStr.ToArray();
            DataTable      tb        = SQLHelper.GetDataTableRunText(strSql, parameter);

            // 2.获取当前分页数据
            //var table = this.GetPagedDataTable(Grid1, tb1);
            Grid1.RecordCount = tb.Rows.Count;
            tb = GetFilteredTable(Grid1.FilteredData, tb);
            var table = this.GetPagedDataTable(Grid1, tb);

            Grid1.DataSource = table;
            Grid1.DataBind();
        }
Exemplo n.º 23
0
        private void BindGridByKnowledgeID()
        {
            int knowledgeID = Convert.ToInt32(ViewState["KnowledgeID"]);

            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> bookList = bookBLL.GetBookByKnowledgeID(knowledgeID, 200);

            if (ViewState["PostID"] != null && ViewState["PostID"].ToString() != "undefined")
            {
                int postID = Int32.Parse(ViewState["PostID"].ToString());
                bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(knowledgeID, 200, postID, 0, 1, 0);
            }

            if (bookList.Count > 0)
            {
                foreach (RailExam.Model.Book book in bookList)
                {
                    book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName + " </a>";
                }

                Grid1.DataSource = bookList;
                Grid1.DataBind();
            }
        }
Exemplo n.º 24
0
        private void databind()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Cusname", typeof(System.String));
            dt.Columns.Add("id", typeof(System.Int32));
            dt.Columns.Add("type", typeof(System.String));

            DataRow row = dt.NewRow();

            row["Cusname"] = "客户名称";
            row["id"]      = 1;
            row["type"]    = "123";
            dt.Rows.Add(row);//这样就可以添加了
            row            = dt.NewRow();
            row["Cusname"] = "客户名称";
            row["id"]      = 2;
            row["type"]    = "456";
            dt.Rows.Add(row);


            Grid1.DataSource = dt.DefaultView;
            Grid1.DataBind();
        }
Exemplo n.º 25
0
    private void BindGrid(string ID)
    {
        StringBuilder cmdTxt = new StringBuilder();

        string connectionString = ConfigurationManager.ConnectionStrings["ERPconnectionstring"].ToString();

        Ede.Uof.Utility.Data.DatabaseHelper m_db = new Ede.Uof.Utility.Data.DatabaseHelper(connectionString);

        cmdTxt.AppendFormat(@" 
                            SELECT 
                            [ID]
                            ,[MID]
                            ,[MB001]
                            ,[MB002]
                            ,[MB003]
                            ,[MB004]
                            ,[PRICES]
                            ,[SPRICES]
                            ,[COSTS]
                            ,[NUMS]
                            ,[MONEYS]
                            ,[FEES]
                            ,[EARNS]
                            FROM [TKBUSINESS].[dbo].[TBPROMOTIONNFEEPRODUCTS]
                            WHERE [MID]=@MID
                            ");

        m_db.AddParameter("@MID", ID);

        DataTable dt = new DataTable();

        dt.Load(m_db.ExecuteReader(cmdTxt.ToString()));

        Grid1.DataSource = dt;
        Grid1.DataBind();
    }
Exemplo n.º 26
0
        /// <summary>
        /// Grid1行点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
        {
            string checkDayDetailId = Grid1.DataKeys[e.RowIndex][0].ToString();

            Model.Check_CheckDayDetail detail = BLL.Check_CheckDayDetailService.GetCheckDayDetailByCheckDayDetailId(checkDayDetailId);
            if (e.CommandName == "click")
            {
                Model.Check_CheckDayDetail newDetail = new Model.Check_CheckDayDetail
                {
                    CheckDayDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckDayDetail)),
                    CheckDayId       = detail.CheckDayId,
                    CheckItem        = detail.CheckItem,
                    CheckContent     = detail.CheckContent,
                    Unqualified      = "隐患",
                    Suggestions      = "整改",
                    CompleteStatus   = true
                };
                BLL.Check_CheckDayDetailService.AddCheckDayDetail(newDetail);
                checkDayDetails  = (from x in Funs.DB.View_Check_CheckDayDetail where x.CheckDayId == this.CheckDayId orderby x.CheckItem select x).ToList();
                Grid1.DataSource = checkDayDetails;
                Grid1.DataBind();
                SetColor();
            }
        }
Exemplo n.º 27
0
        private void bindGrid(string userId, string dt1, string dt2)
        {
            string sqlCmd = "";

            if (userId == "all")
            {
                sqlCmd  = "select A.*,c.chineseName,d.deptName from OA_Attendence_Record A";
                sqlCmd += " left join OA_Sys_EmployeeInfo c on c.id=a.userId left join OA_sys_department d on d.id=c.deptId";
                sqlCmd += " where userId in (select id from OA_Sys_EmployeeInfo";
                sqlCmd += " where deptId like '" + ddl_dept.SelectedValue + "') and recordDate>='" + dt1 + "' and recordDate<='" + dt2 + "' order by recordDate";
            }
            else
            {
                sqlCmd  = "select A.*,c.chineseName,d.deptName from OA_Attendence_Record A";
                sqlCmd += " left join OA_Sys_EmployeeInfo c on c.id=a.userId left join OA_sys_department d on d.id=c.deptId";
                sqlCmd += " where userId='" + userId + "'";
                sqlCmd += " and recordDate>='" + dt1 + "' and recordDate<='" + dt2 + "' order by recordDate";
            }
            DataTable dt = new DataTable();

            SqlSel.GetSqlSel(ref dt, sqlCmd);
            Grid1.DataSource = dt;
            Grid1.DataBind();
        }
        private void BindGrid(string strOrderBy)
        {
            int         startRow   = int.Parse(ViewState["StartRow"].ToString());
            int         endRow     = int.Parse(ViewState["EndRow"].ToString());
            int         nItemcount = 0;
            EmployeeBLL psBLL      = new EmployeeBLL();

            ViewState["PinYin"]       = txtPinYin.Text;
            ViewState["WorkNo"]       = txtWorkNo.Text;
            ViewState["EmployeeName"] = txtEmployeeName.Text;
            IList <RailExam.Model.Employee> Employees = psBLL.GetEmployeesSelect(Convert.ToInt32(ddlOrg.SelectedValue), ViewState["PinYin"].ToString(), ViewState["WorkNo"].ToString(), ViewState["EmployeeName"].ToString(), strOrderBy, startRow, endRow, ref nItemcount);

            if (Employees.Count > 0)
            {
                Grid1.VirtualItemCount = nItemcount;
                Grid1.DataSource       = Employees;
                Grid1.DataBind();
                ViewState["EmptyFlag"] = 0;
            }
            else
            {
                BindEmptyGrid1();
            }
        }
Exemplo n.º 29
0
 private void BindData()
 {
     try
     {
         StringBuilder condition = new StringBuilder("WHERE 1=1");
         string        key       = StringHelper.ClearSqlStringExSpace(ttbSearchKey.Text.Trim());
         if (key.Length > 0)
         {
             condition.AppendFormat(" AND [R_NAME] like '%{0}%'", key);
         }
         int recordCount = 0;
         using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStringByDefaultDB, "*", "[S_ROLE]", condition.ToString(), "ORDER BY R_ORDERID ASC", Grid1.PageIndex + 1, Grid1.PageSize, out recordCount))
         {
             Grid1.RecordCount = recordCount;
             Grid1.DataSource  = dt;
             Grid1.DataBind();
         }
     }
     catch (Exception ex)
     {
         logger.Error("S.R.Manage.BindData():Exception", ex);
         Alert.ShowInParent("系统错误。");
     }
 }
        protected void  级单位_SelectedIndexChanged(object sender, EventArgs e)
        {
            string str盘点类型  = 盘点类型.SelectedText;
            string name     = 级单位.SelectedText;
            int    用户二级部门ID = Convert.ToInt32(Session["二级部门ID"]);
            int    盘点主表ID   = Convert.ToInt32(盘点名称.SelectedValue);

            if (name == "全部")
            {
                //Grid1.RecordCount = bll.查询盘点设备总数("全部", 2);
                Grid1.RecordCount = bll.查询已盘点总数(盘点主表ID, 用户二级部门ID, "全部", str盘点类型);
                Grid1.DataSource  = bll.查询已盘点数据(盘点主表ID, 用户二级部门ID, "", "全部", str盘点类型, Grid1.PageIndex, Grid1.PageSize);
                Grid1.DataBind();
            }
            else
            {
                int ID = Convert.ToInt32(级单位.SelectedValue);
                //Grid1.RecordCount = bll.查询盘点设备总数(name, ID);
                //DataTable table = GetSourceData();
                Grid1.RecordCount = bll.查询已盘点总数(盘点主表ID, ID, "部门", str盘点类型);
                Grid1.DataSource  = bll.查询已盘点数据(盘点主表ID, ID, "", "部门", str盘点类型, Grid1.PageIndex, Grid1.PageSize);
                Grid1.DataBind();
            }
        }