. Net public class Design 1

Source: Internet
Author: User

Data Table:

Administrator information table, product information table, product type table (number, name, image), Order Details table, image information table, user message table, member information table, product order table, and reply message table.

Public Design: web. Config

<Configuration>
<Deleetask>
<Add key = "ConnectionString" value = "server = localhost; database = db_NetStore; UId = sa; password = '000000'"/>
</AppSettings>
<System. web>

Five public classes

CommonClass public method class

DBClass database operations

GoodsClass manages various operations on Product Information

OrderClass manages various operations on shopping order information

UserClass: Manage various operations on user information

Here we will only briefly introduce CommonClass and DBClass

/// <Summary>
/// Description: MessageBox is used to bring up a dialog box on the client. When the dialog box is closed, a specified page is returned.
/// Parameter: content displayed in the TxtMessage dialog box.
/// The page to jump to after the Url dialog box is closed
/// </Summary>
Public string MessageBox (string TxtMessage, string Url)
{
String str;
Str = "<script language = javascript> alert ('" + TxtMessage + "'); location = '" + Url + "'; </script> ";
Return str;
}

/// <Summary>
/// Description: MessageBox is used to pop up a dialog box on the client.
/// Parameter: content displayed in the TxtMessage dialog box.
/// </Summary>
Public string MessageBox (string TxtMessage)
{
String str;
Str = "<script language = javascript> alert ('" + TxtMessage + "') </script> ";
Return str;
}

/// <Summary>
/// Description: MessageBoxPag is used to bring up a dialog box on the client. The close dialog box returns to the original page.
/// Parameter: content displayed in the TxtMessage dialog box.
/// </Summary>
Public string MessageBoxPage (string TxtMessage)
{
String str;
Str = "<script language = javascript> alert ('" + TxtMessage + "'); location = 'javascript: history. go (-1) '; </script> ";
Return str;
}

/// <Summary>
/// Implement the Random verification code
/// </Summary>
/// <Param name = "n"> display the number of verification codes </param>
/// <Returns> returns the generated random number </returns>
Public string RandomNum (int n )//
{
// Define a string containing numbers, uppercase letters, and lowercase letters
String strchar = ", A, B, C, D, E, F, G, H, I, J, K, L, M, n, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, B, c, d, e, f, g, h, I, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z ";
// Convert the strchar string into an array
// String. The Split method returns a String array containing the child strings in the instance (separated by elements of the specified Char array.
String [] VcArray = strchar. Split (',');
String VNum = "";
// Record the last random value to avoid the generation of several identical random numbers.
Int temp =-1;
// Use a simple algorithm to ensure different random numbers are generated
Random rand = new Random ();
For (int I = 1; I <n + 1; I ++)
{
If (temp! =-1)
{
// The unchecked keyword is used to cancel overflow checks for integer arithmetic operations and conversions.
// Get the DateTime. Ticks attribute to indicate the number of scales of the date and time of the instance.
Rand = new Random (I * temp * unchecked (int) DateTime. Now. Ticks ));
}
// The Random. Next method returns a non-negative Random number less than the specified maximum value.
Int t = rand. Next (61 );
If (temp! =-1 & temp = t)
{
Return RandomNum (n );
}
Temp = t;
VNum + = VcArray [t];
}
Return VNum; // return the generated random number.
}

/// <Summary>
/// Used to extract the nleng digits after the decimal point
/// </Summary>
/// <Param name = "sString"> original string of sString. </Param>
/// <Param name = "nLeng"> nLeng length. </Param>
/// <Returns> the processed string. </Returns>
Public string VarStr (string sString, int nLeng)
{
Int index = sString. IndexOf (".");
If (index =-1 | index + nLeng> = sString. Length)
Return sString;
Else
Return sString. Substring (0, (index + nLeng + 1 ));
}

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.