2015-8-25-knowledge of the backend and general function collation

Source: Internet
Author: User

First, the structure is generally divided into B/s (browser/server) and C/S (client/server), we use is based on B/s structure.

where B is primarily a page composed of some controls, mainly controlled by JScript,

The S is mainly controlled by the SSL code, divided into Server script and Data Sources, first of all, the difference between the two (Server script with SS instead, Data Sources with DS instead):

    • For our lims system, the most common operation is to the database of the increase, delete, change, check, wherein the "check", that is, the operation of the data from the database is generally done by the DS, that is, the data in the database "Take Out", the other three increase, delete, Change and some of the specific needs to return the results of the query to be implemented with SS, that is, the data for the specific operation .
    • For DS, more attention to results, generally need to return data, usually return data sets, usually need to be implemented with GetDataSet (), for the SS, more attention to the process, that is, the process of executing an SQL statement, by using the SQLExecute () function to execute the SQL statement, can return different types of data, you can implement some complex functions,
    • For DS and SS, the DS setting receives values directly behind the value: =, while for SS it is required to write: default, to implement set defaults
    • For this system, the use of DS and the use of the SS to return data is not the same, the data returned with DS is generally a data set, the background is generally the return of the data with XML specification of the data is structured processing, to obtain a certain specification of the XML document, Then the front end is received and then the XML document is parsed according to the corresponding rules, and the data returned by SS is not structured with the SML specification, and the data is returned directly. (The main purpose of XML is to separate the data and the application that uses the data, which facilitates the formatted transmission of the data data.)
    1. Server script Common function collation:
    1. :P arameters function: in order to get passed the parameter values, such as :P arameters suppcode;
    2. :D efault function: define default values for parameters, such as :D efault suppcode, "";
    3. :D eclare function: custom parameters, such as :D eclare Exists;
    4.       SQLExecute ()                                      function: Execute SQL statement
       1  1   function: Execute SQL statement  2  2   parameter: SQLExecute (SQL Statement, DATASOURCE), SQL statement is the SQL statement executed, Datasource is the data source, generally does not write, defaults to the current system is connected to the data source.  3  3  return value: If the Execute SELECT statement returns a two-dimensional array, Other statements return logical values. 
      view code
    5.      runsql ()                         &NB Sp            function: executes a non-select SQL statement,
       1  "  insert into materials (Matcode) VALUES (?)   " ,,{matcode}); Note: The SELECT statement cannot be executed  2  2   3  3  return value: Returns the logical value. 
      view code
    6. Execfunction () function: Execute external function
      1 1 function: Execute external function 2 2 parameters: Execfunction (ActionId, {Array of Parameters}), ActionId to call function pathname, can call file in server script and data sources Parameters is the value of the passed function, which is received in the calling file.  33 return value: The value returned by the calling function
      View Code
    7. :P rocedure strName; function : function of an executable program called internally

      :P arameters N;

      : Endproc;

      Doproc ("StrName", {n});

      1 1 Function : Function of an executable program called internally 2 2 Parameters: Doproc ("<ProcName>", [{<parameters array>}]); ProcName is the calling program name; The parameters array is the argument passed to the calling program.  33 return value: Any value returned by the calling program
      View Code 
    8. : IF (); Function: Logical judgment

      : ELSE;

      : ENDIF;

    9. : Begincase; Function: Branch Selection

      : case;

      : Exitcase;

      : OTHERWISE;

      : Endcase;

    10. : Return function: Value returned
    11. Usrmes (); Function: Log in server script and data sources,
       1   function: Log logs in server script and data sources, Shown in the IED Environment server log, does not affect code execution, for example:  2  :D Eclare Teststr;  3  teststr: =  aaa   "  4  usrmes ( " parametersname   " ,teststr);  5  parameter: usrmes ( parametersname   " ,teststr); Parametersname is the custom display name, TESTSTR is the variable name to display  6  return Value: String, displayed in server log 
      View Code

2. Data sources commonly used function collation:

    1. :P arameters function: Gets the parameter value passed in order, setting the default value differs from the server script, which needs to be specified directly after the parameter. such as folderno:= ' A00004412 ';
    2. :D eclare function: custom parameters, such as :D eclare Exists;
    3. GetDataSet(); Features:Execute the parameters of the SQL statement to return a dataset in the database
      1 function: Execute the parameters of the SQL statement to return a dataset in the database2 parameters: GetDataSet (strSQL, Arrparamsvalues, Bwithschema). The SQL statement executed by strSQL; Arrparamsvalues is a parameter passed to the SQL statement, not required; Bwithschema generally not, the default is true. For example:3:P arameters matcode:="', startddate:="',4expdate:="';5 :D eclare strSQL, Strtoday;6strSQL: ="SELECT * from Mfginstructions7WHERE (expdate isNULL and matcode=?) or (matcode= and Startddate <=? and Expdate >=?)";8 : RETURN getdataset (strSQL, {matcode, Matcode,9 today (), Today ()});TenReturn value: DataSet data set
      View Code
    4. Getdatasetfromarray () function: Returns a DataSet from an array
      1 parameters: Getdatasetfromarray (arrvalues, Arrfields). Arrvalues, a two-dimensional array; arrfields, optional, is the field name corresponding to the two-dimensional array in the returned dataset, the default is Field1, Field2 ... In turn. You can also customize the field name, but the field name needs to be the same as the number of columns in the two-dimensional array, and only the data that defines the field is returned if less than the number of columns.  2 return value: DataSet DataSet
      View Code
    5. Lsearch();Features:Used to search for field values.
      1 function: Used to search for field values. The function uses an SQL SELECT expression to find the value of a specific field and returns the value, and if the field value does not exist, returns the value by default, and returns the first column of the first row if multiple fields are searched. For example:2Lsearch ("Select Matno from MATERIAL where Origrec = 5","No Material","DATABASE")3Returns the Matno field value of the Origrec =5, otherwise returns"No Material". 4 parameters: Lsearch (SELECT Expression, Default, Database). Expression is the SELECT statement to execute; default is the value returned, the database is the data source, it is not normally set, and is assumed to be the current databases. 5Return value: Field value or Default value
      View Code

3. Client Common function collation:

    1. function Form1_oninit (sender, EventArgs) functionality : Executes this function in code View when the form is initialized
    2. function Form1_onload (Sender,eventargs) feature: executes this function when the form is loaded View code
    3. function Form1_onshow (sender, EventArgs) feature: executes this function in code View When the form is displayed
    4. function Form1_onclose (sender, EventArgs) feature: executes this function in code View When the form is closed
    5. form. ShowModalDialog () function: call form View Code
    6. Form. ShowModalDialog () has not been used, to be determined.
    7. LIMs. CallServer () function: Call Server Scripts-side code
    8. LIMs. GetData (Note the difference from the lims.getdatasource below)View Code
    9. LIMs. Getdatasource () function: Call the data Sources end code
    10. LIMs. GetDataSet () function: Call the data Sources end code
    11. the difference between Dgdatagrid.refresh () and Dgdatagrid.refreshex () is: View Code
    12. form.formarguments function : Call data sources side code View Code
    13. Form.returnvalue function : Return a value to the calling form

      View Code
    14. form. Variables function: global variable of the current form View Co De
    15. Navigator. variables["starlimsdept"] function:The global variable of application, defined anywhere in the current application, can be taken in any place. View Code
    16. Dialogs.messagebox () Features: pop-up message dialog box View Code
    17. alert () function: displays variable or object values, often used for debugging View Code
    18. try{} catch (Ex:exception) {} function: exception handling, similar to exception handling in Java

2015-8-25-knowledge of the backend and general function collation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.