private int GetClassIDByDD_TYPE(string DD_TYPE) { int ClassID = 0; string ClassName = ""; //Get Class Name from DBF DBFTemp.SetFile(this.DBFPath + "DD_CLASS.DBF"); DBFTemp.Connect(); DBFResultTemp = DBFTemp.Query("select DD_NAME from DD_TYPE.DBF where DD_TYPE='" + DD_TYPE + "'"); DBFDataTemp = DBFResultTemp.GetResult(); while (DBFDataTemp.Read()) { ClassName = CutSpace(DBFDataTemp[0].ToString()); } DBFDataTemp.Close(); DBFTemp.DisConnect(); //Get ClassID from SQL SqlResultTemp = SqlTemp.Query("select ClassID from DDPawnageClass where ClassName='" + ClassName + "'"); SqlDataTemp = SqlResultTemp.GetResult(); while (SqlDataTemp.Read()) { ClassID = Convert.ToInt32(SqlDataTemp[0].ToString()); } SqlDataTemp.Close(); return(ClassID); }
private string GetMesureUnitIDbByUNITTYPE(string UNITTYPE) { string FinalReturn = ""; string MesureUnitName = ""; //Read MesureUnitName DBFTemp.SetFile(this.DBFPath + "UNITTYPE.DBF"); DBFTemp.Connect(); DBFResultTemp = DBFTemp.Query("select UNITNAME from UNITTYPE.DBF where UNITTYPE = '" + UNITTYPE + "'"); DBFDataTemp = DBFResultTemp.GetResult(); while (DBFDataTemp.Read()) { MesureUnitName = CutSpace(DBFDataTemp[0].ToString()); } DBFDataTemp.Close(); DBFTemp.DisConnect(); if (MesureUnitName == "") { SqlResultTemp = SqlTemp.Query("select UnitID from DDMesureUnit where UnitName = '其它'"); SqlDataTemp = SqlResultTemp.GetResult(); SqlDataTemp.Read(); FinalReturn = CutSpace(SqlDataTemp[0].ToString()); SqlDataTemp.Close(); return(FinalReturn); } //Get MasureUnitID SqlResultTemp = SqlTemp.Query("select UnitID from DDMesureUnit where UnitName = '" + MesureUnitName + "'"); SqlDataTemp = SqlResultTemp.GetResult(); SqlDataTemp.Read(); FinalReturn = SqlDataTemp[0].ToString(); SqlDataTemp.Close(); return(FinalReturn); }
private string GetStatisticClassIDByD1_CLASS(string D1_CLASS) { string FinalReturn = ""; string ClassName = ""; //Read ClassName DBFTemp.SetFile(this.DBFPath + "D1_CLASS.DBF"); DBFTemp.Connect(); DBFResultTemp = DBFTemp.Query("select D1_NAME from D1_CLASS.DBF where D1_CLASS = '" + D1_CLASS + "'"); DBFDataTemp = DBFResultTemp.GetResult(); while (DBFDataTemp.Read()) { ClassName = CutSpace(DBFDataTemp[0].ToString()); } DBFDataTemp.Close(); DBFTemp.DisConnect(); if (ClassName == "") { SqlResultTemp = SqlTemp.Query("select ClassID from DDStatisticClass where ClassName = '其它'"); SqlDataTemp = SqlResultTemp.GetResult(); SqlDataTemp.Read(); FinalReturn = CutSpace(SqlDataTemp[0].ToString()); SqlDataTemp.Close(); return(FinalReturn); } //GetStatisticClassID SqlResultTemp = SqlTemp.Query("select ClassID from DDStatisticClass where ClassName = '" + ClassName + "'"); SqlDataTemp = SqlResultTemp.GetResult(); SqlDataTemp.Read(); FinalReturn = SqlDataTemp[0].ToString(); SqlDataTemp.Close(); return(FinalReturn); }
private string GetOperatorNameByDBFOperator(string theOperator) { string OperatorName = ""; DBFTemp.SetFile(this.DBFPath + "OPERATOR.DBF"); DBFTemp.Connect(); DBFResultTemp = DBFTemp.Query("select NAME from OPERATOR.DBF where OPERATOR='" + theOperator + "'"); DBFDataTemp = DBFResultTemp.GetResult(); while (DBFDataTemp.Read()) { OperatorName = CutSpace(DBFDataTemp[0].ToString()); } DBFDataTemp.Close(); DBFTemp.DisConnect(); return(OperatorName); }
private int GetParentIDByDD_TYPE(string DD_TYPE) { string DD_CLASS = ""; string ClassName = ""; string FinalReturn = ""; //GetClassName DD_CLASS = DD_TYPE.Substring(0, 4); DBFTemp.SetFile(this.DBFPath + "DD_CLASS.DBF"); DBFTemp.Connect(); DBFResultTemp = DBFTemp.Query("select CLASS_NAME from DD_CLASS.DBF where DD_CLASS='" + DD_CLASS + "'"); DBFDataTemp = DBFResultTemp.GetResult(); while (DBFDataTemp.Read()) { ClassName = CutSpace(DBFDataTemp[0].ToString()); } DBFDataTemp.Close(); DBFTemp.DisConnect(); //GetClassId SqlResultTemp = SqlTemp.Query("select ClassID from DDPawnageClass where ClassName='" + ClassName + "' order by ClassID DESC"); SqlDataTemp = SqlResultTemp.GetResult(); while (SqlDataTemp.Read()) { FinalReturn = SqlDataTemp[0].ToString(); } SqlDataTemp.Close(); //if not success if (FinalReturn == "") { SqlResultTemp = SqlTemp.Query("select ClassID from DDPawnageClass where ClassName='其它'"); SqlDataTemp = SqlResultTemp.GetResult(); SqlDataTemp.Read(); FinalReturn = SqlDataTemp[0].ToString(); SqlDataTemp.Close(); return(Convert.ToInt32(FinalReturn)); } else { return(Convert.ToInt32(FinalReturn)); } }
private string GetContactNamebyB_NO(string B_NO) { DBFTemp.SetFile(this.DBFPath + "CUST_RCD.DBF"); DBFTemp.Connect(); DBFResultTemp = DBFTemp.Query("select NAME from CUST_RCD.DBF where B_NO='" + B_NO + "'"); DBFDataTemp = DBFResultTemp.GetResult(); if (DBFDataTemp.Read()) { string ContactName = CutSpace(DBFDataTemp[0].ToString()); DBFDataTemp.Close(); DBFTemp.DisConnect(); return(ContactName); } else { DBFDataTemp.Close(); DBFTemp.DisConnect(); return(""); } }
private int GetSqlCertIDbyDBFCertID(string DBFID) { DBFTemp.SetFile(this.DBFPath + "S_TYPE.DBF"); DBFTemp.Connect(); DBFResultTemp = DBFTemp.Query("select S_TYPE from S_TYPE.DBF where S_NO='" + DBFID + "'"); DBFDataTemp = DBFResultTemp.GetResult(); if (DBFDataTemp.Read()) { string DBFName = CutSpace(DBFDataTemp[0].ToString()); DBFDataTemp.Close(); DBFTemp.DisConnect(); SqlResultTemp = SqlTemp.Query("select TypeID from DDCertTypes where TypeName='" + DBFName + "'"); SqlDataTemp = SqlResultTemp.GetResult(); if (SqlDataTemp.Read()) { int SqlID = Convert.ToInt32(CutSpace(SqlDataTemp[0].ToString())); SqlDataTemp.Close(); DBFDataTemp.Close(); DBFTemp.DisConnect(); return(SqlID); } else { DBFDataTemp.Close(); DBFTemp.DisConnect(); SqlDataTemp.Close(); return(-1); } } else { DBFDataTemp.Close(); DBFTemp.DisConnect(); return(-1); } }
private int GetSqlTicketStatusIDbyDBFB_NO(string theB_NO) { int SqlTicketStatus = 0; string OP_TYPE = "0"; DBFTemp.SetFile(this.DBFPath + "OP_RCD.DBF"); DBFTemp.Connect(); DBFResultTemp = DBFTemp.Query("select OP_TYPE from OP_RCD.DBF where B_NO='" + theB_NO + "'"); DBFDataTemp = DBFResultTemp.GetResult(); while (DBFDataTemp.Read()) { OP_TYPE = CutSpace(DBFDataTemp[0].ToString()); } DBFDataTemp.Close(); SqlResultTemp = SqlTemp.Query("select StatusID from DDTicketStatus where Description='" + DBFTicketStatus_TYPEMapping(OP_TYPE) + "'"); SqlDataTemp = SqlResultTemp.GetResult(); SqlDataTemp.Read(); SqlTicketStatus = Convert.ToInt32(CutSpace(SqlDataTemp[0].ToString())); SqlDataTemp.Close(); DBFTemp.DisConnect(); return(SqlTicketStatus); }