private void button7_Click(object sender, EventArgs e) { string strUserNum = StringTools.DecodingForString(this.txtOrderNo.Text); string strPassword = StringTools.MD5Encode(StringTools.DecodingForString(this.txtDeliveryNo.Text)); DataTable dt = new DeliveryPrintBC().LoginCheck(strUserNum, strPassword); if (dt != null) { if (dt.Rows.Count > 0) { MessageBox.Show(dt.Rows.Count.ToString()); } else { MessageBox.Show("0"); } } else { MessageBox.Show("null"); } }
public DataTable LoginCheck(string userNum, string password) { try { if (!CheckSoapHead()) { return null; } string strUserNum = StringTools.DecodingForString(userNum); DataTable dt = new DataTable(); //检查是否已经登录 if (Application["DeliveryPrintService" + strUserNum] != null) { dt = null; } else { string strPassword = StringTools.MD5Encode(StringTools.DecodingForString(password)).ToUpper(); dt = new DeliveryPrintBC().LoginCheck(strUserNum, strPassword); if (dt != null) { if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { //保存session Application["DeliveryPrintService" + strUserNum] = "1"; } } } } return dt; } catch (Exception) { return null; //throw; } }