/// <summary> /// 构造函数 /// </summary> /// <param name="conn">数据库连接</param> /// <param name="configservice">基本配置信息</param> /// <param name="handlersevice">所有操作方法句柄</param> /// <param name="adminhandlers">管理员操作方法</param> public AdminLoginHandlers(Connection conn, ConfigService configservice,HandlerService handlersevice, AdminHandlers adminhandlers) { base.conn = conn; base.handlerService = handlersevice; this._adminh = adminhandlers; this.Initialization(); }
/// <summary> /// �����趨�������Ҳ�ѯ���������ҳ /// </summary> /// <param name="errText">������Ϣ</param> /// <param name="tableName">����</param> /// <param name="arrShowField">��Ҫ������ʾ���ֶμ�</param> /// <param name="strConditionField">��ѯ�����ֶμ�(Ϊ����in�IJ�ѯ����hashtable�ij�string)</param> /// <param name="arrSortField">�����ֶμ�</param> /// <param name="pageSize">ÿҳ��ʾ�ļ�¼����</param> /// <param name="page">Ҫ��ʾ��ҳ����</param> /// <param name="ads_out_Data">���صĽ�����ݼ�</param> /// <returns>�ɹ�����1 ʧ��С��0</returns> public static int GetPage(PageSearchItem sItem,Connection conn, ref int curPage, ref int pageCount, ref int counts, ref DataSet ads_out_Data) { //������Ҫ��ʾ���ֶμ���SQL�� StringBuilder strShowField = new StringBuilder(); for (int i = 0; i < sItem.arrShowField.Count; i++) { if (i == 0) { strShowField.Append(sItem.arrShowField[i]); } else { strShowField.Append(", " + sItem.arrShowField[i]); } } //��������SQL�� StringBuilder strSortField = new StringBuilder(); for (int i = 0; i < sItem.arrSortField.Count; i++) { if (i == 0) { strSortField.Append(sItem.arrSortField[i]); } else { strSortField.Append(", " + sItem.arrSortField[i]); } } SqlParameter sp0 = new SqlParameter("@tblName", SqlDbType.NVarChar, 50); sp0.Value = sItem.tableName; SqlParameter sp1 = new SqlParameter("@fldName", SqlDbType.NVarChar, 500); sp1.Value = strShowField.ToString(); SqlParameter sp2 = new SqlParameter("@fldSort", SqlDbType.NVarChar, 200); sp2.Value = strSortField.ToString(); SqlParameter sp3 = new SqlParameter("@strCondition", SqlDbType.NVarChar, 4000); sp3.Value = sItem.strCondition; SqlParameter sp4 = new SqlParameter("@pageSize", SqlDbType.Int, 4); sp4.Value = sItem.pageSize.ToString(); SqlParameter sp5 = new SqlParameter("@page", SqlDbType.Int, 4); sp5.Value = sItem.page.ToString(); SqlParameter sp6 = new SqlParameter("@curpage", SqlDbType.Int, 4); sp6.Direction = ParameterDirection.Output; SqlParameter sp7 = new SqlParameter("@pageCount", SqlDbType.Int, 4); sp7.Direction = ParameterDirection.Output; SqlParameter sp8 = new SqlParameter("@counts", SqlDbType.Int, 4); sp8.Direction = ParameterDirection.Output; SqlParameter sp9 = new SqlParameter("@retval", SqlDbType.Int, 4); sp9.Direction = ParameterDirection.Output; string[] reValues = conn.GetDataSet("SP_TCG_GetPage", new SqlParameter[] { sp0, sp1, sp2, sp3, sp4, sp5, sp6, sp7, sp8, sp9 }, new int[] { 6, 7, 8, 9 }, ref ads_out_Data); if(reValues!=null) { //�ܼ�¼�� counts = (int)Convert.ChangeType(reValues[2], typeof(int)); //��ҳ�� pageCount = (int)Convert.ChangeType(reValues[1], typeof(int)); //��ǰҳ�� curPage = (int)Convert.ChangeType(reValues[0], typeof(int)); return (int)Convert.ChangeType(reValues[3], typeof(int)); } return -19000000; }
public DataTable GetAllNewsSpecialityInfoByCache(Connection conn, bool readdb) { if (readdb) { return this.GetAllNewsSpecialityInfo(conn); } else { DataTable dt = (DataTable)CachingService.Get("AllNewsSpeciality"); if (dt == null) { dt = this.GetAllNewsSpecialityInfo(conn); CachingService.Set("AllNewsSpeciality", dt, null); } return dt; } }
/// <summary> /// ����ID�����Դ���� /// </summary> /// <param name="conn"></param> /// <param name="id"></param> /// <returns></returns> public Speciality GetNewsSpecialityInfoById(Connection conn, int id) { string SQL = "SELECT iId,iSiteId,iParent,vcTitle,vcExplain,dUpDateDate FROM Speciality (NOLOCK) WHERE iId=" + id.ToString(); DataTable dt = conn.GetDataTable(SQL); if (dt == null) return null; if (dt.Rows.Count != 1) return null; Speciality item = new Speciality(); DataRow Row = dt.Rows[0]; item.iId = (int)Row["iId"]; item.iSiteId = (int)Row["iSiteId"]; item.iParent = (int)Row["iParent"]; item.vcTitle = (string)Row["vcTitle"]; item.vcExplain = (string)Row["vcExplain"]; item.dUpDateDate = (DateTime)Row["dUpDateDate"]; dt.Clear(); dt.Dispose(); dt = null; Row.Delete(); return item; }
/// <summary> /// ɾ������ /// </summary> /// <param name="conn"></param> /// <param name="adminname"></param> /// <param name="ids"></param> /// <returns></returns> public int NewSpecialityDel(Connection conn, string adminname, string ids) { SqlParameter sp0 = new SqlParameter("@vcAdminName", SqlDbType.VarChar, 50); sp0.Value = adminname; SqlParameter sp1 = new SqlParameter("@vcip", SqlDbType.VarChar, 15); sp1.Value = objectHandlers.UserIp; SqlParameter sp2 = new SqlParameter("@cAction", SqlDbType.Char, 2); sp2.Value = "03"; SqlParameter sp3 = new SqlParameter("@IDs", SqlDbType.VarChar, 200); sp3.Value = ids; SqlParameter sp4 = new SqlParameter("@reValue", SqlDbType.Int); sp4.Direction = ParameterDirection.Output; string[] reValues = conn.Execute("SP_News_SpecialityAdmin", new SqlParameter[] { sp0, sp1, sp2, sp3, sp4 }, new int[] { 4 }); if (reValues != null) { int rtn = (int)Convert.ChangeType(reValues[0], typeof(int)); return rtn; } return -19000000; }
/// <summary> /// ���������Դ���� /// </summary> /// <param name="conn"></param> /// <returns></returns> public DataTable GetAllNewsSpecialityInfo(Connection conn) { string SQL = "SELECT iId,iSiteId,iParent,vcTitle,vcExplain,dUpDateDate FROM Speciality (NOLOCK)"; return conn.GetDataTable(SQL); }
/// <summary> /// ����Ѷ���� /// </summary> /// <param name="conn"></param> /// <param name="adminname"></param> /// <param name="nif"></param> /// <returns></returns> public int NewsSpecialityMdy(Connection conn, string adminname, Speciality nif) { SqlParameter sp0 = new SqlParameter("@vcAdminName", SqlDbType.VarChar, 50); sp0.Value = adminname; SqlParameter sp1 = new SqlParameter("@vcip", SqlDbType.VarChar, 15); sp1.Value = objectHandlers.UserIp; SqlParameter sp2 = new SqlParameter("@iSiteId", SqlDbType.Int, 4); sp2.Value = nif.iSiteId; SqlParameter sp3 = new SqlParameter("@iParent", SqlDbType.Int, 4); sp3.Value = nif.iParent; SqlParameter sp4 = new SqlParameter("@vcTitle", SqlDbType.VarChar, 50); sp4.Value = nif.vcTitle; SqlParameter sp5 = new SqlParameter("@vcExplain", SqlDbType.VarChar, 50); sp5.Value = nif.vcExplain; SqlParameter sp6 = new SqlParameter("@cAction", SqlDbType.Char, 2); sp6.Value = "02"; SqlParameter sp7 = new SqlParameter("@iId", SqlDbType.Int, 4); sp7.Value = nif.iId; SqlParameter sp8 = new SqlParameter("@reValue", SqlDbType.Int); sp8.Direction = ParameterDirection.Output; string[] reValues = conn.Execute("SP_News_SpecialityAdmin", new SqlParameter[] { sp0, sp1, sp2, sp3, sp4, sp5, sp6,sp7,sp8 }, new int[] { 8 }); if (reValues != null) { int rtn = (int)Convert.ChangeType(reValues[0], typeof(int)); return rtn; } return -19000000; }