public void gsoutinterface(int i_TypeNo, int i_SetTableNo, int i_TableNo, out string strSequence, out string strUnitCount) { //ȡ�����е����е�ͳ�ƽ�� dealData RptR_C = new dealData(); SqlDataReader objRCReader; objRCReader = RptR_C.getRC_R(i_TypeNo, i_SetTableNo, i_TableNo); int row = 7; //int col = 3; int col1 = 0; int rowLen = 5; int collen = 15; strSequence = ""; strUnitCount = ""; //ȡ����λ�� while (objRCReader.Read()) { if (objRCReader["serialtype"].ToString() == "1") { row = (int)objRCReader["startrow"]; rowLen = (int)objRCReader["icount"]; } else { col1 = (int)objRCReader["startcol"]; collen = (int)objRCReader["icount"]; } } if (collen == 0) { collen = 1; } if (rowLen == 0) { rowLen = 1; } objRCReader = null; //���ϼ����ͱ���� row = row + 2; col1 = col1 + 2; for (int i = row; i < row + rowLen; i++) { for (int j = col1; j < col1 + collen; j++) { strSequence += i + "," + j + ";"; } } if (strSequence.Length > 1) { strSequence = strSequence.Substring(0, strSequence.Length - 1); } //��Ԫ���� DataAccess.Data.GetSql RptUnit = new DataAccess.Data.GetSql(); string strSql = " select * from r201 where serialno > 2 and typeno =" + i_TypeNo + " and settableno = " + i_SetTableNo + " and tableno = " + i_TableNo; DataTable dt = RptUnit.gsQuerySql(strSql, "R201"); if (dt != null && dt.Rows.Count != 0) { for (int k = 0; k < dt.Rows.Count; k++) { if (dt.Rows[k]["startrow"].ToString() == "0" || dt.Rows[k]["startcol"].ToString() == "0") { continue; } else { strUnitCount += dt.Rows[k]["startrow"].ToString() + "," + dt.Rows[k]["startcol"].ToString() + ";"; } } } //���� strSql = " select * from eg01 where typeno =" + i_TypeNo + " and settbl = " + i_SetTableNo + " and tablno = " + i_TableNo; dt = RptUnit.gsQuerySql(strSql, "eg01"); if (dt != null && dt.Rows.Count != 0) { for (int l = 0; l < dt.Rows.Count; l++) { if (dt.Rows[l]["startr"].ToString() == "0" || dt.Rows[l]["startc"].ToString() == "0") { continue; } else { strUnitCount += dt.Rows[l]["startr"].ToString() + "," + dt.Rows[l]["startc"].ToString() + ";"; } } } if (strUnitCount.Length > 1) { strUnitCount = strUnitCount.Substring(0, strUnitCount.Length - 1); } }
public string gssequenceItemCH(int iTypeno, int iSettableno, int iTableno) { string strtmp = "", strSql; int irowcount = 1, icolcount = 1; DataTable dttmp; DataAccess.Data.GetSql getsql = new DataAccess.Data.GetSql(); strtmp = getRptHead(iTypeno, iSettableno, iTableno); //strtmp = "����: " + this.Text + "\n"; strSql = "select * from r203 where typeno = " + iTypeno + " and settableno = " + iSettableno + " and tableno = " + iTableno + " order by serialno,sequenceno "; dttmp = getsql.gsQuerySql(strSql, "r203"); if (dttmp != null && dttmp.Rows.Count != 0) { for (int i = 0; i < dttmp.Rows.Count; i++) { //ȫ������ if (dttmp.Rows[i]["serialno"].ToString() == "0") { strtmp += "\rȫ�������� \n"; strtmp += GetStrItemCh(dttmp.Rows[i]["chineseitem"].ToString(), dttmp.Rows[i]["baseExpr"].ToString()) + "\n\r"; } //������ if (dttmp.Rows[i]["serialno"].ToString() == "1") { if (irowcount == 1) { strtmp += "\r�������� \n"; } strtmp += irowcount + "��" + dttmp.Rows[i]["sequencename"].ToString() + "\n" + GetStrItemCh(dttmp.Rows[i]["chineseitem"].ToString(), dttmp.Rows[i]["baseExpr"].ToString()) + "\n"; strtmp += getSequenceType(dttmp.Rows[i]["dealstyle"].ToString(), dttmp.Rows[i]["dealItemCH"].ToString()) + "\r"; irowcount++; } //������ if (dttmp.Rows[i]["serialno"].ToString() == "2") { if (icolcount == 1) { strtmp += "\r�������� \n"; } strtmp += icolcount + "��" + dttmp.Rows[i]["sequencename"].ToString() + "\n" + GetStrItemCh(dttmp.Rows[i]["chineseitem"].ToString(), dttmp.Rows[i]["baseExpr"].ToString()) + "\n"; strtmp += getSequenceType(dttmp.Rows[i]["dealstyle"].ToString(), dttmp.Rows[i]["dealItemCH"].ToString()) + "\r"; icolcount++; } } } //��Ԫ���� strSql = "select a.sequencename,a.serialno,a.chineseitem,a.baseExpr,b.startrow,b.startcol from r203 a,r201 b where a.typeno = " + iTypeno + " and a.settableno = " + iSettableno + " and a.tableno = " + iTableno + " and a.typeno = b.typeno and a.settableno = b.settableno and a.tableno = b.tableno and a.serialno = b.serialno and a.serialno>2 order by a.serialno,a.sequenceno "; dttmp = getsql.gsQuerySql(strSql, "r203"); if (dttmp != null && dttmp.Rows.Count != 0) { for (int j = 0; j < dttmp.Rows.Count; j++) { strtmp += "\r��Ԫ������ \n"; strtmp += "��" + dttmp.Rows[j]["startrow"].ToString() + "��" + "��" + dttmp.Rows[j]["startcol"].ToString() + "�У� " + GetStrItemCh(dttmp.Rows[j]["chineseitem"].ToString(), dttmp.Rows[j]["baseExpr"].ToString()) + "\n\r"; } } strtmp += "\n"; return strtmp; }
/// <summary> /// i_TypeNo ���� i_SetTableNo �ױ�� i_TableNo ����� /// strUnit ��λ /// strSequence ����������е�λ�� /// strUnitCount ������嵥Ԫ��λ�� /// </summary> /// <param name="i_TypeNo"></param> /// <param name="i_SetTableNo"></param> /// <param name="i_TableNo"></param> /// <param name="strUnit"></param> /// <param name="strSequence"></param> /// <param name="strUnitCount"></param> public SortedList gsoutinterface(int i_TypeNo, int i_SetTableNo, int i_TableNo, string strUnit) { //���ɱ��� //��λ m_B0110 = strUnit; //������ string strtmp = " select MainObject from r200 where typeno = " + i_TypeNo + " and settableno = " + i_SetTableNo + " and tableno = " + i_TableNo; DataAccess.Data.GetSql getsql = new DataAccess.Data.GetSql(); DataTable dt = getsql.gsQuerySql(strtmp, "R200"); if (dt == null || dt.Rows.Count == 0) { m_strMainObject = "AA01"; } else { m_strMainObject = dt.Rows[0]["MainObject"].ToString(); } if (m_strMainObject == "") { m_strMainObject = "AA01"; } //�ж��������Ƿ��е�λ string strSQLtmp = "SELECT * FROM gs_property WHERE infoid= '" + m_strMainObject + "' AND infofield = 'ab0110' "; dt = getsql.gsQuerySql(strSQLtmp, "gs_property"); if (dt == null || dt.Rows.Count == 0) { m_B0110 = "-1"; } //���ɱ��� StatResult(i_TypeNo, i_SetTableNo, i_TableNo, true); //ȡ�����е����е�ͳ�ƽ�� dealData RptR_C = new dealData(); SqlDataReader objRCReader; objRCReader = RptR_C.getRC_R(i_TypeNo, i_SetTableNo, i_TableNo); int row = 7; int col = 3; int col1 = 0; int rowLen = 5; int collen = 15; SortedList sortmp = new SortedList(); //ȡ����λ�� while (objRCReader.Read()) { if (objRCReader["serialtype"].ToString() == "1") { row = (int)objRCReader["startrow"]; rowLen = (int)objRCReader["icount"]; } else { col1 = (int)objRCReader["startcol"]; collen = (int)objRCReader["icount"]; } } if (collen == 0) { collen = 1; } if (rowLen == 0) { rowLen = 1; } objRCReader = null; //���ϼ����ͱ���� row = row + 2; col1 = col1 + 2; dealData addData = new dealData(); SqlDataReader objAssReader; //��д�������� objAssReader = addData.getRApp(i_TypeNo, i_SetTableNo, i_TableNo, m_B0110, "T" + i_TypeNo.ToString() + "_" + i_SetTableNo.ToString() + "_" + i_TableNo.ToString(), "1"); if (objAssReader != null) { while (objAssReader.Read()) { col = col1; for (int i = col; i <= collen + col - 1; i++) { sortmp.Add(row + "_" + i, objAssReader["C" + (i - col + 1).ToString()]); } row = row + 1; } } objAssReader = null; //��Ԫ���� dealData RptUnit = new dealData(); SqlDataReader objUnitReader; objUnitReader = RptUnit.getUnitResult(i_TypeNo, i_SetTableNo, i_TableNo, m_B0110, "1"); while (objUnitReader.Read()) { sortmp.Add(objUnitReader["row"].ToString() + "_" + objUnitReader["col"].ToString(), objUnitReader["svalue"]); } return sortmp; }
/// <summary> /// ���ɱ���ı���ͷ /// </summary> /// <returns></returns> private string getRptHead(int itypeno, int isettableno, int itableno) { string strSQL, strRptHead = ""; DataAccess.Data.GetSql getsql = new DataAccess.Data.GetSql(); DataTable dttemp1 = new DataTable(); strSQL = "SELECT * FROM r000 where typeno = " + itypeno; dttemp1 = getsql.gsQuerySql(strSQL, "r000"); strRptHead += "��� �� " + dttemp1.Rows[0]["name"].ToString() + "\n"; strSQL = "SELECT * FROM r100 where typeno = " + itypeno + " and settableno = " + isettableno; dttemp1 = getsql.gsQuerySql(strSQL, "r100"); strRptHead += "�ױ� �� " + dttemp1.Rows[0]["name"].ToString() + "\n"; strSQL = "SELECT * FROM r200 where typeno = " + itypeno + " and settableno = " + isettableno + " and tableno = " + itableno; dttemp1 = getsql.gsQuerySql(strSQL, "r200"); strRptHead += "���� �� " + dttemp1.Rows[0]["name"].ToString() + "\n"; return strRptHead; }
/// <summary> /// �鿴��ʽ /// </summary> /// <param name="strtable"></param> /// <returns></returns> private string getCheck(string strtable, int itypeno, int isettableno, int itableno) { string strSQL, strRptCheck = "(��)"; DataTable dttemp1 = new DataTable(); DataAccess.Data.GetSql getsql = new DataAccess.Data.GetSql(); strSQL = "SELECT * FROM " + strtable + " where typeno = " + itypeno + " and settableno = " + isettableno + " and tableNo = " + itableno; dttemp1 = getsql.gsQuerySql(strSQL, strtable); if (dttemp1 != null && dttemp1.Rows.Count != 0) { strRptCheck = ""; for (int i = 0; i < dttemp1.Rows.Count; i++) { strRptCheck += i + 1 + " " + dttemp1.Rows[i]["lExpr"].ToString() + " " + dttemp1.Rows[i]["opsign"].ToString() + " " + dttemp1.Rows[i]["rExpr"].ToString() + "\n"; } } return strRptCheck; }
//���ɺϲ����SQL��� public string GetSQl(out string strWhere) { strWhere = ""; try { dealData RptR_C = new dealData(); SqlDataReader objRCReader; dealData Rpt4 = new dealData(); SqlDataReader objRPT4Reader; objRCReader = RptR_C.getRC_R(m_TypeNo, m_SetTableNo, m_TableNo); Sequence First = new Sequence(-1, -1, 1, 1, "#"); Sequence Second = new Sequence(-1, -1, 1, 1, "#"); Sequence Result = new Sequence(-1, -1, 1, 1, "#"); string RowExpr = "";//�������ı��ʽ string ColExpr = "";//�������ı��ʽ string RowItem = "";//���������� string ColItem = "";//���������� string RowChineseItem = "";//�е�����������ϵ string ColChineseItem = "";//�е�����������ϵ string ResultItem = "";//���Ľ�������� string ResultExpr = "";//���Ľ���ı��ʽ string ResultChinese = "";//����ĺ������� int sequenceRow = -1; int sequenceCol = -1; int getcount1 = 0; int getcount2 = 0; string[] strTempwl; char[] a; a = "~".ToCharArray(); int i = 1; if (m_strMainObject == "") { string strtmp = " select MainObject from r200 where typeno = " + m_TypeNo + " and settableno = " + m_SetTableNo + " and tableno = " + m_TableNo; DataAccess.Data.GetSql getsql = new DataAccess.Data.GetSql(); DataTable dt = getsql.gsQuerySql(strtmp, "R200"); if (dt == null || dt.Rows.Count == 0) { m_strMainObject = "AA01"; } else { m_strMainObject = dt.Rows[0]["MainObject"].ToString(); } } //������������ while (objRCReader.Read()) { if (i == 1) { if ((int)(objRCReader["icount"]) != 0) { First.STARTROW = (int)(objRCReader["startrow"]) + 2; First.ENDROW = (int)(objRCReader["startrow"]) + 2 + (int)(objRCReader["icount"]) - 1; First.STARTCOL = (int)(objRCReader["startcol"]) + 2; First.ENDCOL = (int)(objRCReader["startcol"]) + 2 + (int)(objRCReader["icount"]) - 1; First.SEQUENCETYPE = objRCReader["serialtype"].ToString(); } } else { if ((int)(objRCReader["icount"]) != 0) { Second.STARTROW = (int)(objRCReader["startrow"]) + 2; Second.ENDROW = (int)(objRCReader["startrow"]) + 2 + (int)(objRCReader["icount"]) - 1; Second.STARTCOL = (int)(objRCReader["startcol"]) + 2; Second.ENDCOL = (int)(objRCReader["startcol"]) + 2 + (int)(objRCReader["icount"]) - 1; Second.SEQUENCETYPE = objRCReader["serialtype"].ToString(); } } i++; } objRCReader.Close(); objRCReader = null; bool blnTemp; blnTemp = true; if (Second.STARTROW != -1 && First.STARTROW != -1) { blnTemp = true; } else if (Second.STARTROW == -1 && First.STARTROW != -1) { Result = First; blnTemp = false; } else if (First.STARTROW == -1 && Second.STARTROW != -1) { Result = Second; blnTemp = false; } else { sequenceRow = -1; sequenceCol = -1; } //return ""; if (blnTemp == false)//һ�л�һ�� { //Result.STARTROW = First.STARTROW; //Result.ENDROW = First.ENDROW; //Result.STARTCOL = First.STARTCOL; //Result.ENDCOL = First.ENDCOL; //Result.SEQUENCETYPE = First.SEQUENCETYPE; sequenceRow = m_row - Result.STARTROW; sequenceCol = m_col - Result.STARTCOL; if (Result.SEQUENCETYPE == "1") { if (sequenceCol != 0) { sequenceCol = -1; } } else { if (sequenceRow != 0) { sequenceRow = -1; } } } else if (First.STARTROW == Second.STARTROW && First.STARTCOL == Second.STARTCOL)//��ά���� { Result.STARTROW = First.STARTROW; if (First.SEQUENCETYPE == "1") { Result.ENDROW = First.ENDROW; } else { Result.ENDROW = Second.ENDROW; } Result.STARTCOL = First.STARTCOL; if (First.SEQUENCETYPE == "2") { Result.ENDCOL = First.ENDCOL; } else { Result.ENDCOL = Second.ENDCOL; } Result.SEQUENCETYPE = "1&2"; sequenceRow = m_row - Result.STARTROW; sequenceCol = m_col - Result.STARTCOL; if (m_row > Result.ENDROW || m_col > Result.ENDCOL) { sequenceRow = -1; sequenceCol = -1; } } else//������û�д��� { Result.SEQUENCETYPE = "1|2"; } //�ҳ����ڵ����е�λ�� //if (First.SEQUENCETYPE == "1" && m_row - First.STARTROW >= 0 && m_row <= First.ENDROW) //{ // sequenceRow = m_row - First.STARTROW; //} //if (First.SEQUENCETYPE == "2" && m_col - First.STARTCOL >= 0 && m_col <= First.ENDCOL) //{ // sequenceCol = m_col - First.STARTCOL; //} //if (Second.SEQUENCETYPE == "1" && m_row - Second.STARTROW >= 0 && m_row <= Second.ENDROW) //{ // sequenceRow = m_row - Second.STARTROW; //} //if (Second.SEQUENCETYPE == "2" && m_col - Second.STARTCOL >= 0 && m_col <= Second.ENDCOL) //{ // sequenceCol = m_col - Second.STARTCOL; //} bool nullSequenceRow = false; bool nullSequenceCol = false; if (sequenceRow > -1 && sequenceCol > -1)//�������� { if (sequenceRow > -1) { dealData Rpt1 = new dealData(); SqlDataReader objRPT1Reader; objRPT1Reader = Rpt1.getOneCondition(m_TypeNo, m_SetTableNo, m_TableNo, sequenceRow, "1"); while (objRPT1Reader.Read()) { if (objRPT1Reader["sequenceType"].ToString() == "4") { return ""; } else { RowExpr = objRPT1Reader["baseexpr"].ToString(); RowItem = objRPT1Reader["baseitem"].ToString(); RowChineseItem = objRPT1Reader["chineseitem"].ToString(); if (RowItem == null || RowItem == "") { nullSequenceRow = true; } } } objRPT1Reader.Close(); //----------------------------------------- dealData Rpt2 = new dealData(); SqlDataReader objRPT2Reader; objRPT2Reader = Rpt2.getOneCondition(m_TypeNo, m_SetTableNo, m_TableNo, sequenceCol, "2"); while (objRPT2Reader.Read()) { if (objRPT2Reader["sequenceType"].ToString() == "4") { return ""; } else { ColExpr = objRPT2Reader["baseexpr"].ToString(); ColItem = objRPT2Reader["baseitem"].ToString(); ColChineseItem = objRPT2Reader["chineseitem"].ToString(); if (ColItem == null || ColItem == "") { nullSequenceCol = true; } } } objRPT2Reader.Close(); //�������ڷָ�� if (RowItem != "") { strTempwl = RowItem.ToString().Split(a); getcount1 = strTempwl.Length; } if (ColItem != "") { strTempwl = ColItem.ToString().Split(a); getcount2 = strTempwl.Length; } //string ResultItem = "";//���Ľ�������� //string ResultExpr = "";//���Ľ���ı��ʽ //string ResultChinese = "";//����ĺ������� if (getcount1 == 0 && getcount2 == 0 && nullSequenceRow == false && nullSequenceCol == false) {//���뵥Ԫ���� //getUnitCondition objRPT4Reader = Rpt4.getUnitCondition(m_TypeNo, m_SetTableNo, m_TableNo, "2", m_row, m_col); while (objRPT4Reader.Read()) { if (objRPT4Reader["sequenceType"].ToString() == "4") { return ""; } else { ColExpr = objRPT4Reader["baseexpr"].ToString(); ColItem = objRPT4Reader["baseitem"].ToString(); ColChineseItem = objRPT4Reader["chineseitem"].ToString(); } } objRPT4Reader.Close(); if (ColExpr != "") { ResultItem = ColItem; ResultExpr = ColExpr; ResultChinese = ColChineseItem; } else { return ""; } } else if (getcount1 == 0 && getcount2 != 0) { ResultItem = ColItem; ResultExpr = ColExpr; ResultChinese = ColChineseItem; } else if (getcount1 != 0 && getcount2 == 0) { ResultItem = RowItem; ResultExpr = RowExpr; ResultChinese = RowChineseItem; } else { if (ColItem == "") { ColExpr = ""; } if (RowItem == "") { RowExpr = ""; } ResultExpr = gs_Comexpress(getcount1, getcount2, RowExpr, ColExpr); ResultItem = RowItem + "~" + ColItem; ResultChinese = RowChineseItem + "~" + ColChineseItem; } getcount1 = getcount2 + getcount1; } } else {//��Ԫ���� objRPT4Reader = Rpt4.getUnitCondition(m_TypeNo, m_SetTableNo, m_TableNo, "3", m_row, m_col); while (objRPT4Reader.Read()) { ColExpr = objRPT4Reader["baseexpr"].ToString(); ColItem = objRPT4Reader["baseitem"].ToString(); ColChineseItem = objRPT4Reader["chineseitem"].ToString(); } objRPT4Reader.Close(); if (ColExpr != "") { ResultItem = ColItem; ResultExpr = ColExpr; ResultChinese = ColChineseItem; strTempwl = ResultItem.ToString().Split(a); getcount1 = strTempwl.Length; } else { return ""; } } //����ȫ������ dealData Rpt3 = new dealData(); SqlDataReader objRPT3Reader; objRPT3Reader = Rpt3.getOneCondition(m_TypeNo, m_SetTableNo, m_TableNo, -1, "0"); while (objRPT3Reader.Read()) { if (objRPT3Reader["sequenceType"].ToString() == "4") { return ""; } else { ColExpr = objRPT3Reader["baseexpr"].ToString(); ColItem = objRPT3Reader["baseitem"].ToString(); ColChineseItem = objRPT3Reader["chineseitem"].ToString(); } } objRPT3Reader.Close(); if (ColItem != "") { if (ColItem == "") { ColExpr = ""; } if (ResultItem == "") { ResultExpr = ""; } strTempwl = ColItem.ToString().Split(a); getcount2 = strTempwl.Length; ResultExpr = gs_Comexpress(getcount1, getcount2, ResultExpr, ColExpr); if (ResultItem != "" && ResultItem != "~") { ResultItem = ResultItem + "~" + ColItem; } else { ResultItem = ColItem; } if (ResultChinese != "" && ResultChinese != "~") { ResultChinese = ResultChinese + "~" + ColChineseItem; } else { ResultChinese = ColChineseItem; } getcount1 = getcount1 + getcount2; } //�����ⲿ���� if (m_Item != null && this.m_Item != "") { strTempwl = m_Item.ToString().Split(a); getcount2 = strTempwl.Length; ResultExpr = gs_Comexpress(getcount1, getcount2, ResultExpr, m_Expr); ResultItem = ResultItem + "~" + m_Item; //ResultChinese = ResultChinese + "~" + ColChineseItem; //getcount1 = getcount1 + getcount2; } //if(ResultItem!="") //{ QueryDeal dealCondition = new QueryDeal(m_strMainObject, ResultExpr, ResultItem, ""); string strCondition = dealCondition.QueryResult(); if (strCondition != "" && m_AB0110 != "-1") { if (m_AB0110 != "" && m_AB0110 != "0") { if (m_strMainObject.ToUpper() != "AB01") { strCondition = strCondition + " and " + m_strMainObject + ".ab0110 like '" + m_AB0110 + "%'"; } else { strCondition = strCondition + " and " + m_strMainObject + ".ab0110 = '" + m_AB0110 + "'"; } } else { if (m_AB0110 != "" && m_AB0110 != "0") { if (m_strMainObject.ToUpper() != "AB01") { strCondition = m_strMainObject + ".ab0110 like '" + m_AB0110 + "%'"; } else { strCondition = m_strMainObject + ".ab0110 = '" + m_AB0110 + "'"; } } } } m_strFLD = dealCondition.FLD; Datastat RptLoad = new Datastat(); RptLoad.MainObject = m_strMainObject; RptLoad.StatResult(m_TypeNo, m_SetTableNo, m_TableNo, false); string strTBL; string strFLD; string strASS; strTBL = RptLoad.TBL; strFLD = RptLoad.FLD; strASS = RptLoad.ASS; dealData dealRequery = new dealData(); if (strCondition == "") { if (m_AB0110 != "-1" && m_AB0110 != "0" && m_AB0110 != "") { if (m_strMainObject.ToUpper() != "AB01") { strCondition = "select " + m_strMainObject + ".ZA0100 from " + m_strMainObject + " where " + m_strMainObject + ".ZC9993 = '1' and " + m_strMainObject + ".ab0110 like '" + m_AB0110 + "%'"; } else { strCondition = "select " + m_strMainObject + ".ZA0100 from " + m_strMainObject + " where " + m_strMainObject + ".ZC9993 = '1' and " + m_strMainObject + ".ab0110 = '" + m_AB0110 + "'"; } } else { strCondition = "select " + m_strMainObject + ".ZA0100 from " + m_strMainObject + " where " + m_strMainObject + ".ZC9993 = '1' "; } } strWhere = strCondition; strCondition = dealRequery.ReQuery(m_strMainObject, strTBL, strFLD, strASS, strCondition); return strCondition; //�����Ԫ���� //sequenceRow } catch (Exception ee) { return ""; //return "getsql " + ee.Message; } }
/// <summary> /// ȡ�û�����Ȩ��ģ������ /// </summary> /// <param name="ModuleCode"></param> /// <param name="Object"></param> /// <param name="BaseExpr"></param> /// <param name="BaseItem"></param> public void gsGetModuleCondition(string UserId, string MainObject, out string BaseExpr, out string BaseItem) { string strExpr = "", strItem = "", strExpr1 = "", strItem1 = ""; int icount1 = 0, icount2 = 0; BaseExpr = ""; BaseItem = ""; DataAccess.Data.GetSql getsql = new DataAccess.Data.GetSql(); string str = " select xd0117,xd0118,xe0201,xe0202 from xd01 left join xe02 on xd01.za0100 = xe02.zc9996 and xe02.za0100 in (select xf0101 from xf01 where za0101 = '" + UserId + "') where xd01.za0100 in (select zc9996 from xe02 where za0100 in (select xf0101 from xf01 where za0101 = '" + UserId + "' )) and xd0110 = '" + MainObject + "' "; DataTable dt = getsql.gsQuerySql(str, "xd01"); if (dt == null || dt.Rows.Count == 0) { return; } for (int i = 0; i < dt.Rows.Count; i++) { strExpr = dt.Rows[i]["XD0117"].ToString(); strItem = dt.Rows[i]["XD0118"].ToString(); strExpr1 = dt.Rows[i]["xe0201"].ToString(); strItem1 = dt.Rows[i]["xe0202"].ToString(); //�ϲ�ģ���û�������*�� if (strItem != "") { icount1 = strItem.Split('~').Length; } if (strItem1 != "") { icount2 = strItem1.Split('~').Length; } if (icount1 == 0) { if (icount2 == 0) { BaseExpr = ""; BaseItem = ""; return; } else { strItem = strItem1; strExpr = strExpr1; } } else { if (icount2 != 0) { strExpr = gs_Comexpress(icount1, icount2, strExpr, strExpr1); if (strItem == "") { strItem = strItem1; } else if (strItem1 == "") { strItem = strItem; } else { strItem = strItem + " ~" + strItem1; } } } //�ۼ����� if (strItem == "") { BaseExpr = ""; BaseItem = ""; return; } if (BaseItem != "") { icount1 = BaseItem.Split('~').Length; } if (strItem != "") { icount2 = strItem.Split('~').Length; } if (icount1 == 0) { if (icount2 == 0) { BaseExpr = ""; BaseItem = ""; return; } else { BaseExpr = strExpr; BaseItem = strItem; } } else { if (icount2 == 0) { BaseExpr = ""; BaseItem = ""; return; } else { BaseExpr = gs_Comexpress1(icount1, icount2, BaseExpr, strExpr); if (BaseItem == "") { BaseItem = strItem; } else if (strItem == "") { BaseItem = BaseItem; } else { BaseItem = BaseItem + " ~" + strItem; } } } } }