/// <summary> /// 是否存在该记录 /// </summary> public bool IsExistsByRecID(int RecID) { QueryStopCustApply query = new QueryStopCustApply(); query.RecID = RecID; DataTable dt = new DataTable(); int count = 0; dt = GetStopCustApply(query, string.Empty, 1, 1, out count); if (count > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Entities.StopCustApply GetStopCustApply(int RecID) { QueryStopCustApply query = new QueryStopCustApply(); query.RecID = RecID; DataTable dt = new DataTable(); int count = 0; dt = GetStopCustApply(query, string.Empty, 1, 1, out count); if (count > 0) { return(LoadSingleStopCustApply(dt.Rows[0])); } else { return(null); } }
/// <summary> /// 无数据权限查询 /// </summary> /// <param name="query"></param> /// <param name="order"></param> /// <param name="currentPage"></param> /// <param name="pageSize"></param> /// <param name="totalCount"></param> /// <returns></returns> public DataTable GetStopCustApplyNoDR(QueryStopCustApply query, string order, int currentPage, int pageSize, out int totalCount) { return(Dal.StopCustApply.Instance.GetStopCustApplyNoDR(query, order, currentPage, pageSize, out totalCount)); }
/// <summary> /// 按照查询条件查询 /// </summary> /// <param name="query">查询条件</param> /// <param name="order">排序</param> /// <param name="currentPage">页号,-1不分页</param> /// <param name="pageSize">每页记录数</param> /// <param name="totalCount">总行数</param> /// <returns>集合</returns> public DataTable GetStopCustApply(QueryStopCustApply query, string order, int currentPage, int pageSize, out int totalCount) { string where = string.Empty; #region 数据权限判断 if (query.LoginID != Constant.INT_INVALID_VALUE) { string whereDataRight = ""; whereDataRight = Dal.UserGroupDataRigth.Instance.GetSqlRightstr("oct", "BGID", "AssignUserID", query.LoginID); where += whereDataRight; } #endregion if (query.RecID != Constant.INT_INVALID_VALUE) { where += " and sca.RecID=" + query.RecID; } if (query.CustID != Constant.STRING_INVALID_VALUE) { where += " and sca.CustID like '%" + StringHelper.SqlFilter(query.CustID) + "%'"; } if (query.CustName != Constant.STRING_INVALID_VALUE) { where += " and ci.CustName like '%" + StringHelper.SqlFilter(query.CustName) + "%'"; } if (query.ApplerName != Constant.STRING_INVALID_VALUE) { where += " and ui.TrueName like '%" + StringHelper.SqlFilter(query.ApplerName) + "%'"; } if (query.AreaID != Constant.INT_INVALID_VALUE && query.AreaID > 0) { where += " and sca.AreaID=" + query.AreaID; } if (query.AreaName != Constant.STRING_INVALID_VALUE && query.AreaName != "-1") { where += " and sca.AreaName='" + StringHelper.SqlFilter(query.AreaName) + "'"; } //分配人 if (query.OperID != Constant.INT_INVALID_VALUE && query.OperID != -1) { where += " and oct.AssignUserID = " + query.OperID; } //客户状态 if (query.StopStatus > 0) { where += " and sca.StopStatus=" + query.StopStatus; } //任务状态 if (query.TaskStatus > 0) { where += " and oct.TaskStatus=" + query.TaskStatus; } if (query.ApplyBeginTime != Constant.STRING_INVALID_VALUE) { where += " and sca.ApplyTime >='" + StringHelper.SqlFilter(query.ApplyBeginTime) + " 0:0:0'"; } if (query.ApplyEndTime != Constant.STRING_INVALID_VALUE) { where += " and sca.ApplyTime <='" + StringHelper.SqlFilter(query.ApplyEndTime) + " 23:59:59'"; } if (query.SubmitBeginTime != Constant.STRING_INVALID_VALUE) { where += " and sca.AuditTime >='" + StringHelper.SqlFilter(query.SubmitBeginTime) + " 0:0:0'"; } if (query.SubmitEndTime != Constant.STRING_INVALID_VALUE) { where += " and sca.AuditTime <='" + StringHelper.SqlFilter(query.SubmitEndTime) + " 23:59:59'"; } if (query.StopBeginTime != Constant.STRING_INVALID_VALUE) { where += " and sca.StopTime >='" + StringHelper.SqlFilter(query.StopBeginTime) + " 0:0:0'"; } if (query.StopEndTime != Constant.STRING_INVALID_VALUE) { where += " and sca.StopTime <='" + query.StopEndTime + " 23:59:59'"; } if (query.Reason != Constant.STRING_INVALID_VALUE && query.Reason != "-1") { int _reason = 0; if (int.TryParse(query.Reason, out _reason)) { where += " and sca.ApplyReason =" + _reason; } } if (query.Remark != Constant.STRING_INVALID_VALUE && query.Remark != "-1") { int _remark = 0; if (int.TryParse(query.Remark, out _remark)) { where += " and sca.ApplyRemark =" + _remark; } } if (query.CarType != Constant.STRING_INVALID_VALUE) { where += " and ci.CarType IN (" + Dal.Util.SqlFilterByInCondition(query.CarType) + ")"; } if (query.ApplyType != Constant.INT_INVALID_VALUE) { where += " and sca.ApplyType=" + query.ApplyType; } DataSet ds; SqlParameter[] parameters = { new SqlParameter("@where", SqlDbType.NVarChar, 40000), new SqlParameter("@order", SqlDbType.NVarChar, 200), new SqlParameter("@pagesize", SqlDbType.Int, 4), new SqlParameter("@indexpage", SqlDbType.Int, 4), new SqlParameter("@totalRecorder", SqlDbType.Int, 4) }; parameters[0].Value = where; parameters[1].Value = order; parameters[2].Value = pageSize; parameters[3].Value = currentPage; parameters[4].Direction = ParameterDirection.Output; ds = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_STOPCUSTAPPLY_SELECT, parameters); totalCount = (int)(parameters[4].Value); return(ds.Tables[0]); }