private Boolean IsValidated(CommonExchange.SysAccess userInfo) { Boolean hasAccess = false; SqlConnection sqlConn; sqlConn = new SqlConnection(); //sqlConn.ConnectionString = "Data Source = 192.168.0.2,1433; Network Library = DBMSSOCN; Initial Catalog = dbdentalsys; User Id = dEnTaL0608T0oTh; Password = D3U%@xL*^eUaZ0#pWt)kS;"; sqlConn.ConnectionString = "Integrated Security = SSPI; Data Source = Localhost; Initial Catalog = dbperezorevillodms; User Id = dEnTaL0r1v3lloT0oTh; Password = g@8_f6%2CbU8!(10gHnQl;"; sqlConn.Open(); using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = sqlConn; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.SelectForLogInSystemUserInfo"; sqlComm.Parameters.Add("@system_user_name", SqlDbType.VarChar).Value = userInfo.UserName; sqlComm.Parameters.Add("@system_user_password", SqlDbType.VarChar).Value = userInfo.Password; //sqlComm.Parameters.Add("@system_user_name", SqlDbType.VarChar).Value = "Debugger"; //sqlComm.Parameters.Add("@system_user_password", SqlDbType.VarChar).Value = "b1o5r8g3e"; using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) { if (sqlReader.HasRows) { while (sqlReader.Read()) { userInfo.UserId = ProcStatic.DataReaderConvert(sqlReader, "system_user_id", ""); userInfo.UserName = ProcStatic.DataReaderConvert(sqlReader, "system_user_name", ""); userInfo.Password = ProcStatic.DataReaderConvert(sqlReader, "system_user_password", ""); userInfo.UserStatus = ProcStatic.DataReaderConvert(sqlReader, "system_user_status", false); userInfo.AccessCode = ProcStatic.DataReaderConvert(sqlReader, "access_code", ""); userInfo.LastName = ProcStatic.DataReaderConvert(sqlReader, "last_name", ""); userInfo.FirstName = ProcStatic.DataReaderConvert(sqlReader, "first_name", ""); userInfo.MiddleName = ProcStatic.DataReaderConvert(sqlReader, "middle_name", ""); userInfo.Position = ProcStatic.DataReaderConvert(sqlReader, "position", ""); userInfo.Connection = sqlConn; break; } _userInfo = userInfo; hasAccess = true; } else { hasAccess = false; } sqlReader.Close(); } } return(hasAccess); }
} //----------------------------- //this function gets a new procedure system id public static String GetNewSysIDProcedureInformation(CommonExchange.SysAccess userInfo) { Int32 rowCount = 0; String procedureId = ""; using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = userInfo.Connection; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.GetCountProcedureInformation"; sqlComm.Parameters.Add("@system_user_id", SqlDbType.VarChar).Value = userInfo.UserId; rowCount = (Int32)sqlComm.ExecuteScalar(); } do { procedureId = "SYSPRC" + ProcStatic.SixDigitZero(++rowCount); } while (IsExistsSysIDProcedureInformation(userInfo.UserId, userInfo.Connection, procedureId)); return(procedureId); }
} //----------------------------- //this function gets a new receipt no public static String GetNewReceiptNoPaymentDetails(CommonExchange.SysAccess userInfo) { Int32 rowCount = 0; String receiptNo = ""; using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = userInfo.Connection; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.GetCountPaymentDetails"; sqlComm.Parameters.Add("@system_user_id", SqlDbType.VarChar).Value = userInfo.UserId; rowCount = (Int32)sqlComm.ExecuteScalar(); } do { receiptNo = "RN" + ProcStatic.TenDigitZero(++rowCount); } while (IsExistsReceiptNoPaymentDetails(userInfo.UserId, userInfo.Connection, receiptNo)); return(receiptNo); }