private void cbbXM_SelectedIndexChanged(object sender, EventArgs e) { var temp = cbbXM.SelectedValue.ToString(); SqlParameter[] p = new SqlParameter[] { new SqlParameter("@ProjectNo", temp) }; var dbc = db.GetSqlStringCommand("SELECT distinct [PartNo] text,[PartNo] value FROM [MeasurementReports] WHERE ProjectNo=@ProjectNo"); dbc.Parameters.AddRange(p); var ds = db.ExecuteDataSet(dbc); if (null != ds) { var dt = ds.Tables[0]; DataRow newRow; newRow = dt.NewRow(); newRow["text"] = "==请选择零件号=="; newRow["value"] = ""; dt.Rows.InsertAt(newRow, 0); cbbLJ.ValueMember = "value"; cbbLJ.DisplayMember = "text"; cbbLJ.DataSource = dt; } }
private void bind() { string status = ""; string PreWwarningTimeStart = ""; string PreWwarningTimeEnd = ""; if (!cbbStatus.SelectedItem.ToString().Contains("请选择")) { if (cbbStatus.SelectedItem.ToString().Contains("未处理")) { status = "0"; } else { status = "1"; } } if (!(dateTimePicker1.CustomFormat == " ")) { PreWwarningTimeStart = dateTimePicker1.Value.ToString().Trim(); } if (!(dateTimePicker2.CustomFormat == " ")) { PreWwarningTimeEnd = dateTimePicker2.Value.ToString().Trim(); } SqlParameter[] p = new SqlParameter[] { new SqlParameter("@PreWwarningTimeStart", PreWwarningTimeStart), new SqlParameter("@PreWwarningTimeEnd", PreWwarningTimeEnd), new SqlParameter("@status", status) }; string sql = @"SELECT [id],[Message],[Filed1],[Filed2],[WarningType],[PreWwarningTime],[DoTime],case when status = 0 then '未处理' else '已处理' end as [status] FROM [dbo].[Warnings] where (''=@PreWwarningTimeStart or ''=@PreWwarningTimeEnd or (PreWwarningTime>=@PreWwarningTimeStart and PreWwarningTime<=@PreWwarningTimeEnd) ) and (''=@status or status=@status) "; var dbc = db.GetSqlStringCommand(sql); dbc.Parameters.AddRange(p); var ds = db.ExecuteDataSet(dbc); GvList.DataSource = ds.Tables[0]; }
private void GvBind() { SqlParameter[] p = new SqlParameter[] { new SqlParameter("@ProjectNo", cbbXM.SelectedValue), new SqlParameter("@PartNo", cbbLJ.SelectedValue) }; var dbc = db.GetSqlStringCommand("SELECT [MeasReportID],[ProjectNo],[PartNo],[PartName],[CreateTime] FROM [MeasurementReports] WHERE (''=@ProjectNo OR [ProjectNo]=@ProjectNo) AND (''=@PartNo OR [PartNo]=@PartNo)"); dbc.Parameters.AddRange(p); var ds = db.ExecuteDataSet(dbc); GvList.DataSource = ds.Tables[0]; }
/// <summary> /// 获取系统车型 /// </summary> /// <param name="companyId">公司编号</param> /// <returns></returns> public IList <EyouSoft.Model.ComStructure.MComCarType> GetList(string companyId) { IList <EyouSoft.Model.ComStructure.MComCarType> list = null; string query = "Select * from tbl_ComCarType where CompanyId=@CompanyId and IsDelete='0' "; DbCommand cmd = _db.GetSqlStringCommand(query); this._db.AddInParameter(cmd, "CompanyId", DbType.AnsiStringFixedLength, companyId); using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db)) { list = new List <EyouSoft.Model.ComStructure.MComCarType>(); while (dr.Read()) { MComCarType item = new MComCarType() { CarTypeId = dr["CarTypeId"].ToString(), CarTypeName = !dr.IsDBNull(dr.GetOrdinal("CarTypeName")) ? dr.GetString(dr.GetOrdinal("CarTypeName")) : null, CompanyId = dr["CompanyId"].ToString(), Desc = !dr.IsDBNull(dr.GetOrdinal("Desc")) ? dr.GetString(dr.GetOrdinal("Desc")) : null, Operator = !dr.IsDBNull(dr.GetOrdinal("Operator")) ? dr.GetString(dr.GetOrdinal("Operator")) : null, OperatorId = dr["OperatorId"].ToString(), SeatNum = dr.GetInt32(dr.GetOrdinal("SeatNum")), TemplateId = dr["TemplateId"].ToString() }; list.Add(item); } } return(list); }
/// <summary> /// 获取上车地点实体 /// </summary> /// <param name="CarLocationId">上车地点编号</param> /// <returns>上车地点实体</returns> public MComCarLocation GetModel(string CarLocationId) { MComCarLocation model = null; string sql = "SELECT [CarLocationId],[CompanyId],[Location],[OffPrice],[OnPrice],[Desc],[Status],[OperatorId],[Operator],[IsDelete] FROM [tbl_ComCarLocation] Where CarLocationId=@CarLocationId"; DbCommand cmd = _db.GetSqlStringCommand(sql); this._db.AddInParameter(cmd, "CarLocationId", DbType.AnsiStringFixedLength, CarLocationId); using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db)) { if (dr.Read()) { model = new MComCarLocation() { CarLocationId = dr["CarLocationId"].ToString(), CompanyId = dr["CompanyId"].ToString(), Desc = !dr.IsDBNull(dr.GetOrdinal("Desc")) ? dr.GetString(dr.GetOrdinal("Desc")) : null, Location = !dr.IsDBNull(dr.GetOrdinal("Location")) ? dr.GetString(dr.GetOrdinal("Location")) : null, OffPrice = dr.GetDecimal(dr.GetOrdinal("OffPrice")), OnPrice = dr.GetDecimal(dr.GetOrdinal("OnPrice")), Operator = dr.GetString(dr.GetOrdinal("Operator")), OperatorId = dr.GetString(dr.GetOrdinal("OperatorId")), Status = dr.GetString(dr.GetOrdinal("Status")) == "1" ? true : false }; } } return(model); }
private void bind() { SqlParameter[] p = new SqlParameter[] { new SqlParameter("@MeasReportID", id) }; var dbc = db.GetSqlStringCommand("SELECT [MeasItemID],[MeasReportID],[MeasItemNO] FROM [MeasurementItems] where MeasReportID=@MeasReportID"); dbc.Parameters.AddRange(p); var ds = db.ExecuteDataSet(dbc); GvList.DataSource = ds.Tables[0]; }
/// <summary> /// Create sql string command. /// </summary> /// <param name="query">sql query.</param> /// <returns>Returns the Db command.</returns> public static DbCommand GetSqlStringCommand(string query) { DbCommand dbCommand = null; try { Microsoft.Practices.EnterpriseLibrary.Data.Database db = DBSelector.Instance.GetDataBase; dbCommand = db.GetSqlStringCommand(query); } catch (Exception ex) { throw ex; } return dbCommand; }
/// <summary> /// Returns an object by executing a scalar function /// </summary> /// <param name="commandText"></param> /// <returns>Object</returns> public static Object ExecuteScalarString(string commandText) { object obj = new object(); try { Microsoft.Practices.EnterpriseLibrary.Data.Database db = DBSelector.Instance.GetDataBase; DbCommand command = db.GetSqlStringCommand(commandText); obj = db.ExecuteScalar(command); } catch (Exception ex) { throw ex; } return obj; }
/// <summary> /// 选中页码上传图片 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtYM.Text.Trim())) { MessageBox.Show("页码不能为空!"); return; } //创建一个对话框对象 OpenFileDialog ofd = new OpenFileDialog(); //为对话框设置标题 ofd.Title = "请选择上传的图片"; //设置筛选的图片格式 ofd.Filter = "图片格式|*.jpg"; //设置是否允许多选 ofd.Multiselect = false; //如果你点了“确定”按钮 if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //获得文件的完整路径(包括名字后后缀) string filePath = ofd.FileName; int position = filePath.LastIndexOf("\\"); //从完整路径中截取出来文件名“1.jpg” string fileName = filePath.Substring(position + 1); Byte[] bytes = GetContent(filePath); MemoryStream ms = new MemoryStream(bytes); //测点信息表上传图片 string strMeasPageID = GetMeasPageID(comboBox1.SelectedValue.ToString(), comboBox2.SelectedValue.ToString(), txtYM.Text.Trim()); string strSqlMeasPage = " update MeasurementPages set MeasPageImage=@Picture " + " where MeasPageID=" + strMeasPageID; DbCommand dbc = db.GetSqlStringCommand(strSqlMeasPage); db.AddInParameter(dbc, "@Picture", DbType.AnsiString, bytes); int ipa = db.ExecuteNonQuery(dbc); this.pictureBox1.Image = Image.FromStream(ms); } }
private void btnOk_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtUser.Text.Trim()) || string.IsNullOrWhiteSpace(txtPwd.Text)) { MessageBox.Show("用户名,密码不能是空"); } else { SqlParameter[] p = new SqlParameter[] { new SqlParameter("@username", txtUser.Text.Trim()), new SqlParameter("@userType", UserType.Application) }; var dbc = db.GetSqlStringCommand("select * from Users where username=@username and userType=@userType"); dbc.Parameters.AddRange(p); var ds = db.ExecuteDataSet(dbc); if (null != ds && ds.Tables[0].Rows.Count > 0) { var pwd = ds.Tables[0].Rows[0]["password"].ToString(); if (txtPwd.Text.Trim() != pwd) { MessageBox.Show("用户名,密码不正确"); } else { base.DialogResult = DialogResult.OK; } } else { MessageBox.Show("用户名,密码不正确"); } } }
/// <summary> /// 根据订单的编号、(修改或变更)获取订单变更列表 /// </summary> /// <param name="OrderId">订单编号</param> /// <param name="changeType">变更或修改</param> /// <returns></returns> public IList <MTourOrderChange> GetTourOrderChangeList(string OrderId, ChangeType?changeType) { IList <MTourOrderChange> list = null; StringBuilder query = new StringBuilder(); query.Append(" SELECT "); query.Append("Id,CompanyId,TourId,RouteId,RouteName,TourSaleId,TourSale,OrderId,OrderCode"); query.Append(",ChangePerson,ChangePrice,OrderSaleId,OrderSale,Content,OperatorId"); query.Append(",Operator,IssueTime,ChangeType,IsSure,SurePersonId,SurePerson,SureTime"); query.Append(" FROM "); query.Append("tbl_TourOrderChange"); query.Append(" Where "); query.AppendFormat("OrderId='{0}'", OrderId); if (changeType.HasValue) { query.AppendFormat(" and ChangeType={0}", (int)changeType.Value); } DbCommand cmd = _db.GetSqlStringCommand(query.ToString()); using (IDataReader dr = DbHelper.ExecuteReader(cmd, _db)) { if (dr != null) { list = new List <MTourOrderChange>(); while (dr.Read()) { MTourOrderChange change = new MTourOrderChange(); change.Id = dr.GetString(dr.GetOrdinal("Id")); change.CompanyId = dr.GetString(dr.GetOrdinal("CompanyId")); change.TourId = dr.GetString(dr.GetOrdinal("TourId")); change.RouteId = !dr.IsDBNull(dr.GetOrdinal("RouteId")) ? dr.GetString(dr.GetOrdinal("RouteId")) : string.Empty; change.RouteName = !dr.IsDBNull(dr.GetOrdinal("RouteName")) ? dr["RouteName"].ToString() : string.Empty; change.TourSaleId = dr.GetString(dr.GetOrdinal("TourSaleId")); change.TourSale = !dr.IsDBNull(dr.GetOrdinal("TourSale")) ? dr["TourSale"].ToString() : string.Empty; change.OrderId = dr.GetString(dr.GetOrdinal("OrderId")); change.OrderCode = !dr.IsDBNull(dr.GetOrdinal("OrderCode")) ? dr.GetString(dr.GetOrdinal("OrderCode")) : string.Empty; change.ChangePerson = dr.GetInt32(dr.GetOrdinal("ChangePerson")); change.ChangePrice = dr.GetDecimal(dr.GetOrdinal("ChangePrice")); change.OrderSaleId = dr.GetString(dr.GetOrdinal("OrderSaleId")); change.OrderSale = !dr.IsDBNull(dr.GetOrdinal("OrderSale")) ? dr["OrderSale"].ToString() : string.Empty; change.Content = !dr.IsDBNull(dr.GetOrdinal("Content")) ? dr["Content"].ToString() : string.Empty; change.OperatorId = dr.GetString(dr.GetOrdinal("OperatorId")); change.Operator = !dr.IsDBNull(dr.GetOrdinal("Operator")) ? dr["Operator"].ToString() : string.Empty; change.IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime")); change.ChangeType = (ChangeType)dr.GetByte(dr.GetOrdinal("ChangeType")); change.IsSure = dr.GetString(dr.GetOrdinal("IsSure")) == "1" ? true : false; change.SurePersonId = !dr.IsDBNull(dr.GetOrdinal("SurePersonId")) ? dr.GetString(dr.GetOrdinal("SurePersonId")) : string.Empty; change.SurePerson = !dr.IsDBNull(dr.GetOrdinal("SurePerson")) ? dr.GetString(dr.GetOrdinal("SurePerson")) : string.Empty;; change.SureTime = !dr.IsDBNull(dr.GetOrdinal("SureTime")) ? dr.GetDateTime(dr.GetOrdinal("SureTime")) : (DateTime?)null; list.Add(change); } } } return(list); }
private void dgvList_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewColumn column = dgvList.Columns[e.ColumnIndex]; if (column is DataGridViewButtonColumn) { var temp = column as DataGridViewButtonColumn; if (temp.DefaultCellStyle.NullValue.ToString() == "上传") { DataGridViewRow Row = dgvList.Rows[e.RowIndex]; var cel1 = Row.Cells["Value1"].Value ?? ""; var cel2 = Row.Cells["Value2"].Value ?? ""; var cel3 = Row.Cells["Value3"].Value ?? ""; var cel4 = Row.Cells["Value4"].Value ?? ""; var cel5 = Row.Cells["Value5"].Value ?? ""; var cel6 = Row.Cells["Value6"].Value ?? ""; var cel7 = Row.Cells["Value7"].Value ?? ""; var cel8 = Row.Cells["Value8"].Value ?? ""; var cel9 = Row.Cells["Value9"].Value ?? ""; var cel10 = Row.Cells["Value10"].Value ?? ""; var id = Row.Cells["ID"].Value ?? ""; SqlParameter[] p = new SqlParameter[] { new SqlParameter("@Value1", cel1), new SqlParameter("@Value2", cel2), new SqlParameter("@Value3", cel3), new SqlParameter("@Value4", cel4), new SqlParameter("@Value5", cel5), new SqlParameter("@Value6", cel6), new SqlParameter("@Value7", cel7), new SqlParameter("@Value8", cel8), new SqlParameter("@Value9", cel9), new SqlParameter("@Value10", cel10), new SqlParameter("@id", id) }; var dbc = db.GetSqlStringCommand("UPDATE [dbo].[MeasureDatas] SET [Value1] = @Value1,[Value2] = @Value2,[Value3] = @Value3,[Value4] = @Value4,[Value5] = @Value5,[Value6] = @Value6,[Value7] = @Value7,[Value8] = @Value8,[Value9] = @Value9,[Value10] = @Value10 WHERE ID=@ID"); dbc.Parameters.AddRange(p); var number = db.ExecuteNonQuery(dbc); if (number > 0) { MessageBox.Show("修改成功"); } else { MessageBox.Show("删除失败"); } } } } }
/// <summary> /// 根据计划编号获取单项业务的拓展实体 /// </summary> /// <param name="tourId"></param> /// <returns></returns> public MSingleServiceExtend GetSingleServiceExtendByTourId(string tourId) { MSingleServiceExtend single = null; StringBuilder query = new StringBuilder(); query.Append(" select TourId,CompanyId,SellerName,SellerId,DeptId,TourPay,TourCode,"); query.Append("TourIncome,TourProfit,TourStatus,OperatorId,Operator,TourType,IsDelete,"); query.Append(" (SELECT TourId,Unit,Quote,ServiceStandard,ServiceType,ServiceName,ServiceId,Remark"); query.Append(" from "); query.Append("tbl_TourTeamPrice"); query.Append(" where "); query.Append(" tbl_TourTeamPrice.TourId=tbl_Tour.TourId "); query.Append(" for xml raw,root('Root'))"); query.Append(" as TourTeamPrice,"); query.Append("(select OrderId,OrderCode,BuyCompanyName,BuyCompanyId,ContactName,ContactTel,ContactDepartId,Adults,TravellerFile,"); query.Append("(SELECT TravellerId,OrderId,CnName,EnName,CardId,VisitorType,CardType"); query.Append(",CardNumber,CardValidDate,VisaStatus,IsCardTransact,Gender,Contact"); query.Append(",LNotice,RNotice,Remark,Status,RAmount,RAmountRemark,RTime,RRemark,IsInsurance"); query.Append(" FROM "); query.Append(" tbl_TourOrderTraveller "); query.Append(" where tbl_TourOrder.OrderId=tbl_TourOrderTraveller.OrderId"); query.Append(" for xml path,elements)"); query.Append("as TourOrderTraveller"); query.Append(" ,ContractId,ContractCode "); query.Append(" from "); query.Append("tbl_TourOrder"); query.Append(" where tbl_TourOrder.TourId=tbl_Tour.TourId"); query.Append(" for xml path,elements,root('Root'))"); query.Append("as TourOrder,"); query.Append("(SELECT PlanId,CompanyId,TourId,Type,SourceId,SourceName,ContactName,ContactPhone"); query.Append(",ContactFax,Num,ReceiveJourney,CostDetail,PlanCost,PaymentType,Status,GuideNotes"); query.Append(",Remarks,SueId,CostId,CostName,CostStatus,CostTime,Confirmation,CostRemarks,DeptId"); query.Append(",OperatorId,OperatorName,IssueTime,Prepaid,IsRebate,AddStatus,IsDelete,ServiceStandard"); query.Append(",CustomerInfo,StartDate,StartTime,EndDate,EndTime"); query.Append(" FROM "); query.Append("tbl_Plan"); query.Append(" where "); query.Append("tbl_Tour.TourId=tbl_Plan.TourId and tbl_Plan.IsDelete=0 "); query.Append("for xml raw,root('Root'))"); query.Append("as TourPlan,"); query.Append("(SELECT TourId,PlanerId,Planer,DeptId "); query.Append(" FROM "); query.Append(" tbl_TourPlaner "); query.Append(" where "); query.Append("tbl_TourPlaner.TourId=tbl_Tour.TourId "); query.Append("for xml raw,root('Root') )"); query.Append("as TourPlaner"); query.Append(" ,LDate "); query.Append(" from tbl_Tour"); query.Append(" Where "); query.AppendFormat(" TourType='{0}' ", 6); query.Append(" and "); query.AppendFormat(" TourId='{0}' ", tourId); DbCommand cmd = _db.GetSqlStringCommand(query.ToString()); using (IDataReader dr = DbHelper.ExecuteReader(cmd, _db)) { if (dr != null) { single = new MSingleServiceExtend(); if (dr.Read()) { single.TourId = dr["TourId"].ToString(); single.CompanyId = dr.GetString(dr.GetOrdinal("CompanyId")); single.SellerName = !dr.IsDBNull(dr.GetOrdinal("SellerName")) ? dr.GetString(dr.GetOrdinal("SellerName")) : string.Empty; single.SellerId = dr.GetString(dr.GetOrdinal("SellerId")); single.DeptId = dr.GetInt32(dr.GetOrdinal("DeptId")); single.TourPay = dr.GetDecimal(dr.GetOrdinal("TourPay")); single.TourIncome = dr.GetDecimal(dr.GetOrdinal("TourIncome")); single.TourProfit = dr.GetDecimal(dr.GetOrdinal("TourProfit")); single.TourStatus = (TourStatus)dr.GetByte(dr.GetOrdinal("TourStatus")); single.OperatorId = dr.GetString(dr.GetOrdinal("OperatorId")); single.Operator = dr.GetString(dr.GetOrdinal("Operator")); single.TourCode = dr["TourCode"].ToString(); string TourOrder = !dr.IsDBNull(dr.GetOrdinal("TourOrder")) ? dr.GetString(dr.GetOrdinal("TourOrder")) : string.Empty; if (!string.IsNullOrEmpty(TourOrder)) { single.TourOrderTravellerList = new List <MTourOrderTraveller>(); MSingleService order = new MSingleService(); single.TourOrderTravellerList = GetOrderAndTravellerByXml(TourOrder, ref order); single.OrderId = order.OrderId; single.OrderCode = order.OrderCode; single.BuyCompanyId = order.BuyCompanyId; single.BuyCompanyName = order.BuyCompanyName; single.ContactName = order.ContactName; single.ContactTel = order.ContactTel; single.ContactDepartId = order.ContactDepartId; single.TravellerFile = order.TravellerFile; single.Adults = order.Adults; single.HeTongId = order.HeTongId; single.HeTongCode = order.HeTongCode; } //计调员信息 string TourPlaner = !dr.IsDBNull(dr.GetOrdinal("TourPlaner")) ? dr.GetString(dr.GetOrdinal("TourPlaner")) : string.Empty; if (!string.IsNullOrEmpty(TourPlaner)) { single.TourPlanersList = new List <MTourPlaner>(); single.TourPlanersList = GetTourPlanerByXML(TourPlaner); } //客人要求(分项报价) string TourTeamPrice = !dr.IsDBNull(dr.GetOrdinal("TourTeamPrice")) ? dr.GetString(dr.GetOrdinal("TourTeamPrice")) : string.Empty; if (!string.IsNullOrEmpty(TourTeamPrice)) { single.TourTeamPriceList = new List <MTourTeamPrice>(); single.TourTeamPriceList = GetTourTeamPriceByXML(TourTeamPrice); } //供应商安排(计调中心) string TourPlan = !dr.IsDBNull(dr.GetOrdinal("TourPlan")) ? dr.GetString(dr.GetOrdinal("TourPlan")) : string.Empty; if (!string.IsNullOrEmpty(TourPlan)) { single.PlanBaseInfoList = new List <EyouSoft.Model.PlanStructure.MPlanBaseInfo>(); single.PlanBaseInfoList = GetPlanBaseInfoByXML(TourPlan); } single.WeiTuoRiQi = dr.GetDateTime(dr.GetOrdinal("LDate")); } } } return(single); }
/// <summary> /// Creates a DBCommand for an SQL query /// </summary> /// <param name="sql"></param> public DbCommand CreateDbCommand(string sql) { return(Db.GetSqlStringCommand(sql)); }
private void GvBind() { if (this.pid <= 1) { this.pid = 1; } if (this.pid >= max) { this.pid = max; } SqlParameter[] p = new SqlParameter[] { new SqlParameter("@MeasPageNo", pid), new SqlParameter("@MeasItemID", iid) }; string sql = @"SELECT a.MeasPageNo,b.MeasItemNO,c.ProjectNo,c.PartNo,c.PartName FROM [QfbServer].[dbo].[MeasurementPages] a left join [dbo].[MeasurementItems] b on a.MeasItemID=b.MeasItemID left join [dbo].[MeasurementReports] c on b.MeasReportID=c.MeasReportID where a.MeasPageNo=@MeasPageNo and b.MeasItemID=@MeasItemID; select [MeasPointID],[PointNo],[UpperTol],[LowerTol],[Direct] from [dbo].[MeasurementPoints] a left join [dbo].[MeasurementPages] b on a.MeasPageID=b.MeasPageID where b.MeasPageNo=@MeasPageNo and b.MeasItemID=@MeasItemID; SELECT count(*) num FROM [MeasurementPages] where [MeasItemID]=@MeasItemID "; var dbc = db.GetSqlStringCommand(sql); dbc.Parameters.AddRange(p); var ds = db.ExecuteDataSet(dbc); if (null != ds) { lbl1.Text = string.Format(_temp, ds.Tables[0].Rows[0]["ProjectNo"].ToString(), ds.Tables[0].Rows[0]["PartNo"].ToString(), ds.Tables[0].Rows[0]["PartName"].ToString(), ds.Tables[0].Rows[0]["MeasItemNO"].ToString() ); var _num = ds.Tables[2].Rows[0][0].ToString(); if (!string.IsNullOrEmpty(_num)) { max = int.Parse(_num); } if (pid > 1) { btnPre.Enabled = true; } else { btnPre.Enabled = false; } if (pid < max) { btnNext.Enabled = true; } else { btnNext.Enabled = false; } lblPage.Text = string.Format("{0} of {1}", pid, max); GvList.DataSource = ds.Tables[1]; } }