What I Understood

download What I Understood

If you can't read please download the document

description

what i understood

Transcript of What I Understood

-------------------------------------------------------------------------------------------------OVERALL PROGRAM FUNCTIONALITIES.------------------------------------------------------------------------------------------------- check registry ( if unsuccessful show error in registry ). ***************How It Works***************** i> frmWSImportExport_Load(object sender, System.EventArgs e) of class frmWSImportExport calls checkRegistry() of same class. ii> checkRegistry() calls checkRegEntryAndLoaditInProperties() of class clsRegistry. iii> checkRegEntryAndLoaditInProperties() reads the following registry : SOFTWARE\\TurfViewDistribution 7.0\\MODULE\\WS under hexkey_localmachine. iv> checkRegEntryAndLoaditInProperties() reads the following strings of registry : a> "export" b> "import" c> "move" v> checkRegEntryAndLoaditInProperties() calls loadRegEntryInProperties() of the class clsRegistry. vi> loadRegEntryInProperties() copies those string values into the follwing corresponding properties of class clsRegistry. a> ExportPath b> ImportPath c> MovePath get the running module. ****************How It Works**************** i> frmWSImportExport_Load(object sender, System.EventArgs e) of class frmWSImportExport calls getRunningModule() of same class. ii> getRunningModule() creates a clsConnection object and a oleDbCommand object to retrieve information about the running module. iii> the following sql command gets executed : " SELECT DISTINCT MODULE_LEVEL_MST.MLEVL_NAME"+" FROM MODULE_LEVEL_MST,MODULE_MST, SYSTEM_INFORMATION"+" WHERE SYSTEM_INFORMATION.MODU_ID = MODULE_MST.MODU_ID AND"+" MODULE_MST.MLEVL_ID = MODULE_LEVEL_MST.MLEVL_ID" iv> the result of the above query is stored as string in the property ModuleInformation of the class clsImportExportDetails. v> the connection is disconnected and the command object is disposed. get the current software version. *****************How It Works*************** i> frmWSImportExport_Load(object sender, System.EventArgs e) of class frmWSImportExport calls getSoftwareVer() of same class. ii> getSoftwareVer() creates a clsConnection object and a oleDbCommand object to retrieve information about the software version. iii> the following sql command gets executed : "SELECT SYSINF_VERSION FROM SYSTEM_INFORMATION WHERE SYSINF_CODE = 'DATABASE'" iv> the result of the above query is stored as string in the property SoftwareVersion of the class clsImportExportDetails. v> the connection is disconnected and the command object is disposed. check or create directory ( if unsuccessful show error in directory ). *****************How It Works*************** i> frmWSImportExport_Load(object sender, System.EventArgs e) of class frmWSImportExport calls checkOrCreateDirectories() of same class. ii> checkOrCreateDirectories() checks whether directories stored in properties ExportPath,ImportPath and MovePath of class clsRegistry really exists or not If any of them does not exist then the method creates it. importing ( if unsuccessful show error in import). *****************How It Works*************** i> frmWSImportExport_Load(object sender, System.EventArgs e) of class frmWSImportExport calls WSImport() of same class. ii> WSImport() creates an object of class clsImport and passes the property value ImportPath of the class clsRegistry.It also appends a "\" at the end of the string stored within Importpath.Thus a static member string of class clsImport, called "directory" is initialized. iii> WSImport() calls ImportData() of the class clsImport with the help of the previously created object.ImportData() carries out the whole task of importing. iv> ImportData() calls getListOfTobeImportedFiles() of class clsImport. getListOfTobeImportedFiles() gets the list of files to be imported into an arraylist getListOfTobeImportedFiles() puts the list of files to be impoted into the arraylist in the following manner : (a) It calls setRequiredCount() of class clsImport which sets a long integer "RequiredCount". (b) setRequiredCount() creates a clsConnection object and an OleDbCommand object. (c) setRequiredCount() executes the following sql command : "SELECT SYSINF_EXP_IMP_COUNT FROM SYSTEM_INFORMATION WHERE SYSINF_CODE = 'IMPORT'" and then converts the result to integer and then sends it back to "RequiredCount". (d) Then getListOfTobeImportedFiles() creates an arraylist of the size of the number of files present in the "directory"(initialized previously) having name "HO*.exp" (e) Then getListOfTobeImportedFiles() creates an empty arraylist of and a string array of the size of the previously created filled arraylist. (f) Each file present in the arraylist is first brought into the string array. Since the filled array list contains file name with full path,the string array also contains file name with full path. (g) Next,for each file in the string array , only the file name is extracted leaving the path information. (h) Now if in this file name all characters starting from 8-th(0-based indexing)position upto 8-th from the other other end are digits then the file name along with the path information is added to the empty arraylist,on condition that the digit value is less than "RequiredCount" . (i) otherwise if not all of them are digits, then that file name is diretly added to the empty array list along with the path information. (j) So the empty arraylist may not contain all the files the filled arraylist. But all the file names included in the empty array list are removed from filled array list. (k) Now the filled array list and RequiredCount is passed to SortAccordingToCount() of class clsImport to be sorted and put into another array list which is returned. v> Next ImportData() calls importIntoDatabase() of class clsImport for each file name(along with path) present in the list returned by getListOfTobeImportedFiles(). vi> importIntoDatabase() calls importXMLFile() of the class clsImport. vii> importXMLFile() actually imports the files on the array list passed to importIntoDatabase().It does it in the following manner : (a) It creates necessary objects like it first creates a clsConnection object next it assigns this object to an OleDbConnection Object,then it creates one OleDbDataAdapter object and one OleDbTransaction object. (b) Then it reads the file to be imported into a dataset with the help of readXML() of class clsImport.To read an XML file readXML() first calls getXMLFileFromEXPFile() of the same class.getXMLFileFromEXPFile() then sheds the file extension and attaches ".zip" at the end(actually all the file names on the array list have extension ".exp").Then it checks if the already exists in "directory".If it already exists then it deletes the file from the "directory".Then it moves the ".exp" file to the "directory" with ".zip" extension.it then unzips this file to a folder and returns the full path of the unzipped file.Since this was originally a an XML file,after unzipping the XML file is retrieved.Hence the returned path is the path of an XML file.After that the XML file is read into a file stream.Then an XmlTextReader of the size of the file stream is created.Finally this XmlTextReader is read into a data set with the help of ReadXml() and the data set is returned. (c) After that importXMLFile() calls isFileinRequiredFormat() of class clsImport which picks up the table named "CHECKFILEINFO" into a data table from the returned dataset.Now the cellvalue of the first row and "ExportCount" column is loaded into property ImportCount of class clsResource.Now it throws up error message if the cellvalue corresponding to the first row and "FileName" column does not match with required ".exp" file name or if the cellvalue corresponding to first row and "SoftwareVer" does not match with the property value of SoftwareVersion of class clsImportExportDetails.But if they matched then it is assumed that the file is in required format. **(d) if the file is in required format then importXMLFile() removes the table named "CHECKFILEINFO" from the data set.Then it calls processDataset() of class clsImport to process the remaining data set. **(e) Finally,the data set is incorporated into the data base. viii> Then importIntoDatabase() calls upDateDataBaseSysInfoTable() of class clsImport. This method creates one clsConnection object and one OleDbCommand object to execute the following sql : "UPDATE SYSTEM_INFORMATION SET SYSINF_INFORMATION_DATE =SYSDATE,SYSINF_EXP_IMP_COUNT = "+clsResources .ImportCount .ToString ()+" WHERE SYSINF_CODE = 'IMPORT'"; **ix> Finally,importIntoDatabase() calls doWiththeImportedFile() to do something with the import exp file. 6> writing to log file.7> exporting ( if unsuccessful show error in export).8> writing to log file.9> closing of WSExportImport form.-------------------------------------------------------------------------------------------------POINT 5 EXPLAINED IN DETAILS-------------------------------------------------------------------------------------------------1> creating import-class object by passing the import path and appending \ at the end. 2> importing data with the object created on point 1.3> if any exception during point 1 and 2 adding error message to a list.-------------------------------------------------------------------------------------------------POINT 2 EXPLAINED IN DETAILS-------------------------------------------------------------------------------------------------1> getting the list of files to be imported.2> each file on the list is imported into database.3> for each file imported successfully the file name is included in a list in a line seperated manner.-------------------------------------------------------------------------------------------------POINT 2 EXPLAINED IN DETAILS-------------------------------------------------------------------------------------------------1> each file is an XML file and each file is imported but on some treatment.2> database is updated after each file is successfully imported.3> something is done on each XML files imported sucessfully.-------------------------------------------------------------------------------------------------POINT 1 EXPLAINED IN DETAILS-------------------------------------------------------------------------------------------------1> XML file is converted to a file stream.2> an XmlTextReader of the size of the file stream is created.3> a data set is created.4> the XmlTextReader is read into the data set.5> check the dataset if it is in the required format.6> if the dataset is in required format then one table namely "CHECKFILEINFO" is removed from the dataset.7> then the dataset is processed for replacing MODU_ID and for inserting into PRODUCT_DETL according to product tax group.