Anda di halaman 1dari 6

-----------------------------------------------------------------------------------------------OVERALL PROGRAM FUNCTIONALITIES.

-----------------------------------------------------------------------------------------------<1> 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_localma
chine.
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 foll
wing
corresponding properties of class clsRegistry.
a> ExportPath
b> ImportPath
c> MovePath
<2> 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 oleDbComman
d 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_INFO
RMATION"+
" WHERE SYSTEM_INFORMATION.MODU_ID = MODULE_MST.
MODU_ID AND"+
" MODULE_MST.MLEVL_ID = MODULE_LEVEL_MST.MLEVL_I

D"
iv> the result of the above query is stored as string in the property M
oduleInformation
of the class clsImportExportDetails.
v> the connection is disconnected and the command object is disposed.
<3> 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
retrieve information about the software version.

object to

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 S
oftwareVersion
of the class clsImportExportDetails.
v> the connection is disconnected and the command object is disposed.
<4> 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 pro
perties
ExportPath,ImportPath and MovePath of class clsRegistry really exis
ts or not
If any of them does not exist then the method creates it.
<5> 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 prop
erty value
ImportPath of the class clsRegistry.It also appends a "\" at the en
d of the
string stored within Importpath.Thus a static member string of clas
s 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 o
f 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 i
nto 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 O
leDbCommand
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 t
o 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 "director
y"(initialized previously) having
name "HO*.exp"
(e) Then getListOfTobeImportedFiles() creates an empty arrayli
st of and a
string array of the size of the previous
ly created filled arraylist.
(f) Each file present in the arraylist is first brought into t
he string array.
Since the filled array list contains file name with full p
ath,the string
array also contains file name with full path.
(g) Next,for each file in the string array , only the file nam
e 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 d
igits 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 na
me is diretly
added to the empty array list along with the path informat
ion.
(j) So the empty arraylist may not contain all the files the f
illed arraylist.
But all the file names included in the empty array list ar
e removed from
filled array list.
(k) Now the filled array list and RequiredCount is passed
to SortAccordingToCount() of class clsIm
port to be sorted and put into
another array list which is returned.
v> Next ImportData() calls importIntoDatabase() of class clsImport for
name(along with path) present in the list returne

each file

d 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 clsCo
nnection object
next it assigns this object to an OleDbConnection Object,t
hen it creates
one OleDbDataAdapter object and one OleDbTransaction objec
t.
(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.getXMLFileFromEX
PFile() then
sheds the file extension and attaches ".zip" at the end(ac
tually all the
file names on the array list have extension ".exp").Then i
t 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 X
ML file,after
unzipping the XML file is retrieved.Hence the returned pat
h is the path of
an XML file.After that the XML file is read into a file st
ream.Then an
XmlTextReader of the size of the file stream is created.Fi
nally this
XmlTextReader is read into a data set with the help of Rea
dXml() and the
data set is returned.
(c) After that importXMLFile() calls isFileinRequiredFormat()
of class
clsImport which picks up the table named "CHECKFILEINFO" i
nto a data table
from the returned dataset.Now the cellvalue of the first r
ow and
"ExportCount" column is loaded into property ImportCount o
f class
clsResource.Now it throws up error message if the cellvalu
e corresponding
to the first row and "FileName" column does not match with
required ".exp"
file name or if the cellvalue corresponding to first row a
nd "SoftwareVer"
does not match with the property value of SoftwareVersion
of class
clsImportExportDetails.But if they matched then it is assu
med that the file
is in required format.

**(d) if the file is in required format then importXMLFile() r


emoves the table
named "CHECKFILEINFO" from the data set.Then it calls proc
essDataset() 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 cla
ss clsImport.
This method creates one clsConnection object and one OleDbCommand o
bject to execute
the following sql :
"UPDATE SYSTEM_INFORMATION SET SYSINF_INFORMATION_DATE =SYSDATE,SYS
INF_EXP_IMP_COUNT
= "+clsResources .ImportCount .ToString ()+" WHER
E SYSINF_CODE = 'IMPORT'";
**ix> Finally,importIntoDatabase() calls doWiththeImportedFile() to do
something with
the import exp file.
6>
7>
8>
9>

writing to log file.


exporting ( if unsuccessful show error in export).
writing to log file.
closing of WSExportImport form.

-----------------------------------------------------------------------------------------------POINT 5 EXPLAINED IN DETAILS


-----------------------------------------------------------------------------------------------1> creating import-class object by passing the import path and appending \ at th
e 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 PR
ODUCT_DETL
according to product tax group.

Anda mungkin juga menyukai